@winspan/claude-forge 1.73.0 → 1.76.0
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/README.md +3 -3
- package/dist/autopilot/ground-truth-rules.d.ts +51 -0
- package/dist/autopilot/ground-truth-rules.d.ts.map +1 -0
- package/dist/autopilot/ground-truth-rules.js +104 -0
- package/dist/autopilot/ground-truth-rules.js.map +1 -0
- package/dist/autopilot/intent-engine.d.ts +10 -2
- package/dist/autopilot/intent-engine.d.ts.map +1 -1
- package/dist/autopilot/intent-engine.js +62 -10
- package/dist/autopilot/intent-engine.js.map +1 -1
- package/dist/autopilot/rule-distiller.d.ts +10 -4
- package/dist/autopilot/rule-distiller.d.ts.map +1 -1
- package/dist/autopilot/rule-distiller.js +49 -37
- package/dist/autopilot/rule-distiller.js.map +1 -1
- package/dist/daemon/handlers/stages/11-intent-analysis.d.ts.map +1 -1
- package/dist/daemon/handlers/stages/11-intent-analysis.js +1 -1
- package/dist/daemon/handlers/stages/11-intent-analysis.js.map +1 -1
- package/dist/daemon/handlers/stop-handler.d.ts.map +1 -1
- package/dist/daemon/handlers/stop-handler.js +25 -0
- package/dist/daemon/handlers/stop-handler.js.map +1 -1
- package/dist/storage/index.d.ts +38 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/sqlite.d.ts +39 -0
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +147 -1
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/web-static/assets/{index-BY8ONBvF.js → index-9J7Muleq.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(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),js=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`}]]),Ms=U(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),Ns=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`}]]),Ps=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`}]]),Fs=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`}]]),Is=U(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Ls=U(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Rs=U(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),zs=U(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Bs=U(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Vs=U(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Hs=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`}]]),Us=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`}]]),Ws=U(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Gs=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`}]]),Ks=U(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),qs=U(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Js=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`}]]),Ys=U(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Xs=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`}]]),Zs=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`}]]),$s=U(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ec=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`}]]),tc=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`}]]),nc=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`}]]),rc=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`}]]),ic=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`}]]),ac=U(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),oc=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`}]]),sc=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`}]]),cc=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`}]]),lc=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`}]]),uc=U(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),dc=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`}]]),fc=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`}]]),pc=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`}]]),mc=U(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),hc=U(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),gc=U(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),_c=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`}]]),vc=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`}]]),yc=U(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),bc=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`}]]),xc=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`}]]),Sc=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`}]]),Cc=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),wc=U(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Tc=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`}]]),Ec=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`}]]),Dc=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`}]]),Oc=U(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),kc=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`}]]),Ac=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`}]]),jc=U(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Mc=U(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Nc=U(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Pc=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`}]]),Fc=U(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Ic=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`}]]),Lc=U(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Rc=U(`test-tube`,[[`path`,{d:`M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2`,key:`125lnx`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}],[`path`,{d:`M14.5 16h-5`,key:`1ox875`}]]),zc=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`}]]),Bc=U(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),Vc=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`}]]),Hc=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`}]]),Uc=U(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),Wc=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`}]]),Gc=U(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Kc=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`}]]),qc=u(y(),1),Jc=u(_(),1),Yc=(0,z.createContext)({toast:()=>{}}),Xc=()=>{};function Zc(e,t=`error`){Xc(e,t)}function Qc({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)(()=>{Xc=i},[i]);let a={success:Us,error:Gs,warning:Vc},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)(Yc.Provider,{value:{toast:i},children:[e,(0,Jc.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)(Gc,{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=>(Zc(e.response?.data?.error||e.response?.data?.message||e.message||`请求失败`,`error`),Promise.reject(e)));var $c=()=>W.get(`/health`),el=()=>W.get(`/config`),tl=e=>W.put(`/config`,e),nl=()=>W.get(`/config/history`),rl=e=>W.get(`/sessions`,{params:e}),il=e=>W.get(`/sessions/${e}`),al=e=>W.delete(`/sessions/${e}`),ol=e=>W.delete(`/sessions`,{data:{ids:e}}),sl=e=>W.get(`/events`,{params:e}),cl=e=>W.get(`/events/stats`,{params:{project_path:e}}),ll=e=>W.get(`/pipelines`,{params:e}),ul=e=>W.get(`/pipelines/${e}`),dl=e=>W.get(`/quality/history`,{params:e}),fl=e=>W.get(`/quality/unresolved`,{params:{project_path:e}}),pl=()=>W.get(`/stats/roi`),ml=()=>W.get(`/stats/overview`),hl=(e,t,n,r)=>W.get(`/knowledge/search`,{params:{q:e,project_path:t,node_type:n,limit:r}}),gl=e=>W.get(`/knowledge/overview`,{params:{project_path:e}}),_l=(e,t)=>W.get(`/knowledge/neighbors`,{params:{node_id:e,project_path:t}}),vl=(e,t)=>W.get(`/knowledge/graph`,{params:{project_path:e,node_type:t}}),yl=e=>W.post(`/knowledge/nodes`,e),bl=(e,t)=>W.put(`/knowledge/nodes/${e}`,t),xl=e=>W.delete(`/knowledge/nodes/${e}`),Sl=e=>W.post(`/pipelines/${e}/close`),Cl=e=>W.post(`/pipelines/batch-close`,{ids:e}),wl=()=>W.post(`/pipelines/close-expired`),Tl=()=>W.get(`/pipelines/active`),El=e=>W.post(`/pipelines/${e}/resume`),Dl=e=>W.post(`/pipelines/${e}/advance`),Ol=e=>W.get(`/projects`,{params:e}),kl=e=>W.get(`/projects/${e}`),Al=e=>W.delete(`/projects/${e}`),jl=e=>W.post(`/convention/init`,{path:e},{timeout:18e4}),Ml=e=>W.get(`/projects/${e}/conventions`),Nl=(e,t)=>W.post(`/projects/${e}/conventions/bind`,{conventionId:t}),Pl=(e,t)=>W.delete(`/projects/${e}/conventions/${encodeURIComponent(t)}`),Fl=e=>W.get(`/projects/${e}/conventions/custom/yaml`),Il=(e,t)=>W.put(`/projects/${e}/conventions/custom`,{yaml:t}),Ll=e=>W.post(`/projects/${e}/conventions/distill`,{},{timeout:12e4}),Rl=e=>W.get(`/claudemd/${e}`),zl=(e,t)=>W.put(`/claudemd/${e}`,{content:t}),Bl=e=>W.get(`/claudemd/${e}/profile`),Vl=e=>W.get(`/claudemd/${e}/modules`),Hl=e=>W.post(`/claudemd/${e}/distill`,void 0,{timeout:18e4}),Ul=e=>W.post(`/claudemd/${e}/init`,void 0,{timeout:18e4}),Wl=e=>W.post(`/quality/${e}/resolve`),Gl=e=>W.post(`/quality/${e}/dismiss`),Kl=e=>W.post(`/quality/batch-dismiss`,{ids:e}),ql=()=>W.post(`/quality/resolve-all`),Jl=e=>W.get(`/quality/${e}/context`),Yl=()=>W.get(`/daemon/status`),Xl=()=>W.post(`/daemon/restart`),Zl=()=>W.get(`/daemon/diagnose`),Ql=()=>W.post(`/daemon/repair`),$l=()=>W.post(`/config/backup`),eu=()=>W.get(`/config/backups`),tu=e=>`/api/config/backups/${encodeURIComponent(e)}`,nu=e=>W.post(`/events/purge`,{retentionDays:e}),ru=e=>W.get(`/stats/api-usage`,{params:{days:e}}),iu=e=>W.get(`/skills`,{params:e}),au=()=>W.get(`/skills/status`),ou=e=>W.get(`/skills/${encodeURIComponent(e)}`),su=(e,t)=>W.post(`/skills/search`,{query:e,...t},{timeout:3e4}),cu=e=>W.post(`/skills/install`,{url:e},{timeout:6e4}),lu=e=>W.delete(`/skills/${encodeURIComponent(e)}`),uu=e=>W.post(`/skills/batch-delete`,{names:e}),du=()=>W.post(`/skills/evolve`,{},{timeout:12e4}),fu=()=>W.post(`/skills/distill`,{},{timeout:12e4}),pu=()=>W.post(`/skills/repair`,{},{timeout:6e4}),mu=()=>W.get(`/conventions`),hu=e=>W.get(`/conventions/${encodeURIComponent(e)}`),gu=()=>W.post(`/conventions/sync-official`),_u=e=>W.post(`/conventions/install`,{url:e},{timeout:3e4}),vu=e=>W.delete(`/conventions/${encodeURIComponent(e)}`),yu=()=>W.get(`/conventions/usage-stats`),bu=e=>W.get(`/conventions/${encodeURIComponent(e)}/evolution-history`),xu=e=>W.post(`/conventions/batch-evolve`,{conventionIds:e},{timeout:12e4}),Su=e=>W.get(`/conventions/${encodeURIComponent(e)}/yaml`),Cu=(e,t)=>W.put(`/conventions/${encodeURIComponent(e)}/yaml`,{yaml:t}),wu=e=>W.get(`/node-types`,{params:e?{projectPath:e}:void 0}),Tu=e=>W.get(`/node-types/${encodeURIComponent(e)}`);function Eu(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=Eu(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Du(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Eu(e))&&(r&&(r+=` `),r+=t);return r}var Ou=(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},ku=(e,t)=>({classGroupId:e,validator:t}),Au=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ju=`-`,Mu=[],Nu=`arbitrary..`,Pu=e=>{let t=Lu(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Iu(e);let n=e.split(ju);return Fu(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ou(i,t):t:i||Mu}return n[e]||Mu}}},Fu=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Fu(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ju):e.slice(t).join(ju),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Iu=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?Nu+r:void 0})(),Lu=e=>{let{theme:t,classGroups:n}=e;return Ru(n,t)},Ru=(e,t)=>{let n=Au();for(let r in e){let i=e[r];zu(i,n,r,t)}return n},zu=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Bu(i,t,n,r)}},Bu=(e,t,n,r)=>{if(typeof e==`string`){Vu(e,t,n);return}if(typeof e==`function`){Hu(e,t,n,r);return}Uu(e,t,n,r)},Vu=(e,t,n)=>{let r=e===``?t:Wu(t,e);r.classGroupId=n},Hu=(e,t,n,r)=>{if(Gu(e)){zu(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ku(n,e))},Uu=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];zu(o,Wu(t,a),n,r)}},Wu=(e,t)=>{let n=e,r=t.split(ju),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Au(),n.nextPart.set(t,i)),n=i}return n},Gu=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Ku=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)}}},qu=`!`,Ju=`:`,Yu=[],Xu=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Zu=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===Ju){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(qu)?(c=s.slice(0,-1),l=!0):s.startsWith(qu)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Xu(t,l,c,u)};if(t){let e=t+Ju,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Xu(Yu,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Qu=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}},$u=e=>({cache:Ku(e.cacheSize),parseClassName:Zu(e),sortModifiers:Qu(e),...Pu(e)}),ed=/\s+/,td=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(ed),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+qu: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},nd=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=rd(n))&&(i&&(i+=` `),i+=r);return i},rd=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=rd(e[r]))&&(n&&(n+=` `),n+=t);return n},id=(e,...t)=>{let n,r,i,a,o=o=>(n=$u(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=td(e,n);return i(e,a),a};return a=o,(...e)=>a(nd(...e))},ad=[],od=e=>{let t=t=>t[e]||ad;return t.isThemeGetter=!0,t},sd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,cd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ld=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ud=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dd=/\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$/,fd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,md=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hd=e=>ld.test(e),gd=e=>!!e&&!Number.isNaN(Number(e)),_d=e=>!!e&&Number.isInteger(Number(e)),vd=e=>e.endsWith(`%`)&&gd(e.slice(0,-1)),yd=e=>ud.test(e),bd=()=>!0,xd=e=>dd.test(e)&&!fd.test(e),Sd=()=>!1,Cd=e=>pd.test(e),wd=e=>md.test(e),Td=e=>!G(e)&&!K(e),Ed=e=>Vd(e,Gd,Sd),G=e=>sd.test(e),Dd=e=>Vd(e,Kd,xd),Od=e=>Vd(e,qd,gd),kd=e=>Vd(e,Yd,bd),Ad=e=>Vd(e,Jd,Sd),jd=e=>Vd(e,Ud,Sd),Md=e=>Vd(e,Wd,wd),Nd=e=>Vd(e,Xd,Cd),K=e=>cd.test(e),Pd=e=>Hd(e,Kd),Fd=e=>Hd(e,Jd),Id=e=>Hd(e,Ud),Ld=e=>Hd(e,Gd),Rd=e=>Hd(e,Wd),zd=e=>Hd(e,Xd,!0),Bd=e=>Hd(e,Yd,!0),Vd=(e,t,n)=>{let r=sd.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Hd=(e,t,n=!1)=>{let r=cd.exec(e);return r?r[1]?t(r[1]):n:!1},Ud=e=>e===`position`||e===`percentage`,Wd=e=>e===`image`||e===`url`,Gd=e=>e===`length`||e===`size`||e===`bg-size`,Kd=e=>e===`length`,qd=e=>e===`number`,Jd=e=>e===`family-name`,Yd=e=>e===`number`||e===`weight`,Xd=e=>e===`shadow`,Zd=id(()=>{let e=od(`color`),t=od(`font`),n=od(`text`),r=od(`font-weight`),i=od(`tracking`),a=od(`leading`),o=od(`breakpoint`),s=od(`container`),c=od(`spacing`),l=od(`radius`),u=od(`shadow`),d=od(`inset-shadow`),f=od(`text-shadow`),p=od(`drop-shadow`),m=od(`blur`),h=od(`perspective`),g=od(`aspect`),_=od(`ease`),v=od(`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=()=>[hd,`full`,`auto`,...w()],E=()=>[_d,`none`,`subgrid`,K,G],D=()=>[`auto`,{span:[`full`,_d,K,G]},_d,K,G],O=()=>[_d,`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=()=>[hd,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[hd,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],P=()=>[hd,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,K,G],I=()=>[...b(),Id,jd,{position:[K,G]}],te=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,Ld,Ed,{size:[K,G]}],re=()=>[vd,Pd,Dd],L=()=>[``,`none`,`full`,l,K,G],R=()=>[``,gd,Pd,Dd],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=()=>[gd,vd,Id,jd],se=()=>[``,`none`,m,K,G],ce=()=>[`none`,gd,K,G],le=()=>[`none`,gd,K,G],ue=()=>[gd,K,G],de=()=>[hd,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[yd],breakpoint:[yd],color:[bd],container:[yd],"drop-shadow":[yd],ease:[`in`,`out`,`in-out`],font:[Td],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[yd],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[yd],shadow:[yd],spacing:[`px`,gd],text:[yd],"text-shadow":[yd],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,hd,G,K,g]}],container:[`container`],columns:[{columns:[gd,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:[_d,`auto`,K,G]}],basis:[{basis:[hd,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[gd,hd,`auto`,`initial`,`none`,G]}],grow:[{grow:[``,gd,K,G]}],shrink:[{shrink:[``,gd,K,G]}],order:[{order:[_d,`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,Pd,Dd]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Bd,kd]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,vd,G]}],"font-family":[{font:[Fd,Ad,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":[gd,`none`,K,Od]}],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:[gd,`from-font`,`auto`,K,Dd]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[gd,`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:te()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},_d,K,G],radial:[``,K,G],conic:[_d,K,G]},Rd,Md]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"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":[gd,K,G]}],"outline-w":[{outline:[``,gd,Pd,Dd]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,zd,Nd]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,zd,Nd]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[gd,Dd]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,zd,Nd]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[gd,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":[gd]}],"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":[gd]}],"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:te()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,K,G]}],filter:[{filter:[``,`none`,K,G]}],blur:[{blur:se()}],brightness:[{brightness:[gd,K,G]}],contrast:[{contrast:[gd,K,G]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,zd,Nd]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,gd,K,G]}],"hue-rotate":[{"hue-rotate":[gd,K,G]}],invert:[{invert:[``,gd,K,G]}],saturate:[{saturate:[gd,K,G]}],sepia:[{sepia:[``,gd,K,G]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,K,G]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[gd,K,G]}],"backdrop-contrast":[{"backdrop-contrast":[gd,K,G]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,gd,K,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[gd,K,G]}],"backdrop-invert":[{"backdrop-invert":[``,gd,K,G]}],"backdrop-opacity":[{"backdrop-opacity":[gd,K,G]}],"backdrop-saturate":[{"backdrop-saturate":[gd,K,G]}],"backdrop-sepia":[{"backdrop-sepia":[``,gd,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:[gd,`initial`,K,G]}],ease:[{ease:[`linear`,`initial`,_,K,G]}],delay:[{delay:[gd,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:[gd,Pd,Dd,Od]}],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 q(...e){return Zd(Du(e))}function Qd(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 $d(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function ef(e){let t={active:`text-green-600 bg-green-50`,completed:`text-blue-600 bg-blue-50`,failed:`text-red-600 bg-red-50`,interrupted:`text-yellow-600 bg-yellow-50`,pending:`text-gray-600 bg-gray-50`};return t[e]||t.pending}function tf(e){return e?e.endsWith(`Z`)||/[+-]\d{2}:\d{2}$/.test(e)?new Date(e):new Date(e+`Z`):new Date}var nf=[{path:`/dashboard`,label:`仪表盘`,icon:fc},{path:`/projects`,label:`项目管理`,icon:oc},{path:`/sessions`,label:`会话管理`,icon:Ts},{path:`/events`,label:`事件流`,icon:Ps},{path:`/pipelines`,label:`流水线`,icon:cc},{path:`/quality`,label:`质量门禁`,icon:Ac},{path:`/knowledge`,label:`知识图谱`,icon:Ns},{path:`/skills`,label:`技能管理`,icon:yc},{path:`/conventions`,label:`规范管理`,icon:As},{path:`/node-types`,label:`节点类型`,icon:Ms},{path:`/analytics`,label:`数据分析`,icon:Fs},{path:`/config`,label:`系统配置`,icon:kc}];function rf({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:()=>$c().then(e=>e.data),refetchInterval:15e3}),a=nf.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:q(`fixed top-0 left-0 bottom-0 z-50 flex flex-col transition-all duration-300`,`bg-gradient-to-b from-slate-900 to-slate-800`,t?`w-16`:`w-60`),children:[(0,B.jsxs)(`div`,{className:q(`flex items-center border-b border-white/10 h-16`,t?`justify-center px-2`:`justify-between px-5`),children:[!t&&(0,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)(Kc,{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)(gc,{className:`h-5 w-5`}):(0,B.jsx)(zs,{className:`h-5 w-5`})})]}),(0,B.jsx)(`nav`,{className:`flex-1 py-4 space-y-1 px-2`,children:nf.map(e=>(0,B.jsxs)(ei,{to:e.path,className:({isActive:e})=>q(`flex items-center gap-3 rounded-lg transition-all duration-200`,t?`justify-center p-3`:`px-3 py-2.5`,e?`bg-blue-600/20 text-blue-400`:`text-white/60 hover:text-white hover:bg-white/5`),children:[(0,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:q(`border-t border-white/10 py-4`,t?`px-2`:`px-5`),children:(0,B.jsxs)(`div`,{className:q(`flex items-center gap-2`,t?`justify-center`:``),children:[(0,B.jsx)(`div`,{className:q(`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:q(`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)(Js,{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.73.0`]}),(0,B.jsxs)(`div`,{className:q(`flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold`,i?.status===`ok`?`bg-green-50 text-green-700 border border-green-200`:`bg-red-50 text-red-700 border border-red-200`),children:[(0,B.jsx)(`div`,{className:q(`w-1.5 h-1.5 rounded-full`,i?.status===`ok`?`bg-green-500`:`bg-red-500`)}),i?.status===`ok`?`在线`:`离线`]})]})]}),(0,B.jsx)(`div`,{className:`p-8 overflow-x-hidden`,children:e})]})]})}var af=(0,z.createContext)({});function of(e){let t=(0,z.useRef)(null);return t.current===null&&(t.current=e()),t.current}var sf=typeof window<`u`?z.useLayoutEffect:z.useEffect,cf=(0,z.createContext)(null);function lf(e,t){e.indexOf(t)===-1&&e.push(t)}function uf(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var df=(e,t,n)=>n>t?t:n<e?e:n,ff={},pf=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function mf(e){return typeof e==`object`&&!!e}var hf=e=>/^0[^.\s]+$/u.test(e);function gf(e){let t;return()=>(t===void 0&&(t=e()),t)}var _f=e=>e,vf=(e,t)=>n=>t(e(n)),yf=(...e)=>e.reduce(vf),bf=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},xf=class{constructor(){this.subscriptions=[]}add(e){return lf(this.subscriptions,e),()=>uf(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}},Sf=e=>e*1e3,Cf=e=>e/1e3;function wf(e,t){return t?1e3/t*e:0}var Tf=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Ef=1e-7,Df=12;function Of(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Tf(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Ef&&++s<Df);return o}function kf(e,t,n,r){if(e===t&&n===r)return _f;let i=t=>Of(t,0,1,e,n);return e=>e===0||e===1?e:Tf(i(e),t,r)}var Af=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,jf=e=>t=>1-e(1-t),Mf=kf(.33,1.53,.69,.99),Nf=jf(Mf),Pf=Af(Nf),Ff=e=>e>=1?1:(e*=2)<1?.5*Nf(e):.5*(2-2**(-10*(e-1))),If=e=>1-Math.sin(Math.acos(e)),Lf=jf(If),Rf=Af(If),zf=kf(.42,0,1,1),Bf=kf(0,0,.58,1),Vf=kf(.42,0,.58,1),Hf=e=>Array.isArray(e)&&typeof e[0]!=`number`,Uf=e=>Array.isArray(e)&&typeof e[0]==`number`,Wf={linear:_f,easeIn:zf,easeInOut:Vf,easeOut:Bf,circIn:If,circInOut:Rf,circOut:Lf,backIn:Nf,backInOut:Pf,backOut:Mf,anticipate:Ff},Gf=e=>typeof e==`string`,Kf=e=>{if(Uf(e)){e.length;let[t,n,r,i]=e;return kf(t,n,r,i)}else if(Gf(e))return Wf[e],`${e}`,Wf[e];return e},qf=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Jf={value:null,addProjectionMetrics:null};function Yf(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&&Jf.value&&Jf.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Xf=40;function Zf(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=qf.reduce((e,n)=>(e[n]=Yf(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=ff.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Xf),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:qf.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<qf.length;t++)o[qf[t]].cancel(e)},state:i,steps:o}}var{schedule:Qf,cancel:$f,state:ep,steps:tp}=Zf(typeof requestAnimationFrame<`u`?requestAnimationFrame:_f,!0),np;function rp(){np=void 0}var ip={now:()=>(np===void 0&&ip.set(ep.isProcessing||ff.useManualTiming?ep.timestamp:performance.now()),np),set:e=>{np=e,queueMicrotask(rp)}},ap={layout:0,mainThread:0,waapi:0},op=e=>t=>typeof t==`string`&&t.startsWith(e),sp=op(`--`),cp=op(`var(--`),lp=e=>cp(e)?up.test(e.split(`/*`)[0].trim()):!1,up=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function dp(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var fp={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},pp={...fp,transform:e=>df(0,1,e)},mp={...fp,default:1},hp=e=>Math.round(e*1e5)/1e5,gp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function _p(e){return e==null}var vp=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,yp=(e,t)=>n=>!!(typeof n==`string`&&vp.test(n)&&n.startsWith(e)||t&&!_p(n)&&Object.prototype.hasOwnProperty.call(n,t)),bp=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(gp);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},xp=e=>df(0,255,e),Sp={...fp,transform:e=>Math.round(xp(e))},Cp={test:yp(`rgb`,`red`),parse:bp(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Sp.transform(e)+`, `+Sp.transform(t)+`, `+Sp.transform(n)+`, `+hp(pp.transform(r))+`)`};function wp(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 Tp={test:yp(`#`),parse:wp,transform:Cp.transform},Ep=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Dp=Ep(`deg`),Op=Ep(`%`),J=Ep(`px`),kp=Ep(`vh`),Ap=Ep(`vw`),jp={...Op,parse:e=>Op.parse(e)/100,transform:e=>Op.transform(e*100)},Mp={test:yp(`hsl`,`hue`),parse:bp(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Op.transform(hp(t))+`, `+Op.transform(hp(n))+`, `+hp(pp.transform(r))+`)`},Np={test:e=>Cp.test(e)||Tp.test(e)||Mp.test(e),parse:e=>Cp.test(e)?Cp.parse(e):Mp.test(e)?Mp.parse(e):Tp.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Cp.transform(e):Mp.transform(e),getAnimatableNone:e=>{let t=Np.parse(e);return t.alpha=0,Np.transform(t)}},Pp=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Fp(e){return isNaN(e)&&typeof e==`string`&&(e.match(gp)?.length||0)+(e.match(Pp)?.length||0)>0}var Ip=`number`,Lp=`color`,Rp=`var`,zp=`var(`,Bp="${}",Vp=/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 Hp(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Vp,e=>(Np.test(e)?(r.color.push(a),i.push(Lp),n.push(Np.parse(e))):e.startsWith(zp)?(r.var.push(a),i.push(Rp),n.push(e)):(r.number.push(a),i.push(Ip),n.push(parseFloat(e))),++a,Bp)).split(Bp),indexes:r,types:i}}function Up(e){return Hp(e).values}function Wp({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===Ip?i+=hp(r[a]):e===Lp?i+=Np.transform(r[a]):i+=r[a]}return i}}function eee(e){return Wp(Hp(e))}var tee=e=>typeof e==`number`?0:Np.test(e)?Np.getAnimatableNone(e):e,Gp=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:tee(e);function Kp(e){let t=Hp(e);return Wp(t)(t.values.map((e,n)=>Gp(e,t.split[n])))}var qp={test:Fp,parse:Up,createTransformer:eee,getAnimatableNone:Kp};function Jp(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 Yp({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=Jp(s,r,e+1/3),a=Jp(s,r,e),o=Jp(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Xp(e,t){return n=>n>0?t:e}var Zp=(e,t,n)=>e+(t-e)*n,Qp=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},$p=[Tp,Cp,Mp],em=e=>$p.find(t=>t.test(e));function tm(e){let t=em(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Mp&&(n=Yp(n)),n}var nm=(e,t)=>{let n=tm(e),r=tm(t);if(!n||!r)return Xp(e,t);let i={...n};return e=>(i.red=Qp(n.red,r.red,e),i.green=Qp(n.green,r.green,e),i.blue=Qp(n.blue,r.blue,e),i.alpha=Zp(n.alpha,r.alpha,e),Cp.transform(i))},rm=new Set([`none`,`hidden`]);function im(e,t){return rm.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function am(e,t){return n=>Zp(e,t,n)}function om(e){return typeof e==`number`?am:typeof e==`string`?lp(e)?Xp:Np.test(e)?nm:um:Array.isArray(e)?sm:typeof e==`object`?Np.test(e)?nm:cm:Xp}function sm(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>om(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function cm(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=om(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function lm(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 um=(e,t)=>{let n=qp.createTransformer(t),r=Hp(e),i=Hp(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?rm.has(e)&&!i.values.length||rm.has(t)&&!r.values.length?im(e,t):yf(sm(lm(r,i),i.values),n):(`${e}${t}`,Xp(e,t))};function dm(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Zp(e,t,n):om(e)(e,t)}var fm=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Qf.update(t,e),stop:()=>$f(t),now:()=>ep.isProcessing?ep.timestamp:ip.now()}},pm=(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)})`},mm=2e4;function hm(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 gm(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(hm(r),mm);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Cf(i)}}var _m={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 vm(e,t){return e*Math.sqrt(1-t*t)}var ym=12;function bm(e,t,n){let r=n;for(let n=1;n<ym;n++)r-=e(r)/t(r);return r}var xm=.001;function Sm({duration:e=_m.duration,bounce:t=_m.bounce,velocity:n=_m.velocity,mass:r=_m.mass}){let i,a;_m.maxDuration;let o=1-t;o=df(_m.minDamping,_m.maxDamping,o),e=df(_m.minDuration,_m.maxDuration,Cf(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=vm(t,o),c=Math.exp(-i);return xm-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=vm(t**2,o);return(-i(t)+xm>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-xm+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=bm(i,a,s);if(e=Sf(e),isNaN(c))return{stiffness:_m.stiffness,damping:_m.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Cm=[`duration`,`bounce`],wm=[`stiffness`,`damping`,`mass`];function Tm(e,t){return t.some(t=>e[t]!==void 0)}function Em(e){let t={velocity:_m.velocity,stiffness:_m.stiffness,damping:_m.damping,mass:_m.mass,isResolvedFromDuration:!1,...e};if(!Tm(e,wm)&&Tm(e,Cm))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*df(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:_m.mass,stiffness:i,damping:a}}else{let n=Sm({...e,velocity:0});t={...t,...n,mass:_m.mass},t.isResolvedFromDuration=!0}return t}function Dm(e=_m.visualDuration,t=_m.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}=Em({...n,velocity:-Cf(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Cf(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?_m.restSpeed.granular:_m.restSpeed.default,i||=v?_m.restDelta.granular:_m.restDelta.default;let y,b,x,S,C,w;if(h<1)x=vm(_,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=>Sf(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=Sf(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=Sf(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(hm(T),mm),t=pm(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Dm.applyToOptions=e=>{let t=gm(e,100,Dm);return e.ease=t.ease,e.duration=Sf(t.duration),e.type=`keyframes`,e};var Om=5;function km(e,t,n){let r=Math.max(t-Om,0);return wf(n-e(r),t-r)}function Am({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=Dm({keyframes:[f.value,m(f.value)],velocity:km(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 jm(e,t,n){let r=[],i=n||ff.mix||dm,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=yf(Array.isArray(t)?t[n]||_f:t,a)),r.push(a)}return r}function Mm(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=jm(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=bf(e[r],e[r+1],n);return s[r](i)};return n?t=>l(df(e[0],e[a-1],t)):l}function Nm(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=bf(0,t,r);e.push(Zp(n,1,i))}}function Pm(e){let t=[0];return Nm(t,e.length-1),t}function Fm(e,t){return e.map(e=>e*t)}function Im(e,t){return e.map(()=>t||Vf).splice(0,e.length-1)}function Lm({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Hf(r)?r.map(Kf):Kf(r),a={done:!1,value:t[0]},o=Mm(Fm(n&&n.length===t.length?n:Pm(t),e),t,{ease:Array.isArray(i)?i:Im(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Rm=e=>e!==null;function zm(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Rm),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Bm={decay:Am,inertia:Am,tween:Lm,keyframes:Lm,spring:Dm};function Vm(e){typeof e.type==`string`&&(e.type=Bm[e.type])}var Hm=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)}},Um=e=>e/100,Wm=class extends Hm{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!==ip.now()&&this.tick(ip.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},ap.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Vm(e);let{type:t=Lm,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Lm;s!==Lm&&typeof o[0]!=`number`&&(this.mixKeyframes=yf(Um,dm(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=hm(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=df(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!==Am&&(b.value=zm(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 Cf(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Cf(e)}get time(){return Cf(this.currentTime)}set time(e){e=Sf(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 km(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(ip.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Cf(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=fm,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(ip.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,ap.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function Gm(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Km=e=>e*180/Math.PI,qm=e=>Ym(Km(Math.atan2(e[1],e[0]))),Jm={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:qm,rotateZ:qm,skewX:e=>Km(Math.atan(e[1])),skewY:e=>Km(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ym=e=>(e%=360,e<0&&(e+=360),e),Xm=qm,Zm=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Qm=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),$m={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Zm,scaleY:Qm,scale:e=>(Zm(e)+Qm(e))/2,rotateX:e=>Ym(Km(Math.atan2(e[6],e[5]))),rotateY:e=>Ym(Km(Math.atan2(-e[2],e[0]))),rotateZ:Xm,rotate:Xm,skewX:e=>Km(Math.atan(e[4])),skewY:e=>Km(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function eh(e){return+!!e.includes(`scale`)}function th(e,t){if(!e||e===`none`)return eh(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=$m,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Jm,i=t}if(!i)return eh(t);let a=r[t],o=i[1].split(`,`).map(rh);return typeof a==`function`?a(o):o[a]}var nh=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return th(n,t)};function rh(e){return parseFloat(e.trim())}var ih=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],ah=new Set(ih),oh=e=>e===fp||e===J,sh=new Set([`x`,`y`,`z`]),nee=ih.filter(e=>!sh.has(e));function ch(e){let t=[];return nee.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var lh={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})=>th(t,`x`),y:(e,{transform:t})=>th(t,`y`)};lh.translateX=lh.x,lh.translateY=lh.y;var uh=new Set,dh=!1,fh=!1,ph=!1;function mh(){if(fh){let e=Array.from(uh).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=ch(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)})}fh=!1,dh=!1,uh.forEach(e=>e.complete(ph)),uh.clear()}function hh(){uh.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(fh=!0)})}function gh(){ph=!0,hh(),mh(),ph=!1}var _h=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?(uh.add(this),dh||(dh=!0,Qf.read(hh),Qf.resolveKeyframes(mh))):(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])}Gm(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),uh.delete(this)}cancel(){this.state===`scheduled`&&(uh.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},vh=e=>e.startsWith(`--`);function yh(e,t,n){vh(t)?e.style.setProperty(t,n):e.style[t]=n}var bh={};function xh(e,t){let n=gf(e);return()=>bh[t]??n()}var Sh=xh(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Ch=xh(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),wh=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Th={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:wh([0,.65,.55,1]),circOut:wh([.55,0,1,.45]),backIn:wh([.31,.01,.66,-.59]),backOut:wh([.33,1.53,.69,.99])};function Eh(e,t){if(e)return typeof e==`function`?Ch()?pm(e,t):`ease-out`:Uf(e)?wh(e):Array.isArray(e)?e.map(e=>Eh(e,t)||Th.easeOut):Th[e]}function ree(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=Eh(s,i);Array.isArray(d)&&(u.easing=d),Jf.value&&ap.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return Jf.value&&p.finished.finally(()=>{ap.waapi--}),p}function Dh(e){return typeof e==`function`&&`applyToOptions`in e}function iee({type:e,...t}){return Dh(e)&&Ch()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Oh=class extends Hm{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=iee(e);this.animation=ree(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=zm(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),yh(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 Cf(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Cf(e)}get time(){return Cf(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Sf(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&&Sh()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),_f):r(this)}},kh={anticipate:Ff,backInOut:Pf,circInOut:Rf};function aee(e){return e in kh}function oee(e){typeof e.ease==`string`&&aee(e.ease)&&(e.ease=kh[e.ease])}var Ah=10,see=class extends Oh{constructor(e){oee(e),Vm(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 Wm({...a,autoplay:!1}),s=Math.max(Ah,ip.now()-this.startTime),c=df(0,Ah,s-Ah),l=o.sample(s).value,{name:u}=this.options;i&&u&&yh(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},jh=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(qp.test(e)||e===`0`)&&!e.startsWith(`url(`));function cee(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function lee(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=jh(i,t),s=jh(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:cee(e)||(n===`spring`||Dh(n))&&r}function Mh(e){e.duration=0,e.type=`keyframes`}var Nh=new Set([`opacity`,`clipPath`,`filter`,`transform`]),uee=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function dee(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&uee.test(e[t]))return!0;return!1}var fee=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),pee=gf(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function mee(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return pee()&&n&&(Nh.has(n)||fee.has(n)&&dee(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var hee=40,gee=class extends Hm{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=ip.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||_h)(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=ip.now();let u=!0;lee(e,i,a,o)||(u=!1,(ff.instantAnimations||!s)&&l?.(zm(e,n,t)),e[0]=e[e.length-1],Mh(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>hee?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&mee(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new see({...d,element:p})}catch{m=new Wm(d)}else m=new Wm(d);m.finished.then(()=>{this.notifyFinished()}).catch(_f),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(),gh()),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 Ph(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var _ee=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function vee(e){let t=_ee.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function Fh(e,t,n=1){`${e}`;let[r,i]=vee(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return pf(e)?parseFloat(e):e}return lp(i)?Fh(i,t,n+1):i}var yee={type:`spring`,stiffness:500,damping:25,restSpeed:10},bee=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),xee={type:`keyframes`,duration:.8},See={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Cee=(e,{keyframes:t})=>t.length>2?xee:ah.has(e)?e.startsWith(`scale`)?bee(t[1]):yee:See;function Ih(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:Ih(n,e)}var wee=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function Tee(e){for(let t in e)if(!wee.has(t))return!0;return!1}var Rh=(e,t,n,r={},i,a)=>o=>{let s=Lh(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Sf(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};Tee(s)||Object.assign(u,Cee(e,u)),u.duration&&=Sf(u.duration),u.repeatDelay&&=Sf(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Mh(u),u.delay===0&&(d=!0)),(ff.instantAnimations||ff.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,Mh(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=zm(u.keyframes,s);if(e!==void 0){Qf.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Wm(u):new gee(u)};function zh(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Bh(e,t,n,r){if(typeof t==`function`){let[i,a]=zh(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]=zh(r);t=t(n===void 0?e.custom:n,i,a)}return t}function Vh(e,t,n){let r=e.getProps();return Bh(r,t,n===void 0?r.custom:n,e)}var Hh=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...ih]),Uh=30,Wh=e=>!isNaN(parseFloat(e)),Gh={current:void 0},Kh=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=ip.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=ip.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Wh(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 xf);let n=this.events[e].add(t);return e===`change`?()=>{n(),Qf.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 Gh.current&&Gh.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=ip.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Uh)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Uh);return wf(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 qh(e,t){return new Kh(e,t)}var Jh=e=>Array.isArray(e);function Yh(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,qh(n))}function Xh(e){return Jh(e)?e[e.length-1]||0:e}function Zh(e,t){let{transitionEnd:n={},transition:r={},...i}=Vh(e,t)||{};i={...i,...n};for(let t in i)Yh(e,t,Xh(i[t]))}var Qh=e=>!!(e&&e.getVelocity);function $h(e){return!!(Qh(e)&&e.add)}function eg(e,t){let n=e.getValue(`willChange`);if($h(n))return n.add(t);if(!n&&ff.WillChange){let n=new ff.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function tg(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var ng=`data-`+tg(`framerAppearId`);function rg(e){return e.props[ng]}function ig({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function ag(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?Ih(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&&ig(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){Qf.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=rg(e);if(n){let e=window.MotionHandoffAnimation(n,t,Qf);e!==null&&(o.startTime=e,f=!0)}}eg(e,t);let p=l??e.shouldReduceMotion;r.start(Rh(t,r,i,p&&Hh.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>Qf.update(()=>{o&&Zh(e,o)});u.length?Promise.all(u).then(t):t()}return u}function og(e,t,n={}){let r=Vh(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(ag(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return sg(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 sg(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(og(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Ph(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function cg(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>og(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=og(e,t,n);else{let i=typeof t==`function`?Vh(e,t,n.custom):t;r=Promise.all(ag(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var lg={test:e=>e===`auto`,parse:e=>e},ug=e=>t=>t.test(e),dg=[fp,J,Op,Dp,Ap,kp,lg],fg=e=>dg.find(ug(e));function pg(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||hf(e)}var mg=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function hg(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(gp)||[];if(!r)return e;let i=n.replace(r,``),a=+!!mg.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var gg=/\b([a-z-]*)\(.*?\)/gu,_g={...qp,getAnimatableNone:e=>{let t=e.match(gg);return t?t.map(hg).join(` `):e}},vg={...qp,getAnimatableNone:e=>{let t=qp.parse(e);return qp.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},yg={...fp,transform:Math.round},bg={borderWidth:J,borderTopWidth:J,borderRightWidth:J,borderBottomWidth:J,borderLeftWidth:J,borderRadius:J,borderTopLeftRadius:J,borderTopRightRadius:J,borderBottomRightRadius:J,borderBottomLeftRadius:J,width:J,maxWidth:J,height:J,maxHeight:J,top:J,right:J,bottom:J,left:J,inset:J,insetBlock:J,insetBlockStart:J,insetBlockEnd:J,insetInline:J,insetInlineStart:J,insetInlineEnd:J,padding:J,paddingTop:J,paddingRight:J,paddingBottom:J,paddingLeft:J,paddingBlock:J,paddingBlockStart:J,paddingBlockEnd:J,paddingInline:J,paddingInlineStart:J,paddingInlineEnd:J,margin:J,marginTop:J,marginRight:J,marginBottom:J,marginLeft:J,marginBlock:J,marginBlockStart:J,marginBlockEnd:J,marginInline:J,marginInlineStart:J,marginInlineEnd:J,fontSize:J,backgroundPositionX:J,backgroundPositionY:J,rotate:Dp,rotateX:Dp,rotateY:Dp,rotateZ:Dp,scale:mp,scaleX:mp,scaleY:mp,scaleZ:mp,skew:Dp,skewX:Dp,skewY:Dp,distance:J,translateX:J,translateY:J,translateZ:J,x:J,y:J,z:J,perspective:J,transformPerspective:J,opacity:pp,originX:jp,originY:jp,originZ:J,zIndex:yg,fillOpacity:pp,strokeOpacity:pp,numOctaves:yg},xg={...bg,color:Np,backgroundColor:Np,outlineColor:Np,fill:Np,stroke:Np,borderColor:Np,borderTopColor:Np,borderRightColor:Np,borderBottomColor:Np,borderLeftColor:Np,filter:_g,WebkitFilter:_g,mask:vg,WebkitMask:vg},Sg=e=>xg[e],Cg=new Set([_g,vg]);function wg(e,t){let n=Sg(e);return Cg.has(n)||(n=qp),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Tg=new Set([`auto`,`none`,`0`]);function Eg(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Tg.has(t)&&Hp(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=wg(n,i)}var Dg=class extends _h{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(),lp(r))){let i=Fh(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Hh.has(n)||e.length!==2)return;let[r,i]=e,a=fg(r),o=fg(i);if(dp(r)!==dp(i)&&lh[n]){this.needsMeasurement=!0;return}if(a!==o)if(oh(a)&&oh(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else lh[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||pg(e[t]))&&n.push(t);n.length&&Eg(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=lh[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]=lh[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 Og(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 kg=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ag(e){return mf(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:jg,cancel:Eee}=Zf(queueMicrotask,!1),Mg={x:!1,y:!1};function Ng(){return Mg.x||Mg.y}function Pg(e){return e===`x`||e===`y`?Mg[e]?null:(Mg[e]=!0,()=>{Mg[e]=!1}):Mg.x||Mg.y?null:(Mg.x=Mg.y=!0,()=>{Mg.x=Mg.y=!1})}function Fg(e,t){let n=Og(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Ig(e){return!(e.pointerType===`touch`||Ng())}function Lg(e,t,n={}){let[r,i,a]=Fg(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(!Ig(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 Rg=(e,t)=>t?e===t?!0:Rg(e,t.parentElement):!1,zg=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Bg=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Vg(e){return Bg.has(e.tagName)||e.isContentEditable===!0}var Hg=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function Ug(e){return Hg.has(e.tagName)||e.isContentEditable===!0}var Wg=new WeakSet;function Gg(e){return t=>{t.key===`Enter`&&e(t)}}function Kg(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var qg=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Gg(()=>{if(Wg.has(n))return;Kg(n,`down`);let e=Gg(()=>{Kg(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>Kg(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function Jg(e){return zg(e)&&!Ng()}var Yg=new WeakSet;function Xg(e,t,n={}){let[r,i,a]=Fg(e,n),o=e=>{let r=e.currentTarget;if(!Jg(e)||Yg.has(e))return;Wg.add(r),n.stopPropagation&&Yg.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Wg.has(r)&&Wg.delete(r),Jg(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||Rg(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),Ag(e)&&(e.addEventListener(`focus`,e=>qg(e,i)),!Vg(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Zg(e){return mf(e)&&`ownerSVGElement`in e}var Qg=new WeakMap,$g,e_=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:Zg(r)&&`getBBox`in r?r.getBBox()[t]:r[n],t_=e_(`inline`,`width`,`offsetWidth`),n_=e_(`block`,`height`,`offsetHeight`);function r_({target:e,borderBoxSize:t}){Qg.get(e)?.forEach(n=>{n(e,{get width(){return t_(e,t)},get height(){return n_(e,t)}})})}function i_(e){e.forEach(r_)}function a_(){typeof ResizeObserver>`u`||($g=new ResizeObserver(i_))}function o_(e,t){$g||a_();let n=Og(e);return n.forEach(e=>{let n=Qg.get(e);n||(n=new Set,Qg.set(e,n)),n.add(t),$g?.observe(e)}),()=>{n.forEach(e=>{let n=Qg.get(e);n?.delete(t),n?.size||$g?.unobserve(e)})}}var s_=new Set,c_;function l_(){c_=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};s_.forEach(t=>t(e))},window.addEventListener(`resize`,c_)}function u_(e){return s_.add(e),c_||l_(),()=>{s_.delete(e),!s_.size&&typeof c_==`function`&&(window.removeEventListener(`resize`,c_),c_=void 0)}}function d_(e,t){return typeof e==`function`?u_(e):o_(e,t)}function f_(e){return Zg(e)&&e.tagName===`svg`}var p_=[...dg,Np,qp],m_=e=>p_.find(ug(e)),h_=()=>({translate:0,scale:1,origin:0,originPoint:0}),g_=()=>({x:h_(),y:h_()}),__=()=>({min:0,max:0}),v_=()=>({x:__(),y:__()}),y_=new WeakMap;function b_(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function x_(e){return typeof e==`string`||Array.isArray(e)}var S_=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],C_=[`initial`,...S_];function w_(e){return b_(e.animate)||C_.some(t=>x_(e[t]))}function T_(e){return!!(w_(e)||e.variants)}function E_(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Qh(i))e.addValue(r,i);else if(Qh(a))e.addValue(r,qh(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,qh(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var D_={current:null},O_={current:!1},k_=typeof window<`u`;function A_(){if(O_.current=!0,k_)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>D_.current=e.matches;e.addEventListener(`change`,t),t()}else D_.current=!1}var j_=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],M_={};function N_(e){M_=e}function P_(){return M_}var F_=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=_h,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=ip.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Qf.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=w_(t),this.isVariantNode=T_(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&&Qh(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,y_.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:(O_.current||A_(),this.shouldReduceMotion=D_.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(),$f(this.notifyUpdate),$f(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&&Nh.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Oh({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Sf(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=ah.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Qf.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 M_){let t=M_[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):v_()}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<j_.length;t++){let n=j_[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=E_(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=qh(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`&&(pf(n)||hf(n))?n=parseFloat(n):!m_(n)&&qp.test(t)&&(n=wg(e,t)),this.setBaseTarget(e,Qh(n)?n.get():n)),Qh(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=Bh(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&&!Qh(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 xf),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){jg.render(this.render)}},I_=class extends F_{constructor(){super(...arguments),this.KeyframeResolver=Dg}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;Qh(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},L_=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function R_({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function z_({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function B_(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 V_(e){return e===void 0||e===1}function H_({scale:e,scaleX:t,scaleY:n}){return!V_(e)||!V_(t)||!V_(n)}function U_(e){return H_(e)||W_(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function W_(e){return G_(e.x)||G_(e.y)}function G_(e){return e&&e!==`0%`}function K_(e,t,n){return n+t*(e-n)}function q_(e,t,n,r,i){return i!==void 0&&(e=K_(e,i,r)),K_(e,n,r)+t}function J_(e,t=0,n=1,r,i){e.min=q_(e.min,t,n,r,i),e.max=q_(e.max,t,n,r,i)}function Y_(e,{x:t,y:n}){J_(e.x,t.translate,t.scale,t.originPoint),J_(e.y,n.translate,n.scale,n.originPoint)}var X_=.999999999999,Z_=1.0000000000001;function Q_(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&&($_(e.x,-a.scroll.offset.x),$_(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Y_(e,o)),r&&U_(a.latestValues)&&nv(e,a.latestValues,a.layout?.layoutBox))}t.x<Z_&&t.x>X_&&(t.x=1),t.y<Z_&&t.y>X_&&(t.y=1)}function $_(e,t){e.min+=t,e.max+=t}function ev(e,t,n,r,i=.5){J_(e,t,n,Zp(e.min,e.max,i),r)}function tv(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function nv(e,t,n){let r=n??e;ev(e.x,tv(t.x,r.x),t.scaleX,t.scale,t.originX),ev(e.y,tv(t.y,r.y),t.scaleY,t.scale,t.originY)}function rv(e,t){return R_(B_(e.getBoundingClientRect(),t))}function iv(e,t,n){let r=rv(e,n),{scroll:i}=t;return i&&($_(r.x,i.offset.x),$_(r.y,i.offset.y)),r}var av={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},ov=ih.length;function sv(e,t,n){let r=``,i=!0;for(let a=0;a<ov;a++){let o=ih[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=kg(s,bg[o]);if(!c){i=!1;let t=av[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function cv(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(ah.has(e)){o=!0;continue}else if(sp(e)){i[e]=n;continue}else{let t=kg(n,bg[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=sv(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 lv(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 uv(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var dv={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(J.test(e))e=parseFloat(e);else return e;return`${uv(e,t.target.x)}% ${uv(e,t.target.y)}%`}},fv={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=qp.parse(e);if(i.length>5)return r;let a=qp.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=Zp(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},pv={borderRadius:{...dv,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:dv,borderTopRightRadius:dv,borderBottomLeftRadius:dv,borderBottomRightRadius:dv,boxShadow:fv};function mv(e,{layout:t,layoutId:n}){return ah.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!pv[e]||e===`opacity`)}function hv(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Qh(r[t])||i&&Qh(i[t])||mv(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function gv(e){return window.getComputedStyle(e)}var _v=class extends I_{constructor(){super(...arguments),this.type=`html`,this.renderInstance=lv}readValueFromInstance(e,t){if(ah.has(t))return this.projection?.isProjecting?eh(t):nh(e,t);{let n=gv(e),r=(sp(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return rv(e,t)}build(e,t,n){cv(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return hv(e,t,n)}},vv={offset:`stroke-dashoffset`,array:`stroke-dasharray`},yv={offset:`strokeDashoffset`,array:`strokeDasharray`};function bv(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?vv:yv;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var xv=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Sv(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(cv(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 xv)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&&bv(d,i,a,o,!1)}var Cv=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`]),wv=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Dee(e,t,n,r){lv(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Cv.has(n)?n:tg(n),t.attrs[n])}function Tv(e,t,n){let r=hv(e,t,n);for(let n in e)if(Qh(e[n])||Qh(t[n])){let t=ih.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Oee=class extends I_{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=v_}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(ah.has(t)){let e=Sg(t);return e&&e.default||0}return t=Cv.has(t)?t:tg(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Tv(e,t,n)}build(e,t,n){Sv(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Dee(e,t,n,r)}mount(e){this.isSVGTag=wv(e.tagName),super.mount(e)}},kee=C_.length;function Ev(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Ev(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<kee;n++){let r=C_[n],i=e.props[r];(x_(i)||i===!1)&&(t[r]=i)}return t}function Dv(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 Aee=[...S_].reverse(),jee=S_.length;function Mee(e){return t=>Promise.all(t.map(({animation:t,options:n})=>cg(e,t,n)))}function Nee(e){let t=Mee(e),n=kv(),r=!0,i=!1,a=t=>(n,r)=>{let i=Vh(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=Ev(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<jee;t++){let p=Aee[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=x_(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||b_(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=Pee(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=Jh(t)&&Jh(n)?!Dv(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=Vh(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Ph(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=Vh(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=kv(),i=!0}}}function Pee(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Dv(t,e):!1}function Ov(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function kv(){return{animate:Ov(!0),whileInView:Ov(),whileHover:Ov(),whileTap:Ov(),whileDrag:Ov(),whileFocus:Ov(),exit:Ov()}}function Av(e,t){e.min=t.min,e.max=t.max}function jv(e,t){Av(e.x,t.x),Av(e.y,t.y)}function Mv(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Nv=1e-4,Fee=1-Nv,Iee=1+Nv,Pv=.01,Lee=0-Pv,Ree=0+Pv;function Fv(e){return e.max-e.min}function zee(e,t,n){return Math.abs(e-t)<=n}function Iv(e,t,n,r=.5){e.origin=r,e.originPoint=Zp(t.min,t.max,e.origin),e.scale=Fv(n)/Fv(t),e.translate=Zp(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Fee&&e.scale<=Iee||isNaN(e.scale))&&(e.scale=1),(e.translate>=Lee&&e.translate<=Ree||isNaN(e.translate))&&(e.translate=0)}function Lv(e,t,n,r){Iv(e.x,t.x,n.x,r?r.originX:void 0),Iv(e.y,t.y,n.y,r?r.originY:void 0)}function Rv(e,t,n,r=0){e.min=(r?Zp(n.min,n.max,r):n.min)+t.min,e.max=e.min+Fv(t)}function Bee(e,t,n,r){Rv(e.x,t.x,n.x,r?.x),Rv(e.y,t.y,n.y,r?.y)}function zv(e,t,n,r=0){let i=r?Zp(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Fv(t)}function Bv(e,t,n,r){zv(e.x,t.x,n.x,r?.x),zv(e.y,t.y,n.y,r?.y)}function Vv(e,t,n,r,i){return e-=t,e=K_(e,1/n,r),i!==void 0&&(e=K_(e,1/i,r)),e}function Vee(e,t=0,n=1,r=.5,i,a=e,o=e){if(Op.test(t)&&(t=parseFloat(t),t=Zp(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=Zp(a.min,a.max,r);e===a&&(s-=t),e.min=Vv(e.min,t,n,s,i),e.max=Vv(e.max,t,n,s,i)}function Hv(e,t,[n,r,i],a,o){Vee(e,t[n],t[r],t[i],t.scale,a,o)}var Hee=[`x`,`scaleX`,`originX`],Uee=[`y`,`scaleY`,`originY`];function Uv(e,t,n,r){Hv(e.x,t,Hee,n?n.x:void 0,r?r.x:void 0),Hv(e.y,t,Uee,n?n.y:void 0,r?r.y:void 0)}function Wv(e){return e.translate===0&&e.scale===1}function Gv(e){return Wv(e.x)&&Wv(e.y)}function Kv(e,t){return e.min===t.min&&e.max===t.max}function Wee(e,t){return Kv(e.x,t.x)&&Kv(e.y,t.y)}function qv(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Jv(e,t){return qv(e.x,t.x)&&qv(e.y,t.y)}function Yv(e){return Fv(e.x)/Fv(e.y)}function Xv(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Zv(e){return[e(`x`),e(`y`)]}function Gee(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 Qv=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],Kee=Qv.length,$v=e=>typeof e==`string`?parseFloat(e):e,ey=e=>typeof e==`number`||J.test(e);function qee(e,t,n,r,i,a){i?(e.opacity=Zp(0,n.opacity??1,Jee(r)),e.opacityExit=Zp(t.opacity??1,0,Yee(r))):a&&(e.opacity=Zp(t.opacity??1,n.opacity??1,r));for(let i=0;i<Kee;i++){let a=Qv[i],o=ty(t,a),s=ty(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||ey(o)===ey(s)?(e[a]=Math.max(Zp($v(o),$v(s),r),0),(Op.test(s)||Op.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=Zp(t.rotate||0,n.rotate||0,r))}function ty(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Jee=ny(0,.5,Lf),Yee=ny(.5,.95,_f);function ny(e,t,n){return r=>r<e?0:r>t?1:n(bf(e,t,r))}function Xee(e,t,n){let r=Qh(e)?e:qh(e);return r.start(Rh(``,r,t,n)),r.animation}function ry(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var Zee=(e,t)=>e.depth-t.depth,Qee=class{constructor(){this.children=[],this.isDirty=!1}add(e){lf(this.children,e),this.isDirty=!0}remove(e){uf(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Zee),this.isDirty=!1,this.children.forEach(e)}};function $ee(e,t){let n=ip.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&($f(r),e(a-t))};return Qf.setup(r,!0),()=>$f(r)}function iy(e){return Qh(e)?e.get():e}var ete=class{constructor(){this.members=[]}add(e){lf(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&&(uf(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(uf(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)}},ay={hasAnimatedSinceResize:!0,hasEverUpdated:!1},oy={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},sy=[``,`X`,`Y`,`Z`],tte=1e3,nte=0;function cy(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function ly(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=rg(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Qf,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&ly(r)}function uy({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=nte++,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,Jf.value&&(oy.nodes=oy.calculatedTargetDeltas=oy.calculatedProjections=0),this.nodes.forEach(ate),this.nodes.forEach(lte),this.nodes.forEach(gy),this.nodes.forEach(ote),Jf.addProjectionMetrics&&Jf.addProjectionMetrics(oy)},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 Qee)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new xf),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=Zg(t)&&!f_(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;Qf.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=$ee(i,250),ay.hasAnimatedSinceResize&&(ay.hasAnimatedSinceResize=!1,this.nodes.forEach(hy)))})}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()||ute,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Jv(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||hy(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(),$f(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(_y),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&&ly(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(cte),this.nodes.forEach(dy);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(fy);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(py),this.nodes.forEach(my),this.nodes.forEach(rte),this.nodes.forEach(ite)):this.nodes.forEach(fy),this.clearAllSnapshots();let e=ip.now();ep.delta=df(0,1e3/60,e-ep.timestamp),ep.timestamp=e,ep.isProcessing=!0,tp.update.process(ep),tp.preRender.process(ep),tp.render.process(ep),ep.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,jg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ste),this.sharedNodes.forEach(vy)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Qf.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Qf.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Fv(this.snapshot.measuredBox.x)&&!Fv(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||=v_(),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&&!Gv(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||U_(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)),Ey(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return v_();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Oy))){let{scroll:e}=this.root;e&&($_(t.x,e.offset.x),$_(t.y,e.offset.y))}return t}removeElementScroll(e){let t=v_();if(jv(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&&jv(t,e),$_(t.x,i.offset.x),$_(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||v_();jv(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&&($_(r.x,-n.scroll.offset.x),$_(r.y,-n.scroll.offset.y)),U_(n.latestValues)&&nv(r,n.latestValues,n.layout?.layoutBox)}return U_(this.latestValues)&&nv(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=v_();jv(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!U_(n.latestValues))continue;let r;n.instance&&(H_(n.latestValues)&&n.updateSnapshot(),r=v_(),jv(r,n.measurePageBox())),Uv(t,n.latestValues,n.snapshot?.layoutBox,r)}return U_(this.latestValues)&&Uv(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!==ep.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=ep.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=v_(),this.targetWithTransforms=v_()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Bee(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):jv(this.target,this.layout.layoutBox),Y_(this.target,this.targetDelta)):jv(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),Jf.value&&oy.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||H_(this.parent.latestValues)||W_(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=v_(),this.relativeTargetOrigin=v_(),Bv(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),jv(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===ep.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;jv(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Q_(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=v_());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Mv(this.prevProjectionDelta.x,this.projectionDelta.x),Mv(this.prevProjectionDelta.y,this.projectionDelta.y)),Lv(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Xv(this.projectionDelta.x,this.prevProjectionDelta.x)||!Xv(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Jf.value&&oy.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=g_(),this.projectionDelta=g_(),this.projectionDeltaWithTransform=g_()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=g_();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=v_(),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(Sy));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;yy(a.x,e.x,n),yy(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Bv(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),xy(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&Wee(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=v_(),jv(d,this.relativeTarget)),s&&(this.animationValues=i,qee(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&&=($f(this.pendingAnimation),void 0),this.pendingAnimation=Qf.update(()=>{ay.hasAnimatedSinceResize=!0,ap.layout++,this.motionValue||=qh(0),this.motionValue.jump(0,!1),this.currentAnimation=Xee(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{ap.layout--},onComplete:()=>{ap.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(tte),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&&Dy(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||v_();let t=Fv(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=Fv(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}jv(t,n),nv(t,i),Lv(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new ete),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&&cy(`z`,e,r,this.animationValues);for(let t=0;t<sy.length;t++)cy(`rotate${sy[t]}`,e,r,this.animationValues),cy(`skew${sy[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=iy(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=iy(t?.pointerEvents)||``),this.hasProjected&&!U_(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Gee(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 pv){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=pv[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?iy(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(dy),this.root.sharedNodes.clear()}}}function rte(e){e.updateLayout()}function ite(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`)Zv(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=Fv(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Av(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else Dy(i,t.layoutBox,n)&&Zv(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=Fv(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=g_();Lv(o,n,t.layoutBox);let s=g_();a?Lv(s,e.applyTransform(r,!0),t.measuredBox):Lv(s,n,t.layoutBox);let c=!Gv(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=v_();Bv(s,t.layoutBox,i.layoutBox,o);let c=v_();Bv(c,n,a.layoutBox,o),Jv(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 ate(e){Jf.value&&oy.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 ote(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ste(e){e.clearSnapshot()}function dy(e){e.clearMeasurements()}function cte(e){e.isLayoutDirty=!0,e.updateLayout()}function fy(e){e.isLayoutDirty=!1}function py(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function my(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function hy(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function lte(e){e.resolveTargetDelta()}function gy(e){e.calcProjection()}function _y(e){e.resetSkewAndRotation()}function vy(e){e.removeLeadSnapshot()}function yy(e,t,n){e.translate=Zp(t.translate,0,n),e.scale=Zp(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function by(e,t,n,r){e.min=Zp(t.min,n.min,r),e.max=Zp(t.max,n.max,r)}function xy(e,t,n,r){by(e.x,t.x,n.x,r),by(e.y,t.y,n.y,r)}function Sy(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var ute={duration:.45,ease:[.4,0,.1,1]},Cy=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),wy=Cy(`applewebkit/`)&&!Cy(`chrome/`)?Math.round:_f;function Ty(e){e.min=wy(e.min),e.max=wy(e.max)}function Ey(e){Ty(e.x),Ty(e.y)}function Dy(e,t,n){return e===`position`||e===`preserve-aspect`&&!zee(Yv(t),Yv(n),.2)}function Oy(e){return e!==e.root&&e.scroll?.wasRoot}var ky=uy({attachResizeListener:(e,t)=>ry(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Ay={current:void 0},jy=uy({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Ay.current){let e=new ky({});e.mount(window),e.setOptions({layoutScroll:!0}),Ay.current=e}return Ay.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),My=(0,z.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Ny(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Py(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ny(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():Ny(e[t],null)}}}}function Fy(...e){return z.useCallback(Py(...e),e)}var Iy=class extends z.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(Ag(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Ag(e)&&e.offsetWidth||0,r=Ag(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 Ly({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)(My),u=Fy(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(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),js=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`}]]),Ms=U(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),Ns=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`}]]),Ps=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`}]]),Fs=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`}]]),Is=U(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Ls=U(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Rs=U(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),zs=U(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Bs=U(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Vs=U(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Hs=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`}]]),Us=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`}]]),Ws=U(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Gs=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`}]]),Ks=U(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),qs=U(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Js=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`}]]),Ys=U(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Xs=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`}]]),Zs=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`}]]),$s=U(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ec=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`}]]),tc=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`}]]),nc=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`}]]),rc=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`}]]),ic=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`}]]),ac=U(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),oc=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`}]]),sc=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`}]]),cc=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`}]]),lc=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`}]]),uc=U(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),dc=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`}]]),fc=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`}]]),pc=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`}]]),mc=U(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),hc=U(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),gc=U(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),_c=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`}]]),vc=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`}]]),yc=U(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),bc=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`}]]),xc=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`}]]),Sc=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`}]]),Cc=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),wc=U(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Tc=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`}]]),Ec=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`}]]),Dc=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`}]]),Oc=U(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),kc=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`}]]),Ac=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`}]]),jc=U(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Mc=U(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Nc=U(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Pc=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`}]]),Fc=U(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Ic=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`}]]),Lc=U(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Rc=U(`test-tube`,[[`path`,{d:`M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2`,key:`125lnx`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}],[`path`,{d:`M14.5 16h-5`,key:`1ox875`}]]),zc=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`}]]),Bc=U(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),Vc=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`}]]),Hc=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`}]]),Uc=U(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),Wc=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`}]]),Gc=U(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Kc=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`}]]),qc=u(y(),1),Jc=u(_(),1),Yc=(0,z.createContext)({toast:()=>{}}),Xc=()=>{};function Zc(e,t=`error`){Xc(e,t)}function Qc({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)(()=>{Xc=i},[i]);let a={success:Us,error:Gs,warning:Vc},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)(Yc.Provider,{value:{toast:i},children:[e,(0,Jc.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)(Gc,{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=>(Zc(e.response?.data?.error||e.response?.data?.message||e.message||`请求失败`,`error`),Promise.reject(e)));var $c=()=>W.get(`/health`),el=()=>W.get(`/config`),tl=e=>W.put(`/config`,e),nl=()=>W.get(`/config/history`),rl=e=>W.get(`/sessions`,{params:e}),il=e=>W.get(`/sessions/${e}`),al=e=>W.delete(`/sessions/${e}`),ol=e=>W.delete(`/sessions`,{data:{ids:e}}),sl=e=>W.get(`/events`,{params:e}),cl=e=>W.get(`/events/stats`,{params:{project_path:e}}),ll=e=>W.get(`/pipelines`,{params:e}),ul=e=>W.get(`/pipelines/${e}`),dl=e=>W.get(`/quality/history`,{params:e}),fl=e=>W.get(`/quality/unresolved`,{params:{project_path:e}}),pl=()=>W.get(`/stats/roi`),ml=()=>W.get(`/stats/overview`),hl=(e,t,n,r)=>W.get(`/knowledge/search`,{params:{q:e,project_path:t,node_type:n,limit:r}}),gl=e=>W.get(`/knowledge/overview`,{params:{project_path:e}}),_l=(e,t)=>W.get(`/knowledge/neighbors`,{params:{node_id:e,project_path:t}}),vl=(e,t)=>W.get(`/knowledge/graph`,{params:{project_path:e,node_type:t}}),yl=e=>W.post(`/knowledge/nodes`,e),bl=(e,t)=>W.put(`/knowledge/nodes/${e}`,t),xl=e=>W.delete(`/knowledge/nodes/${e}`),Sl=e=>W.post(`/pipelines/${e}/close`),Cl=e=>W.post(`/pipelines/batch-close`,{ids:e}),wl=()=>W.post(`/pipelines/close-expired`),Tl=()=>W.get(`/pipelines/active`),El=e=>W.post(`/pipelines/${e}/resume`),Dl=e=>W.post(`/pipelines/${e}/advance`),Ol=e=>W.get(`/projects`,{params:e}),kl=e=>W.get(`/projects/${e}`),Al=e=>W.delete(`/projects/${e}`),jl=e=>W.post(`/convention/init`,{path:e},{timeout:18e4}),Ml=e=>W.get(`/projects/${e}/conventions`),Nl=(e,t)=>W.post(`/projects/${e}/conventions/bind`,{conventionId:t}),Pl=(e,t)=>W.delete(`/projects/${e}/conventions/${encodeURIComponent(t)}`),Fl=e=>W.get(`/projects/${e}/conventions/custom/yaml`),Il=(e,t)=>W.put(`/projects/${e}/conventions/custom`,{yaml:t}),Ll=e=>W.post(`/projects/${e}/conventions/distill`,{},{timeout:12e4}),Rl=e=>W.get(`/claudemd/${e}`),zl=(e,t)=>W.put(`/claudemd/${e}`,{content:t}),Bl=e=>W.get(`/claudemd/${e}/profile`),Vl=e=>W.get(`/claudemd/${e}/modules`),Hl=e=>W.post(`/claudemd/${e}/distill`,void 0,{timeout:18e4}),Ul=e=>W.post(`/claudemd/${e}/init`,void 0,{timeout:18e4}),Wl=e=>W.post(`/quality/${e}/resolve`),Gl=e=>W.post(`/quality/${e}/dismiss`),Kl=e=>W.post(`/quality/batch-dismiss`,{ids:e}),ql=()=>W.post(`/quality/resolve-all`),Jl=e=>W.get(`/quality/${e}/context`),Yl=()=>W.get(`/daemon/status`),Xl=()=>W.post(`/daemon/restart`),Zl=()=>W.get(`/daemon/diagnose`),Ql=()=>W.post(`/daemon/repair`),$l=()=>W.post(`/config/backup`),eu=()=>W.get(`/config/backups`),tu=e=>`/api/config/backups/${encodeURIComponent(e)}`,nu=e=>W.post(`/events/purge`,{retentionDays:e}),ru=e=>W.get(`/stats/api-usage`,{params:{days:e}}),iu=e=>W.get(`/skills`,{params:e}),au=()=>W.get(`/skills/status`),ou=e=>W.get(`/skills/${encodeURIComponent(e)}`),su=(e,t)=>W.post(`/skills/search`,{query:e,...t},{timeout:3e4}),cu=e=>W.post(`/skills/install`,{url:e},{timeout:6e4}),lu=e=>W.delete(`/skills/${encodeURIComponent(e)}`),uu=e=>W.post(`/skills/batch-delete`,{names:e}),du=()=>W.post(`/skills/evolve`,{},{timeout:12e4}),fu=()=>W.post(`/skills/distill`,{},{timeout:12e4}),pu=()=>W.post(`/skills/repair`,{},{timeout:6e4}),mu=()=>W.get(`/conventions`),hu=e=>W.get(`/conventions/${encodeURIComponent(e)}`),gu=()=>W.post(`/conventions/sync-official`),_u=e=>W.post(`/conventions/install`,{url:e},{timeout:3e4}),vu=e=>W.delete(`/conventions/${encodeURIComponent(e)}`),yu=()=>W.get(`/conventions/usage-stats`),bu=e=>W.get(`/conventions/${encodeURIComponent(e)}/evolution-history`),xu=e=>W.post(`/conventions/batch-evolve`,{conventionIds:e},{timeout:12e4}),Su=e=>W.get(`/conventions/${encodeURIComponent(e)}/yaml`),Cu=(e,t)=>W.put(`/conventions/${encodeURIComponent(e)}/yaml`,{yaml:t}),wu=e=>W.get(`/node-types`,{params:e?{projectPath:e}:void 0}),Tu=e=>W.get(`/node-types/${encodeURIComponent(e)}`);function Eu(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=Eu(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Du(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Eu(e))&&(r&&(r+=` `),r+=t);return r}var Ou=(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},ku=(e,t)=>({classGroupId:e,validator:t}),Au=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ju=`-`,Mu=[],Nu=`arbitrary..`,Pu=e=>{let t=Lu(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Iu(e);let n=e.split(ju);return Fu(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ou(i,t):t:i||Mu}return n[e]||Mu}}},Fu=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Fu(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ju):e.slice(t).join(ju),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Iu=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?Nu+r:void 0})(),Lu=e=>{let{theme:t,classGroups:n}=e;return Ru(n,t)},Ru=(e,t)=>{let n=Au();for(let r in e){let i=e[r];zu(i,n,r,t)}return n},zu=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Bu(i,t,n,r)}},Bu=(e,t,n,r)=>{if(typeof e==`string`){Vu(e,t,n);return}if(typeof e==`function`){Hu(e,t,n,r);return}Uu(e,t,n,r)},Vu=(e,t,n)=>{let r=e===``?t:Wu(t,e);r.classGroupId=n},Hu=(e,t,n,r)=>{if(Gu(e)){zu(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ku(n,e))},Uu=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];zu(o,Wu(t,a),n,r)}},Wu=(e,t)=>{let n=e,r=t.split(ju),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Au(),n.nextPart.set(t,i)),n=i}return n},Gu=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Ku=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)}}},qu=`!`,Ju=`:`,Yu=[],Xu=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Zu=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===Ju){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(qu)?(c=s.slice(0,-1),l=!0):s.startsWith(qu)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Xu(t,l,c,u)};if(t){let e=t+Ju,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Xu(Yu,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Qu=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}},$u=e=>({cache:Ku(e.cacheSize),parseClassName:Zu(e),sortModifiers:Qu(e),...Pu(e)}),ed=/\s+/,td=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(ed),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+qu: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},nd=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=rd(n))&&(i&&(i+=` `),i+=r);return i},rd=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=rd(e[r]))&&(n&&(n+=` `),n+=t);return n},id=(e,...t)=>{let n,r,i,a,o=o=>(n=$u(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=td(e,n);return i(e,a),a};return a=o,(...e)=>a(nd(...e))},ad=[],od=e=>{let t=t=>t[e]||ad;return t.isThemeGetter=!0,t},sd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,cd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ld=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ud=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dd=/\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$/,fd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,md=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hd=e=>ld.test(e),gd=e=>!!e&&!Number.isNaN(Number(e)),_d=e=>!!e&&Number.isInteger(Number(e)),vd=e=>e.endsWith(`%`)&&gd(e.slice(0,-1)),yd=e=>ud.test(e),bd=()=>!0,xd=e=>dd.test(e)&&!fd.test(e),Sd=()=>!1,Cd=e=>pd.test(e),wd=e=>md.test(e),Td=e=>!G(e)&&!K(e),Ed=e=>Vd(e,Gd,Sd),G=e=>sd.test(e),Dd=e=>Vd(e,Kd,xd),Od=e=>Vd(e,qd,gd),kd=e=>Vd(e,Yd,bd),Ad=e=>Vd(e,Jd,Sd),jd=e=>Vd(e,Ud,Sd),Md=e=>Vd(e,Wd,wd),Nd=e=>Vd(e,Xd,Cd),K=e=>cd.test(e),Pd=e=>Hd(e,Kd),Fd=e=>Hd(e,Jd),Id=e=>Hd(e,Ud),Ld=e=>Hd(e,Gd),Rd=e=>Hd(e,Wd),zd=e=>Hd(e,Xd,!0),Bd=e=>Hd(e,Yd,!0),Vd=(e,t,n)=>{let r=sd.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Hd=(e,t,n=!1)=>{let r=cd.exec(e);return r?r[1]?t(r[1]):n:!1},Ud=e=>e===`position`||e===`percentage`,Wd=e=>e===`image`||e===`url`,Gd=e=>e===`length`||e===`size`||e===`bg-size`,Kd=e=>e===`length`,qd=e=>e===`number`,Jd=e=>e===`family-name`,Yd=e=>e===`number`||e===`weight`,Xd=e=>e===`shadow`,Zd=id(()=>{let e=od(`color`),t=od(`font`),n=od(`text`),r=od(`font-weight`),i=od(`tracking`),a=od(`leading`),o=od(`breakpoint`),s=od(`container`),c=od(`spacing`),l=od(`radius`),u=od(`shadow`),d=od(`inset-shadow`),f=od(`text-shadow`),p=od(`drop-shadow`),m=od(`blur`),h=od(`perspective`),g=od(`aspect`),_=od(`ease`),v=od(`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=()=>[hd,`full`,`auto`,...w()],E=()=>[_d,`none`,`subgrid`,K,G],D=()=>[`auto`,{span:[`full`,_d,K,G]},_d,K,G],O=()=>[_d,`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=()=>[hd,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[hd,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],P=()=>[hd,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,K,G],I=()=>[...b(),Id,jd,{position:[K,G]}],te=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,Ld,Ed,{size:[K,G]}],re=()=>[vd,Pd,Dd],L=()=>[``,`none`,`full`,l,K,G],R=()=>[``,gd,Pd,Dd],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=()=>[gd,vd,Id,jd],se=()=>[``,`none`,m,K,G],ce=()=>[`none`,gd,K,G],le=()=>[`none`,gd,K,G],ue=()=>[gd,K,G],de=()=>[hd,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[yd],breakpoint:[yd],color:[bd],container:[yd],"drop-shadow":[yd],ease:[`in`,`out`,`in-out`],font:[Td],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[yd],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[yd],shadow:[yd],spacing:[`px`,gd],text:[yd],"text-shadow":[yd],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,hd,G,K,g]}],container:[`container`],columns:[{columns:[gd,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:[_d,`auto`,K,G]}],basis:[{basis:[hd,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[gd,hd,`auto`,`initial`,`none`,G]}],grow:[{grow:[``,gd,K,G]}],shrink:[{shrink:[``,gd,K,G]}],order:[{order:[_d,`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,Pd,Dd]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Bd,kd]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,vd,G]}],"font-family":[{font:[Fd,Ad,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":[gd,`none`,K,Od]}],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:[gd,`from-font`,`auto`,K,Dd]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[gd,`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:te()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},_d,K,G],radial:[``,K,G],conic:[_d,K,G]},Rd,Md]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"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":[gd,K,G]}],"outline-w":[{outline:[``,gd,Pd,Dd]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,zd,Nd]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,zd,Nd]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[gd,Dd]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,zd,Nd]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[gd,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":[gd]}],"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":[gd]}],"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:te()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,K,G]}],filter:[{filter:[``,`none`,K,G]}],blur:[{blur:se()}],brightness:[{brightness:[gd,K,G]}],contrast:[{contrast:[gd,K,G]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,zd,Nd]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,gd,K,G]}],"hue-rotate":[{"hue-rotate":[gd,K,G]}],invert:[{invert:[``,gd,K,G]}],saturate:[{saturate:[gd,K,G]}],sepia:[{sepia:[``,gd,K,G]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,K,G]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[gd,K,G]}],"backdrop-contrast":[{"backdrop-contrast":[gd,K,G]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,gd,K,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[gd,K,G]}],"backdrop-invert":[{"backdrop-invert":[``,gd,K,G]}],"backdrop-opacity":[{"backdrop-opacity":[gd,K,G]}],"backdrop-saturate":[{"backdrop-saturate":[gd,K,G]}],"backdrop-sepia":[{"backdrop-sepia":[``,gd,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:[gd,`initial`,K,G]}],ease:[{ease:[`linear`,`initial`,_,K,G]}],delay:[{delay:[gd,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:[gd,Pd,Dd,Od]}],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 q(...e){return Zd(Du(e))}function Qd(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 $d(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function ef(e){let t={active:`text-green-600 bg-green-50`,completed:`text-blue-600 bg-blue-50`,failed:`text-red-600 bg-red-50`,interrupted:`text-yellow-600 bg-yellow-50`,pending:`text-gray-600 bg-gray-50`};return t[e]||t.pending}function tf(e){return e?e.endsWith(`Z`)||/[+-]\d{2}:\d{2}$/.test(e)?new Date(e):new Date(e+`Z`):new Date}var nf=[{path:`/dashboard`,label:`仪表盘`,icon:fc},{path:`/projects`,label:`项目管理`,icon:oc},{path:`/sessions`,label:`会话管理`,icon:Ts},{path:`/events`,label:`事件流`,icon:Ps},{path:`/pipelines`,label:`流水线`,icon:cc},{path:`/quality`,label:`质量门禁`,icon:Ac},{path:`/knowledge`,label:`知识图谱`,icon:Ns},{path:`/skills`,label:`技能管理`,icon:yc},{path:`/conventions`,label:`规范管理`,icon:As},{path:`/node-types`,label:`节点类型`,icon:Ms},{path:`/analytics`,label:`数据分析`,icon:Fs},{path:`/config`,label:`系统配置`,icon:kc}];function rf({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:()=>$c().then(e=>e.data),refetchInterval:15e3}),a=nf.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:q(`fixed top-0 left-0 bottom-0 z-50 flex flex-col transition-all duration-300`,`bg-gradient-to-b from-slate-900 to-slate-800`,t?`w-16`:`w-60`),children:[(0,B.jsxs)(`div`,{className:q(`flex items-center border-b border-white/10 h-16`,t?`justify-center px-2`:`justify-between px-5`),children:[!t&&(0,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)(Kc,{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)(gc,{className:`h-5 w-5`}):(0,B.jsx)(zs,{className:`h-5 w-5`})})]}),(0,B.jsx)(`nav`,{className:`flex-1 py-4 space-y-1 px-2`,children:nf.map(e=>(0,B.jsxs)(ei,{to:e.path,className:({isActive:e})=>q(`flex items-center gap-3 rounded-lg transition-all duration-200`,t?`justify-center p-3`:`px-3 py-2.5`,e?`bg-blue-600/20 text-blue-400`:`text-white/60 hover:text-white hover:bg-white/5`),children:[(0,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:q(`border-t border-white/10 py-4`,t?`px-2`:`px-5`),children:(0,B.jsxs)(`div`,{className:q(`flex items-center gap-2`,t?`justify-center`:``),children:[(0,B.jsx)(`div`,{className:q(`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:q(`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)(Js,{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.76.0`]}),(0,B.jsxs)(`div`,{className:q(`flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold`,i?.status===`ok`?`bg-green-50 text-green-700 border border-green-200`:`bg-red-50 text-red-700 border border-red-200`),children:[(0,B.jsx)(`div`,{className:q(`w-1.5 h-1.5 rounded-full`,i?.status===`ok`?`bg-green-500`:`bg-red-500`)}),i?.status===`ok`?`在线`:`离线`]})]})]}),(0,B.jsx)(`div`,{className:`p-8 overflow-x-hidden`,children:e})]})]})}var af=(0,z.createContext)({});function of(e){let t=(0,z.useRef)(null);return t.current===null&&(t.current=e()),t.current}var sf=typeof window<`u`?z.useLayoutEffect:z.useEffect,cf=(0,z.createContext)(null);function lf(e,t){e.indexOf(t)===-1&&e.push(t)}function uf(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var df=(e,t,n)=>n>t?t:n<e?e:n,ff={},pf=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function mf(e){return typeof e==`object`&&!!e}var hf=e=>/^0[^.\s]+$/u.test(e);function gf(e){let t;return()=>(t===void 0&&(t=e()),t)}var _f=e=>e,vf=(e,t)=>n=>t(e(n)),yf=(...e)=>e.reduce(vf),bf=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},xf=class{constructor(){this.subscriptions=[]}add(e){return lf(this.subscriptions,e),()=>uf(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}},Sf=e=>e*1e3,Cf=e=>e/1e3;function wf(e,t){return t?1e3/t*e:0}var Tf=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Ef=1e-7,Df=12;function Of(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Tf(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Ef&&++s<Df);return o}function kf(e,t,n,r){if(e===t&&n===r)return _f;let i=t=>Of(t,0,1,e,n);return e=>e===0||e===1?e:Tf(i(e),t,r)}var Af=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,jf=e=>t=>1-e(1-t),Mf=kf(.33,1.53,.69,.99),Nf=jf(Mf),Pf=Af(Nf),Ff=e=>e>=1?1:(e*=2)<1?.5*Nf(e):.5*(2-2**(-10*(e-1))),If=e=>1-Math.sin(Math.acos(e)),Lf=jf(If),Rf=Af(If),zf=kf(.42,0,1,1),Bf=kf(0,0,.58,1),Vf=kf(.42,0,.58,1),Hf=e=>Array.isArray(e)&&typeof e[0]!=`number`,Uf=e=>Array.isArray(e)&&typeof e[0]==`number`,Wf={linear:_f,easeIn:zf,easeInOut:Vf,easeOut:Bf,circIn:If,circInOut:Rf,circOut:Lf,backIn:Nf,backInOut:Pf,backOut:Mf,anticipate:Ff},Gf=e=>typeof e==`string`,Kf=e=>{if(Uf(e)){e.length;let[t,n,r,i]=e;return kf(t,n,r,i)}else if(Gf(e))return Wf[e],`${e}`,Wf[e];return e},qf=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Jf={value:null,addProjectionMetrics:null};function Yf(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&&Jf.value&&Jf.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Xf=40;function Zf(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=qf.reduce((e,n)=>(e[n]=Yf(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=ff.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Xf),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:qf.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<qf.length;t++)o[qf[t]].cancel(e)},state:i,steps:o}}var{schedule:Qf,cancel:$f,state:ep,steps:tp}=Zf(typeof requestAnimationFrame<`u`?requestAnimationFrame:_f,!0),np;function rp(){np=void 0}var ip={now:()=>(np===void 0&&ip.set(ep.isProcessing||ff.useManualTiming?ep.timestamp:performance.now()),np),set:e=>{np=e,queueMicrotask(rp)}},ap={layout:0,mainThread:0,waapi:0},op=e=>t=>typeof t==`string`&&t.startsWith(e),sp=op(`--`),cp=op(`var(--`),lp=e=>cp(e)?up.test(e.split(`/*`)[0].trim()):!1,up=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function dp(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var fp={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},pp={...fp,transform:e=>df(0,1,e)},mp={...fp,default:1},hp=e=>Math.round(e*1e5)/1e5,gp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function _p(e){return e==null}var vp=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,yp=(e,t)=>n=>!!(typeof n==`string`&&vp.test(n)&&n.startsWith(e)||t&&!_p(n)&&Object.prototype.hasOwnProperty.call(n,t)),bp=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(gp);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},xp=e=>df(0,255,e),Sp={...fp,transform:e=>Math.round(xp(e))},Cp={test:yp(`rgb`,`red`),parse:bp(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Sp.transform(e)+`, `+Sp.transform(t)+`, `+Sp.transform(n)+`, `+hp(pp.transform(r))+`)`};function wp(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 Tp={test:yp(`#`),parse:wp,transform:Cp.transform},Ep=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Dp=Ep(`deg`),Op=Ep(`%`),J=Ep(`px`),kp=Ep(`vh`),Ap=Ep(`vw`),jp={...Op,parse:e=>Op.parse(e)/100,transform:e=>Op.transform(e*100)},Mp={test:yp(`hsl`,`hue`),parse:bp(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Op.transform(hp(t))+`, `+Op.transform(hp(n))+`, `+hp(pp.transform(r))+`)`},Np={test:e=>Cp.test(e)||Tp.test(e)||Mp.test(e),parse:e=>Cp.test(e)?Cp.parse(e):Mp.test(e)?Mp.parse(e):Tp.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Cp.transform(e):Mp.transform(e),getAnimatableNone:e=>{let t=Np.parse(e);return t.alpha=0,Np.transform(t)}},Pp=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Fp(e){return isNaN(e)&&typeof e==`string`&&(e.match(gp)?.length||0)+(e.match(Pp)?.length||0)>0}var Ip=`number`,Lp=`color`,Rp=`var`,zp=`var(`,Bp="${}",Vp=/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 Hp(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Vp,e=>(Np.test(e)?(r.color.push(a),i.push(Lp),n.push(Np.parse(e))):e.startsWith(zp)?(r.var.push(a),i.push(Rp),n.push(e)):(r.number.push(a),i.push(Ip),n.push(parseFloat(e))),++a,Bp)).split(Bp),indexes:r,types:i}}function Up(e){return Hp(e).values}function Wp({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===Ip?i+=hp(r[a]):e===Lp?i+=Np.transform(r[a]):i+=r[a]}return i}}function eee(e){return Wp(Hp(e))}var tee=e=>typeof e==`number`?0:Np.test(e)?Np.getAnimatableNone(e):e,Gp=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:tee(e);function Kp(e){let t=Hp(e);return Wp(t)(t.values.map((e,n)=>Gp(e,t.split[n])))}var qp={test:Fp,parse:Up,createTransformer:eee,getAnimatableNone:Kp};function Jp(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 Yp({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=Jp(s,r,e+1/3),a=Jp(s,r,e),o=Jp(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Xp(e,t){return n=>n>0?t:e}var Zp=(e,t,n)=>e+(t-e)*n,Qp=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},$p=[Tp,Cp,Mp],em=e=>$p.find(t=>t.test(e));function tm(e){let t=em(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Mp&&(n=Yp(n)),n}var nm=(e,t)=>{let n=tm(e),r=tm(t);if(!n||!r)return Xp(e,t);let i={...n};return e=>(i.red=Qp(n.red,r.red,e),i.green=Qp(n.green,r.green,e),i.blue=Qp(n.blue,r.blue,e),i.alpha=Zp(n.alpha,r.alpha,e),Cp.transform(i))},rm=new Set([`none`,`hidden`]);function im(e,t){return rm.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function am(e,t){return n=>Zp(e,t,n)}function om(e){return typeof e==`number`?am:typeof e==`string`?lp(e)?Xp:Np.test(e)?nm:um:Array.isArray(e)?sm:typeof e==`object`?Np.test(e)?nm:cm:Xp}function sm(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>om(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function cm(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=om(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function lm(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 um=(e,t)=>{let n=qp.createTransformer(t),r=Hp(e),i=Hp(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?rm.has(e)&&!i.values.length||rm.has(t)&&!r.values.length?im(e,t):yf(sm(lm(r,i),i.values),n):(`${e}${t}`,Xp(e,t))};function dm(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Zp(e,t,n):om(e)(e,t)}var fm=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Qf.update(t,e),stop:()=>$f(t),now:()=>ep.isProcessing?ep.timestamp:ip.now()}},pm=(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)})`},mm=2e4;function hm(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 gm(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(hm(r),mm);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Cf(i)}}var _m={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 vm(e,t){return e*Math.sqrt(1-t*t)}var ym=12;function bm(e,t,n){let r=n;for(let n=1;n<ym;n++)r-=e(r)/t(r);return r}var xm=.001;function Sm({duration:e=_m.duration,bounce:t=_m.bounce,velocity:n=_m.velocity,mass:r=_m.mass}){let i,a;_m.maxDuration;let o=1-t;o=df(_m.minDamping,_m.maxDamping,o),e=df(_m.minDuration,_m.maxDuration,Cf(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=vm(t,o),c=Math.exp(-i);return xm-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=vm(t**2,o);return(-i(t)+xm>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-xm+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=bm(i,a,s);if(e=Sf(e),isNaN(c))return{stiffness:_m.stiffness,damping:_m.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Cm=[`duration`,`bounce`],wm=[`stiffness`,`damping`,`mass`];function Tm(e,t){return t.some(t=>e[t]!==void 0)}function Em(e){let t={velocity:_m.velocity,stiffness:_m.stiffness,damping:_m.damping,mass:_m.mass,isResolvedFromDuration:!1,...e};if(!Tm(e,wm)&&Tm(e,Cm))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*df(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:_m.mass,stiffness:i,damping:a}}else{let n=Sm({...e,velocity:0});t={...t,...n,mass:_m.mass},t.isResolvedFromDuration=!0}return t}function Dm(e=_m.visualDuration,t=_m.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}=Em({...n,velocity:-Cf(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Cf(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?_m.restSpeed.granular:_m.restSpeed.default,i||=v?_m.restDelta.granular:_m.restDelta.default;let y,b,x,S,C,w;if(h<1)x=vm(_,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=>Sf(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=Sf(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=Sf(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(hm(T),mm),t=pm(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Dm.applyToOptions=e=>{let t=gm(e,100,Dm);return e.ease=t.ease,e.duration=Sf(t.duration),e.type=`keyframes`,e};var Om=5;function km(e,t,n){let r=Math.max(t-Om,0);return wf(n-e(r),t-r)}function Am({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=Dm({keyframes:[f.value,m(f.value)],velocity:km(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 jm(e,t,n){let r=[],i=n||ff.mix||dm,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=yf(Array.isArray(t)?t[n]||_f:t,a)),r.push(a)}return r}function Mm(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=jm(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=bf(e[r],e[r+1],n);return s[r](i)};return n?t=>l(df(e[0],e[a-1],t)):l}function Nm(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=bf(0,t,r);e.push(Zp(n,1,i))}}function Pm(e){let t=[0];return Nm(t,e.length-1),t}function Fm(e,t){return e.map(e=>e*t)}function Im(e,t){return e.map(()=>t||Vf).splice(0,e.length-1)}function Lm({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Hf(r)?r.map(Kf):Kf(r),a={done:!1,value:t[0]},o=Mm(Fm(n&&n.length===t.length?n:Pm(t),e),t,{ease:Array.isArray(i)?i:Im(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Rm=e=>e!==null;function zm(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Rm),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Bm={decay:Am,inertia:Am,tween:Lm,keyframes:Lm,spring:Dm};function Vm(e){typeof e.type==`string`&&(e.type=Bm[e.type])}var Hm=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)}},Um=e=>e/100,Wm=class extends Hm{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!==ip.now()&&this.tick(ip.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},ap.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Vm(e);let{type:t=Lm,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Lm;s!==Lm&&typeof o[0]!=`number`&&(this.mixKeyframes=yf(Um,dm(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=hm(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=df(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!==Am&&(b.value=zm(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 Cf(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Cf(e)}get time(){return Cf(this.currentTime)}set time(e){e=Sf(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 km(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(ip.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Cf(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=fm,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(ip.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,ap.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function Gm(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Km=e=>e*180/Math.PI,qm=e=>Ym(Km(Math.atan2(e[1],e[0]))),Jm={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:qm,rotateZ:qm,skewX:e=>Km(Math.atan(e[1])),skewY:e=>Km(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ym=e=>(e%=360,e<0&&(e+=360),e),Xm=qm,Zm=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Qm=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),$m={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Zm,scaleY:Qm,scale:e=>(Zm(e)+Qm(e))/2,rotateX:e=>Ym(Km(Math.atan2(e[6],e[5]))),rotateY:e=>Ym(Km(Math.atan2(-e[2],e[0]))),rotateZ:Xm,rotate:Xm,skewX:e=>Km(Math.atan(e[4])),skewY:e=>Km(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function eh(e){return+!!e.includes(`scale`)}function th(e,t){if(!e||e===`none`)return eh(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=$m,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Jm,i=t}if(!i)return eh(t);let a=r[t],o=i[1].split(`,`).map(rh);return typeof a==`function`?a(o):o[a]}var nh=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return th(n,t)};function rh(e){return parseFloat(e.trim())}var ih=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],ah=new Set(ih),oh=e=>e===fp||e===J,sh=new Set([`x`,`y`,`z`]),nee=ih.filter(e=>!sh.has(e));function ch(e){let t=[];return nee.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var lh={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})=>th(t,`x`),y:(e,{transform:t})=>th(t,`y`)};lh.translateX=lh.x,lh.translateY=lh.y;var uh=new Set,dh=!1,fh=!1,ph=!1;function mh(){if(fh){let e=Array.from(uh).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=ch(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)})}fh=!1,dh=!1,uh.forEach(e=>e.complete(ph)),uh.clear()}function hh(){uh.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(fh=!0)})}function gh(){ph=!0,hh(),mh(),ph=!1}var _h=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?(uh.add(this),dh||(dh=!0,Qf.read(hh),Qf.resolveKeyframes(mh))):(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])}Gm(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),uh.delete(this)}cancel(){this.state===`scheduled`&&(uh.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},vh=e=>e.startsWith(`--`);function yh(e,t,n){vh(t)?e.style.setProperty(t,n):e.style[t]=n}var bh={};function xh(e,t){let n=gf(e);return()=>bh[t]??n()}var Sh=xh(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Ch=xh(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),wh=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Th={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:wh([0,.65,.55,1]),circOut:wh([.55,0,1,.45]),backIn:wh([.31,.01,.66,-.59]),backOut:wh([.33,1.53,.69,.99])};function Eh(e,t){if(e)return typeof e==`function`?Ch()?pm(e,t):`ease-out`:Uf(e)?wh(e):Array.isArray(e)?e.map(e=>Eh(e,t)||Th.easeOut):Th[e]}function ree(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=Eh(s,i);Array.isArray(d)&&(u.easing=d),Jf.value&&ap.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return Jf.value&&p.finished.finally(()=>{ap.waapi--}),p}function Dh(e){return typeof e==`function`&&`applyToOptions`in e}function iee({type:e,...t}){return Dh(e)&&Ch()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Oh=class extends Hm{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=iee(e);this.animation=ree(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=zm(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),yh(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 Cf(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Cf(e)}get time(){return Cf(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Sf(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&&Sh()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),_f):r(this)}},kh={anticipate:Ff,backInOut:Pf,circInOut:Rf};function aee(e){return e in kh}function oee(e){typeof e.ease==`string`&&aee(e.ease)&&(e.ease=kh[e.ease])}var Ah=10,see=class extends Oh{constructor(e){oee(e),Vm(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 Wm({...a,autoplay:!1}),s=Math.max(Ah,ip.now()-this.startTime),c=df(0,Ah,s-Ah),l=o.sample(s).value,{name:u}=this.options;i&&u&&yh(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},jh=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(qp.test(e)||e===`0`)&&!e.startsWith(`url(`));function cee(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function lee(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=jh(i,t),s=jh(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:cee(e)||(n===`spring`||Dh(n))&&r}function Mh(e){e.duration=0,e.type=`keyframes`}var Nh=new Set([`opacity`,`clipPath`,`filter`,`transform`]),uee=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function dee(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&uee.test(e[t]))return!0;return!1}var fee=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),pee=gf(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function mee(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return pee()&&n&&(Nh.has(n)||fee.has(n)&&dee(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var hee=40,gee=class extends Hm{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=ip.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||_h)(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=ip.now();let u=!0;lee(e,i,a,o)||(u=!1,(ff.instantAnimations||!s)&&l?.(zm(e,n,t)),e[0]=e[e.length-1],Mh(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>hee?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&mee(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new see({...d,element:p})}catch{m=new Wm(d)}else m=new Wm(d);m.finished.then(()=>{this.notifyFinished()}).catch(_f),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(),gh()),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 Ph(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var _ee=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function vee(e){let t=_ee.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function Fh(e,t,n=1){`${e}`;let[r,i]=vee(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return pf(e)?parseFloat(e):e}return lp(i)?Fh(i,t,n+1):i}var yee={type:`spring`,stiffness:500,damping:25,restSpeed:10},bee=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),xee={type:`keyframes`,duration:.8},See={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Cee=(e,{keyframes:t})=>t.length>2?xee:ah.has(e)?e.startsWith(`scale`)?bee(t[1]):yee:See;function Ih(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:Ih(n,e)}var wee=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function Tee(e){for(let t in e)if(!wee.has(t))return!0;return!1}var Rh=(e,t,n,r={},i,a)=>o=>{let s=Lh(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Sf(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};Tee(s)||Object.assign(u,Cee(e,u)),u.duration&&=Sf(u.duration),u.repeatDelay&&=Sf(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Mh(u),u.delay===0&&(d=!0)),(ff.instantAnimations||ff.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,Mh(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=zm(u.keyframes,s);if(e!==void 0){Qf.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Wm(u):new gee(u)};function zh(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Bh(e,t,n,r){if(typeof t==`function`){let[i,a]=zh(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]=zh(r);t=t(n===void 0?e.custom:n,i,a)}return t}function Vh(e,t,n){let r=e.getProps();return Bh(r,t,n===void 0?r.custom:n,e)}var Hh=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...ih]),Uh=30,Wh=e=>!isNaN(parseFloat(e)),Gh={current:void 0},Kh=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=ip.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=ip.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Wh(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 xf);let n=this.events[e].add(t);return e===`change`?()=>{n(),Qf.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 Gh.current&&Gh.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=ip.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Uh)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Uh);return wf(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 qh(e,t){return new Kh(e,t)}var Jh=e=>Array.isArray(e);function Yh(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,qh(n))}function Xh(e){return Jh(e)?e[e.length-1]||0:e}function Zh(e,t){let{transitionEnd:n={},transition:r={},...i}=Vh(e,t)||{};i={...i,...n};for(let t in i)Yh(e,t,Xh(i[t]))}var Qh=e=>!!(e&&e.getVelocity);function $h(e){return!!(Qh(e)&&e.add)}function eg(e,t){let n=e.getValue(`willChange`);if($h(n))return n.add(t);if(!n&&ff.WillChange){let n=new ff.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function tg(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var ng=`data-`+tg(`framerAppearId`);function rg(e){return e.props[ng]}function ig({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function ag(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?Ih(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&&ig(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){Qf.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=rg(e);if(n){let e=window.MotionHandoffAnimation(n,t,Qf);e!==null&&(o.startTime=e,f=!0)}}eg(e,t);let p=l??e.shouldReduceMotion;r.start(Rh(t,r,i,p&&Hh.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>Qf.update(()=>{o&&Zh(e,o)});u.length?Promise.all(u).then(t):t()}return u}function og(e,t,n={}){let r=Vh(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(ag(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return sg(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 sg(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(og(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Ph(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function cg(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>og(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=og(e,t,n);else{let i=typeof t==`function`?Vh(e,t,n.custom):t;r=Promise.all(ag(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var lg={test:e=>e===`auto`,parse:e=>e},ug=e=>t=>t.test(e),dg=[fp,J,Op,Dp,Ap,kp,lg],fg=e=>dg.find(ug(e));function pg(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||hf(e)}var mg=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function hg(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(gp)||[];if(!r)return e;let i=n.replace(r,``),a=+!!mg.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var gg=/\b([a-z-]*)\(.*?\)/gu,_g={...qp,getAnimatableNone:e=>{let t=e.match(gg);return t?t.map(hg).join(` `):e}},vg={...qp,getAnimatableNone:e=>{let t=qp.parse(e);return qp.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},yg={...fp,transform:Math.round},bg={borderWidth:J,borderTopWidth:J,borderRightWidth:J,borderBottomWidth:J,borderLeftWidth:J,borderRadius:J,borderTopLeftRadius:J,borderTopRightRadius:J,borderBottomRightRadius:J,borderBottomLeftRadius:J,width:J,maxWidth:J,height:J,maxHeight:J,top:J,right:J,bottom:J,left:J,inset:J,insetBlock:J,insetBlockStart:J,insetBlockEnd:J,insetInline:J,insetInlineStart:J,insetInlineEnd:J,padding:J,paddingTop:J,paddingRight:J,paddingBottom:J,paddingLeft:J,paddingBlock:J,paddingBlockStart:J,paddingBlockEnd:J,paddingInline:J,paddingInlineStart:J,paddingInlineEnd:J,margin:J,marginTop:J,marginRight:J,marginBottom:J,marginLeft:J,marginBlock:J,marginBlockStart:J,marginBlockEnd:J,marginInline:J,marginInlineStart:J,marginInlineEnd:J,fontSize:J,backgroundPositionX:J,backgroundPositionY:J,rotate:Dp,rotateX:Dp,rotateY:Dp,rotateZ:Dp,scale:mp,scaleX:mp,scaleY:mp,scaleZ:mp,skew:Dp,skewX:Dp,skewY:Dp,distance:J,translateX:J,translateY:J,translateZ:J,x:J,y:J,z:J,perspective:J,transformPerspective:J,opacity:pp,originX:jp,originY:jp,originZ:J,zIndex:yg,fillOpacity:pp,strokeOpacity:pp,numOctaves:yg},xg={...bg,color:Np,backgroundColor:Np,outlineColor:Np,fill:Np,stroke:Np,borderColor:Np,borderTopColor:Np,borderRightColor:Np,borderBottomColor:Np,borderLeftColor:Np,filter:_g,WebkitFilter:_g,mask:vg,WebkitMask:vg},Sg=e=>xg[e],Cg=new Set([_g,vg]);function wg(e,t){let n=Sg(e);return Cg.has(n)||(n=qp),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Tg=new Set([`auto`,`none`,`0`]);function Eg(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Tg.has(t)&&Hp(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=wg(n,i)}var Dg=class extends _h{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(),lp(r))){let i=Fh(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Hh.has(n)||e.length!==2)return;let[r,i]=e,a=fg(r),o=fg(i);if(dp(r)!==dp(i)&&lh[n]){this.needsMeasurement=!0;return}if(a!==o)if(oh(a)&&oh(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else lh[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||pg(e[t]))&&n.push(t);n.length&&Eg(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=lh[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]=lh[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 Og(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 kg=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ag(e){return mf(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:jg,cancel:Eee}=Zf(queueMicrotask,!1),Mg={x:!1,y:!1};function Ng(){return Mg.x||Mg.y}function Pg(e){return e===`x`||e===`y`?Mg[e]?null:(Mg[e]=!0,()=>{Mg[e]=!1}):Mg.x||Mg.y?null:(Mg.x=Mg.y=!0,()=>{Mg.x=Mg.y=!1})}function Fg(e,t){let n=Og(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Ig(e){return!(e.pointerType===`touch`||Ng())}function Lg(e,t,n={}){let[r,i,a]=Fg(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(!Ig(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 Rg=(e,t)=>t?e===t?!0:Rg(e,t.parentElement):!1,zg=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Bg=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Vg(e){return Bg.has(e.tagName)||e.isContentEditable===!0}var Hg=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function Ug(e){return Hg.has(e.tagName)||e.isContentEditable===!0}var Wg=new WeakSet;function Gg(e){return t=>{t.key===`Enter`&&e(t)}}function Kg(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var qg=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Gg(()=>{if(Wg.has(n))return;Kg(n,`down`);let e=Gg(()=>{Kg(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>Kg(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function Jg(e){return zg(e)&&!Ng()}var Yg=new WeakSet;function Xg(e,t,n={}){let[r,i,a]=Fg(e,n),o=e=>{let r=e.currentTarget;if(!Jg(e)||Yg.has(e))return;Wg.add(r),n.stopPropagation&&Yg.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Wg.has(r)&&Wg.delete(r),Jg(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||Rg(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),Ag(e)&&(e.addEventListener(`focus`,e=>qg(e,i)),!Vg(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Zg(e){return mf(e)&&`ownerSVGElement`in e}var Qg=new WeakMap,$g,e_=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:Zg(r)&&`getBBox`in r?r.getBBox()[t]:r[n],t_=e_(`inline`,`width`,`offsetWidth`),n_=e_(`block`,`height`,`offsetHeight`);function r_({target:e,borderBoxSize:t}){Qg.get(e)?.forEach(n=>{n(e,{get width(){return t_(e,t)},get height(){return n_(e,t)}})})}function i_(e){e.forEach(r_)}function a_(){typeof ResizeObserver>`u`||($g=new ResizeObserver(i_))}function o_(e,t){$g||a_();let n=Og(e);return n.forEach(e=>{let n=Qg.get(e);n||(n=new Set,Qg.set(e,n)),n.add(t),$g?.observe(e)}),()=>{n.forEach(e=>{let n=Qg.get(e);n?.delete(t),n?.size||$g?.unobserve(e)})}}var s_=new Set,c_;function l_(){c_=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};s_.forEach(t=>t(e))},window.addEventListener(`resize`,c_)}function u_(e){return s_.add(e),c_||l_(),()=>{s_.delete(e),!s_.size&&typeof c_==`function`&&(window.removeEventListener(`resize`,c_),c_=void 0)}}function d_(e,t){return typeof e==`function`?u_(e):o_(e,t)}function f_(e){return Zg(e)&&e.tagName===`svg`}var p_=[...dg,Np,qp],m_=e=>p_.find(ug(e)),h_=()=>({translate:0,scale:1,origin:0,originPoint:0}),g_=()=>({x:h_(),y:h_()}),__=()=>({min:0,max:0}),v_=()=>({x:__(),y:__()}),y_=new WeakMap;function b_(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function x_(e){return typeof e==`string`||Array.isArray(e)}var S_=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],C_=[`initial`,...S_];function w_(e){return b_(e.animate)||C_.some(t=>x_(e[t]))}function T_(e){return!!(w_(e)||e.variants)}function E_(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Qh(i))e.addValue(r,i);else if(Qh(a))e.addValue(r,qh(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,qh(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var D_={current:null},O_={current:!1},k_=typeof window<`u`;function A_(){if(O_.current=!0,k_)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>D_.current=e.matches;e.addEventListener(`change`,t),t()}else D_.current=!1}var j_=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],M_={};function N_(e){M_=e}function P_(){return M_}var F_=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=_h,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=ip.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Qf.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=w_(t),this.isVariantNode=T_(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&&Qh(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,y_.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:(O_.current||A_(),this.shouldReduceMotion=D_.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(),$f(this.notifyUpdate),$f(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&&Nh.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Oh({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Sf(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=ah.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Qf.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 M_){let t=M_[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):v_()}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<j_.length;t++){let n=j_[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=E_(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=qh(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`&&(pf(n)||hf(n))?n=parseFloat(n):!m_(n)&&qp.test(t)&&(n=wg(e,t)),this.setBaseTarget(e,Qh(n)?n.get():n)),Qh(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=Bh(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&&!Qh(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 xf),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){jg.render(this.render)}},I_=class extends F_{constructor(){super(...arguments),this.KeyframeResolver=Dg}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;Qh(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},L_=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function R_({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function z_({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function B_(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 V_(e){return e===void 0||e===1}function H_({scale:e,scaleX:t,scaleY:n}){return!V_(e)||!V_(t)||!V_(n)}function U_(e){return H_(e)||W_(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function W_(e){return G_(e.x)||G_(e.y)}function G_(e){return e&&e!==`0%`}function K_(e,t,n){return n+t*(e-n)}function q_(e,t,n,r,i){return i!==void 0&&(e=K_(e,i,r)),K_(e,n,r)+t}function J_(e,t=0,n=1,r,i){e.min=q_(e.min,t,n,r,i),e.max=q_(e.max,t,n,r,i)}function Y_(e,{x:t,y:n}){J_(e.x,t.translate,t.scale,t.originPoint),J_(e.y,n.translate,n.scale,n.originPoint)}var X_=.999999999999,Z_=1.0000000000001;function Q_(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&&($_(e.x,-a.scroll.offset.x),$_(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Y_(e,o)),r&&U_(a.latestValues)&&nv(e,a.latestValues,a.layout?.layoutBox))}t.x<Z_&&t.x>X_&&(t.x=1),t.y<Z_&&t.y>X_&&(t.y=1)}function $_(e,t){e.min+=t,e.max+=t}function ev(e,t,n,r,i=.5){J_(e,t,n,Zp(e.min,e.max,i),r)}function tv(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function nv(e,t,n){let r=n??e;ev(e.x,tv(t.x,r.x),t.scaleX,t.scale,t.originX),ev(e.y,tv(t.y,r.y),t.scaleY,t.scale,t.originY)}function rv(e,t){return R_(B_(e.getBoundingClientRect(),t))}function iv(e,t,n){let r=rv(e,n),{scroll:i}=t;return i&&($_(r.x,i.offset.x),$_(r.y,i.offset.y)),r}var av={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},ov=ih.length;function sv(e,t,n){let r=``,i=!0;for(let a=0;a<ov;a++){let o=ih[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=kg(s,bg[o]);if(!c){i=!1;let t=av[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function cv(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(ah.has(e)){o=!0;continue}else if(sp(e)){i[e]=n;continue}else{let t=kg(n,bg[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=sv(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 lv(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 uv(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var dv={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(J.test(e))e=parseFloat(e);else return e;return`${uv(e,t.target.x)}% ${uv(e,t.target.y)}%`}},fv={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=qp.parse(e);if(i.length>5)return r;let a=qp.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=Zp(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},pv={borderRadius:{...dv,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:dv,borderTopRightRadius:dv,borderBottomLeftRadius:dv,borderBottomRightRadius:dv,boxShadow:fv};function mv(e,{layout:t,layoutId:n}){return ah.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!pv[e]||e===`opacity`)}function hv(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Qh(r[t])||i&&Qh(i[t])||mv(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function gv(e){return window.getComputedStyle(e)}var _v=class extends I_{constructor(){super(...arguments),this.type=`html`,this.renderInstance=lv}readValueFromInstance(e,t){if(ah.has(t))return this.projection?.isProjecting?eh(t):nh(e,t);{let n=gv(e),r=(sp(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return rv(e,t)}build(e,t,n){cv(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return hv(e,t,n)}},vv={offset:`stroke-dashoffset`,array:`stroke-dasharray`},yv={offset:`strokeDashoffset`,array:`strokeDasharray`};function bv(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?vv:yv;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var xv=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Sv(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(cv(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 xv)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&&bv(d,i,a,o,!1)}var Cv=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`]),wv=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Dee(e,t,n,r){lv(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Cv.has(n)?n:tg(n),t.attrs[n])}function Tv(e,t,n){let r=hv(e,t,n);for(let n in e)if(Qh(e[n])||Qh(t[n])){let t=ih.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Oee=class extends I_{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=v_}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(ah.has(t)){let e=Sg(t);return e&&e.default||0}return t=Cv.has(t)?t:tg(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Tv(e,t,n)}build(e,t,n){Sv(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Dee(e,t,n,r)}mount(e){this.isSVGTag=wv(e.tagName),super.mount(e)}},kee=C_.length;function Ev(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Ev(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<kee;n++){let r=C_[n],i=e.props[r];(x_(i)||i===!1)&&(t[r]=i)}return t}function Dv(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 Aee=[...S_].reverse(),jee=S_.length;function Mee(e){return t=>Promise.all(t.map(({animation:t,options:n})=>cg(e,t,n)))}function Nee(e){let t=Mee(e),n=kv(),r=!0,i=!1,a=t=>(n,r)=>{let i=Vh(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=Ev(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<jee;t++){let p=Aee[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=x_(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||b_(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=Pee(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=Jh(t)&&Jh(n)?!Dv(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=Vh(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Ph(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=Vh(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=kv(),i=!0}}}function Pee(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Dv(t,e):!1}function Ov(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function kv(){return{animate:Ov(!0),whileInView:Ov(),whileHover:Ov(),whileTap:Ov(),whileDrag:Ov(),whileFocus:Ov(),exit:Ov()}}function Av(e,t){e.min=t.min,e.max=t.max}function jv(e,t){Av(e.x,t.x),Av(e.y,t.y)}function Mv(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Nv=1e-4,Fee=1-Nv,Iee=1+Nv,Pv=.01,Lee=0-Pv,Ree=0+Pv;function Fv(e){return e.max-e.min}function zee(e,t,n){return Math.abs(e-t)<=n}function Iv(e,t,n,r=.5){e.origin=r,e.originPoint=Zp(t.min,t.max,e.origin),e.scale=Fv(n)/Fv(t),e.translate=Zp(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Fee&&e.scale<=Iee||isNaN(e.scale))&&(e.scale=1),(e.translate>=Lee&&e.translate<=Ree||isNaN(e.translate))&&(e.translate=0)}function Lv(e,t,n,r){Iv(e.x,t.x,n.x,r?r.originX:void 0),Iv(e.y,t.y,n.y,r?r.originY:void 0)}function Rv(e,t,n,r=0){e.min=(r?Zp(n.min,n.max,r):n.min)+t.min,e.max=e.min+Fv(t)}function Bee(e,t,n,r){Rv(e.x,t.x,n.x,r?.x),Rv(e.y,t.y,n.y,r?.y)}function zv(e,t,n,r=0){let i=r?Zp(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Fv(t)}function Bv(e,t,n,r){zv(e.x,t.x,n.x,r?.x),zv(e.y,t.y,n.y,r?.y)}function Vv(e,t,n,r,i){return e-=t,e=K_(e,1/n,r),i!==void 0&&(e=K_(e,1/i,r)),e}function Vee(e,t=0,n=1,r=.5,i,a=e,o=e){if(Op.test(t)&&(t=parseFloat(t),t=Zp(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=Zp(a.min,a.max,r);e===a&&(s-=t),e.min=Vv(e.min,t,n,s,i),e.max=Vv(e.max,t,n,s,i)}function Hv(e,t,[n,r,i],a,o){Vee(e,t[n],t[r],t[i],t.scale,a,o)}var Hee=[`x`,`scaleX`,`originX`],Uee=[`y`,`scaleY`,`originY`];function Uv(e,t,n,r){Hv(e.x,t,Hee,n?n.x:void 0,r?r.x:void 0),Hv(e.y,t,Uee,n?n.y:void 0,r?r.y:void 0)}function Wv(e){return e.translate===0&&e.scale===1}function Gv(e){return Wv(e.x)&&Wv(e.y)}function Kv(e,t){return e.min===t.min&&e.max===t.max}function Wee(e,t){return Kv(e.x,t.x)&&Kv(e.y,t.y)}function qv(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Jv(e,t){return qv(e.x,t.x)&&qv(e.y,t.y)}function Yv(e){return Fv(e.x)/Fv(e.y)}function Xv(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Zv(e){return[e(`x`),e(`y`)]}function Gee(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 Qv=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],Kee=Qv.length,$v=e=>typeof e==`string`?parseFloat(e):e,ey=e=>typeof e==`number`||J.test(e);function qee(e,t,n,r,i,a){i?(e.opacity=Zp(0,n.opacity??1,Jee(r)),e.opacityExit=Zp(t.opacity??1,0,Yee(r))):a&&(e.opacity=Zp(t.opacity??1,n.opacity??1,r));for(let i=0;i<Kee;i++){let a=Qv[i],o=ty(t,a),s=ty(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||ey(o)===ey(s)?(e[a]=Math.max(Zp($v(o),$v(s),r),0),(Op.test(s)||Op.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=Zp(t.rotate||0,n.rotate||0,r))}function ty(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Jee=ny(0,.5,Lf),Yee=ny(.5,.95,_f);function ny(e,t,n){return r=>r<e?0:r>t?1:n(bf(e,t,r))}function Xee(e,t,n){let r=Qh(e)?e:qh(e);return r.start(Rh(``,r,t,n)),r.animation}function ry(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var Zee=(e,t)=>e.depth-t.depth,Qee=class{constructor(){this.children=[],this.isDirty=!1}add(e){lf(this.children,e),this.isDirty=!0}remove(e){uf(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Zee),this.isDirty=!1,this.children.forEach(e)}};function $ee(e,t){let n=ip.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&($f(r),e(a-t))};return Qf.setup(r,!0),()=>$f(r)}function iy(e){return Qh(e)?e.get():e}var ete=class{constructor(){this.members=[]}add(e){lf(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&&(uf(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(uf(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)}},ay={hasAnimatedSinceResize:!0,hasEverUpdated:!1},oy={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},sy=[``,`X`,`Y`,`Z`],tte=1e3,nte=0;function cy(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function ly(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=rg(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Qf,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&ly(r)}function uy({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=nte++,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,Jf.value&&(oy.nodes=oy.calculatedTargetDeltas=oy.calculatedProjections=0),this.nodes.forEach(ate),this.nodes.forEach(lte),this.nodes.forEach(gy),this.nodes.forEach(ote),Jf.addProjectionMetrics&&Jf.addProjectionMetrics(oy)},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 Qee)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new xf),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=Zg(t)&&!f_(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;Qf.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=$ee(i,250),ay.hasAnimatedSinceResize&&(ay.hasAnimatedSinceResize=!1,this.nodes.forEach(hy)))})}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()||ute,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Jv(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||hy(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(),$f(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(_y),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&&ly(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(cte),this.nodes.forEach(dy);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(fy);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(py),this.nodes.forEach(my),this.nodes.forEach(rte),this.nodes.forEach(ite)):this.nodes.forEach(fy),this.clearAllSnapshots();let e=ip.now();ep.delta=df(0,1e3/60,e-ep.timestamp),ep.timestamp=e,ep.isProcessing=!0,tp.update.process(ep),tp.preRender.process(ep),tp.render.process(ep),ep.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,jg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ste),this.sharedNodes.forEach(vy)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Qf.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Qf.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Fv(this.snapshot.measuredBox.x)&&!Fv(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||=v_(),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&&!Gv(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||U_(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)),Ey(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return v_();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Oy))){let{scroll:e}=this.root;e&&($_(t.x,e.offset.x),$_(t.y,e.offset.y))}return t}removeElementScroll(e){let t=v_();if(jv(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&&jv(t,e),$_(t.x,i.offset.x),$_(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||v_();jv(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&&($_(r.x,-n.scroll.offset.x),$_(r.y,-n.scroll.offset.y)),U_(n.latestValues)&&nv(r,n.latestValues,n.layout?.layoutBox)}return U_(this.latestValues)&&nv(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=v_();jv(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!U_(n.latestValues))continue;let r;n.instance&&(H_(n.latestValues)&&n.updateSnapshot(),r=v_(),jv(r,n.measurePageBox())),Uv(t,n.latestValues,n.snapshot?.layoutBox,r)}return U_(this.latestValues)&&Uv(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!==ep.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=ep.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=v_(),this.targetWithTransforms=v_()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Bee(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):jv(this.target,this.layout.layoutBox),Y_(this.target,this.targetDelta)):jv(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),Jf.value&&oy.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||H_(this.parent.latestValues)||W_(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=v_(),this.relativeTargetOrigin=v_(),Bv(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),jv(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===ep.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;jv(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Q_(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=v_());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Mv(this.prevProjectionDelta.x,this.projectionDelta.x),Mv(this.prevProjectionDelta.y,this.projectionDelta.y)),Lv(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Xv(this.projectionDelta.x,this.prevProjectionDelta.x)||!Xv(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Jf.value&&oy.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=g_(),this.projectionDelta=g_(),this.projectionDeltaWithTransform=g_()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=g_();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=v_(),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(Sy));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;yy(a.x,e.x,n),yy(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Bv(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),xy(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&Wee(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=v_(),jv(d,this.relativeTarget)),s&&(this.animationValues=i,qee(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&&=($f(this.pendingAnimation),void 0),this.pendingAnimation=Qf.update(()=>{ay.hasAnimatedSinceResize=!0,ap.layout++,this.motionValue||=qh(0),this.motionValue.jump(0,!1),this.currentAnimation=Xee(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{ap.layout--},onComplete:()=>{ap.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(tte),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&&Dy(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||v_();let t=Fv(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=Fv(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}jv(t,n),nv(t,i),Lv(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new ete),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&&cy(`z`,e,r,this.animationValues);for(let t=0;t<sy.length;t++)cy(`rotate${sy[t]}`,e,r,this.animationValues),cy(`skew${sy[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=iy(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=iy(t?.pointerEvents)||``),this.hasProjected&&!U_(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Gee(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 pv){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=pv[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?iy(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(dy),this.root.sharedNodes.clear()}}}function rte(e){e.updateLayout()}function ite(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`)Zv(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=Fv(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Av(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else Dy(i,t.layoutBox,n)&&Zv(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=Fv(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=g_();Lv(o,n,t.layoutBox);let s=g_();a?Lv(s,e.applyTransform(r,!0),t.measuredBox):Lv(s,n,t.layoutBox);let c=!Gv(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=v_();Bv(s,t.layoutBox,i.layoutBox,o);let c=v_();Bv(c,n,a.layoutBox,o),Jv(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 ate(e){Jf.value&&oy.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 ote(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ste(e){e.clearSnapshot()}function dy(e){e.clearMeasurements()}function cte(e){e.isLayoutDirty=!0,e.updateLayout()}function fy(e){e.isLayoutDirty=!1}function py(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function my(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function hy(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function lte(e){e.resolveTargetDelta()}function gy(e){e.calcProjection()}function _y(e){e.resetSkewAndRotation()}function vy(e){e.removeLeadSnapshot()}function yy(e,t,n){e.translate=Zp(t.translate,0,n),e.scale=Zp(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function by(e,t,n,r){e.min=Zp(t.min,n.min,r),e.max=Zp(t.max,n.max,r)}function xy(e,t,n,r){by(e.x,t.x,n.x,r),by(e.y,t.y,n.y,r)}function Sy(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var ute={duration:.45,ease:[.4,0,.1,1]},Cy=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),wy=Cy(`applewebkit/`)&&!Cy(`chrome/`)?Math.round:_f;function Ty(e){e.min=wy(e.min),e.max=wy(e.max)}function Ey(e){Ty(e.x),Ty(e.y)}function Dy(e,t,n){return e===`position`||e===`preserve-aspect`&&!zee(Yv(t),Yv(n),.2)}function Oy(e){return e!==e.root&&e.scroll?.wasRoot}var ky=uy({attachResizeListener:(e,t)=>ry(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Ay={current:void 0},jy=uy({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Ay.current){let e=new ky({});e.mount(window),e.setOptions({layoutScroll:!0}),Ay.current=e}return Ay.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),My=(0,z.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Ny(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Py(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ny(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():Ny(e[t],null)}}}}function Fy(...e){return z.useCallback(Py(...e),e)}var Iy=class extends z.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(Ag(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Ag(e)&&e.offsetWidth||0,r=Ag(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 Ly({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)(My),u=Fy(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;
|
|
@@ -67,10 +67,10 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
67
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 R4(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var z4=(e,t)=>Math.abs(e-t)<1.01,B4=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},V4=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},H4=e=>e,U4=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},W4=(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(V4(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(V4(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},G4={passive:!0},K4=typeof window>`u`?!0:`onscrollend`in window,q4=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&K4?()=>void 0:B4(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,G4);let l=e.options.useScrollendEvent&&K4;return l&&n.addEventListener(`scrollend`,c,G4),()=>{n.removeEventListener(`scroll`,s),l&&n.removeEventListener(`scrollend`,c)}},J4=(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})},X4=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:H4,rangeExtractor:U4,onChange:()=>{},measureElement:J4,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=L4(()=>(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=L4(()=>[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=L4(()=>[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=L4(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?Q4({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=L4(()=>{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=L4(()=>[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 R4(t[Z4(0,t.length-1,e=>R4(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&&z4(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()}},Z4=(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 Q4({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=Z4(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 $4=typeof document<`u`?z.useLayoutEffect:z.useEffect;function e3({useFlushSync:e=!0,...t}){let n=z.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,Jc.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=z.useState(()=>new X4(r));return i.setOptions(r),$4(()=>i._didMount(),[]),$4(()=>i._willUpdate()),i}function t3(e){return e3({observeElementRect:W4,observeElementOffset:q4,scrollToFn:Y4,...e})}var n3={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 r3(e){if(!e)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function i3(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 a3(){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:T4(D4(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:()=>sl({limit:t,tool_name:r||void 0,start_time:w,search:p||void 0}).then(e=>e.data)}),k=lt({mutationFn:e=>nu(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,r3(e.tool_input),r3(e.tool_output)].join(` `).toLowerCase().includes(d.toLowerCase())))||[],j=t3({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)(N4,{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)(X,{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)(Oc,{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:q(`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)(Ps,{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:q(`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)(Y,{variant:`secondary`,size:`sm`,icon:Qs,onClick:()=>{let e=[`时间`,`类型`,`工具`,`项目`,`会话ID`,`摘要`],t=A.map(e=>{let t=i3(e);return[e.timestamp,e.hook_type,e.tool_name||``,e.project_path.split(`/`).pop()||``,e.session_id.slice(0,12),t.subtitle]});M4(`events-${T4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},children:`导出`}),(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,icon:zc,onClick:()=>{S({open:!0,title:`清理历史事件`,description:`确认清理 ${y} 天前的已蒸馏事件?此操作不可撤销。`,onConfirm:()=>{k.mutate(y),S({...x,open:!1})}})},loading:k.isPending,children:`清理历史`}),(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Tc,onClick:()=>O(),children:`刷新`})]})]})}),(0,B.jsx)(X,{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)},className:q(`px-3 py-1.5 rounded-full text-sm transition-all`,r===e?`bg-blue-100 text-blue-700 border-2 border-blue-300`:`bg-gray-100 text-gray-700 hover:bg-gray-200 border-2 border-transparent`),children:[(0,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)(X,{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=i3(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)(Rs,{className:`h-4 w-4`}):(0,B.jsx)(Bs,{className:`h-4 w-4`})}),(0,B.jsx)(Fx,{size:`sm`,className:n3[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)(Lc,{className:`h-4 w-4`}):(0,B.jsx)(nc,{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:T4(tf(t.timestamp),`HH:mm:ss`)})]}),(0,B.jsx)(Hy,{children:r&&(0,B.jsx)(Mx.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)(_c,{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:r3(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)(js,{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:r3(t.tool_output)})]})]})})})]})},t.event_id)})})})}),(0,B.jsx)(O4,{open:x.open,title:x.title,description:x.description,variant:`danger`,onConfirm:x.onConfirm,onCancel:()=>S({...x,open:!1})})]})}function o3(){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)(``),[g,_]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:v,isLoading:y,isError:b,refetch:x}=ct({queryKey:[`pipelines`,`active`],queryFn:()=>ll({status:`active`,page_size:100}).then(e=>e.data),refetchInterval:1e4}),{data:S,refetch:C}=ct({queryKey:[`pipelines`,`completed`,n,i,c,u],queryFn:()=>ll({status:`completed`,search:n||void 0,complexity:i||void 0,page:c,page_size:u}).then(e=>e.data)}),w=lt({mutationFn:e=>Sl(e),onSuccess:()=>e.invalidateQueries({queryKey:[`pipelines`]})}),T=lt({mutationFn:()=>wl(),onSuccess:()=>e.invalidateQueries({queryKey:[`pipelines`]})}),E=lt({mutationFn:e=>Cl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`pipelines`]}),p(new Set)}});if(y)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(b)return(0,B.jsx)(N4,{message:`Pipeline 数据加载失败`,onRetry:()=>x()});let D=v?.items||[],O=S?.items||[],k=S?.total||0,A=D.filter(e=>!m||e.requirement.toLowerCase().includes(m.toLowerCase())||e.project.toLowerCase().includes(m.toLowerCase())),j=o===`all`||o===`active`,M=o===`all`||o===`completed`,N=Math.ceil(k/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:[D.length,` 个活跃 · `,k,` 个已完成`,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:[A.length>0&&f.size>0&&(0,B.jsxs)(Y,{variant:`danger`,size:`sm`,icon:Gc,onClick:()=>{f.size!==0&&_({open:!0,title:`批量关闭 Pipeline`,description:`确认关闭选中的 ${f.size} 个 Pipeline?`,onConfirm:()=>{E.mutate(Array.from(f)),_(e=>({...e,open:!1}))}})},loading:E.isPending,children:[`批量关闭 (`,f.size,`)`]}),A.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>{f.size===A.length?p(new Set):p(new Set(A.map(e=>e.id)))},children:f.size===A.length?`取消全选`:`全选`}),(0,B.jsx)(Y,{variant:`danger`,size:`sm`,icon:zc,onClick:()=>{_({open:!0,title:`清理过期 Pipeline`,description:`确认关闭所有过期 Pipeline?`,onConfirm:()=>{T.mutate(),_(e=>({...e,open:!1}))}})},loading:T.isPending,children:`清理过期`})]}),(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Tc,onClick:()=>x(),children:`刷新`}),(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Qs,onClick:()=>{let e=[...D,...O];M4(`pipelines-${T4(new Date,`yyyyMMdd-HHmmss`)}.csv`,[`ID`,`需求`,`复杂度`,`状态`,`项目`,`创建时间`],e.map(e=>[e.id,e.requirement,e.complexity,e.status,e.project,e.createdAt]))},children:`导出 CSV`})]})]}),j&&D.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-500 uppercase tracking-wider`,children:[`活跃中 (`,A.length,`/`,D.length,`)`]}),(0,B.jsxs)(`div`,{className:`relative w-64`,children:[(0,B.jsx)(Oc,{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:`搜索活跃 Pipeline...`,value:m,onChange:e=>h(e.target.value),className:`w-full pl-10 pr-4 py-1.5 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`})]})]}),(0,B.jsx)(`div`,{className:`space-y-3`,children:A.map((e,n)=>(0,B.jsx)(Mx.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:n*.05},children:(0,B.jsx)(X,{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:`#10b98120`},children:(0,B.jsx)(cc,{className:`h-5 w-5`,style:{color:`#10b981`}})}),(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)(Fx,{variant:`primary`,size:`sm`,children:`动态`}),(0,B.jsx)(`span`,{children:e.project}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Ks,{className:`h-3 w-3`}),T4(tf(e.createdAt),`MM-dd HH:mm`)]})]}),e.type===`dynamic`&&e.nodeConfig&&(0,B.jsxs)(`div`,{className:`mt-2 flex items-center gap-3 text-xs text-gray-600`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(cc,{className:`h-3 w-3`}),e.nodeConfig.totalNodes,` 个节点`]}),e.nodeConfig.boundSkills.length>0&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`⚡ `,e.nodeConfig.boundSkills.length,` 个技能`]}),(0,B.jsxs)(`span`,{className:`text-gray-400`,children:[`节点类型:`,e.nodeConfig.nodeTypes.map(e=>e.split(/[_\-.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)).join(` → `)]})]})]})]}),(0,B.jsx)(Y,{variant:`danger`,size:`sm`,icon:Gc,onClick:()=>{_({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{w.mutate(e.id),_(e=>({...e,open:!1}))}})},loading:w.isPending,children:`关闭`})]})})},e.id))})]}),M&&(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)(X,{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)(Oc,{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:O.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.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(Fx,{size:`sm`,variant:`primary`,children:`动态编排`}),e.nodeConfig&&(0,B.jsxs)(`div`,{className:`text-xs text-gray-500 space-y-0.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(cc,{className:`h-3 w-3`}),e.nodeConfig.totalNodes,` 节点`,e.nodeConfig.boundSkills.length>0&&(0,B.jsxs)(`span`,{className:`ml-1`,children:[`· ⚡ `,e.nodeConfig.boundSkills.length,` 技能`]})]}),(0,B.jsx)(`div`,{className:`text-gray-400 max-w-[200px] truncate`,children:e.nodeConfig.nodeTypes.map(e=>e.split(/[_\-.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)).join(` → `)})]})]})}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Fx,{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:T4(tf(e.createdAt),`MM-dd HH:mm`)}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:tc,onClick:n=>{n.stopPropagation(),t(`/pipelines/${e.id}`)},children:`查看`})})]},e.id))})]})}),k===0&&(0,B.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无历史记录`}),k>0&&(0,B.jsx)(j4,{currentPage:c,totalPages:N,onPageChange:l,pageSize:u,onPageSizeChange:e=>{d(e),l(1)},totalItems:k})]})]}),(0,B.jsx)(O4,{open:g.open,title:g.title,description:g.description,variant:`danger`,onConfirm:g.onConfirm,onCancel:()=>_({...g,open:!1})})]})}var s3={document:ic,code:qs,test:Rc,config:kc,diagram:uc,data:Xs,other:ac},c3={analyze:{name:`需求分析`,description:`分析需求,明确目标和范围`},design:{name:`架构设计`,description:`设计系统架构和技术方案`},profile:{name:`性能分析`,description:`分析性能瓶颈,制定优化方案`},code:{name:`编码实现`,description:`编写代码,实现功能`},test:{name:`测试验证`,description:`编写测试,验证功能正确性`},review:{name:`代码审查`,description:`审查代码质量和规范`}},l3={analy:`#3b82f6`,design:`#8b5cf6`,architect:`#8b5cf6`,profile:`#06b6d4`,code:`#10b981`,implement:`#10b981`,test:`#f59e0b`,verif:`#f59e0b`,review:`#ef4444`,deploy:`#06b6d4`};function u3(e){let t=e.toLowerCase();for(let[e,n]of Object.entries(l3))if(t.includes(e))return n;return`#6b7280`}function d3(e){let t=c3[e];return t?t.name:e.split(/[_\-.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}function f3(e){return c3[e]?.description||null}function p3(e){let t=new Set,n=[],r=new Map(e.map(e=>[e.id,e]));function i(e){if(t.has(e))return;t.add(e);let a=r.get(e);a&&((a.dependencies||[]).forEach(e=>i(e)),n.push(a))}return e.forEach(e=>i(e.id)),n}function m3(e,t){if(!e)return null;let n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),i=Math.floor((r-n)/1e3);return i<60?`${i}s`:`${Math.floor(i/60)}m ${i%60}s`}function h3({pipeline:e,onRetryNode:t}){let[n,r]=(0,z.useState)(new Set),i=(0,z.useMemo)(()=>p3(e.nodes),[e.nodes]),a=i.filter(e=>e.status===`completed`).length,o=i.length>0&&a===i.length,s=o?-1:i.findIndex(t=>t.id===e.currentNodeId),c=e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return i.length===0?(0,B.jsx)(X,{children:(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400`,children:`暂无节点`})}):(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(X,{className:`!p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,B.jsxs)(`span`,{className:`text-sm font-medium text-gray-700`,children:[`编排阶段 · `,a,`/`,i.length,` 已完成`]}),(0,B.jsx)(`span`,{className:`text-xs text-gray-400`,children:o||e.status===`completed`?`✅ 全部完成`:e.status===`failed`?`❌ 已失败`:s>=0?`当前:第 ${s+1} 阶段`:`准备中`})]}),(0,B.jsx)(`div`,{className:`flex items-start gap-0 overflow-x-auto pb-1`,children:i.map((t,n)=>{let r=t.id===e.currentNodeId,a=t.status===`completed`,o=t.status===`failed`,s=u3(t.nodeTypeId),c=o?`#ef4444`:a||r?s:void 0;return(0,B.jsxs)(`div`,{className:`flex items-center flex-shrink-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,B.jsx)(`div`,{className:q(`w-9 h-9 rounded-full flex items-center justify-center text-xs font-bold transition-all`,c?`text-white`:`bg-gray-100 text-gray-400`,r&&`ring-4 ring-offset-2`),style:c?{backgroundColor:c,...r?{ringColor:`${s}40`}:{}}:{},children:a?`✓`:o?`✗`:n+1}),(0,B.jsx)(`span`,{className:q(`text-xs mt-1 max-w-[72px] text-center leading-tight break-words`,r?`font-bold text-gray-900`:`text-gray-500`),children:d3(t.nodeTypeId)})]}),n<i.length-1&&(0,B.jsx)(`div`,{className:q(`h-0.5 w-6 mx-0.5 mb-5 flex-shrink-0 transition-colors`,a?`bg-green-400`:`bg-gray-200`)})]},t.id)})})]}),(0,B.jsx)(`div`,{className:`space-y-3`,children:i.map((r,a)=>{let o=r.id===e.currentNodeId,s=u3(r.nodeTypeId),l=d3(r.nodeTypeId),u=f3(r.nodeTypeId),d=m3(r.startedAt,r.completedAt),f=n.has(r.id),p=null,m=null;if(r.output)try{let e=JSON.parse(r.output);e.artifacts&&e.validation?p=e:m=r.output}catch{m=r.output}let h=m?m.trim().split(`
|
|
68
68
|
`):[],g=h.length>10,_=(r.dependencies||[]).map(e=>{let t=i.find(t=>t.id===e);return t?d3(t.nodeTypeId):e.slice(0,8)});return(0,B.jsxs)(X,{className:q(`!p-0 overflow-hidden transition-all`,o?`ring-2 ring-blue-400 ring-offset-1`:``),children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 p-4`,children:[(0,B.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center text-white font-bold text-sm flex-shrink-0`,style:{backgroundColor:r.status===`pending`?`#d1d5db`:r.status===`failed`?`#ef4444`:s},children:r.status===`completed`?`✓`:r.status===`failed`?`✗`:a+1}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`font-semibold text-gray-900`,children:l}),o&&(0,B.jsx)(Fx,{variant:`info`,size:`sm`,children:`当前阶段`}),(0,B.jsx)(Fx,{size:`sm`,variant:r.status===`completed`?`success`:r.status===`in_progress`?`info`:r.status===`failed`?`danger`:`default`,children:r.status===`completed`?`已完成`:r.status===`in_progress`?`执行中`:r.status===`failed`?`失败`:`等待中`}),d&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-gray-400`,children:[(0,B.jsx)(Ks,{className:`w-3 h-3`}),d]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5 mt-1`,children:[u&&(0,B.jsx)(`span`,{className:`text-xs text-gray-500`,children:u}),r.boundSkillName&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-amber-600`,children:[(0,B.jsx)(Kc,{className:`w-3 h-3`}),r.boundSkillName]}),_.length>0&&(0,B.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`依赖:`,_.join(`, `)]}),r.completedAt&&(0,B.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`完成于 `,T4(new Date(r.completedAt),`HH:mm:ss`)]})]})]}),r.status===`failed`&&t&&(0,B.jsx)(Y,{variant:`outline`,size:`sm`,icon:Ec,onClick:()=>t(r.id),className:`flex-shrink-0`,children:`重试`})]}),p&&(0,B.jsxs)(`div`,{className:`border-t border-gray-100 bg-gray-50 px-4 pt-3 pb-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,B.jsx)(`span`,{className:`text-xs font-semibold text-gray-500 uppercase tracking-wider`,children:`阶段产出`}),!p.validation.passed&&(0,B.jsx)(Fx,{variant:`danger`,size:`sm`,children:`验证失败`})]}),p.summary&&(0,B.jsx)(`div`,{className:`text-sm text-gray-700 mb-3`,children:p.summary}),p.artifacts.length>0&&(0,B.jsx)(`div`,{className:`space-y-2`,children:p.artifacts.map((e,t)=>(0,B.jsx)(`div`,{className:`bg-white rounded-lg border border-gray-200 p-3`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(s3[e.type]||ac,{className:`w-4 h-4 text-gray-400 mt-0.5 flex-shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`font-mono text-sm text-gray-900 break-all`,children:e.path}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-xs text-gray-500`,children:[(0,B.jsx)(`span`,{className:`capitalize`,children:e.type}),e.size_bytes&&(0,B.jsxs)(`span`,{children:[`· `,(e.size_bytes/1024).toFixed(1),` KB`]}),(0,B.jsxs)(`span`,{children:[`· `,T4(new Date(e.created_at),`HH:mm:ss`)]})]})]})]})},t))}),p.validation.errors&&p.validation.errors.length>0&&(0,B.jsx)(`div`,{className:`mt-3 p-2 bg-red-50 border border-red-200 rounded text-xs text-red-700`,children:p.validation.errors.map((e,t)=>(0,B.jsxs)(`div`,{children:[`• `,e]},t))})]}),!p&&h.length>0&&(0,B.jsxs)(`div`,{className:`border-t border-gray-100 bg-gray-50 px-4 pt-3 pb-4`,children:[(0,B.jsx)(`span`,{className:`text-xs font-semibold text-gray-500 uppercase tracking-wider`,children:`阶段产出`}),(0,B.jsx)(`div`,{className:q(`mt-2 text-sm text-gray-800 whitespace-pre-wrap font-mono bg-white rounded-lg border border-gray-100 p-3 leading-relaxed`,!f&&g?`max-h-52 overflow-hidden`:``),children:!f&&g?h.slice(0,10).join(`
|
|
69
69
|
`)+`
|
|
70
|
-
…`:m}),g&&(0,B.jsx)(`button`,{onClick:()=>c(r.id),className:`mt-2 text-xs text-blue-600 hover:underline flex items-center gap-1`,children:f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Vs,{className:`w-3 h-3`}),`收起`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Rs,{className:`w-3 h-3`}),`展开全部(`,h.length,` 行)`]})})]}),r.status===`in_progress`&&h.length===0&&(0,B.jsxs)(`div`,{className:`border-t border-blue-100 bg-blue-50 px-4 py-3 flex items-center gap-2 text-sm text-blue-600`,children:[(0,B.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-500 animate-pulse`}),`正在执行,等待产出…`]})]},r.id)})})]})}var g3={PreToolUse:`#3b82f6`,PostToolUse:`#10b981`,UserPromptSubmit:`#f59e0b`,Stop:`#ef4444`};function _3(){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,isError:d,error:f}=ct({queryKey:[`pipeline`,e],queryFn:()=>ul(e).then(e=>e.data),enabled:!!e,refetchInterval:5e3}),p=lt({mutationFn:()=>Sl(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),t(c)},onError:e=>Zc(e.message||`关闭失败`,`error`)}),m=lt({mutationFn:()=>El(e),onSuccess:()=>{Zc(`已添加到执行队列,下次工具调用时自动注入提示`,`success`)},onError:e=>Zc(e.message||`恢复失败`,`error`)}),h=lt({mutationFn:t=>Dl(e),onSuccess:t=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),Zc(t.data.message||`节点已重置,等待重新执行`,`success`)},onError:e=>Zc(e.message||`重试失败`,`error`)});if(d)return(0,B.jsxs)(`div`,{className:`flex items-center justify-center h-96 text-red-500`,children:[`加载失败:`,f?.message||`未知错误`]});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 g=l,_=g.status!==`completed`&&g.status!==`failed`;return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(F4,{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)(Y,{variant:`ghost`,size:`sm`,icon:Ds,onClick:()=>t(c),children:`返回`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`h2`,{className:`text-lg font-bold text-gray-900`,children:`Pipeline 执行轨迹`}),(0,B.jsxs)(Fx,{variant:`primary`,size:`sm`,children:[(0,B.jsx)(Uc,{className:`w-3 h-3 mr-1`}),` 动态编排`]})]}),(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)(Fx,{variant:_?`info`:`success`,children:g.status===`completed`?`已完成`:g.status===`failed`?`已失败`:`执行中`}),(0,B.jsx)(Fx,{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)(Y,{variant:`secondary`,size:`sm`,icon:Ts,onClick:()=>t(`/sessions/${l.sessionId}`),children:`查看会话`}),_&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Y,{variant:`primary`,size:`sm`,onClick:()=>m.mutate(),loading:m.isPending,children:`继续执行`}),(0,B.jsx)(Y,{variant:`danger`,size:`sm`,icon:Gc,onClick:()=>{s({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{p.mutate(),s(e=>({...e,open:!1}))}})},children:`关闭`})]})]})]}),(0,B.jsx)(X,{className:`!p-4`,children:(0,B.jsx)(`p`,{className:`text-sm text-gray-700 line-clamp-3`,children:l.requirement})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-3`,children:[(0,B.jsxs)(X,{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)(X,{className:`text-center !p-3`,children:[(0,B.jsx)(`div`,{className:`text-xl font-bold text-green-600`,children:`${g.stats.completedNodes}/${g.stats.totalNodes}`}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`节点`})]}),(0,B.jsxs)(X,{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)(X,{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)(X,{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:q(`px-4 py-2 rounded-md text-sm font-medium transition-colors`,i===e?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`),children:{tasks:`编排图 (${g.stats.totalNodes})`,events:`事件 (${l.stats.totalEvents})`,artifacts:`产物 (${l.stats.totalArtifacts})`,quality:`质量 (${l.stats.totalQualityIssues})`}[e]},e))}),i===`tasks`&&(0,B.jsx)(`div`,{className:`space-y-4`,children:(0,B.jsx)(h3,{pipeline:g,onRetryNode:e=>{s({open:!0,title:`重试失败节点`,description:`确定要重试此节点吗?节点状态将重置为等待中,下次工具调用时自动重新执行。`,onConfirm:()=>{h.mutate(e),s(e=>({...e,open:!1}))}})}})}),i===`events`&&(0,B.jsx)(X,{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)(Mx.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:T4(tf(e.time),`HH:mm:ss`)}),(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:g3[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)(X,{title:`产物文件`,children:(0,B.jsxs)(`div`,{className:`space-y-2`,children:[l.artifacts.map((e,t)=>(0,B.jsx)(Mx.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)(nc,{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,` · `,T4(tf(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)(X,{title:`质量问题`,children:(0,B.jsxs)(`div`,{className:`space-y-2`,children:[l.qualityIssues.map((e,t)=>(0,B.jsxs)(Mx.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)(Us,{className:`h-5 w-5 text-green-500 mt-0.5`}):(0,B.jsx)(Vc,{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)(Fx,{size:`sm`,variant:e.level===`error`?`danger`:e.level===`warn`?`warning`:`info`,children:e.level}),(0,B.jsx)(Fx,{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:T4(tf(e.createdAt),`MM-dd HH:mm`)})]})]}),(0,B.jsx)(Fx,{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)(Ac,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`暂无质量问题`]})]})}),(0,B.jsx)(O4,{open:o.open,title:o.title,description:o.description,variant:`danger`,onConfirm:o.onConfirm,onCancel:()=>s({...o,open:!1})})]})}var v3={spec:{label:`规格`,icon:ic,color:`text-blue-600`,bg:`bg-blue-50`,border:`border-blue-200`},security:{label:`安全`,icon:jc,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-200`},quality:{label:`质量`,icon:nc,color:`text-purple-600`,bg:`bg-purple-50`,border:`border-purple-200`},test:{label:`测试`,icon:Rc,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-200`},performance:{label:`性能`,icon:Kc,color:`text-orange-600`,bg:`bg-orange-50`,border:`border-orange-200`}},y3={fail:{label:`失败`,icon:Gs,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-300`},warn:{label:`警告`,icon:Vc,color:`text-yellow-600`,bg:`bg-yellow-50`,border:`border-yellow-300`},pass:{label:`通过`,icon:Us,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-300`}};function b3({level:e}){let t=y3[e];if(!t)return(0,B.jsx)(Fx,{size:`sm`,children:e});let n=t.icon;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),t.label]})}function x3({category:e}){let t=v3[e];if(!t)return(0,B.jsx)(Fx,{size:`sm`,children:e});let n=t.icon;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),t.label]})}function S3(){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)(1),[h,g]=(0,z.useState)(20),[_,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(null),[x,S]=(0,z.useState)(new Set),[C,w]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:T,isError:E,refetch:D}=ct({queryKey:[`quality-unresolved`],queryFn:()=>fl().then(e=>e.data),refetchInterval:1e4}),{data:O}=ct({queryKey:[`quality-history`,r,a,s,l,t],queryFn:()=>dl({limit:500,level:r||void 0,category:a||void 0,resolved:s===`resolved`?!0:s===`unresolved`?!1:void 0,project_path:l||void 0,search:t||void 0}).then(e=>e.data)}),{data:k}=ct({queryKey:[`quality-history`,`all`],queryFn:()=>dl({limit:500}).then(e=>e.data)}),A=lt({mutationFn:e=>Wl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),j=lt({mutationFn:e=>Gl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),M=lt({mutationFn:()=>ql(),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),N=lt({mutationFn:e=>Kl(e),onSuccess:()=>{S(new Set),e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),ee=async e=>{try{let t=await Jl(e);await navigator.clipboard.writeText(t.data.context),b(e),Zc(`上下文已复制,请粘贴到 Claude Code 进行修复`,`success`),setTimeout(()=>b(null),3e3)}catch{Zc(`复制失败`,`error`)}},P=O?.items||[],F=Math.ceil(P.length/h),I=P.slice((p-1)*h,p*h),te=k?.total||0,ne=T?.total||0,re=P.filter(e=>e.level===`fail`).length,L=P.filter(e=>e.level===`warn`).length,R=Array.from(new Set(k?.items.map(e=>e.level)||[])),ie=Array.from(new Set(k?.items.map(e=>e.category)||[])),ae=Array.from(new Set(k?.items.map(e=>e.project_path?.split(`/`).pop()||``).filter(Boolean)||[])),oe=[r,a,s,l].filter(Boolean).length,se=()=>{let e=[`级别`,`类别`,`消息`,`项目`,`状态`,`创建时间`],t=P.map(e=>[e.level,e.category,e.message,e.project_path?.split(`/`).pop()||``,e.resolved?`已解决`:`未解决`,e.created_at?T4(tf(e.created_at),`yyyy-MM-dd HH:mm:ss`):``]);M4(`quality-issues-${T4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)};return E?(0,B.jsx)(N4,{message:`质量数据加载失败`,onRetry:()=>D()}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(X,{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)(Oc,{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),m(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:()=>f(e=>!e),className:q(`flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border transition-colors`,d||oe>0?`border-blue-300 bg-blue-50 text-blue-700`:`border-gray-200 text-gray-600 hover:bg-gray-50`),children:[(0,B.jsx)(sc,{className:`h-4 w-4`}),`筛选`,oe>0&&(0,B.jsx)(`span`,{className:`ml-1 px-1.5 py-0.5 bg-blue-600 text-white text-xs rounded-full`,children:oe}),(0,B.jsx)(Rs,{className:q(`h-3.5 w-3.5 transition-transform`,d&&`rotate-180`)})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[x.size>0&&(0,B.jsxs)(Y,{variant:`secondary`,size:`sm`,icon:Gc,onClick:()=>w({open:!0,title:`批量忽略问题`,description:`确认忽略选中的 ${x.size} 个问题?`,onConfirm:()=>{N.mutate(Array.from(x)),w(e=>({...e,open:!1}))}}),loading:N.isPending,children:[`忽略 (`,x.size,`)`]}),ne>0&&(0,B.jsx)(Y,{variant:`primary`,size:`sm`,icon:Ls,onClick:()=>w({open:!0,title:`全部标记已修复`,description:`确认将 ${ne} 个问题全部标记为已修复?`,onConfirm:()=>{M.mutate(),w(e=>({...e,open:!1}))}}),loading:M.isPending,children:`全部已修复`}),(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Qs,onClick:()=>P.length>0&&se(),children:`导出`})]})]}),d&&(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),m(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:`全部级别`}),R.map(e=>(0,B.jsx)(`option`,{value:e,children:y3[e]?.label||e},e))]}),(0,B.jsxs)(`select`,{value:a,onChange:e=>{o(e.target.value),m(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:`全部类别`}),ie.map(e=>(0,B.jsx)(`option`,{value:e,children:v3[e]?.label||e},e))]}),(0,B.jsxs)(`select`,{value:s,onChange:e=>{c(e.target.value),m(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:`resolved`,children:`已解决`}),(0,B.jsx)(`option`,{value:`unresolved`,children:`未解决`})]}),(0,B.jsxs)(`select`,{value:l,onChange:e=>{u(e.target.value),m(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:`全部项目`}),ae.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,B.jsxs)(X,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-red-600`,children:re}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`失败`})]}),(0,B.jsxs)(X,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-amber-600`,children:L}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`警告`})]}),(0,B.jsxs)(X,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-orange-600`,children:ne}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`未解决`})]}),(0,B.jsxs)(X,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:te}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`总检查`})]})]}),(0,B.jsxs)(X,{title:`问题列表 (${P.length})`,action:P.length>0?(0,B.jsx)(`button`,{onClick:()=>{let e=I.filter(e=>!e.resolved).map(e=>String(e.id));x.size===e.length&&e.length>0?S(new Set):S(new Set(e))},className:`text-xs text-blue-600 hover:underline`,children:x.size>0?`取消全选`:`全选当前页未解决`}):void 0,children:[(0,B.jsx)(`div`,{className:`space-y-2`,children:I.map((e,t)=>{let n=_===String(e.id||t);return(0,B.jsxs)(`div`,{className:`rounded-lg border border-gray-100 overflow-hidden`,children:[(0,B.jsxs)(Mx.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:t*.02},className:q(`flex items-center gap-3 p-4 cursor-pointer transition-all`,x.has(String(e.id))?`bg-blue-50`:`hover:bg-gray-50`),onClick:()=>v(n?null:String(e.id||t)),children:[e.resolved?(0,B.jsx)(`div`,{className:`h-4 w-4 flex-shrink-0`}):(0,B.jsx)(`input`,{type:`checkbox`,checked:x.has(String(e.id)),onChange:t=>{t.stopPropagation(),S(t=>{let n=new Set(t);return n.has(String(e.id))?n.delete(String(e.id)):n.add(String(e.id)),n})},onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded border-gray-300 text-blue-600 cursor-pointer flex-shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 grid grid-cols-1 md:grid-cols-5 gap-3 items-center min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,B.jsx)(b3,{level:e.level}),(0,B.jsx)(x3,{category:e.category})]}),(0,B.jsx)(`div`,{className:`md:col-span-2 min-w-0`,children:(0,B.jsx)(`p`,{className:`text-sm text-gray-700 truncate`,children:e.message})}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500 truncate`,children:e.project_path?.split(`/`).pop()||`-`}),(0,B.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,B.jsx)(Fx,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`}),(0,B.jsx)(`span`,{className:`text-xs text-gray-400 flex-shrink-0`,children:e.created_at?T4(tf(e.created_at),`MM-dd HH:mm`):``}),n?(0,B.jsx)(Rs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`}):(0,B.jsx)(Bs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`})]})]})]}),(0,B.jsx)(Hy,{children:n&&(0,B.jsx)(Mx.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 break-all`,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?T4(tf(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:T4(tf(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)(Y,{variant:`ghost`,size:`sm`,icon:y===String(e.id)?Is:Ys,onClick:t=>{t.stopPropagation(),ee(String(e.id))},children:y===String(e.id)?`已复制`:`复制上下文`}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Ls,onClick:t=>{t.stopPropagation(),A.mutate(String(e.id))},loading:A.isPending,children:`标记已修复`}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Gc,onClick:t=>{t.stopPropagation(),j.mutate(String(e.id))},loading:j.isPending,children:`忽略`})]})]})})})]},e.id||t)})}),P.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,B.jsx)(Us,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`没有符合条件的记录`]}),P.length>0&&(0,B.jsx)(j4,{currentPage:p,totalPages:F,onPageChange:m,pageSize:h,onPageSizeChange:e=>{g(e),m(1)},totalItems:P.length})]}),(0,B.jsx)(O4,{open:C.open,title:C.title,description:C.description,variant:`warning`,onConfirm:C.onConfirm,onCancel:()=>w({...C,open:!1})})]})}var C3=[{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 w3(){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:()=>el().then(e=>e.data)}),{data:v,refetch:y}=ct({queryKey:[`daemon-diagnosis`],queryFn:()=>Zl().then(e=>e.data),enabled:a===`environment`}),{data:b,refetch:x}=ct({queryKey:[`backups`],queryFn:()=>eu().then(e=>e.data),enabled:a===`backup_mgmt`}),{data:S}=ct({queryKey:[`config-history`],queryFn:()=>nl().then(e=>e.data),enabled:a===`history`}),{data:C}=ct({queryKey:[`daemon-status`],queryFn:()=>Yl().then(e=>e.data),enabled:a===`backup_mgmt`}),w=lt({mutationFn:()=>$l(),onSuccess:()=>{x(),i(`success`),setTimeout(()=>i(`idle`),3e3)},onError:()=>{i(`error`),setTimeout(()=>i(`idle`),3e3)}}),T=lt({mutationFn:()=>Ql(),onSuccess:e=>{d(e.data),y()}});(0,z.useEffect)(()=>{g&&!t&&n(g)},[g,t]);let E=lt({mutationFn:e=>tl(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(C3.map(e=>e.key)))}catch{Zc(`配置文件格式错误,请选择有效的 JSON 文件`,`error`)}},r.readAsText(t)},e.click()},ee=C3.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)(X,{className:`!p-2 sticky top-6`,children:(0,B.jsxs)(`nav`,{className:`space-y-1`,children:[C3.map(e=>(0,B.jsx)(`button`,{onClick:()=>o(e.key),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors`,a===e.key?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:e.title},e.key)),(0,B.jsx)(`div`,{className:`border-t border-gray-100 my-1`}),(0,B.jsxs)(`button`,{onClick:()=>o(`backup_mgmt`),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,a===`backup_mgmt`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,B.jsx)(Xs,{className:`h-3.5 w-3.5`}),`数据备份`]}),(0,B.jsxs)(`button`,{onClick:()=>o(`environment`),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,a===`environment`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,B.jsx)(Ac,{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)(Hy,{children:[r===`success`&&(0,B.jsxs)(Mx.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)(Us,{className:`h-4 w-4`}),`已保存`]}),r===`error`&&(0,B.jsxs)(Mx.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)(Gs,{className:`h-4 w-4`}),`保存失败`]})]}),l&&(0,B.jsx)(Fx,{variant:`warning`,children:`未保存`}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Qs,onClick:M,children:`导出`}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Hc,onClick:N,children:`导入`}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Ec,onClick:j,disabled:!l,children:`撤销`}),(0,B.jsx)(Y,{variant:`primary`,size:`sm`,icon:Dc,onClick:A,loading:E.isPending,disabled:!l,children:`保存`})]})]}),a!==`environment`&&a!==`backup_mgmt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(X,{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:q(`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:q(`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)(ec,{className:`h-4 w-4`}):(0,B.jsx)(tc,{className:`h-4 w-4`})})]})})]},e.key))})}),(0,B.jsx)(X,{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)(Y,{variant:`danger`,size:`sm`,icon:Vc,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)(X,{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)(lc,{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)(Y,{variant:`primary`,size:`sm`,icon:Xs,onClick:()=>w.mutate(),loading:w.isPending,children:`立即备份`})]})}),(0,B.jsxs)(X,{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)(Y,{variant:`ghost`,size:`sm`,icon:Tc,onClick:()=>x(),children:`刷新`})]}),b&&b.items.length>0?(0,B.jsx)(`div`,{className:`space-y-2`,children:b.items.map(e=>(0,B.jsxs)(`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:[T4(new Date(e.createdAt),`yyyy-MM-dd HH:mm:ss`),` · `,e.sizeMb,` MB 内存占用`]})]}),(0,B.jsx)(`a`,{href:tu(e.filename),download:e.filename,className:`ml-3 flex-shrink-0`,children:(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Qs,children:`下载`})})]},e.filename))}):(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无备份记录`})]}),(0,B.jsxs)(X,{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:`数据管理`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:`清理历史事件`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:`删除超过指定天数的事件记录`})]}),(0,B.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`清理历史事件`,description:`确定要清理 30 天前的事件记录吗?此操作不可撤销。`,onConfirm:()=>{W.post(`/events/purge`,{retentionDays:30}).then(()=>{Zc(`事件清理完成`,`success`),h(e=>({...e,open:!1}))}).catch(()=>{Zc(`事件清理失败`,`error`),h(e=>({...e,open:!1}))})}})},children:`清理 30 天前`})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:`数据库优化`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:`执行 VACUUM 回收空间,提升性能`})]}),(0,B.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`数据库优化`,description:`确定要执行 VACUUM 优化吗?此操作可能需要几分钟。`,onConfirm:()=>{W.post(`/config/vacuum`).then(()=>{Zc(`数据库优化完成`,`success`),h(e=>({...e,open:!1}))}).catch(()=>{Zc(`数据库优化失败`,`error`),h(e=>({...e,open:!1}))})}})},children:`立即优化`})]})]})]})]}),a===`history`&&(0,B.jsxs)(X,{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:T4(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)})]}),(0,B.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`确认恢复配置`,description:`确定要恢复到 ${T4(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)} 的配置吗?当前配置将被覆盖。`,onConfirm:()=>{E.mutate(e.config),h(e=>({...e,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)(X,{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)(Y,{variant:`secondary`,size:`sm`,icon:Tc,onClick:()=>y(),children:`重新检测`}),(0,B.jsx)(Y,{size:`sm`,icon:Wc,onClick:()=>T.mutate(),disabled:T.isPending||v?.hooksHealthy,children:T.isPending?`修复中...`:`一键修复`})]})]})}),u&&(0,B.jsx)(X,{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)(Us,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,B.jsx)(Vc,{className:`h-4 w-4 text-yellow-500 mt-0.5 flex-shrink-0`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:q(`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)(Y,{variant:`ghost`,size:`sm`,icon:Gs,onClick:()=>d(null)})]})}),v&&(0,B.jsx)(X,{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)(Us,{className:`h-4 w-4 text-green-500`}):e.id===`daemon_process`?(0,B.jsx)(Vc,{className:`h-4 w-4 text-yellow-500`}):(0,B.jsx)(Gs,{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)(X,{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)(Us,{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)(Vc,{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)(O4,{open:m.open,title:m.title,description:m.description,variant:`danger`,onConfirm:m.onConfirm,onCancel:()=>h({...m,open:!1})})]})}function T3({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 E3=[`#667eea`,`#10b981`,`#f59e0b`,`#ef4444`,`#8b5cf6`,`#06b6d4`],D3={"7d":7,"30d":30,"90d":90,custom:0};function O3(){let[e,t]=(0,z.useState)(`30d`),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),o=D3[e],s=e===`custom`?n?`${n}T00:00:00`:void 0:T4(D4(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:()=>rl({limit:500,start_time:s,end_time:c}).then(e=>e.data)}),{data:p,isLoading:m,isError:h,refetch:g}=ct({queryKey:[`events`,{limit:1e3,startTime:s,endTime:c}],queryFn:()=>sl({limit:1e3,start_time:s,end_time:c}).then(e=>e.data)}),{data:_,isLoading:v}=ct({queryKey:[`event-stats`],queryFn:()=>cl().then(e=>e.data)}),{data:y}=ct({queryKey:[`api-usage-stats`,e],queryFn:()=>ru(e===`custom`?90:o).then(e=>e.data),staleTime:6e4}),b=u||m||v,x=d||h,S=()=>{M4(`analytics-sessions-${T4(new Date,`yyyyMMdd`)}.csv`,[`日期`,`会话数`],C.map(e=>[e.date,e.count])),M4(`analytics-tools-${T4(new Date,`yyyyMMdd`)}.csv`,[`工具`,`使用次数`],E.map(e=>[e.name,e.value])),M4(`analytics-projects-${T4(new Date,`yyyyMMdd`)}.csv`,[`项目`,`事件数`],T.map(e=>[e.name,e.value])),M4(`analytics-durations-${T4(new Date,`yyyyMMdd`)}.csv`,[`时长区间`,`会话数`],O.map(e=>[e.range,e.count]))},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=T4(new Date(e.getTime()+n*24*60*60*1e3),`MM-dd`);return{date:r,count:l.items.filter(e=>T4(tf(e.start_time),`MM-dd`)===r).length}})}return Array.from({length:o},(e,t)=>{let n=T4(D4(new Date,o-1-t),`MM-dd`);return{date:n,count:l.items.filter(e=>T4(tf(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=>tf(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=(tf(e.end_time).getTime()-tf(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)(()=>{let e=D.filter(e=>e>0&&e<=480),t=e.length>0?e.reduce((e,t)=>e+t,0)/e.length:0,n=l?.items.filter(e=>e.event_count>0&&e.event_count<=500)??[];return{avgSessionEvents:n.length>0?n.reduce((e,t)=>e+t.event_count,0)/n.length:0,avgSessionDuration:t}},[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)(N4,{message:`分析数据加载失败`,onRetry:()=>{f(),g()}}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(X,{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)(Ps,{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:q(`px-3 py-1.5 text-sm transition-colors`,e===n?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:n===`7d`?`7 天`:n===`30d`?`30 天`:n===`90d`?`90 天`:`自定义`},n))})]}),(0,B.jsx)(Y,{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)(X,{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)(X,{className:`text-center !p-4`,children:[(0,B.jsx)(Ks,{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)(X,{className:`text-center !p-4`,children:[(0,B.jsx)(Kc,{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)(X,{className:`text-center !p-4`,children:[(0,B.jsx)(Bc,{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)(X,{title:`最近 ${o} 天会话趋势`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(_2,{data:C,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`date`}),(0,B.jsx)(p1,{}),(0,B.jsx)(WW,{}),(0,B.jsx)(jQ,{type:`monotone`,dataKey:`count`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3})]})})})}),(0,B.jsx)(X,{title:`24 小时事件分布`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(q0,{data:w,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`hour`}),(0,B.jsx)(p1,{}),(0,B.jsx)(WW,{}),(0,B.jsx)(KZ,{type:`monotone`,dataKey:`count`,stroke:`#10b981`,strokeWidth:2})]})})})}),(0,B.jsx)(X,{title:`项目活跃度 Top 10`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(Y0,{data:T,layout:`vertical`,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{type:`number`}),(0,B.jsx)(p1,{dataKey:`name`,type:`category`,width:100}),(0,B.jsx)(WW,{}),(0,B.jsx)(j$,{dataKey:`value`,fill:`#667eea`})]})})})}),(0,B.jsx)(X,{title:`工具使用排行 Top 15`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(Y0,{data:E,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`name`,angle:-45,textAnchor:`end`,height:80}),(0,B.jsx)(p1,{}),(0,B.jsx)(WW,{}),(0,B.jsx)(j$,{dataKey:`value`,fill:`#10b981`})]})})})}),(0,B.jsx)(X,{title:`会话时长分布`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(h2,{children:[(0,B.jsx)(HJ,{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:E3[t%E3.length]},`cell-${t}`))}),(0,B.jsx)(WW,{})]})})})}),(0,B.jsx)(X,{title:`事件类型趋势`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(_2,{data:_?.stats.slice(0,30)||[],children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`date`}),(0,B.jsx)(p1,{}),(0,B.jsx)(WW,{}),(0,B.jsx)(QA,{}),(0,B.jsx)(jQ,{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)(Zs,{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)(X,{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)(X,{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)(X,{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)(X,{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)(X,{title:`每日 Token 趋势`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(_2,{data:y.dailyTrend,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`date`}),(0,B.jsx)(p1,{}),(0,B.jsx)(WW,{formatter:e=>`${(e/1e3).toFixed(1)}K`}),(0,B.jsx)(QA,{}),(0,B.jsx)(jQ,{type:`monotone`,dataKey:`tokens_in`,name:`输入`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3,stackId:`1`}),(0,B.jsx)(jQ,{type:`monotone`,dataKey:`tokens_out`,name:`输出`,stroke:`#10b981`,fill:`#10b981`,fillOpacity:.3,stackId:`1`})]})})})}),(0,B.jsx)(X,{title:`每日费用趋势(USD)`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(Y0,{data:y.dailyTrend,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`date`}),(0,B.jsx)(p1,{tickFormatter:e=>`$${e.toFixed(3)}`}),(0,B.jsx)(WW,{formatter:e=>`$${e.toFixed(4)}`}),(0,B.jsx)(j$,{dataKey:`cost_usd`,name:`费用`,fill:`#f59e0b`})]})})})}),y.byModel.length>0&&(0,B.jsx)(X,{title:`按模型费用分布`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(h2,{children:[(0,B.jsx)(HJ,{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:E3[t%E3.length]},t))}),(0,B.jsx)(WW,{formatter:e=>`$${e.toFixed(4)}`})]})})})})]})]})]})}function k3(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=k3(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var A3={value:()=>{}};function j3(){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 M3(n)}function M3(e){this._=e}function N3(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}})}M3.prototype=j3.prototype={constructor:M3,on:function(e,t){var n=this._,r=N3(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=P3(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]=F3(n[i],e.name,t);else if(t==null)for(i in n)n[i]=F3(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 M3(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 P3(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function F3(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=A3,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var I3={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 L3(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),I3.hasOwnProperty(t)?{space:I3[t],local:e}:e}function R3(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 z3(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function B3(e){var t=L3(e);return(t.local?z3:R3)(t)}function V3(){}function H3(e){return e==null?V3:function(){return this.querySelector(e)}}function U3(e){typeof e!=`function`&&(e=H3(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new L6(r,this._parents)}function W3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function G3(){return[]}function K3(e){return e==null?G3:function(){return this.querySelectorAll(e)}}function q3(e){return function(){return W3(e.apply(this,arguments))}}function J3(e){e=typeof e==`function`?q3(e):K3(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new L6(r,i)}function Y3(e){return function(){return this.matches(e)}}function X3(e){return function(t){return t.matches(e)}}var Z3=Array.prototype.find;function Q3(e){return function(){return Z3.call(this.children,e)}}function $3(){return this.firstElementChild}function e6(e){return this.select(e==null?$3:Q3(typeof e==`function`?e:X3(e)))}var t6=Array.prototype.filter;function n6(){return Array.from(this.children)}function r6(e){return function(){return t6.call(this.children,e)}}function i6(e){return this.selectAll(e==null?n6:r6(typeof e==`function`?e:X3(e)))}function a6(e){typeof e!=`function`&&(e=Y3(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new L6(r,this._parents)}function o6(e){return Array(e.length)}function s6(){return new L6(this._enter||this._groups.map(o6),this._parents)}function c6(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}c6.prototype={constructor:c6,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 l6(e){return function(){return e}}function u6(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 c6(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function d6(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 c6(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function f6(e){return e.__data__}function p6(e,t){if(!arguments.length)return Array.from(this,f6);var n=t?d6:u6,r=this._parents,i=this._groups;typeof e!=`function`&&(e=l6(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=m6(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new L6(o,r),o._enter=s,o._exit=c,o}function m6(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function h6(){return new L6(this._exit||this._groups.map(o6),this._parents)}function g6(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 _6(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new L6(s,this._parents)}function v6(){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 y6(e){e||=b6;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new L6(i,this._parents).order()}function b6(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function x6(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function S6(){return Array.from(this)}function C6(){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 w6(){let e=0;for(let t of this)++e;return e}function T6(){return!this.node()}function E6(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 D6(e){return function(){this.removeAttribute(e)}}function Kie(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qie(e,t){return function(){this.setAttribute(e,t)}}function Jie(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Yie(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Xie(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 Zie(e,t){var n=L3(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?Kie:D6:typeof t==`function`?n.local?Xie:Yie:n.local?Jie:qie)(n,t))}function O6(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Qie(e){return function(){this.style.removeProperty(e)}}function $ie(e,t,n){return function(){this.style.setProperty(e,t,n)}}function eae(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function tae(e,t,n){return arguments.length>1?this.each((t==null?Qie:typeof t==`function`?eae:$ie)(e,t,n??``)):k6(this.node(),e)}function k6(e,t){return e.style.getPropertyValue(t)||O6(e).getComputedStyle(e,null).getPropertyValue(t)}function nae(e){return function(){delete this[e]}}function rae(e,t){return function(){this[e]=t}}function iae(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function aae(e,t){return arguments.length>1?this.each((t==null?nae:typeof t==`function`?iae:rae)(e,t)):this.node()[e]}function A6(e){return e.trim().split(/^|\s+/)}function j6(e){return e.classList||new M6(e)}function M6(e){this._node=e,this._names=A6(e.getAttribute(`class`)||``)}M6.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 N6(e,t){for(var n=j6(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function P6(e,t){for(var n=j6(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function oae(e){return function(){N6(this,e)}}function sae(e){return function(){P6(this,e)}}function cae(e,t){return function(){(t.apply(this,arguments)?N6:P6)(this,e)}}function lae(e,t){var n=A6(e+``);if(arguments.length<2){for(var r=j6(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?cae:t?oae:sae)(n,t))}function uae(){this.textContent=``}function dae(e){return function(){this.textContent=e}}function fae(e){return function(){this.textContent=e.apply(this,arguments)??``}}function pae(e){return arguments.length?this.each(e==null?uae:(typeof e==`function`?fae:dae)(e)):this.node().textContent}function mae(){this.innerHTML=``}function hae(e){return function(){this.innerHTML=e}}function gae(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function _ae(e){return arguments.length?this.each(e==null?mae:(typeof e==`function`?gae:hae)(e)):this.node().innerHTML}function vae(){this.nextSibling&&this.parentNode.appendChild(this)}function yae(){return this.each(vae)}function bae(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xae(){return this.each(bae)}function Sae(e){var t=typeof e==`function`?e:B3(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Cae(){return null}function wae(e,t){var n=typeof e==`function`?e:B3(e),r=t==null?Cae:typeof t==`function`?t:H3(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Tae(){var e=this.parentNode;e&&e.removeChild(this)}function Eae(){return this.each(Tae)}function Dae(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Oae(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function kae(e){return this.select(e?Oae:Dae)}function Aae(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function jae(e){return function(t){e.call(this,t,this.__data__)}}function Mae(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 Nae(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 Pae(e,t,n){return function(){var r=this.__on,i,a=jae(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 Fae(e,t,n){var r=Mae(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?Pae:Nae,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function F6(e,t,n){var r=O6(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 Iae(e,t){return function(){return F6(this,e,t)}}function Lae(e,t){return function(){return F6(this,e,t.apply(this,arguments))}}function Rae(e,t){return this.each((typeof t==`function`?Lae:Iae)(e,t))}function*zae(){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 I6=[null];function L6(e,t){this._groups=e,this._parents=t}function R6(){return new L6([[document.documentElement]],I6)}function Bae(){return this}L6.prototype=R6.prototype={constructor:L6,select:U3,selectAll:J3,selectChild:e6,selectChildren:i6,filter:a6,data:p6,enter:s6,exit:h6,join:g6,merge:_6,selection:Bae,order:v6,sort:y6,call:x6,nodes:S6,node:C6,size:w6,empty:T6,each:E6,attr:Zie,style:tae,property:aae,classed:lae,text:pae,html:_ae,raise:yae,lower:xae,append:Sae,insert:wae,remove:Eae,clone:kae,datum:Aae,on:Fae,dispatch:Rae,[Symbol.iterator]:zae};function z6(e){return typeof e==`string`?new L6([[document.querySelector(e)]],[document.documentElement]):new L6([[e]],I6)}function Vae(e){let t;for(;t=e.sourceEvent;)e=t;return e}function B6(e,t){if(e=Vae(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 Hae={passive:!1},V6={capture:!0,passive:!1};function H6(e){e.stopImmediatePropagation()}function U6(e){e.preventDefault(),e.stopImmediatePropagation()}function W6(e){var t=e.document.documentElement,n=z6(e).on(`dragstart.drag`,U6,V6);`onselectstart`in t?n.on(`selectstart.drag`,U6,V6):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function G6(e,t){var n=e.document.documentElement,r=z6(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,U6,V6),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 K6=e=>()=>e;function q6(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}})}q6.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Uae(e){return!e.ctrlKey&&!e.button}function Wae(){return this.parentNode}function Gae(e,t){return t??{x:e.x,y:e.y}}function Kae(){return navigator.maxTouchPoints||`ontouchstart`in this}function J6(){var e=Uae,t=Wae,n=Gae,r=Kae,i={},a=j3(`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`,_,Hae).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&&(z6(n.view).on(`mousemove.drag`,m,V6).on(`mouseup.drag`,h,V6),W6(n.view),H6(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(U6(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){z6(e.view).on(`mousemove.drag mouseup.drag`,null),G6(e.view,l),U6(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]))&&(H6(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])&&(U6(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])&&(H6(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=B6(l||r,t),p,m,h;if((h=n.call(e,new q6(`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=B6(l||a,t),_=o;break}u.call(r,e,new q6(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:K6(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:K6(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:K6(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:K6(!!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 Y6=0,X6=0,Z6=0,Q6=1e3,$6,e8,t8=0,n8=0,r8=0,i8=typeof performance==`object`&&performance.now?performance:Date,a8=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function o8(){return n8||=(a8(qae),i8.now()+r8)}function qae(){n8=0}function s8(){this._call=this._time=this._next=null}s8.prototype=c8.prototype={constructor:s8,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?o8():+n)+(t==null?0:+t),!this._next&&e8!==this&&(e8?e8._next=this:$6=this,e8=this),this._call=e,this._time=n,u8()},stop:function(){this._call&&(this._call=null,this._time=1/0,u8())}};function c8(e,t,n){var r=new s8;return r.restart(e,t,n),r}function Jae(){o8(),++Y6;for(var e=$6,t;e;)(t=n8-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Y6}function l8(){n8=(t8=i8.now())+r8,Y6=X6=0;try{Jae()}finally{Y6=0,Xae(),n8=0}}function Yae(){var e=i8.now(),t=e-t8;t>Q6&&(r8-=t,t8=e)}function Xae(){for(var e,t=$6,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:$6=n);e8=e,u8(r)}function u8(e){Y6||(X6&&=clearTimeout(X6),e-n8>24?(e<1/0&&(X6=setTimeout(l8,e-i8.now()-r8)),Z6&&=clearInterval(Z6)):(Z6||=(t8=i8.now(),setInterval(Yae,Q6)),Y6=1,a8(l8)))}function d8(e,t,n){var r=new s8;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Zae=j3(`start`,`end`,`cancel`,`interrupt`),Qae=[];function f8(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;$ae(e,n,{name:t,index:r,group:i,on:Zae,tween:Qae,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function p8(e,t){var n=h8(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function m8(e,t){var n=h8(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function h8(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function $ae(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=c8(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 d8(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(d8(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 g8(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 eoe(e){return this.each(function(){g8(this,e)})}function toe(e,t){var n,r;return function(){var i=m8(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 noe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=m8(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 roe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=h8(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?toe:noe)(n,e,t))}function _8(e,t,n){var r=e._id;return e.each(function(){var e=m8(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return h8(e,r).value[t]}}function v8(e,t){var n;return(typeof t==`number`?TI:t instanceof rI?wI:(n=rI(t))?(t=n,wI):OI)(e,t)}function ioe(e){return function(){this.removeAttribute(e)}}function aoe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ooe(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 soe(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 coe(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 loe(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 uoe(e,t){var n=L3(e),r=n===`transform`?$ne:v8;return this.attrTween(e,typeof t==`function`?(n.local?loe:coe)(n,r,_8(this,`attr.`+e,t)):t==null?(n.local?aoe:ioe)(n):(n.local?soe:ooe)(n,r,t))}function doe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function foe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function poe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&foe(e,i)),n}return i._value=t,i}function moe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&doe(e,i)),n}return i._value=t,i}function hoe(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=L3(e);return this.tween(n,(r.local?poe:moe)(r,t))}function goe(e,t){return function(){p8(this,e).delay=+t.apply(this,arguments)}}function _oe(e,t){return t=+t,function(){p8(this,e).delay=t}}function voe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?goe:_oe)(t,e)):h8(this.node(),t).delay}function yoe(e,t){return function(){m8(this,e).duration=+t.apply(this,arguments)}}function boe(e,t){return t=+t,function(){m8(this,e).duration=t}}function xoe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?yoe:boe)(t,e)):h8(this.node(),t).duration}function Soe(e,t){if(typeof t!=`function`)throw Error();return function(){m8(this,e).ease=t}}function Coe(e){var t=this._id;return arguments.length?this.each(Soe(t,e)):h8(this.node(),t).ease}function woe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();m8(this,e).ease=n}}function Toe(e){if(typeof e!=`function`)throw Error();return this.each(woe(this._id,e))}function Eoe(e){typeof e!=`function`&&(e=Y3(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 b8(r,this._parents,this._name,this._id)}function Doe(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 b8(o,this._parents,this._name,this._id)}function Ooe(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 koe(e,t,n){var r,i,a=Ooe(t)?p8:m8;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Aoe(e,t){var n=this._id;return arguments.length<2?h8(this.node(),n).on.on(e):this.each(koe(n,e,t))}function joe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Moe(){return this.on(`end.remove`,joe(this._id))}function Noe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=H3(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,f8(l[f],t,n,f,l,h8(u,n)));return new b8(a,this._parents,t,n)}function Poe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=K3(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=h8(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&f8(p,t,n,h,f,m);a.push(f),o.push(u)}return new b8(a,o,t,n)}var Foe=R6.prototype.constructor;function Ioe(){return new Foe(this._groups,this._parents)}function Loe(e,t){var n,r,i;return function(){var a=k6(this,e),o=(this.style.removeProperty(e),k6(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function y8(e){return function(){this.style.removeProperty(e)}}function Roe(e,t,n){var r,i=n+``,a;return function(){var o=k6(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function zoe(e,t,n){var r,i,a;return function(){var o=k6(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),k6(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Boe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=m8(this,e),l=c.on,u=c.value[a]==null?s||=y8(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Voe(e,t,n){var r=(e+=``)==`transform`?Qne:v8;return t==null?this.styleTween(e,Loe(e,r)).on(`end.style.`+e,y8(e)):typeof t==`function`?this.styleTween(e,zoe(e,r,_8(this,`style.`+e,t))).each(Boe(this._id,e)):this.styleTween(e,Roe(e,r,t),n).on(`end.style.`+e,null)}function Hoe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Uoe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Hoe(e,a,n)),r}return a._value=t,a}function Woe(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,Uoe(e,t,n??``))}function Goe(e){return function(){this.textContent=e}}function Koe(e){return function(){this.textContent=e(this)??``}}function qoe(e){return this.tween(`text`,typeof e==`function`?Koe(_8(this,`text`,e)):Goe(e==null?``:e+``))}function Joe(e){return function(t){this.textContent=e.call(this,t)}}function Yoe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Joe(r)),t}return r._value=e,r}function Xoe(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,Yoe(e))}function Zoe(){for(var e=this._name,t=this._id,n=x8(),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=h8(c,t);f8(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new b8(r,this._parents,e,n)}function Qoe(){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=m8(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 $oe=0;function b8(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ese(e){return R6().transition(e)}function x8(){return++$oe}var S8=R6.prototype;b8.prototype=ese.prototype={constructor:b8,select:Noe,selectAll:Poe,selectChild:S8.selectChild,selectChildren:S8.selectChildren,filter:Eoe,merge:Doe,selection:Ioe,transition:Zoe,call:S8.call,nodes:S8.nodes,node:S8.node,size:S8.size,empty:S8.empty,each:S8.each,on:Aoe,attr:uoe,attrTween:hoe,style:Voe,styleTween:Woe,text:qoe,textTween:Xoe,remove:Moe,tween:roe,delay:voe,duration:xoe,ease:Coe,easeVarying:Toe,end:Qoe,[Symbol.iterator]:S8[Symbol.iterator]};function tse(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var nse={time:null,delay:0,duration:250,ease:tse};function rse(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function ise(e){var t,n;e instanceof b8?(t=e._id,e=e._name):(t=x8(),(n=nse).time=o8(),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])&&f8(c,e,t,l,o,n||rse(c,t));return new b8(r,this._parents,e,t)}R6.prototype.interrupt=eoe,R6.prototype.transition=ise;var C8=e=>()=>e;function ase(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 w8(e,t,n){this.k=e,this.x=t,this.y=n}w8.prototype={constructor:w8,scale:function(e){return e===1?this:new w8(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new w8(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 T8=new w8(1,0,0);E8.prototype=w8.prototype;function E8(e){for(;!e.__zoom;)if(!(e=e.parentNode))return T8;return e.__zoom}function D8(e){e.stopImmediatePropagation()}function O8(e){e.preventDefault(),e.stopImmediatePropagation()}function ose(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function sse(){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 k8(){return this.__zoom||T8}function cse(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lse(){return navigator.maxTouchPoints||`ontouchstart`in this}function use(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 A8(){var e=ose,t=sse,n=use,r=cse,i=lse,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=LI,l=j3(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,k8).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`,k8),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(T8.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 w8(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 w8(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 w8(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=z6(this.that).datum();l.call(e,this.that,new ase(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=B6(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)],g8(this),s.start();O8(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=z6(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=B6(t,i),l=t.clientX,u=t.clientY;W6(t.view),D8(t),a.mouse=[c,this.__zoom.invert(c)],g8(this),a.start();function d(e){if(O8(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]=B6(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),G6(e.view,a.moved),O8(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=B6(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);O8(r),s>0?z6(this).transition().duration(s).call(x,d,c,r):z6(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(D8(t),s=0;s<i;++s)c=r[s],l=B6(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)),g8(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(O8(e),s=0;s<a;++s)c=i[s],l=B6(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(D8(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=B6(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=z6(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:C8(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:C8(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:C8(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:C8([[+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 j8={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.`},M8=[[-1/0,-1/0],[1/0,1/0]],N8=[`Enter`,` `,`Escape`],P8={"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`},F8;(function(e){e.Strict=`strict`,e.Loose=`loose`})(F8||={});var I8;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(I8||={});var L8;(function(e){e.Partial=`partial`,e.Full=`full`})(L8||={});var R8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},z8;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(z8||={});var B8;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(B8||={});var V8;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(V8||={});var H8={[V8.Left]:V8.Right,[V8.Right]:V8.Left,[V8.Top]:V8.Bottom,[V8.Bottom]:V8.Top};function U8(e){return e===null?null:e?`valid`:`invalid`}var W8=e=>`id`in e&&`source`in e&&`target`in e,dse=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),G8=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),K8=(e,t=[0,0])=>{let{width:n,height:r}=_5(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},fse=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:r5(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):G8(n)?n:t.nodeLookup.get(n.id)),t5(e,i?a5(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),q8=(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=t5(n,a5(e)),r=!0)}),r?r5(n):{x:0,y:0,width:0,height:0}},J8=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...d5(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=s5(s,i5(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},pse=(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 mse(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 hse({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=m5(q8(mse(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 Y8({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`,j8.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&g5(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=g5(d)?Z8(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,j8.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 gse({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=pse(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 X8=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Z8=(e={x:0,y:0},t,n)=>({x:X8(e.x,t[0][0],t[1][0]-(n?.width??0)),y:X8(e.y,t[0][1],t[1][1]-(n?.height??0))});function Q8(e,t,n){let{width:r,height:i}=_5(n),{x:a,y:o}=n.internals.positionAbsolute;return Z8(e,[[a,o],[a+r,o+i]],t)}var $8=(e,t,n)=>e<t?X8(Math.abs(e-t),1,t)/t:e>n?-X8(Math.abs(e-n),1,t)/t:0,e5=(e,t,n=15,r=40)=>[$8(e.x,r,t.width-r)*n,$8(e.y,r,t.height-r)*n],t5=(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)}),n5=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),r5=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),i5=(e,t=[0,0])=>{let{x:n,y:r}=G8(e)?e.internals.positionAbsolute:K8(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}},a5=(e,t=[0,0])=>{let{x:n,y:r}=G8(e)?e.internals.positionAbsolute:K8(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)}},o5=(e,t)=>r5(t5(n5(e),n5(t))),s5=(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)},c5=e=>l5(e.width)&&l5(e.height)&&l5(e.x)&&l5(e.y),l5=e=>!isNaN(e)&&isFinite(e),_se=(e,t)=>{},u5=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),d5=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?u5(s,o):s},f5=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function p5(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 vse(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=p5(e,n),i=p5(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=p5(e.top??e.y??0,n),i=p5(e.bottom??e.y??0,n),a=p5(e.left??e.x??0,t),o=p5(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 yse(e,t,n,r,i,a){let{x:o,y:s}=f5(e,[t,n,r]),{x:c,y:l}=f5({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 m5=(e,t,n,r,i,a)=>{let o=vse(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=X8(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=yse(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}},h5=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function g5(e){return e!=null&&e!==`parent`}function _5(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function v5(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function y5(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 b5(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function bse(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function xse(e){return{...P8,...e||{}}}function x5(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=E5(e),s=d5({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?u5(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var S5=e=>({width:e.offsetWidth,height:e.offsetHeight}),C5=e=>e?.getRootNode?.()||window?.document,Sse=[`INPUT`,`SELECT`,`TEXTAREA`];function w5(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Sse.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var T5=e=>`clientX`in e,E5=(e,t)=>{let n=T5(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)}},D5=(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,...S5(t)}})};function O5({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 k5(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function A5({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case V8.Left:return[t-k5(t-r,a),n];case V8.Right:return[t+k5(r-t,a),n];case V8.Top:return[t,n-k5(n-i,a)];case V8.Bottom:return[t,n+k5(i-n,a)]}}function j5({sourceX:e,sourceY:t,sourcePosition:n=V8.Bottom,targetX:r,targetY:i,targetPosition:a=V8.Top,curvature:o=.25}){let[s,c]=A5({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=A5({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=O5({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 M5({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 Cse({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 wse({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=t5(a5(e),a5(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),s5({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},r5(a))>0}var Tse=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Ese=(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)),Dse=(e,t,n={})=>{if(!e.source||!e.target)return j8.error006(),t;let r=n.getEdgeId||Tse,i;return i=W8(e)?{...e}:{...e,id:r(e)},Ese(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function N5({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=M5({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var P5={[V8.Left]:{x:-1,y:0},[V8.Right]:{x:1,y:0},[V8.Top]:{x:0,y:-1},[V8.Bottom]:{x:0,y:1}},Ose=({source:e,sourcePosition:t=V8.Bottom,target:n})=>t===V8.Left||t===V8.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},F5=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function kse({source:e,sourcePosition:t=V8.Bottom,target:n,targetPosition:r=V8.Top,center:i,offset:a,stepPosition:o}){let s=P5[t],c=P5[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=Ose({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]=M5({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 Ase(e,t,n,r){let i=Math.min(F5(e,t)/2,F5(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 I5({sourceX:e,sourceY:t,sourcePosition:n=V8.Bottom,targetX:r,targetY:i,targetPosition:a=V8.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=kse({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+=Ase(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function L5(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function jse(e){let{sourceNode:t,targetNode:n}=e;if(!L5(t)||!L5(n))return null;let r=t.internals.handleBounds||R5(t.handles),i=n.internals.handleBounds||R5(n.handles),a=B5(r?.source??[],e.sourceHandle),o=B5(e.connectionMode===F8.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,j8.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||V8.Bottom,c=o?.position||V8.Top,l=z5(t,a,s),u=z5(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function R5(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 z5(e,t,n=V8.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??_5(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case V8.Top:return{x:i+o/2,y:a};case V8.Right:return{x:i+o,y:a+s/2};case V8.Bottom:return{x:i+o/2,y:a+s};case V8.Left:return{x:i,y:a+s/2}}}function B5(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function V5(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Mse(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=V5(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 H5=1e3,Nse=10,U5={nodeOrigin:[0,0],nodeExtent:M8,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Pse={...U5,checkEquality:!0};function W5(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Fse(e,t,n){let r=W5(U5,n);for(let n of e.values())if(n.parentId)q5(n,e,t,r);else{let e=Z8(K8(n,r.nodeOrigin),g5(n.extent)?n.extent:r.nodeExtent,_5(n));n.internals.positionAbsolute=e}}function Ise(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 G5(e){return e===`manual`}function K5(e,t,n,r={}){let i=W5(Pse,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!G5(i.zIndexMode)?H5: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=Z8(K8(u,i.nodeOrigin),g5(u.extent)?u.extent:i.nodeExtent,_5(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Ise(u,e),z:J5(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&&q5(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Lse(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 q5(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=W5(U5,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}Lse(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*Nse),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Rse(e,u,o,s,a&&!G5(c)?H5: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 J5(e,t,n){let r=l5(e.zIndex)?e.zIndex:0;return G5(n)?r:r+(e.selected?t:0)}function Rse(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=_5(e),l=K8(e,n),u=g5(e.extent)?Z8(l,e.extent,c):l,d=Z8({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Q8(d,c,t));let f=J5(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Y5(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=o5(a.get(n.parentId)?.expandedRect??i5(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=_5(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 zse(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=S5(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=g5(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=Q8(h,s,t.get(e.parentId)):m&&(h=Z8(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:D5(`source`,r.nodeElement,p,d,e.id),target:D5(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&q5(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:i5(g,i)}))}}if(f.length>0){let e=Y5(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Bse({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 X5(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 Z5(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}`;X5(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),X5(`target`,s,c,e,i,o),t.set(r.id,r)}}function Q5(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Q5(n,t):!1}function $5(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 Vse(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Q5(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 e7({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 Hse({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=u5(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Use({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=z6(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?n5(q8(s)):null,x=v&&l?Hse({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)}:u5(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}=Y8({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]=e7({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]=e5(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=x5(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Vse(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=e7({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=J6().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=x5(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=E5(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=x5(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=E5(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=E5(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]=e7({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||!$5(t,`.${g}`,v))&&(!_||$5(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Wse(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())s5(i,i5(e))>0&&r.push(e);return r}var Gse=250;function Kse(e,t,n,r){let i=[],a=1/0,o=Wse(e,n,t+Gse);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}=z5(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 t7(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,...z5(o,c,c.position,!0)}:c}function n7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function qse(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var r7=()=>!0;function Jse(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:_=r7,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=C5(e.target),E=0,D,{x:O,y:k}=E5(e),A=n7(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=t7(i,A,r,c,t);if(!N)return;let ee=E5(e,j),P=!1,F=null,I=!1,te=null;function ne(){if(!u||!j)return;let[e,t]=e5(ee,j,S);f({x:e,y:t}),E=requestAnimationFrame(ne)}let re={...N,nodeId:i,type:A,position:N.position},L=c.get(i),R={inProgress:!0,isValid:null,from:z5(L,re,V8.Left,!0),fromHandle:re,fromPosition:re.position,fromNode:L,to:ee,toHandle:null,toPosition:H8[re.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}=E5(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ie()}if(!x()||!re){oe(e);return}let a=b();ee=E5(e,j),D=Kse(d5(ee,a,!1,[1,1]),n,c,re),P||=(ne(),!0);let s=i7(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});te=s.handleDomNode,F=s.connection,I=qse(!!D,s.isValid);let u=c.get(i),f=u?z5(u,re,V8.Left,!0):R.from,p={...R,from:f,isValid:I,to:s.toHandle&&I?f5({x:s.toHandle.x,y:s.toHandle.y},a):ee,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:H8[re.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||te)&&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,te=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 i7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=r7,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}=E5(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=n7(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===F8.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=t7(t,e,a,u,n,!0)}return _}var a7={onPointerDown:Jse,isValid:i7};function Yse({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=z6(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&&h5()?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=A8().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:B6}}var o7=e=>({x:e.x,y:e.y,zoom:e.k}),s7=({x:e,y:t,zoom:n})=>T8.translate(e,t).scale(n),c7=(e,t)=>e.target.closest(`.${t}`),l7=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xse=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,u7=(e,t=0,n=Xse,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},d7=e=>{let t=e.ctrlKey&&h5()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Zse({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(c7(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=B6(u),t=d*2**d7(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===I8.Vertical?0:u.deltaX*f,m=i===I8.Horizontal?0:u.deltaY*f;!h5()&&u.shiftKey&&i!==I8.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=o7(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 Qse({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=c7(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function $se({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=o7(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 ece({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&l7(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,o7(a.transform))}}function tce({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&l7(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=o7(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function nce({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`&&(c7(d,`${l}-flow__node`)||c7(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||c7(d,s)&&m||c7(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 rce({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=A8().scaleExtent([t,n]).translateExtent(r),f=z6(e).call(d);v({x:i.x,y:i.y,zoom:X8(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(d7);function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?kI:LI).transform(u7(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:!l5(E)||E<0?0:E);let k=O?Zse({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Qse({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(f.on(`wheel.zoom`,k,{passive:!1}),!r){let e=$se({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,e);let t=ece({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,t);let r=tce({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,r)}let A=nce({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=s7(e),i=d?.constrain()(r,t,n);return i&&await h(i),new Promise(e=>e(i))}async function y(e,t){let n=s7(e);return await h(n,t),new Promise(e=>e(n))}function b(e){if(f){let t=s7(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?E8(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`?kI:LI).scaleTo(u7(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`?kI:LI).scaleBy(u7(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=!l5(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 f7;(function(e){e.Line=`line`,e.Handle=`handle`})(f7||={});function ice({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 p7(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 m7(e,t){return Math.max(0,t-e)}function h7(e,t){return Math.max(0,e-t)}function g7(e,t,n){return Math.max(0,t-e,e-n)}function _7(e,t){return e?!t:t}function ace(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=g7(E,h,g),j=g7(D,_,v);if(o){let e=0,t=0;c&&w<0?e=m7(y+w+O,o[0][0]):!c&&w>0&&(e=h7(y+E+O,o[1][0])),l&&T<0?t=m7(b+T+k,o[0][1]):!l&&T>0&&(t=h7(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=h7(y+w,s[0][0]):!c&&w<0&&(e=m7(y+E,s[1][0])),l&&T>0?t=h7(b+T,s[0][1]):!l&&T<0&&(t=m7(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=g7(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?h7(b+k+E/C,o[1][1])*C:m7(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?m7(b+E/C,s[1][1])*C:h7(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=g7(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?h7(y+D*C+O,o[1][0])/C:m7(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?m7(y+D*C,s[1][0])/C:h7(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=(_7(c,l)?-w:w)/C:w=(_7(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 v7={width:0,height:0,x:0,y:0},oce={...v7,pointerX:0,pointerY:0,aspectRatio:1};function sce(e){return[[0,0],[e.measured.width,e.measured.height]]}function cce(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 lce({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=z6(e),o={controlDirection:p7(`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={...v7},h={...oce};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:p7(e)};let g,_=null,v=[],y,b,x,S=!1,C=J6().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}=x5(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`?sce(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=cce(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=x5(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}=ace(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=ice({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 y7=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},uce=e=>e?y7(e):y7,{useDebugValue:dce}=z.default,{useSyncExternalStoreWithSelector:fce}=Iw.default,pce=e=>e;function b7(e,t=pce,n){let r=fce(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return dce(r),r}var x7=(e,t)=>{let n=uce(e),r=(e,r=t)=>b7(n,e,r);return Object.assign(r,n),r},mce=(e,t)=>e?x7(e,t):x7;function S7(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 C7=(0,z.createContext)(null),hce=C7.Provider,w7=j8.error001();function T7(e,t){let n=(0,z.useContext)(C7);if(n===null)throw Error(w7);return b7(n,e,t)}function E7(){let e=(0,z.useContext)(C7);if(e===null)throw Error(w7);return(0,z.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var D7={display:`none`},gce={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},O7=`react-flow__node-desc`,k7=`react-flow__edge-desc`,_ce=`react-flow__aria-live`,vce=e=>e.ariaLiveMessage,yce=e=>e.ariaLabelConfig;function bce({rfId:e}){let t=T7(vce);return(0,B.jsx)(`div`,{id:`${_ce}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:gce,children:t})}function xce({rfId:e,disableKeyboardA11y:t}){let n=T7(yce);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{id:`${O7}-${e}`,style:D7,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,B.jsx)(`div`,{id:`${k7}-${e}`,style:D7,children:n[`edge.a11yDescription.default`]}),!t&&(0,B.jsx)(bce,{rfId:e})]})}var A7=(0,z.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,B.jsx)(`div`,{className:k3([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));A7.displayName=`Panel`;function Sce({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,B.jsx)(A7,{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 Cce=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}},j7=e=>e.id;function wce(e,t){return S7(e.selectedNodes.map(j7),t.selectedNodes.map(j7))&&S7(e.selectedEdges.map(j7),t.selectedEdges.map(j7))}function Tce({onSelectionChange:e}){let t=E7(),{selectedNodes:n,selectedEdges:r}=T7(Cce,wce);return(0,z.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Ece=e=>!!e.onSelectionChangeHandlers;function Dce({onSelectionChange:e}){let t=T7(Ece);return e||t?(0,B.jsx)(Tce,{onSelectionChange:e}):null}var M7=typeof window<`u`?z.useLayoutEffect:z.useEffect,N7=[0,0],Oce={x:0,y:0,zoom:1},P7=[...`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`],kce=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}),F7={translateExtent:M8,nodeOrigin:N7,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Ace(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=T7(kce,S7),l=E7();M7(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=F7,s()}),[]);let u=(0,z.useRef)(F7);return M7(()=>{for(let s of P7){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:xse(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},P7.map(t=>e[t])),null}function I7(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function jce(e){let[t,n]=(0,z.useState)(e===`system`?null:e);return(0,z.useEffect)(()=>{if(e!==`system`){n(e);return}let t=I7(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?I7()?.matches?`dark`:`light`:t}var L7=typeof document<`u`?document:null;function R7(e=null,t={target:L7,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(`+`,`
|
|
70
|
+
…`:m}),g&&(0,B.jsx)(`button`,{onClick:()=>c(r.id),className:`mt-2 text-xs text-blue-600 hover:underline flex items-center gap-1`,children:f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Vs,{className:`w-3 h-3`}),`收起`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Rs,{className:`w-3 h-3`}),`展开全部(`,h.length,` 行)`]})})]}),r.status===`in_progress`&&h.length===0&&(0,B.jsxs)(`div`,{className:`border-t border-blue-100 bg-blue-50 px-4 py-3 flex items-center gap-2 text-sm text-blue-600`,children:[(0,B.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-500 animate-pulse`}),`正在执行,等待产出…`]})]},r.id)})})]})}var g3={PreToolUse:`#3b82f6`,PostToolUse:`#10b981`,UserPromptSubmit:`#f59e0b`,Stop:`#ef4444`};function _3(){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,isError:d,error:f}=ct({queryKey:[`pipeline`,e],queryFn:()=>ul(e).then(e=>e.data),enabled:!!e,refetchInterval:5e3}),p=lt({mutationFn:()=>Sl(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),t(c)},onError:e=>Zc(e.message||`关闭失败`,`error`)}),m=lt({mutationFn:()=>El(e),onSuccess:()=>{Zc(`已添加到执行队列,下次工具调用时自动注入提示`,`success`)},onError:e=>Zc(e.message||`恢复失败`,`error`)}),h=lt({mutationFn:t=>Dl(e),onSuccess:t=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),Zc(t.data.message||`节点已重置,等待重新执行`,`success`)},onError:e=>Zc(e.message||`重试失败`,`error`)});if(d)return(0,B.jsxs)(`div`,{className:`flex items-center justify-center h-96 text-red-500`,children:[`加载失败:`,f?.message||`未知错误`]});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 g=l,_=g.status!==`completed`&&g.status!==`failed`;return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(F4,{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)(Y,{variant:`ghost`,size:`sm`,icon:Ds,onClick:()=>t(c),children:`返回`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`h2`,{className:`text-lg font-bold text-gray-900`,children:`Pipeline 执行轨迹`}),(0,B.jsxs)(Fx,{variant:`primary`,size:`sm`,children:[(0,B.jsx)(Uc,{className:`w-3 h-3 mr-1`}),` 动态编排`]})]}),(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)(Fx,{variant:_?`info`:`success`,children:g.status===`completed`?`已完成`:g.status===`failed`?`已失败`:`执行中`}),(0,B.jsx)(Fx,{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)(Y,{variant:`secondary`,size:`sm`,icon:Ts,onClick:()=>t(`/sessions/${l.sessionId}`),children:`查看会话`}),_&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Y,{variant:`primary`,size:`sm`,onClick:()=>m.mutate(),loading:m.isPending,children:`继续执行`}),(0,B.jsx)(Y,{variant:`danger`,size:`sm`,icon:Gc,onClick:()=>{s({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{p.mutate(),s(e=>({...e,open:!1}))}})},children:`关闭`})]})]})]}),(0,B.jsx)(X,{className:`!p-4`,children:(0,B.jsx)(`p`,{className:`text-sm text-gray-700 line-clamp-3`,children:l.requirement})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-3`,children:[(0,B.jsxs)(X,{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)(X,{className:`text-center !p-3`,children:[(0,B.jsx)(`div`,{className:`text-xl font-bold text-green-600`,children:`${g.stats.completedNodes}/${g.stats.totalNodes}`}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`节点`})]}),(0,B.jsxs)(X,{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)(X,{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)(X,{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:q(`px-4 py-2 rounded-md text-sm font-medium transition-colors`,i===e?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`),children:{tasks:`编排图 (${g.stats.totalNodes})`,events:`事件 (${l.stats.totalEvents})`,artifacts:`产物 (${l.stats.totalArtifacts})`,quality:`质量 (${l.stats.totalQualityIssues})`}[e]},e))}),i===`tasks`&&(0,B.jsx)(`div`,{className:`space-y-4`,children:(0,B.jsx)(h3,{pipeline:g,onRetryNode:e=>{s({open:!0,title:`重试失败节点`,description:`确定要重试此节点吗?节点状态将重置为等待中,下次工具调用时自动重新执行。`,onConfirm:()=>{h.mutate(e),s(e=>({...e,open:!1}))}})}})}),i===`events`&&(0,B.jsx)(X,{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)(Mx.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:T4(tf(e.time),`HH:mm:ss`)}),(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:g3[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)(X,{title:`产物文件`,children:(0,B.jsxs)(`div`,{className:`space-y-2`,children:[l.artifacts.map((e,t)=>(0,B.jsx)(Mx.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)(nc,{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,` · `,T4(tf(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)(X,{title:`质量问题`,children:(0,B.jsxs)(`div`,{className:`space-y-2`,children:[l.qualityIssues.map((e,t)=>(0,B.jsxs)(Mx.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)(Us,{className:`h-5 w-5 text-green-500 mt-0.5`}):(0,B.jsx)(Vc,{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)(Fx,{size:`sm`,variant:e.level===`error`?`danger`:e.level===`warn`?`warning`:`info`,children:e.level}),(0,B.jsx)(Fx,{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:T4(tf(e.createdAt),`MM-dd HH:mm`)})]})]}),(0,B.jsx)(Fx,{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)(Ac,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`暂无质量问题`]})]})}),(0,B.jsx)(O4,{open:o.open,title:o.title,description:o.description,variant:`danger`,onConfirm:o.onConfirm,onCancel:()=>s({...o,open:!1})})]})}var v3={spec:{label:`规格`,icon:ic,color:`text-blue-600`,bg:`bg-blue-50`,border:`border-blue-200`},security:{label:`安全`,icon:jc,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-200`},quality:{label:`质量`,icon:nc,color:`text-purple-600`,bg:`bg-purple-50`,border:`border-purple-200`},test:{label:`测试`,icon:Rc,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-200`},performance:{label:`性能`,icon:Kc,color:`text-orange-600`,bg:`bg-orange-50`,border:`border-orange-200`}},y3={fail:{label:`失败`,icon:Gs,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-300`},warn:{label:`警告`,icon:Vc,color:`text-yellow-600`,bg:`bg-yellow-50`,border:`border-yellow-300`},pass:{label:`通过`,icon:Us,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-300`}};function b3({level:e}){let t=y3[e];if(!t)return(0,B.jsx)(Fx,{size:`sm`,children:e});let n=t.icon;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),t.label]})}function x3({category:e}){let t=v3[e];if(!t)return(0,B.jsx)(Fx,{size:`sm`,children:e});let n=t.icon;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),t.label]})}function S3(){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)(1),[h,g]=(0,z.useState)(20),[_,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(null),[x,S]=(0,z.useState)(new Set),[C,w]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:T,isError:E,refetch:D}=ct({queryKey:[`quality-unresolved`],queryFn:()=>fl().then(e=>e.data),refetchInterval:1e4}),{data:O}=ct({queryKey:[`quality-history`,r,a,s,l,t],queryFn:()=>dl({limit:500,level:r||void 0,category:a||void 0,resolved:s===`resolved`?!0:s===`unresolved`?!1:void 0,project_path:l||void 0,search:t||void 0}).then(e=>e.data)}),{data:k}=ct({queryKey:[`quality-history`,`all`],queryFn:()=>dl({limit:500}).then(e=>e.data)}),A=lt({mutationFn:e=>Wl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),j=lt({mutationFn:e=>Gl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),M=lt({mutationFn:()=>ql(),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),N=lt({mutationFn:e=>Kl(e),onSuccess:()=>{S(new Set),e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),ee=async e=>{try{let t=await Jl(e);await navigator.clipboard.writeText(t.data.context),b(e),Zc(`上下文已复制,请粘贴到 Claude Code 进行修复`,`success`),setTimeout(()=>b(null),3e3)}catch{Zc(`复制失败`,`error`)}},P=O?.items||[],F=Math.ceil(P.length/h),I=P.slice((p-1)*h,p*h),te=k?.total||0,ne=T?.total||0,re=P.filter(e=>e.level===`fail`).length,L=P.filter(e=>e.level===`warn`).length,R=Array.from(new Set(k?.items.map(e=>e.level)||[])),ie=Array.from(new Set(k?.items.map(e=>e.category)||[])),ae=Array.from(new Set(k?.items.map(e=>e.project_path?.split(`/`).pop()||``).filter(Boolean)||[])),oe=[r,a,s,l].filter(Boolean).length,se=()=>{let e=[`级别`,`类别`,`消息`,`项目`,`状态`,`创建时间`],t=P.map(e=>[e.level,e.category,e.message,e.project_path?.split(`/`).pop()||``,e.resolved?`已解决`:`未解决`,e.created_at?T4(tf(e.created_at),`yyyy-MM-dd HH:mm:ss`):``]);M4(`quality-issues-${T4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)};return E?(0,B.jsx)(N4,{message:`质量数据加载失败`,onRetry:()=>D()}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(X,{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)(Oc,{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),m(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:()=>f(e=>!e),className:q(`flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border transition-colors`,d||oe>0?`border-blue-300 bg-blue-50 text-blue-700`:`border-gray-200 text-gray-600 hover:bg-gray-50`),children:[(0,B.jsx)(sc,{className:`h-4 w-4`}),`筛选`,oe>0&&(0,B.jsx)(`span`,{className:`ml-1 px-1.5 py-0.5 bg-blue-600 text-white text-xs rounded-full`,children:oe}),(0,B.jsx)(Rs,{className:q(`h-3.5 w-3.5 transition-transform`,d&&`rotate-180`)})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[x.size>0&&(0,B.jsxs)(Y,{variant:`secondary`,size:`sm`,icon:Gc,onClick:()=>w({open:!0,title:`批量忽略问题`,description:`确认忽略选中的 ${x.size} 个问题?`,onConfirm:()=>{N.mutate(Array.from(x)),w(e=>({...e,open:!1}))}}),loading:N.isPending,children:[`忽略 (`,x.size,`)`]}),ne>0&&(0,B.jsx)(Y,{variant:`primary`,size:`sm`,icon:Ls,onClick:()=>w({open:!0,title:`全部标记已修复`,description:`确认将 ${ne} 个问题全部标记为已修复?`,onConfirm:()=>{M.mutate(),w(e=>({...e,open:!1}))}}),loading:M.isPending,children:`全部已修复`}),(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Qs,onClick:()=>P.length>0&&se(),children:`导出`})]})]}),d&&(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),m(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:`全部级别`}),R.map(e=>(0,B.jsx)(`option`,{value:e,children:y3[e]?.label||e},e))]}),(0,B.jsxs)(`select`,{value:a,onChange:e=>{o(e.target.value),m(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:`全部类别`}),ie.map(e=>(0,B.jsx)(`option`,{value:e,children:v3[e]?.label||e},e))]}),(0,B.jsxs)(`select`,{value:s,onChange:e=>{c(e.target.value),m(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:`resolved`,children:`已解决`}),(0,B.jsx)(`option`,{value:`unresolved`,children:`未解决`})]}),(0,B.jsxs)(`select`,{value:l,onChange:e=>{u(e.target.value),m(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:`全部项目`}),ae.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,B.jsxs)(X,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-red-600`,children:re}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`失败`})]}),(0,B.jsxs)(X,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-amber-600`,children:L}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`警告`})]}),(0,B.jsxs)(X,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-orange-600`,children:ne}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`未解决`})]}),(0,B.jsxs)(X,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:te}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`总检查`})]})]}),(0,B.jsxs)(X,{title:`问题列表 (${P.length})`,action:P.length>0?(0,B.jsx)(`button`,{onClick:()=>{let e=I.filter(e=>!e.resolved).map(e=>String(e.id));x.size===e.length&&e.length>0?S(new Set):S(new Set(e))},className:`text-xs text-blue-600 hover:underline`,children:x.size>0?`取消全选`:`全选当前页未解决`}):void 0,children:[(0,B.jsx)(`div`,{className:`space-y-2`,children:I.map((e,t)=>{let n=_===String(e.id||t);return(0,B.jsxs)(`div`,{className:`rounded-lg border border-gray-100 overflow-hidden`,children:[(0,B.jsxs)(Mx.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:t*.02},className:q(`flex items-center gap-3 p-4 cursor-pointer transition-all`,x.has(String(e.id))?`bg-blue-50`:`hover:bg-gray-50`),onClick:()=>v(n?null:String(e.id||t)),children:[e.resolved?(0,B.jsx)(`div`,{className:`h-4 w-4 flex-shrink-0`}):(0,B.jsx)(`input`,{type:`checkbox`,checked:x.has(String(e.id)),onChange:t=>{t.stopPropagation(),S(t=>{let n=new Set(t);return n.has(String(e.id))?n.delete(String(e.id)):n.add(String(e.id)),n})},onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded border-gray-300 text-blue-600 cursor-pointer flex-shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 grid grid-cols-1 md:grid-cols-5 gap-3 items-center min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,B.jsx)(b3,{level:e.level}),(0,B.jsx)(x3,{category:e.category})]}),(0,B.jsx)(`div`,{className:`md:col-span-2 min-w-0`,children:(0,B.jsx)(`p`,{className:`text-sm text-gray-700 truncate`,children:e.message})}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500 truncate`,children:e.project_path?.split(`/`).pop()||`-`}),(0,B.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,B.jsx)(Fx,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`}),(0,B.jsx)(`span`,{className:`text-xs text-gray-400 flex-shrink-0`,children:e.created_at?T4(tf(e.created_at),`MM-dd HH:mm`):``}),n?(0,B.jsx)(Rs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`}):(0,B.jsx)(Bs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`})]})]})]}),(0,B.jsx)(Hy,{children:n&&(0,B.jsx)(Mx.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 break-all`,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?T4(tf(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:T4(tf(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)(Y,{variant:`ghost`,size:`sm`,icon:y===String(e.id)?Is:Ys,onClick:t=>{t.stopPropagation(),ee(String(e.id))},children:y===String(e.id)?`已复制`:`复制上下文`}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Ls,onClick:t=>{t.stopPropagation(),A.mutate(String(e.id))},loading:A.isPending,children:`标记已修复`}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Gc,onClick:t=>{t.stopPropagation(),j.mutate(String(e.id))},loading:j.isPending,children:`忽略`})]})]})})})]},e.id||t)})}),P.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,B.jsx)(Us,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`没有符合条件的记录`]}),P.length>0&&(0,B.jsx)(j4,{currentPage:p,totalPages:F,onPageChange:m,pageSize:h,onPageSizeChange:e=>{g(e),m(1)},totalItems:P.length})]}),(0,B.jsx)(O4,{open:C.open,title:C.title,description:C.description,variant:`warning`,onConfirm:C.onConfirm,onCancel:()=>w({...C,open:!1})})]})}var C3=[{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 w3(){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:()=>el().then(e=>e.data)}),{data:v,refetch:y}=ct({queryKey:[`daemon-diagnosis`],queryFn:()=>Zl().then(e=>e.data),enabled:a===`environment`}),{data:b,refetch:x}=ct({queryKey:[`backups`],queryFn:()=>eu().then(e=>e.data),enabled:a===`backup_mgmt`}),{data:S}=ct({queryKey:[`config-history`],queryFn:()=>nl().then(e=>e.data),enabled:a===`history`}),{data:C}=ct({queryKey:[`daemon-status`],queryFn:()=>Yl().then(e=>e.data),enabled:a===`backup_mgmt`}),w=lt({mutationFn:()=>$l(),onSuccess:()=>{x(),i(`success`),setTimeout(()=>i(`idle`),3e3)},onError:()=>{i(`error`),setTimeout(()=>i(`idle`),3e3)}}),T=lt({mutationFn:()=>Ql(),onSuccess:e=>{d(e.data),y()}});(0,z.useEffect)(()=>{g&&!t&&n(g)},[g,t]);let E=lt({mutationFn:e=>tl(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(C3.map(e=>e.key)))}catch{Zc(`配置文件格式错误,请选择有效的 JSON 文件`,`error`)}},r.readAsText(t)},e.click()},ee=C3.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)(X,{className:`!p-2 sticky top-6`,children:(0,B.jsxs)(`nav`,{className:`space-y-1`,children:[C3.map(e=>(0,B.jsx)(`button`,{onClick:()=>o(e.key),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors`,a===e.key?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:e.title},e.key)),(0,B.jsx)(`div`,{className:`border-t border-gray-100 my-1`}),(0,B.jsxs)(`button`,{onClick:()=>o(`backup_mgmt`),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,a===`backup_mgmt`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,B.jsx)(Xs,{className:`h-3.5 w-3.5`}),`数据备份`]}),(0,B.jsxs)(`button`,{onClick:()=>o(`environment`),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,a===`environment`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,B.jsx)(Ac,{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)(Hy,{children:[r===`success`&&(0,B.jsxs)(Mx.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)(Us,{className:`h-4 w-4`}),`已保存`]}),r===`error`&&(0,B.jsxs)(Mx.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)(Gs,{className:`h-4 w-4`}),`保存失败`]})]}),l&&(0,B.jsx)(Fx,{variant:`warning`,children:`未保存`}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Qs,onClick:M,children:`导出`}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Hc,onClick:N,children:`导入`}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Ec,onClick:j,disabled:!l,children:`撤销`}),(0,B.jsx)(Y,{variant:`primary`,size:`sm`,icon:Dc,onClick:A,loading:E.isPending,disabled:!l,children:`保存`})]})]}),a!==`environment`&&a!==`backup_mgmt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(X,{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:q(`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:q(`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)(ec,{className:`h-4 w-4`}):(0,B.jsx)(tc,{className:`h-4 w-4`})})]})})]},e.key))})}),(0,B.jsx)(X,{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)(Y,{variant:`danger`,size:`sm`,icon:Vc,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)(X,{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)(lc,{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)(Y,{variant:`primary`,size:`sm`,icon:Xs,onClick:()=>w.mutate(),loading:w.isPending,children:`立即备份`})]})}),(0,B.jsxs)(X,{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)(Y,{variant:`ghost`,size:`sm`,icon:Tc,onClick:()=>x(),children:`刷新`})]}),b&&b.items.length>0?(0,B.jsx)(`div`,{className:`space-y-2`,children:b.items.map(e=>(0,B.jsxs)(`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:[T4(new Date(e.createdAt),`yyyy-MM-dd HH:mm:ss`),` · `,e.sizeMb,` MB 内存占用`]})]}),(0,B.jsx)(`a`,{href:tu(e.filename),download:e.filename,className:`ml-3 flex-shrink-0`,children:(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Qs,children:`下载`})})]},e.filename))}):(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无备份记录`})]}),(0,B.jsxs)(X,{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:`数据管理`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:`清理历史事件`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:`删除超过指定天数的事件记录`})]}),(0,B.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`清理历史事件`,description:`确定要清理 30 天前的事件记录吗?此操作不可撤销。`,onConfirm:()=>{W.post(`/events/purge`,{retentionDays:30}).then(()=>{Zc(`事件清理完成`,`success`),h(e=>({...e,open:!1}))}).catch(()=>{Zc(`事件清理失败`,`error`),h(e=>({...e,open:!1}))})}})},children:`清理 30 天前`})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:`数据库优化`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:`执行 VACUUM 回收空间,提升性能`})]}),(0,B.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`数据库优化`,description:`确定要执行 VACUUM 优化吗?此操作可能需要几分钟。`,onConfirm:()=>{W.post(`/config/vacuum`).then(()=>{Zc(`数据库优化完成`,`success`),h(e=>({...e,open:!1}))}).catch(()=>{Zc(`数据库优化失败`,`error`),h(e=>({...e,open:!1}))})}})},children:`立即优化`})]})]})]})]}),a===`history`&&(0,B.jsxs)(X,{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:T4(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)})]}),(0,B.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`确认恢复配置`,description:`确定要恢复到 ${T4(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)} 的配置吗?当前配置将被覆盖。`,onConfirm:()=>{E.mutate(e.config),h(e=>({...e,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)(X,{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)(Y,{variant:`secondary`,size:`sm`,icon:Tc,onClick:()=>y(),children:`重新检测`}),(0,B.jsx)(Y,{size:`sm`,icon:Wc,onClick:()=>T.mutate(),disabled:T.isPending||v?.hooksHealthy,children:T.isPending?`修复中...`:`一键修复`})]})]})}),u&&(0,B.jsx)(X,{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)(Us,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,B.jsx)(Vc,{className:`h-4 w-4 text-yellow-500 mt-0.5 flex-shrink-0`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:q(`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)(Y,{variant:`ghost`,size:`sm`,icon:Gs,onClick:()=>d(null)})]})}),v&&(0,B.jsx)(X,{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)(Us,{className:`h-4 w-4 text-green-500`}):e.id===`daemon_process`?(0,B.jsx)(Vc,{className:`h-4 w-4 text-yellow-500`}):(0,B.jsx)(Gs,{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)(X,{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)(Us,{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)(Vc,{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)(O4,{open:m.open,title:m.title,description:m.description,variant:`danger`,onConfirm:m.onConfirm,onCancel:()=>h({...m,open:!1})})]})}function T3({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 E3=[`#667eea`,`#10b981`,`#f59e0b`,`#ef4444`,`#8b5cf6`,`#06b6d4`],D3={"7d":7,"30d":30,"90d":90,custom:0};function O3(){let[e,t]=(0,z.useState)(`30d`),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),o=D3[e],s=e===`custom`?n?`${n}T00:00:00`:void 0:T4(D4(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:()=>rl({limit:500,start_time:s,end_time:c}).then(e=>e.data)}),{data:p,isLoading:m,isError:h,refetch:g}=ct({queryKey:[`events`,{limit:1e3,startTime:s,endTime:c}],queryFn:()=>sl({limit:1e3,start_time:s,end_time:c}).then(e=>e.data)}),{data:_,isLoading:v}=ct({queryKey:[`event-stats`],queryFn:()=>cl().then(e=>e.data)}),{data:y}=ct({queryKey:[`api-usage-stats`,e],queryFn:()=>ru(e===`custom`?90:o).then(e=>e.data),staleTime:6e4}),b=u||m||v,x=d||h,S=()=>{M4(`analytics-sessions-${T4(new Date,`yyyyMMdd`)}.csv`,[`日期`,`会话数`],C.map(e=>[e.date,e.count])),M4(`analytics-tools-${T4(new Date,`yyyyMMdd`)}.csv`,[`工具`,`使用次数`],D.map(e=>[e.name,e.value])),M4(`analytics-projects-${T4(new Date,`yyyyMMdd`)}.csv`,[`项目`,`事件数`],T.map(e=>[e.name,e.value])),M4(`analytics-durations-${T4(new Date,`yyyyMMdd`)}.csv`,[`时长区间`,`会话数`],k.map(e=>[e.range,e.count]))},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=T4(new Date(e.getTime()+n*24*60*60*1e3),`MM-dd`);return{date:r,count:l.items.filter(e=>T4(tf(e.start_time),`MM-dd`)===r).length}})}return Array.from({length:o},(e,t)=>{let n=T4(D4(new Date,o-1-t),`MM-dd`);return{date:n,count:l.items.filter(e=>T4(tf(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=>tf(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={Bash:`Bash 命令`,Read:`读取文件`,Edit:`编辑文件`,Write:`写入文件`,Grep:`搜索内容`,Glob:`查找文件`,Agent:`子代理`,WebFetch:`网页获取`,WebSearch:`网页搜索`,TodoWrite:`任务管理`,NotebookEdit:`笔记编辑`,stop:`停止`,notification:`通知`,UserPrompt:`用户输入`,TaskCreate:`创建任务`,TaskUpdate:`更新任务`,TaskList:`任务列表`,TaskGet:`获取任务`,TaskStop:`停止任务`,TaskOutput:`任务输出`},D=(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[e]||e,value:t}))},[p?.items]),{sessionDurations:O,durationBuckets:k}=(0,z.useMemo)(()=>{if(!l?.items)return{sessionDurations:[],durationBuckets:[]};let e=l.items.filter(e=>e.end_time).map(e=>{let t=(tf(e.end_time).getTime()-tf(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:A,avgSessionDuration:j}=(0,z.useMemo)(()=>{let e=O.filter(e=>e>0&&e<=480),t=e.length>0?e.reduce((e,t)=>e+t,0)/e.length:0,n=l?.items.filter(e=>e.event_count>0&&e.event_count<=500)??[];return{avgSessionEvents:n.length>0?n.reduce((e,t)=>e+t.event_count,0)/n.length:0,avgSessionDuration:t}},[l?.items,O]);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)(N4,{message:`分析数据加载失败`,onRetry:()=>{f(),g()}}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(X,{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)(Ps,{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:q(`px-3 py-1.5 text-sm transition-colors`,e===n?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:n===`7d`?`7 天`:n===`30d`?`30 天`:n===`90d`?`90 天`:`自定义`},n))})]}),(0,B.jsx)(Y,{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)(X,{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:A.toFixed(1)}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`平均会话事件数`})]}),(0,B.jsxs)(X,{className:`text-center !p-4`,children:[(0,B.jsx)(Ks,{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:j.toFixed(1)}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`平均会话时长(分钟)`})]}),(0,B.jsxs)(X,{className:`text-center !p-4`,children:[(0,B.jsx)(Kc,{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)(X,{className:`text-center !p-4`,children:[(0,B.jsx)(Bc,{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)(X,{title:`最近 ${o} 天会话趋势`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(_2,{data:C,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`date`}),(0,B.jsx)(p1,{}),(0,B.jsx)(WW,{}),(0,B.jsx)(jQ,{type:`monotone`,dataKey:`count`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3})]})})})}),(0,B.jsx)(X,{title:`24 小时事件分布`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(q0,{data:w,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`hour`}),(0,B.jsx)(p1,{}),(0,B.jsx)(WW,{}),(0,B.jsx)(KZ,{type:`monotone`,dataKey:`count`,stroke:`#10b981`,strokeWidth:2})]})})})}),(0,B.jsx)(X,{title:`项目活跃度 Top 10`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(Y0,{data:T,layout:`vertical`,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{type:`number`}),(0,B.jsx)(p1,{dataKey:`name`,type:`category`,width:100}),(0,B.jsx)(WW,{}),(0,B.jsx)(j$,{dataKey:`value`,fill:`#667eea`})]})})})}),(0,B.jsx)(X,{title:`工具使用排行 Top 15`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(Y0,{data:D,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`name`,angle:-45,textAnchor:`end`,height:80}),(0,B.jsx)(p1,{}),(0,B.jsx)(WW,{}),(0,B.jsx)(j$,{dataKey:`value`,fill:`#10b981`})]})})})}),(0,B.jsx)(X,{title:`会话时长分布`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(h2,{children:[(0,B.jsx)(HJ,{data:k,cx:`50%`,cy:`50%`,labelLine:!1,label:({range:e,count:t})=>`${e}: ${t}`,outerRadius:80,fill:`#8884d8`,dataKey:`count`,children:k.map((e,t)=>(0,B.jsx)(GW,{fill:E3[t%E3.length]},`cell-${t}`))}),(0,B.jsx)(WW,{})]})})})}),(0,B.jsx)(X,{title:`事件类型趋势`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(_2,{data:_?.stats.slice(0,30)||[],children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`date`}),(0,B.jsx)(p1,{}),(0,B.jsx)(WW,{}),(0,B.jsx)(QA,{}),(0,B.jsx)(jQ,{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)(Zs,{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)(X,{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)(X,{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)(X,{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)(X,{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)(X,{title:`每日 Token 趋势`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(_2,{data:y.dailyTrend,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`date`}),(0,B.jsx)(p1,{}),(0,B.jsx)(WW,{formatter:e=>`${(e/1e3).toFixed(1)}K`}),(0,B.jsx)(QA,{}),(0,B.jsx)(jQ,{type:`monotone`,dataKey:`tokens_in`,name:`输入`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3,stackId:`1`}),(0,B.jsx)(jQ,{type:`monotone`,dataKey:`tokens_out`,name:`输出`,stroke:`#10b981`,fill:`#10b981`,fillOpacity:.3,stackId:`1`})]})})})}),(0,B.jsx)(X,{title:`每日费用趋势(USD)`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(Y0,{data:y.dailyTrend,children:[(0,B.jsx)($X,{strokeDasharray:`3 3`}),(0,B.jsx)(Q$,{dataKey:`date`}),(0,B.jsx)(p1,{tickFormatter:e=>`$${e.toFixed(3)}`}),(0,B.jsx)(WW,{formatter:e=>`$${e.toFixed(4)}`}),(0,B.jsx)(j$,{dataKey:`cost_usd`,name:`费用`,fill:`#f59e0b`})]})})})}),y.byModel.length>0&&(0,B.jsx)(X,{title:`按模型费用分布`,children:(0,B.jsx)(T3,{children:(0,B.jsx)($O,{width:`100%`,height:250,children:(0,B.jsxs)(h2,{children:[(0,B.jsx)(HJ,{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:E3[t%E3.length]},t))}),(0,B.jsx)(WW,{formatter:e=>`$${e.toFixed(4)}`})]})})})})]})]})]})}function k3(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=k3(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var A3={value:()=>{}};function j3(){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 M3(n)}function M3(e){this._=e}function N3(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}})}M3.prototype=j3.prototype={constructor:M3,on:function(e,t){var n=this._,r=N3(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=P3(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]=F3(n[i],e.name,t);else if(t==null)for(i in n)n[i]=F3(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 M3(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 P3(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function F3(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=A3,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var I3={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 L3(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),I3.hasOwnProperty(t)?{space:I3[t],local:e}:e}function R3(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 z3(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function B3(e){var t=L3(e);return(t.local?z3:R3)(t)}function V3(){}function H3(e){return e==null?V3:function(){return this.querySelector(e)}}function U3(e){typeof e!=`function`&&(e=H3(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new L6(r,this._parents)}function W3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function G3(){return[]}function K3(e){return e==null?G3:function(){return this.querySelectorAll(e)}}function q3(e){return function(){return W3(e.apply(this,arguments))}}function J3(e){e=typeof e==`function`?q3(e):K3(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new L6(r,i)}function Y3(e){return function(){return this.matches(e)}}function X3(e){return function(t){return t.matches(e)}}var Z3=Array.prototype.find;function Q3(e){return function(){return Z3.call(this.children,e)}}function $3(){return this.firstElementChild}function e6(e){return this.select(e==null?$3:Q3(typeof e==`function`?e:X3(e)))}var t6=Array.prototype.filter;function n6(){return Array.from(this.children)}function r6(e){return function(){return t6.call(this.children,e)}}function i6(e){return this.selectAll(e==null?n6:r6(typeof e==`function`?e:X3(e)))}function a6(e){typeof e!=`function`&&(e=Y3(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new L6(r,this._parents)}function o6(e){return Array(e.length)}function s6(){return new L6(this._enter||this._groups.map(o6),this._parents)}function c6(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}c6.prototype={constructor:c6,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 l6(e){return function(){return e}}function u6(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 c6(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function d6(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 c6(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function f6(e){return e.__data__}function p6(e,t){if(!arguments.length)return Array.from(this,f6);var n=t?d6:u6,r=this._parents,i=this._groups;typeof e!=`function`&&(e=l6(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=m6(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new L6(o,r),o._enter=s,o._exit=c,o}function m6(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function h6(){return new L6(this._exit||this._groups.map(o6),this._parents)}function g6(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 _6(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new L6(s,this._parents)}function v6(){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 y6(e){e||=b6;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new L6(i,this._parents).order()}function b6(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function x6(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function S6(){return Array.from(this)}function C6(){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 w6(){let e=0;for(let t of this)++e;return e}function T6(){return!this.node()}function E6(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 D6(e){return function(){this.removeAttribute(e)}}function Kie(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qie(e,t){return function(){this.setAttribute(e,t)}}function Jie(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Yie(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Xie(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 Zie(e,t){var n=L3(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?Kie:D6:typeof t==`function`?n.local?Xie:Yie:n.local?Jie:qie)(n,t))}function O6(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Qie(e){return function(){this.style.removeProperty(e)}}function $ie(e,t,n){return function(){this.style.setProperty(e,t,n)}}function eae(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function tae(e,t,n){return arguments.length>1?this.each((t==null?Qie:typeof t==`function`?eae:$ie)(e,t,n??``)):k6(this.node(),e)}function k6(e,t){return e.style.getPropertyValue(t)||O6(e).getComputedStyle(e,null).getPropertyValue(t)}function nae(e){return function(){delete this[e]}}function rae(e,t){return function(){this[e]=t}}function iae(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function aae(e,t){return arguments.length>1?this.each((t==null?nae:typeof t==`function`?iae:rae)(e,t)):this.node()[e]}function A6(e){return e.trim().split(/^|\s+/)}function j6(e){return e.classList||new M6(e)}function M6(e){this._node=e,this._names=A6(e.getAttribute(`class`)||``)}M6.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 N6(e,t){for(var n=j6(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function P6(e,t){for(var n=j6(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function oae(e){return function(){N6(this,e)}}function sae(e){return function(){P6(this,e)}}function cae(e,t){return function(){(t.apply(this,arguments)?N6:P6)(this,e)}}function lae(e,t){var n=A6(e+``);if(arguments.length<2){for(var r=j6(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?cae:t?oae:sae)(n,t))}function uae(){this.textContent=``}function dae(e){return function(){this.textContent=e}}function fae(e){return function(){this.textContent=e.apply(this,arguments)??``}}function pae(e){return arguments.length?this.each(e==null?uae:(typeof e==`function`?fae:dae)(e)):this.node().textContent}function mae(){this.innerHTML=``}function hae(e){return function(){this.innerHTML=e}}function gae(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function _ae(e){return arguments.length?this.each(e==null?mae:(typeof e==`function`?gae:hae)(e)):this.node().innerHTML}function vae(){this.nextSibling&&this.parentNode.appendChild(this)}function yae(){return this.each(vae)}function bae(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xae(){return this.each(bae)}function Sae(e){var t=typeof e==`function`?e:B3(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Cae(){return null}function wae(e,t){var n=typeof e==`function`?e:B3(e),r=t==null?Cae:typeof t==`function`?t:H3(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Tae(){var e=this.parentNode;e&&e.removeChild(this)}function Eae(){return this.each(Tae)}function Dae(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Oae(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function kae(e){return this.select(e?Oae:Dae)}function Aae(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function jae(e){return function(t){e.call(this,t,this.__data__)}}function Mae(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 Nae(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 Pae(e,t,n){return function(){var r=this.__on,i,a=jae(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 Fae(e,t,n){var r=Mae(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?Pae:Nae,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function F6(e,t,n){var r=O6(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 Iae(e,t){return function(){return F6(this,e,t)}}function Lae(e,t){return function(){return F6(this,e,t.apply(this,arguments))}}function Rae(e,t){return this.each((typeof t==`function`?Lae:Iae)(e,t))}function*zae(){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 I6=[null];function L6(e,t){this._groups=e,this._parents=t}function R6(){return new L6([[document.documentElement]],I6)}function Bae(){return this}L6.prototype=R6.prototype={constructor:L6,select:U3,selectAll:J3,selectChild:e6,selectChildren:i6,filter:a6,data:p6,enter:s6,exit:h6,join:g6,merge:_6,selection:Bae,order:v6,sort:y6,call:x6,nodes:S6,node:C6,size:w6,empty:T6,each:E6,attr:Zie,style:tae,property:aae,classed:lae,text:pae,html:_ae,raise:yae,lower:xae,append:Sae,insert:wae,remove:Eae,clone:kae,datum:Aae,on:Fae,dispatch:Rae,[Symbol.iterator]:zae};function z6(e){return typeof e==`string`?new L6([[document.querySelector(e)]],[document.documentElement]):new L6([[e]],I6)}function Vae(e){let t;for(;t=e.sourceEvent;)e=t;return e}function B6(e,t){if(e=Vae(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 Hae={passive:!1},V6={capture:!0,passive:!1};function H6(e){e.stopImmediatePropagation()}function U6(e){e.preventDefault(),e.stopImmediatePropagation()}function W6(e){var t=e.document.documentElement,n=z6(e).on(`dragstart.drag`,U6,V6);`onselectstart`in t?n.on(`selectstart.drag`,U6,V6):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function G6(e,t){var n=e.document.documentElement,r=z6(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,U6,V6),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 K6=e=>()=>e;function q6(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}})}q6.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Uae(e){return!e.ctrlKey&&!e.button}function Wae(){return this.parentNode}function Gae(e,t){return t??{x:e.x,y:e.y}}function Kae(){return navigator.maxTouchPoints||`ontouchstart`in this}function J6(){var e=Uae,t=Wae,n=Gae,r=Kae,i={},a=j3(`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`,_,Hae).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&&(z6(n.view).on(`mousemove.drag`,m,V6).on(`mouseup.drag`,h,V6),W6(n.view),H6(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(U6(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){z6(e.view).on(`mousemove.drag mouseup.drag`,null),G6(e.view,l),U6(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]))&&(H6(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])&&(U6(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])&&(H6(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=B6(l||r,t),p,m,h;if((h=n.call(e,new q6(`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=B6(l||a,t),_=o;break}u.call(r,e,new q6(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:K6(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:K6(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:K6(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:K6(!!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 Y6=0,X6=0,Z6=0,Q6=1e3,$6,e8,t8=0,n8=0,r8=0,i8=typeof performance==`object`&&performance.now?performance:Date,a8=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function o8(){return n8||=(a8(qae),i8.now()+r8)}function qae(){n8=0}function s8(){this._call=this._time=this._next=null}s8.prototype=c8.prototype={constructor:s8,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?o8():+n)+(t==null?0:+t),!this._next&&e8!==this&&(e8?e8._next=this:$6=this,e8=this),this._call=e,this._time=n,u8()},stop:function(){this._call&&(this._call=null,this._time=1/0,u8())}};function c8(e,t,n){var r=new s8;return r.restart(e,t,n),r}function Jae(){o8(),++Y6;for(var e=$6,t;e;)(t=n8-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Y6}function l8(){n8=(t8=i8.now())+r8,Y6=X6=0;try{Jae()}finally{Y6=0,Xae(),n8=0}}function Yae(){var e=i8.now(),t=e-t8;t>Q6&&(r8-=t,t8=e)}function Xae(){for(var e,t=$6,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:$6=n);e8=e,u8(r)}function u8(e){Y6||(X6&&=clearTimeout(X6),e-n8>24?(e<1/0&&(X6=setTimeout(l8,e-i8.now()-r8)),Z6&&=clearInterval(Z6)):(Z6||=(t8=i8.now(),setInterval(Yae,Q6)),Y6=1,a8(l8)))}function d8(e,t,n){var r=new s8;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Zae=j3(`start`,`end`,`cancel`,`interrupt`),Qae=[];function f8(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;$ae(e,n,{name:t,index:r,group:i,on:Zae,tween:Qae,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function p8(e,t){var n=h8(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function m8(e,t){var n=h8(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function h8(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function $ae(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=c8(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 d8(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(d8(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 g8(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 eoe(e){return this.each(function(){g8(this,e)})}function toe(e,t){var n,r;return function(){var i=m8(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 noe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=m8(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 roe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=h8(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?toe:noe)(n,e,t))}function _8(e,t,n){var r=e._id;return e.each(function(){var e=m8(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return h8(e,r).value[t]}}function v8(e,t){var n;return(typeof t==`number`?TI:t instanceof rI?wI:(n=rI(t))?(t=n,wI):OI)(e,t)}function ioe(e){return function(){this.removeAttribute(e)}}function aoe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ooe(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 soe(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 coe(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 loe(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 uoe(e,t){var n=L3(e),r=n===`transform`?$ne:v8;return this.attrTween(e,typeof t==`function`?(n.local?loe:coe)(n,r,_8(this,`attr.`+e,t)):t==null?(n.local?aoe:ioe)(n):(n.local?soe:ooe)(n,r,t))}function doe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function foe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function poe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&foe(e,i)),n}return i._value=t,i}function moe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&doe(e,i)),n}return i._value=t,i}function hoe(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=L3(e);return this.tween(n,(r.local?poe:moe)(r,t))}function goe(e,t){return function(){p8(this,e).delay=+t.apply(this,arguments)}}function _oe(e,t){return t=+t,function(){p8(this,e).delay=t}}function voe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?goe:_oe)(t,e)):h8(this.node(),t).delay}function yoe(e,t){return function(){m8(this,e).duration=+t.apply(this,arguments)}}function boe(e,t){return t=+t,function(){m8(this,e).duration=t}}function xoe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?yoe:boe)(t,e)):h8(this.node(),t).duration}function Soe(e,t){if(typeof t!=`function`)throw Error();return function(){m8(this,e).ease=t}}function Coe(e){var t=this._id;return arguments.length?this.each(Soe(t,e)):h8(this.node(),t).ease}function woe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();m8(this,e).ease=n}}function Toe(e){if(typeof e!=`function`)throw Error();return this.each(woe(this._id,e))}function Eoe(e){typeof e!=`function`&&(e=Y3(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 b8(r,this._parents,this._name,this._id)}function Doe(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 b8(o,this._parents,this._name,this._id)}function Ooe(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 koe(e,t,n){var r,i,a=Ooe(t)?p8:m8;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Aoe(e,t){var n=this._id;return arguments.length<2?h8(this.node(),n).on.on(e):this.each(koe(n,e,t))}function joe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Moe(){return this.on(`end.remove`,joe(this._id))}function Noe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=H3(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,f8(l[f],t,n,f,l,h8(u,n)));return new b8(a,this._parents,t,n)}function Poe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=K3(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=h8(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&f8(p,t,n,h,f,m);a.push(f),o.push(u)}return new b8(a,o,t,n)}var Foe=R6.prototype.constructor;function Ioe(){return new Foe(this._groups,this._parents)}function Loe(e,t){var n,r,i;return function(){var a=k6(this,e),o=(this.style.removeProperty(e),k6(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function y8(e){return function(){this.style.removeProperty(e)}}function Roe(e,t,n){var r,i=n+``,a;return function(){var o=k6(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function zoe(e,t,n){var r,i,a;return function(){var o=k6(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),k6(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Boe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=m8(this,e),l=c.on,u=c.value[a]==null?s||=y8(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Voe(e,t,n){var r=(e+=``)==`transform`?Qne:v8;return t==null?this.styleTween(e,Loe(e,r)).on(`end.style.`+e,y8(e)):typeof t==`function`?this.styleTween(e,zoe(e,r,_8(this,`style.`+e,t))).each(Boe(this._id,e)):this.styleTween(e,Roe(e,r,t),n).on(`end.style.`+e,null)}function Hoe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Uoe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Hoe(e,a,n)),r}return a._value=t,a}function Woe(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,Uoe(e,t,n??``))}function Goe(e){return function(){this.textContent=e}}function Koe(e){return function(){this.textContent=e(this)??``}}function qoe(e){return this.tween(`text`,typeof e==`function`?Koe(_8(this,`text`,e)):Goe(e==null?``:e+``))}function Joe(e){return function(t){this.textContent=e.call(this,t)}}function Yoe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Joe(r)),t}return r._value=e,r}function Xoe(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,Yoe(e))}function Zoe(){for(var e=this._name,t=this._id,n=x8(),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=h8(c,t);f8(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new b8(r,this._parents,e,n)}function Qoe(){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=m8(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 $oe=0;function b8(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ese(e){return R6().transition(e)}function x8(){return++$oe}var S8=R6.prototype;b8.prototype=ese.prototype={constructor:b8,select:Noe,selectAll:Poe,selectChild:S8.selectChild,selectChildren:S8.selectChildren,filter:Eoe,merge:Doe,selection:Ioe,transition:Zoe,call:S8.call,nodes:S8.nodes,node:S8.node,size:S8.size,empty:S8.empty,each:S8.each,on:Aoe,attr:uoe,attrTween:hoe,style:Voe,styleTween:Woe,text:qoe,textTween:Xoe,remove:Moe,tween:roe,delay:voe,duration:xoe,ease:Coe,easeVarying:Toe,end:Qoe,[Symbol.iterator]:S8[Symbol.iterator]};function tse(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var nse={time:null,delay:0,duration:250,ease:tse};function rse(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function ise(e){var t,n;e instanceof b8?(t=e._id,e=e._name):(t=x8(),(n=nse).time=o8(),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])&&f8(c,e,t,l,o,n||rse(c,t));return new b8(r,this._parents,e,t)}R6.prototype.interrupt=eoe,R6.prototype.transition=ise;var C8=e=>()=>e;function ase(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 w8(e,t,n){this.k=e,this.x=t,this.y=n}w8.prototype={constructor:w8,scale:function(e){return e===1?this:new w8(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new w8(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 T8=new w8(1,0,0);E8.prototype=w8.prototype;function E8(e){for(;!e.__zoom;)if(!(e=e.parentNode))return T8;return e.__zoom}function D8(e){e.stopImmediatePropagation()}function O8(e){e.preventDefault(),e.stopImmediatePropagation()}function ose(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function sse(){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 k8(){return this.__zoom||T8}function cse(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lse(){return navigator.maxTouchPoints||`ontouchstart`in this}function use(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 A8(){var e=ose,t=sse,n=use,r=cse,i=lse,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=LI,l=j3(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,k8).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`,k8),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(T8.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 w8(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 w8(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 w8(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=z6(this.that).datum();l.call(e,this.that,new ase(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=B6(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)],g8(this),s.start();O8(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=z6(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=B6(t,i),l=t.clientX,u=t.clientY;W6(t.view),D8(t),a.mouse=[c,this.__zoom.invert(c)],g8(this),a.start();function d(e){if(O8(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]=B6(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),G6(e.view,a.moved),O8(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=B6(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);O8(r),s>0?z6(this).transition().duration(s).call(x,d,c,r):z6(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(D8(t),s=0;s<i;++s)c=r[s],l=B6(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)),g8(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(O8(e),s=0;s<a;++s)c=i[s],l=B6(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(D8(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=B6(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=z6(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:C8(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:C8(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:C8(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:C8([[+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 j8={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.`},M8=[[-1/0,-1/0],[1/0,1/0]],N8=[`Enter`,` `,`Escape`],P8={"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`},F8;(function(e){e.Strict=`strict`,e.Loose=`loose`})(F8||={});var I8;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(I8||={});var L8;(function(e){e.Partial=`partial`,e.Full=`full`})(L8||={});var R8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},z8;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(z8||={});var B8;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(B8||={});var V8;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(V8||={});var H8={[V8.Left]:V8.Right,[V8.Right]:V8.Left,[V8.Top]:V8.Bottom,[V8.Bottom]:V8.Top};function U8(e){return e===null?null:e?`valid`:`invalid`}var W8=e=>`id`in e&&`source`in e&&`target`in e,dse=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),G8=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),K8=(e,t=[0,0])=>{let{width:n,height:r}=_5(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},fse=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:r5(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):G8(n)?n:t.nodeLookup.get(n.id)),t5(e,i?a5(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),q8=(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=t5(n,a5(e)),r=!0)}),r?r5(n):{x:0,y:0,width:0,height:0}},J8=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...d5(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=s5(s,i5(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},pse=(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 mse(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 hse({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=m5(q8(mse(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 Y8({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`,j8.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&g5(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=g5(d)?Z8(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,j8.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 gse({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=pse(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 X8=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Z8=(e={x:0,y:0},t,n)=>({x:X8(e.x,t[0][0],t[1][0]-(n?.width??0)),y:X8(e.y,t[0][1],t[1][1]-(n?.height??0))});function Q8(e,t,n){let{width:r,height:i}=_5(n),{x:a,y:o}=n.internals.positionAbsolute;return Z8(e,[[a,o],[a+r,o+i]],t)}var $8=(e,t,n)=>e<t?X8(Math.abs(e-t),1,t)/t:e>n?-X8(Math.abs(e-n),1,t)/t:0,e5=(e,t,n=15,r=40)=>[$8(e.x,r,t.width-r)*n,$8(e.y,r,t.height-r)*n],t5=(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)}),n5=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),r5=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),i5=(e,t=[0,0])=>{let{x:n,y:r}=G8(e)?e.internals.positionAbsolute:K8(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}},a5=(e,t=[0,0])=>{let{x:n,y:r}=G8(e)?e.internals.positionAbsolute:K8(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)}},o5=(e,t)=>r5(t5(n5(e),n5(t))),s5=(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)},c5=e=>l5(e.width)&&l5(e.height)&&l5(e.x)&&l5(e.y),l5=e=>!isNaN(e)&&isFinite(e),_se=(e,t)=>{},u5=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),d5=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?u5(s,o):s},f5=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function p5(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 vse(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=p5(e,n),i=p5(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=p5(e.top??e.y??0,n),i=p5(e.bottom??e.y??0,n),a=p5(e.left??e.x??0,t),o=p5(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 yse(e,t,n,r,i,a){let{x:o,y:s}=f5(e,[t,n,r]),{x:c,y:l}=f5({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 m5=(e,t,n,r,i,a)=>{let o=vse(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=X8(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=yse(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}},h5=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function g5(e){return e!=null&&e!==`parent`}function _5(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function v5(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function y5(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 b5(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function bse(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function xse(e){return{...P8,...e||{}}}function x5(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=E5(e),s=d5({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?u5(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var S5=e=>({width:e.offsetWidth,height:e.offsetHeight}),C5=e=>e?.getRootNode?.()||window?.document,Sse=[`INPUT`,`SELECT`,`TEXTAREA`];function w5(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Sse.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var T5=e=>`clientX`in e,E5=(e,t)=>{let n=T5(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)}},D5=(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,...S5(t)}})};function O5({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 k5(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function A5({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case V8.Left:return[t-k5(t-r,a),n];case V8.Right:return[t+k5(r-t,a),n];case V8.Top:return[t,n-k5(n-i,a)];case V8.Bottom:return[t,n+k5(i-n,a)]}}function j5({sourceX:e,sourceY:t,sourcePosition:n=V8.Bottom,targetX:r,targetY:i,targetPosition:a=V8.Top,curvature:o=.25}){let[s,c]=A5({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=A5({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=O5({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 M5({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 Cse({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 wse({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=t5(a5(e),a5(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),s5({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},r5(a))>0}var Tse=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Ese=(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)),Dse=(e,t,n={})=>{if(!e.source||!e.target)return j8.error006(),t;let r=n.getEdgeId||Tse,i;return i=W8(e)?{...e}:{...e,id:r(e)},Ese(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function N5({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=M5({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var P5={[V8.Left]:{x:-1,y:0},[V8.Right]:{x:1,y:0},[V8.Top]:{x:0,y:-1},[V8.Bottom]:{x:0,y:1}},Ose=({source:e,sourcePosition:t=V8.Bottom,target:n})=>t===V8.Left||t===V8.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},F5=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function kse({source:e,sourcePosition:t=V8.Bottom,target:n,targetPosition:r=V8.Top,center:i,offset:a,stepPosition:o}){let s=P5[t],c=P5[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=Ose({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]=M5({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 Ase(e,t,n,r){let i=Math.min(F5(e,t)/2,F5(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 I5({sourceX:e,sourceY:t,sourcePosition:n=V8.Bottom,targetX:r,targetY:i,targetPosition:a=V8.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=kse({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+=Ase(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function L5(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function jse(e){let{sourceNode:t,targetNode:n}=e;if(!L5(t)||!L5(n))return null;let r=t.internals.handleBounds||R5(t.handles),i=n.internals.handleBounds||R5(n.handles),a=B5(r?.source??[],e.sourceHandle),o=B5(e.connectionMode===F8.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,j8.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||V8.Bottom,c=o?.position||V8.Top,l=z5(t,a,s),u=z5(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function R5(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 z5(e,t,n=V8.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??_5(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case V8.Top:return{x:i+o/2,y:a};case V8.Right:return{x:i+o,y:a+s/2};case V8.Bottom:return{x:i+o/2,y:a+s};case V8.Left:return{x:i,y:a+s/2}}}function B5(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function V5(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Mse(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=V5(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 H5=1e3,Nse=10,U5={nodeOrigin:[0,0],nodeExtent:M8,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Pse={...U5,checkEquality:!0};function W5(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Fse(e,t,n){let r=W5(U5,n);for(let n of e.values())if(n.parentId)q5(n,e,t,r);else{let e=Z8(K8(n,r.nodeOrigin),g5(n.extent)?n.extent:r.nodeExtent,_5(n));n.internals.positionAbsolute=e}}function Ise(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 G5(e){return e===`manual`}function K5(e,t,n,r={}){let i=W5(Pse,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!G5(i.zIndexMode)?H5: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=Z8(K8(u,i.nodeOrigin),g5(u.extent)?u.extent:i.nodeExtent,_5(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Ise(u,e),z:J5(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&&q5(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Lse(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 q5(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=W5(U5,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}Lse(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*Nse),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Rse(e,u,o,s,a&&!G5(c)?H5: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 J5(e,t,n){let r=l5(e.zIndex)?e.zIndex:0;return G5(n)?r:r+(e.selected?t:0)}function Rse(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=_5(e),l=K8(e,n),u=g5(e.extent)?Z8(l,e.extent,c):l,d=Z8({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Q8(d,c,t));let f=J5(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Y5(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=o5(a.get(n.parentId)?.expandedRect??i5(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=_5(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 zse(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=S5(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=g5(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=Q8(h,s,t.get(e.parentId)):m&&(h=Z8(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:D5(`source`,r.nodeElement,p,d,e.id),target:D5(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&q5(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:i5(g,i)}))}}if(f.length>0){let e=Y5(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Bse({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 X5(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 Z5(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}`;X5(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),X5(`target`,s,c,e,i,o),t.set(r.id,r)}}function Q5(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Q5(n,t):!1}function $5(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 Vse(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Q5(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 e7({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 Hse({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=u5(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Use({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=z6(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?n5(q8(s)):null,x=v&&l?Hse({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)}:u5(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}=Y8({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]=e7({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]=e5(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=x5(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Vse(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=e7({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=J6().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=x5(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=E5(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=x5(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=E5(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=E5(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]=e7({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||!$5(t,`.${g}`,v))&&(!_||$5(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Wse(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())s5(i,i5(e))>0&&r.push(e);return r}var Gse=250;function Kse(e,t,n,r){let i=[],a=1/0,o=Wse(e,n,t+Gse);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}=z5(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 t7(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,...z5(o,c,c.position,!0)}:c}function n7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function qse(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var r7=()=>!0;function Jse(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:_=r7,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=C5(e.target),E=0,D,{x:O,y:k}=E5(e),A=n7(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=t7(i,A,r,c,t);if(!N)return;let ee=E5(e,j),P=!1,F=null,I=!1,te=null;function ne(){if(!u||!j)return;let[e,t]=e5(ee,j,S);f({x:e,y:t}),E=requestAnimationFrame(ne)}let re={...N,nodeId:i,type:A,position:N.position},L=c.get(i),R={inProgress:!0,isValid:null,from:z5(L,re,V8.Left,!0),fromHandle:re,fromPosition:re.position,fromNode:L,to:ee,toHandle:null,toPosition:H8[re.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}=E5(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ie()}if(!x()||!re){oe(e);return}let a=b();ee=E5(e,j),D=Kse(d5(ee,a,!1,[1,1]),n,c,re),P||=(ne(),!0);let s=i7(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});te=s.handleDomNode,F=s.connection,I=qse(!!D,s.isValid);let u=c.get(i),f=u?z5(u,re,V8.Left,!0):R.from,p={...R,from:f,isValid:I,to:s.toHandle&&I?f5({x:s.toHandle.x,y:s.toHandle.y},a):ee,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:H8[re.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||te)&&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,te=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 i7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=r7,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}=E5(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=n7(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===F8.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=t7(t,e,a,u,n,!0)}return _}var a7={onPointerDown:Jse,isValid:i7};function Yse({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=z6(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&&h5()?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=A8().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:B6}}var o7=e=>({x:e.x,y:e.y,zoom:e.k}),s7=({x:e,y:t,zoom:n})=>T8.translate(e,t).scale(n),c7=(e,t)=>e.target.closest(`.${t}`),l7=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xse=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,u7=(e,t=0,n=Xse,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},d7=e=>{let t=e.ctrlKey&&h5()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Zse({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(c7(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=B6(u),t=d*2**d7(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===I8.Vertical?0:u.deltaX*f,m=i===I8.Horizontal?0:u.deltaY*f;!h5()&&u.shiftKey&&i!==I8.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=o7(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 Qse({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=c7(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function $se({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=o7(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 ece({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&l7(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,o7(a.transform))}}function tce({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&l7(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=o7(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function nce({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`&&(c7(d,`${l}-flow__node`)||c7(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||c7(d,s)&&m||c7(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 rce({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=A8().scaleExtent([t,n]).translateExtent(r),f=z6(e).call(d);v({x:i.x,y:i.y,zoom:X8(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(d7);function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?kI:LI).transform(u7(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:!l5(E)||E<0?0:E);let k=O?Zse({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Qse({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(f.on(`wheel.zoom`,k,{passive:!1}),!r){let e=$se({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,e);let t=ece({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,t);let r=tce({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,r)}let A=nce({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=s7(e),i=d?.constrain()(r,t,n);return i&&await h(i),new Promise(e=>e(i))}async function y(e,t){let n=s7(e);return await h(n,t),new Promise(e=>e(n))}function b(e){if(f){let t=s7(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?E8(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`?kI:LI).scaleTo(u7(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`?kI:LI).scaleBy(u7(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=!l5(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 f7;(function(e){e.Line=`line`,e.Handle=`handle`})(f7||={});function ice({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 p7(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 m7(e,t){return Math.max(0,t-e)}function h7(e,t){return Math.max(0,e-t)}function g7(e,t,n){return Math.max(0,t-e,e-n)}function _7(e,t){return e?!t:t}function ace(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=g7(E,h,g),j=g7(D,_,v);if(o){let e=0,t=0;c&&w<0?e=m7(y+w+O,o[0][0]):!c&&w>0&&(e=h7(y+E+O,o[1][0])),l&&T<0?t=m7(b+T+k,o[0][1]):!l&&T>0&&(t=h7(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=h7(y+w,s[0][0]):!c&&w<0&&(e=m7(y+E,s[1][0])),l&&T>0?t=h7(b+T,s[0][1]):!l&&T<0&&(t=m7(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=g7(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?h7(b+k+E/C,o[1][1])*C:m7(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?m7(b+E/C,s[1][1])*C:h7(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=g7(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?h7(y+D*C+O,o[1][0])/C:m7(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?m7(y+D*C,s[1][0])/C:h7(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=(_7(c,l)?-w:w)/C:w=(_7(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 v7={width:0,height:0,x:0,y:0},oce={...v7,pointerX:0,pointerY:0,aspectRatio:1};function sce(e){return[[0,0],[e.measured.width,e.measured.height]]}function cce(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 lce({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=z6(e),o={controlDirection:p7(`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={...v7},h={...oce};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:p7(e)};let g,_=null,v=[],y,b,x,S=!1,C=J6().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}=x5(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`?sce(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=cce(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=x5(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}=ace(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=ice({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 y7=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},uce=e=>e?y7(e):y7,{useDebugValue:dce}=z.default,{useSyncExternalStoreWithSelector:fce}=Iw.default,pce=e=>e;function b7(e,t=pce,n){let r=fce(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return dce(r),r}var x7=(e,t)=>{let n=uce(e),r=(e,r=t)=>b7(n,e,r);return Object.assign(r,n),r},mce=(e,t)=>e?x7(e,t):x7;function S7(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 C7=(0,z.createContext)(null),hce=C7.Provider,w7=j8.error001();function T7(e,t){let n=(0,z.useContext)(C7);if(n===null)throw Error(w7);return b7(n,e,t)}function E7(){let e=(0,z.useContext)(C7);if(e===null)throw Error(w7);return(0,z.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var D7={display:`none`},gce={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},O7=`react-flow__node-desc`,k7=`react-flow__edge-desc`,_ce=`react-flow__aria-live`,vce=e=>e.ariaLiveMessage,yce=e=>e.ariaLabelConfig;function bce({rfId:e}){let t=T7(vce);return(0,B.jsx)(`div`,{id:`${_ce}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:gce,children:t})}function xce({rfId:e,disableKeyboardA11y:t}){let n=T7(yce);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{id:`${O7}-${e}`,style:D7,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,B.jsx)(`div`,{id:`${k7}-${e}`,style:D7,children:n[`edge.a11yDescription.default`]}),!t&&(0,B.jsx)(bce,{rfId:e})]})}var A7=(0,z.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,B.jsx)(`div`,{className:k3([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));A7.displayName=`Panel`;function Sce({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,B.jsx)(A7,{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 Cce=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}},j7=e=>e.id;function wce(e,t){return S7(e.selectedNodes.map(j7),t.selectedNodes.map(j7))&&S7(e.selectedEdges.map(j7),t.selectedEdges.map(j7))}function Tce({onSelectionChange:e}){let t=E7(),{selectedNodes:n,selectedEdges:r}=T7(Cce,wce);return(0,z.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Ece=e=>!!e.onSelectionChangeHandlers;function Dce({onSelectionChange:e}){let t=T7(Ece);return e||t?(0,B.jsx)(Tce,{onSelectionChange:e}):null}var M7=typeof window<`u`?z.useLayoutEffect:z.useEffect,N7=[0,0],Oce={x:0,y:0,zoom:1},P7=[...`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`],kce=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}),F7={translateExtent:M8,nodeOrigin:N7,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Ace(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=T7(kce,S7),l=E7();M7(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=F7,s()}),[]);let u=(0,z.useRef)(F7);return M7(()=>{for(let s of P7){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:xse(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},P7.map(t=>e[t])),null}function I7(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function jce(e){let[t,n]=(0,z.useState)(e===`system`?null:e);return(0,z.useEffect)(()=>{if(e!==`system`){n(e);return}let t=I7(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?I7()?.matches?`dark`:`light`:t}var L7=typeof document<`u`?document:null;function R7(e=null,t={target:L7,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(`+`,`
|
|
71
71
|
`).replace(`
|
|
72
72
|
|
|
73
73
|
`,`
|
|
74
74
|
+`).split(`
|
|
75
75
|
`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,z.useEffect)(()=>{let n=t?.target??L7,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)&&w5(e))return!1;let n=B7(e.code,s);if(a.current.add(e[n]),z7(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=B7(e.code,s);z7(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 z7(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function B7(e,t){return t.includes(e)?`code`:`key`}var Mce=()=>{let e=E7();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=m5(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 d5(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=f5(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function V7(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)Nce(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 Nce(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 H7(e,t){return V7(e,t)}function U7(e,t){return V7(e,t)}function W7(e,t){return{id:e,type:`select`,selected:t}}function G7(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(W7(a.id,e)))}return r}function K7({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 q7(e){return{id:e.id,type:`remove`}}var J7=e=>dse(e),Pce=e=>W8(e);function Y7(e){return(0,z.forwardRef)(e)}function X7(e){let[t,n]=(0,z.useState)(BigInt(0)),[r]=(0,z.useState)(()=>Fce(()=>n(e=>e+BigInt(1))));return M7(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Fce(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Z7=(0,z.createContext)(null);function Ice({children:e}){let t=E7(),n=X7((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=K7({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=X7((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(K7({items:s,lookup:o}))},[])),i=(0,z.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,B.jsx)(Z7.Provider,{value:i,children:e})}function Lce(){let e=(0,z.useContext)(Z7);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Rce=e=>!!e.panZoom;function Q7(){let e=Mce(),t=E7(),n=Lce(),r=T7(Rce),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=J7(e)?e:n.get(e.id),a=i.parentId?y5(i.position,i.measured,i.parentId,n,r):i.position;return i5({...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&&J7(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&&Pce(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 gse({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(q7);o?.(f),c(e)}if(m){let e=d.map(q7);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=c5(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=i5(s?r:a),l=s5(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=c5(e)?e:a(e);if(!r)return!1;let i=s5(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 fse(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??bse();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 $7=e=>e.selected,zce=typeof window<`u`?window:void 0;function Bce({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=E7(),{deleteElements:r}=Q7(),i=R7(e,{actInsideInputWithModifier:!1}),a=R7(t,{target:zce});(0,z.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter($7),edges:e.filter($7)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,z.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Vce(e){let t=E7();(0,z.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=S5(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,j8.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 e9={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Hce=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Uce({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=I8.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=E7(),S=(0,z.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=T7(Hce,S7),E=R7(f),D=(0,z.useRef)();Vce(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=rce({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:e9,children:m})}var Wce=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Gce(){let{userSelectionActive:e,userSelectionRect:t}=T7(Wce,S7);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 t9=(e,t)=>n=>{n.target===t.current&&e?.(n)},Kce=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function qce({isSelecting:e,selectionKeyPressed:t,selectionMode:n=L8.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=E7(),{userSelectionActive:g,elementsSelectable:_,dragging:v,connectionInProgress:y}=T7(Kce,S7),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:k3([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:v,selection:e}]),onClick:b?void 0:t9(E,x),onContextMenu:t9(D,x),onWheel:t9(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}=E5(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(J8(s,y,a,n===L8.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)}}b5(b,C.current)||u(G7(s,C.current,!0)),b5(x,w.current)||d(G7(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}=E5(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:e9,children:[m,(0,B.jsx)(Gce,{})]})}function n9({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`,j8.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function r9({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=E7(),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)();return(0,z.useEffect)(()=>{u.current=Use({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{n9({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 Jce=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function i9(){let e=E7();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=Jce(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=u5(t,i));let{position:a,positionAbsolute:s}=Y8({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 a9=(0,z.createContext)(null),Yce=a9.Provider;a9.Consumer;var o9=()=>(0,z.useContext)(a9),Xce=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Zce=(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===F8.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Qce({type:e=`source`,position:t=V8.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=E7(),_=o9(),{connectOnClick:v,noPanClassName:y,rfId:b}=T7(Xce,S7),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=T7(Zce(_,m,e),S7);_||g.getState().onError?.(`010`,j8.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(Dse(i,e))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=T5(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();a7.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:k3([`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=C5(t.target),h=n||c,{connection:v,isValid:y}=a7.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 s9=(0,z.memo)(Y7(Qce));function $ce({data:e,isConnectable:t,sourcePosition:n=V8.Bottom}){return(0,B.jsxs)(B.Fragment,{children:[e?.label,(0,B.jsx)(s9,{type:`source`,position:n,isConnectable:t})]})}function ele({data:e,isConnectable:t,targetPosition:n=V8.Top,sourcePosition:r=V8.Bottom}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(s9,{type:`target`,position:n,isConnectable:t}),e?.label,(0,B.jsx)(s9,{type:`source`,position:r,isConnectable:t})]})}function tle(){return null}function nle({data:e,isConnectable:t,targetPosition:n=V8.Top}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(s9,{type:`target`,position:n,isConnectable:t}),e?.label]})}var c9={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},l9={input:$ce,default:ele,output:nle,group:tle};function rle(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 ile=e=>{let{width:t,height:n,x:r,y:i}=q8(e.nodeLookup,{filter:e=>!!e.selected});return{width:l5(t)?t:null,height:l5(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 ale({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=E7(),{width:i,height:a,transformString:o,userSelectionActive:s}=T7(ile,S7),c=i9(),l=(0,z.useRef)(null);(0,z.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(r9({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:k3([`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(c9,e.key)&&(e.preventDefault(),c({direction:c9[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var u9=typeof window<`u`?window:void 0,ole=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function d9({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}=T7(ole,S7),te=R7(l,{target:u9}),ne=R7(h,{target:u9}),re=ne||w,L=ne||b,R=u&&re!==!0,ie=te||I||R;return Bce({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,B.jsx)(Uce,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:L,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!te&&re,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)(qce,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:re,isSelecting:!!ie,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:R,children:[e,F&&(0,B.jsx)(ale,{onSelectionContextMenu:A,noPanClassName:M,disableKeyboardA11y:N})]})})}d9.displayName=`FlowRenderer`;var sle=(0,z.memo)(d9),cle=e=>t=>e?J8(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 lle(e){return T7((0,z.useCallback)(cle(e),[e]),S7)}var ule=e=>e.updateNodeInternals;function dle(){let e=T7(ule),[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 fle({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=E7(),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 ple({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}=T7(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},S7),S=y.type||`default`,C=g?.[S]||l9[S];C===void 0&&(v?.(`003`,j8.error003(S)),S=`default`,C=g?.default||l9.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=E7(),k=v5(y),A=fle({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=r9({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=i9();if(y.hidden)return null;let N=_5(y),ee=rle(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,te=i?e=>i(e,{...b.userNode}):void 0,ne=a?e=>a(e,{...b.userNode}):void 0,re=o?e=>o(e,{...b.userNode}):void 0,L=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&n9({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},R=t=>{if(!(w5(t.nativeEvent)||m)){if(N8.includes(t.key)&&T)n9({id:e,store:O,unselect:t.key===`Escape`,nodeRef:A});else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(c9,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:c9[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&&(J8(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:k3([`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:te,onContextMenu:ne,onClick:L,onDoubleClick:re,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:`${O7}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,B.jsx)(Yce,{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 mle=(0,z.memo)(ple),hle=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function f9(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=T7(hle,S7),o=lle(e.onlyRenderVisibleElements),s=dle();return(0,B.jsx)(`div`,{className:`react-flow__nodes`,style:e9,children:o.map(o=>(0,B.jsx)(mle,{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))})}f9.displayName=`NodeRenderer`;var gle=(0,z.memo)(f9);function _le(e){return T7((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&&wse({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),S7)}var vle=({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`}),yle=({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`}),p9={[B8.Arrow]:vle,[B8.ArrowClosed]:yle};function ble(e){let t=E7();return(0,z.useMemo)(()=>Object.prototype.hasOwnProperty.call(p9,e)?p9[e]:(t.getState().onError?.(`009`,j8.error009(e)),null),[e])}var xle=({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=ble(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},m9=({defaultColor:e,rfId:t})=>{let n=T7(e=>e.edges),r=T7(e=>e.defaultEdgeOptions),i=(0,z.useMemo)(()=>Mse(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)(xle,{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};m9.displayName=`MarkerDefinitions`;var Sle=(0,z.memo)(m9);function h9({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=k3([`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}h9.displayName=`EdgeText`;var Cle=(0,z.memo)(h9);function g9({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:k3([`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&&l5(t)&&l5(n)?(0,B.jsx)(Cle,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function _9({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===V8.Left||e===V8.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function v9({sourceX:e,sourceY:t,sourcePosition:n=V8.Bottom,targetX:r,targetY:i,targetPosition:a=V8.Top}){let[o,s]=_9({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=_9({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=O5({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 y9(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]=v9({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,B.jsx)(g9,{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 wle=y9({isInternal:!1}),b9=y9({isInternal:!0});wle.displayName=`SimpleBezierEdge`,b9.displayName=`SimpleBezierEdgeInternal`;function x9(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=V8.Bottom,targetPosition:m=V8.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=I5({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,B.jsx)(g9,{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 S9=x9({isInternal:!1}),C9=x9({isInternal:!0});S9.displayName=`SmoothStepEdge`,C9.displayName=`SmoothStepEdgeInternal`;function w9(e){return(0,z.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,B.jsx)(S9,{...n,id:r,pathOptions:(0,z.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Tle=w9({isInternal:!1}),T9=w9({isInternal:!0});Tle.displayName=`StepEdge`,T9.displayName=`StepEdgeInternal`;function E9(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]=N5({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,B.jsx)(g9,{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 Ele=E9({isInternal:!1}),D9=E9({isInternal:!0});Ele.displayName=`StraightEdge`,D9.displayName=`StraightEdgeInternal`;function O9(e){return(0,z.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=V8.Bottom,targetPosition:s=V8.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]=j5({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,B.jsx)(g9,{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 Dle=O9({isInternal:!1}),k9=O9({isInternal:!0});Dle.displayName=`BezierEdge`,k9.displayName=`BezierEdgeInternal`;var A9={default:k9,straight:D9,step:T9,smoothstep:C9,simplebezier:b9},j9={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Ole=(e,t,n)=>n===V8.Left?e-t:n===V8.Right?e+t:e,kle=(e,t,n)=>n===V8.Top?e-t:n===V8.Bottom?e+t:e,M9=`react-flow__edgeupdater`;function N9({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:k3([M9,`${M9}-${s}`]),cx:Ole(t,r,e),cy:kle(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function Ale({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=E7(),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`;a7.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)(N9,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,B.jsx)(N9,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function jle({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=T7(t=>t.edgeLookup.get(e)),b=T7(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||A9[x];S===void 0&&(_?.(`011`,j8.error011(x)),x=`default`,S=h?.default||A9.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=E7(),{zIndex:M,sourceX:N,sourceY:ee,targetX:P,targetY:F,sourcePosition:I,targetPosition:te}=T7((0,z.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return{zIndex:y.zIndex,...j9};let i=jse({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_});return{zIndex:Cse({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode}),...i||j9}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),S7),ne=(0,z.useMemo)(()=>y.markerStart?`url('#${V5(y.markerStart,m)}')`:void 0,[y.markerStart,m]),re=(0,z.useMemo)(()=>y.markerEnd?`url('#${V5(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||ee===null||P===null||F===null)return null;let L=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:k3([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:L,onDoubleClick:R,onContextMenu:ie,onMouseEnter:ae,onMouseMove:oe,onMouseLeave:se,onKeyDown:C?t=>{if(!v&&N8.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?`${k7}-${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:te,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:ne,markerEnd:re,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,B.jsx)(Ale,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:ee,targetX:P,targetY:F,sourcePosition:I,targetPosition:te,setUpdateHover:O,setReconnecting:A})]})})}var Mle=(0,z.memo)(jle),Nle=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function P9({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}=T7(Nle,S7),b=_le(t);return(0,B.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,B.jsx)(Sle,{defaultColor:e,rfId:n}),b.map(e=>(0,B.jsx)(Mle,{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))]})}P9.displayName=`EdgeRenderer`;var Ple=(0,z.memo)(P9),Fle=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ile({children:e}){return(0,B.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:T7(Fle)},children:e})}function Lle(e){let t=Q7(),n=(0,z.useRef)(!1);(0,z.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var Rle=e=>e.panZoom?.syncViewport;function zle(e){let t=T7(Rle),n=E7();return(0,z.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function F9(e){return e.connection.inProgress?{...e.connection,to:d5(e.connection.to,e.transform)}:{...e.connection}}function Ble(e){return e?t=>e(F9(t)):F9}function Vle(e){return T7(Ble(e),S7)}var Hle=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ule({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=T7(Hle,S7);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:k3([`react-flow__connection`,U8(s)]),children:(0,B.jsx)(I9,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var I9=({style:e,type:t=z8.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}=Vle();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:U8(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 z8.Bezier:[m]=j5(h);break;case z8.SimpleBezier:[m]=v9(h);break;case z8.Step:[m]=I5({...h,borderRadius:0});break;case z8.SmoothStep:[m]=I5(h);break;default:[m]=N5(h)}return(0,B.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};I9.displayName=`ConnectionLine`;var Wle={};function L9(e=Wle){(0,z.useRef)(e),E7(),(0,z.useEffect)(()=>{},[e])}function Gle(){E7(),(0,z.useRef)(!1),(0,z.useEffect)(()=>{},[])}function R9({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:te,panOnDrag:ne,onPaneClick:re,onPaneMouseEnter:L,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 L9(e),L9(t),Gle(),Lle(n),zle(Ce),(0,B.jsx)(sle,{onPaneClick:re,onPaneMouseEnter:L,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:te,panOnScroll:P,panOnScrollSpeed:F,panOnScrollMode:I,panOnDrag:ne,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)(Ile,{children:[(0,B.jsx)(Ple,{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)(Ule,{style:h,type:m,component:g,containerStyle:_}),(0,B.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,B.jsx)(gle,{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`})]})})}R9.displayName=`GraphView`;var Kle=(0,z.memo)(R9),z9=({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??M8;Z5(h,g,_);let{nodesInitialized:x}=K5(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=m5(q8(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:M8,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:F8.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:{...R8},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:_se,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:P8,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},qle=({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})=>mce((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 hse({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...z9({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}=K5(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();Z5(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}=zse(e,n,r,i,a,o,l);d&&(Fse(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=z5(e,o.fromHandle,V8.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=Y5(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(H7(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(U7(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=>W7(e,!0)));return}i(G7(r,new Set([...e]),!0)),a(G7(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>W7(e,!0)));return}a(G7(n,new Set([...e]))),i(G7(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(W7(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(W7(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,W7(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,W7(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]||(K5(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 Bse({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:{...R8}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...z9()})}},Object.is);function Jle({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)(()=>qle({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)(hce,{value:m,children:(0,B.jsx)(Ice,{children:p})})}function Yle({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)(C7)?(0,B.jsx)(B.Fragment,{children:e}):(0,B.jsx)(Jle,{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 Xle={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function Zle({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:te=z8.Bezier,connectionLineStyle:ne,connectionLineComponent:re,connectionLineContainerStyle:L,deleteKeyCode:R=`Backspace`,selectionKeyCode:ie=`Shift`,selectionOnDrag:ae=!1,selectionMode:oe=L8.Full,panActivationKeyCode:se=`Space`,multiSelectionKeyCode:ce=h5()?`Meta`:`Control`,zoomActivationKeyCode:le=h5()?`Meta`:`Control`,snapToGrid:ue,snapGrid:de,onlyRenderVisibleElements:fe=!1,selectNodesOnDrag:pe,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,nodeOrigin:ve=N7,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe=!0,defaultViewport:Se=Oce,minZoom:Ce=.5,maxZoom:we=2,translateExtent:Te=M8,preventScrolling:Ee=!0,nodeExtent:De,defaultMarkerColor:Oe=`#b1b1b7`,zoomOnScroll:ke=!0,zoomOnPinch:Ae=!0,panOnScroll:je=!1,panOnScrollSpeed:Me=.5,panOnScrollMode:Ne=I8.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=jce(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,...Xle},ref:Pt,className:k3([`react-flow`,i,It]),id:xt,role:`application`,children:(0,B.jsxs)(Yle,{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)(Ace,{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)(Kle,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:te,connectionLineStyle:ne,connectionLineComponent:re,connectionLineContainerStyle:L,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)(Dce,{onSelectionChange:k}),We,(0,B.jsx)(Sce,{proOptions:lt,position:ct}),(0,B.jsx)(xce,{rfId:Ft,disableKeyboardA11y:pt})]})})}var Qle=Y7(Zle);function $le(e){let[t,n]=(0,z.useState)(e);return[t,n,(0,z.useCallback)(e=>n(t=>H7(e,t)),[])]}function eue(e){let[t,n]=(0,z.useState)(e);return[t,n,(0,z.useCallback)(e=>n(t=>U7(e,t)),[])]}j8.error014();function tue({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:k3([`react-flow__background-pattern`,n,r])})}function nue({radius:e,className:t}){return(0,B.jsx)(`circle`,{cx:e,cy:e,r:e,className:k3([`react-flow__background-pattern`,`dots`,t])})}var B9;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(B9||={});var rue={[B9.Dots]:1,[B9.Lines]:1,[B9.Cross]:6},iue=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function V9({id:e,variant:t=B9.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}=T7(iue,S7),m=r||rue[t],h=t===B9.Dots,g=t===B9.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:k3([`react-flow__background`,l]),style:{...c,...e9,"--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)(nue,{radius:y/2,className:u}):(0,B.jsx)(tue,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,B.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}V9.displayName=`Background`;var aue=(0,z.memo)(V9);function oue(){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 sue(){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 cue(){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 lue(){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 uue(){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 H9({children:e,className:t,...n}){return(0,B.jsx)(`button`,{type:`button`,className:k3([`react-flow__controls-button`,t]),...n,children:e})}var due=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function U9({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=E7(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=T7(due,S7),{zoomIn:y,zoomOut:b,fitView:x}=Q7();return(0,B.jsxs)(A7,{className:k3([`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)(H9,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,B.jsx)(oue,{})}),(0,B.jsx)(H9,{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)(sue,{})})]}),n&&(0,B.jsx)(H9,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,B.jsx)(cue,{})}),r&&(0,B.jsx)(H9,{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)(uue,{}):(0,B.jsx)(lue,{})}),u]})}U9.displayName=`Controls`;var fue=(0,z.memo)(U9);function pue({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:k3([`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 mue=(0,z.memo)(pue),hue=e=>e.nodes.map(e=>e.id),W9=e=>e instanceof Function?e:()=>e;function gue({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=mue,onClick:o}){let s=T7(hue,S7),c=W9(t),l=W9(e),u=W9(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,B.jsx)(B.Fragment,{children:s.map(e=>(0,B.jsx)(vue,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function _ue({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}=T7(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}=_5(r);return{node:r,x:i,y:a,width:o,height:s}},S7);return!l||l.hidden||!v5(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 vue=(0,z.memo)(_ue),yue=(0,z.memo)(gue),bue=200,xue=150,Sue=e=>!e.hidden,Cue=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?o5(q8(e.nodeLookup,{filter:Sue}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},wue=`react-flow__minimap-desc`;function G9({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=E7(),S=(0,z.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=T7(Cue,S7),j=e?.width??bue,M=e?.height??xue,N=C.width/j,ee=C.height/M,P=Math.max(N,ee),F=P*j,I=P*M,te=b*P,ne=C.x-(F-C.width)/2-te,re=C.y-(I-C.height)/2-te,L=F+te*2,R=I+te*2,ie=`${wue}-${T}`,ae=(0,z.useRef)(0),oe=(0,z.useRef)();ae.current=P,(0,z.useEffect)(()=>{if(S.current&&E)return oe.current=Yse({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)(A7,{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:k3([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,B.jsxs)(`svg`,{width:j,height:M,viewBox:`${ne} ${re} ${L} ${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)(yue,{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${ne-te},${re-te}h${L+te*2}v${R+te*2}h${-L-te*2}z
|
|
76
|
-
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}G9.displayName=`MiniMap`;var K9=(0,z.memo)(G9),Tue=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Eue={[f7.Line]:`right`,[f7.Handle]:`bottom-right`};function Due({nodeId:e,position:t,variant:n=f7.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=o9(),y=typeof e==`string`?e:v,b=E7(),x=(0,z.useRef)(null),S=n===f7.Handle,C=T7((0,z.useCallback)(Tue(S&&p),[S,p]),S7),w=(0,z.useRef)(null),T=t??Eue[n];return(0,z.useEffect)(()=>{if(!(!x.current||!y))return w.current||=lce({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=Y5([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...y5({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:k3([`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)(Due);var q9={requirement:`#3b82f6`,decision:`#8b5cf6`,code_change:`#10b981`,outcome:`#f59e0b`};function Oue({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:q9[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:B8.ArrowClosed,color:`#d1d5db`}})),[t]),[a,,o]=$le(r),[s,,c]=eue(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)(Qle,{nodes:a,edges:s,onNodesChange:o,onEdgesChange:c,onNodeClick:l,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[(0,B.jsx)(aue,{color:`#f3f4f6`,gap:20}),(0,B.jsx)(fue,{}),(0,B.jsx)(K9,{nodeColor:t=>q9[e.find(e=>e.id===t.id)?.node_type||``]||`#6b7280`,style:{background:`#f9fafb`}})]})}var J9={requirement:ic,decision:pc,code_change:qs,outcome:Us},Y9={requirement:`#3b82f6`,decision:`#8b5cf6`,code_change:`#10b981`,outcome:`#f59e0b`},X9={requirement:`需求`,decision:`决策`,code_change:`代码变更`,outcome:`结果`},Z9=[`#3b82f6`,`#8b5cf6`,`#10b981`,`#f59e0b`,`#ef4444`,`#06b6d4`];function kue(){let e=qe(),[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(new Set),[l,u]=(0,z.useState)(1),[d,f]=(0,z.useState)(20),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(``),[x,S]=(0,z.useState)(`list`),[C,w]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:T}=ct({queryKey:[`knowledge-overview`],queryFn:()=>gl().then(e=>e.data)}),{data:E}=ct({queryKey:[`knowledge-search`,t,r,y],queryFn:()=>hl(t,y||void 0,r||void 0).then(e=>e.data),enabled:t.length>0}),{data:D}=ct({queryKey:[`knowledge-all`],queryFn:()=>hl(``,void 0,void 0,500).then(e=>e.data)}),{data:O}=ct({queryKey:[`knowledge-filtered`,r,y],queryFn:()=>hl(``,y||void 0,r||void 0,500).then(e=>e.data),enabled:t.length===0&&(!!r||!!y)}),{data:k}=ct({queryKey:[`knowledge-neighbors`,a],queryFn:()=>_l(a).then(e=>e.data),enabled:!!a}),{data:A}=ct({queryKey:[`knowledge-graph`,y,r],queryFn:()=>vl(y||void 0,r||void 0).then(e=>e.data),enabled:x===`graph`}),j=lt({mutationFn:yl,onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-filtered`]}),e.invalidateQueries({queryKey:[`knowledge-search`]}),e.invalidateQueries({queryKey:[`knowledge-overview`]}),m(!1)}}),M=lt({mutationFn:({id:e,data:t})=>bl(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-filtered`]}),e.invalidateQueries({queryKey:[`knowledge-search`]}),g(!1),v(null)}}),N=lt({mutationFn:xl,onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-filtered`]}),e.invalidateQueries({queryKey:[`knowledge-search`]}),e.invalidateQueries({queryKey:[`knowledge-overview`]}),o(null)}}),ee=lt({mutationFn:async e=>{for(let t of e)await xl(t)},onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-filtered`]}),e.invalidateQueries({queryKey:[`knowledge-search`]}),e.invalidateQueries({queryKey:[`knowledge-overview`]}),c(new Set),o(null)}}),P=t?E?.items:r||y?O?.items:D?.items,F=Array.from(new Set(D?.items.map(e=>e.node_type)||[])),I=Array.from(new Set(D?.items.map(e=>e.project_path||``).filter(Boolean)||[])),te=T?.byType?Object.entries(T.byType).map(([e,t])=>({name:e,value:t})):[],ne=Math.ceil((P?.length||0)/d),re=P?.slice((l-1)*d,l*d),L=e=>{e.preventDefault();let t=new FormData(e.currentTarget);j.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`)})},R=e=>{if(e.preventDefault(),!_)return;let t=new FormData(e.currentTarget);M.mutate({id:_.id,data:{title:t.get(`title`),content:t.get(`content`),tags:t.get(`tags`)}})},ie=e=>{w({open:!0,title:`删除知识节点`,description:`确认删除此知识节点?关联的边也会被删除。`,onConfirm:()=>{N.mutate(e),w(e=>({...e,open:!1}))}})};return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(X,{children:(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1`,children:[(0,B.jsx)(Oc,{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),u(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),u(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:`全部类型`}),F.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsxs)(`select`,{value:y,onChange:e=>{b(e.target.value),u(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:`全部项目`}),I.map(e=>(0,B.jsx)(`option`,{value:e,children:e.split(`/`).pop()},e))]}),(0,B.jsx)(Y,{variant:`primary`,size:`sm`,icon:Cc,onClick:()=>m(!0),children:`创建节点`}),s.size>0&&(0,B.jsxs)(Y,{variant:`danger`,size:`sm`,icon:zc,onClick:()=>{w({open:!0,title:`批量删除知识节点`,description:`确定删除选中的 ${s.size} 个知识节点吗?关联的边也会被删除。此操作不可撤销。`,onConfirm:()=>{ee.mutate(Array.from(s)),w(e=>({...e,open:!1}))}})},loading:ee.isPending,children:[`删除 (`,s.size,`)`]}),(0,B.jsxs)(`div`,{className:`flex border border-gray-200 rounded-lg overflow-hidden`,children:[(0,B.jsx)(`button`,{onClick:()=>S(`list`),className:`px-3 py-2 text-sm transition-colors ${x===`list`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`}`,children:`列表`}),(0,B.jsxs)(`button`,{onClick:()=>S(`graph`),className:`px-3 py-2 text-sm transition-colors flex items-center gap-1 ${x===`graph`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`}`,children:[(0,B.jsx)(vc,{className:`h-4 w-4`}),`图谱`]})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,B.jsxs)(X,{title:`知识图谱概览`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 mb-4`,children:[(0,B.jsxs)(`button`,{className:`text-center p-4 bg-blue-50 rounded-xl hover:bg-blue-100 transition-colors cursor-pointer`,onClick:()=>{i(``),b(``),u(1)},title:`点击查看全部节点`,children:[(0,B.jsx)(Ns,{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:T?.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)(cc,{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:te.length}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`节点类型`})]})]}),te.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:te.map((e,t)=>(0,B.jsxs)(`button`,{onClick:()=>{i(r===e.name?``:e.name),u(1)},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${r===e.name?`text-white`:`bg-gray-100 text-gray-700 hover:bg-gray-200`}`,style:r===e.name?{backgroundColor:Z9[t%Z9.length]}:{},children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:Z9[t%Z9.length]}}),X9[e.name]||e.name,(0,B.jsxs)(`span`,{className:`opacity-70`,children:[`(`,e.value,`)`]})]},e.name))})]}),(0,B.jsx)(X,{title:`节点类型分布`,children:te.length>0?(0,B.jsx)($O,{width:`100%`,height:200,children:(0,B.jsxs)(h2,{children:[(0,B.jsx)(HJ,{data:te,cx:`50%`,cy:`50%`,innerRadius:50,outerRadius:80,dataKey:`value`,label:({name:e,percent:t})=>`${X9[e]||e} ${(t*100).toFixed(0)}%`,onClick:e=>{i(r===e.name?``:e.name),u(1)},style:{cursor:`pointer`},children:te.map((e,t)=>(0,B.jsx)(GW,{fill:Z9[t%Z9.length],opacity:r&&r!==e.name?.4:1},t))}),(0,B.jsx)(WW,{})]})}):(0,B.jsx)(`div`,{className:`flex items-center justify-center h-48 text-gray-400`,children:`暂无数据`})})]}),x===`graph`&&(0,B.jsx)(X,{title:`知识图谱`,children:(0,B.jsx)(`div`,{className:`h-[600px] border border-gray-200 rounded-lg overflow-hidden`,children:A?(0,B.jsx)(Oue,{nodes:A.nodes,edges:A.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`})})})}),x===`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)(X,{title:`知识节点 (${P?.length||0})`,action:(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[P&&P.length>0&&(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Qs,onClick:()=>{if(!P||P.length===0)return;let e=[`ID`,`标题`,`类型`,`内容`,`标签`,`项目路径`],t=P.map(e=>[e.id,e.title,e.node_type,e.content,e.tags||``,e.project_path||``]);M4(`knowledge-nodes-${T4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},children:`导出 CSV`}),re&&re.length>0&&(0,B.jsx)(`button`,{onClick:()=>{s.size===re.length?c(new Set):c(new Set(re.map(e=>e.id)))},className:`text-xs text-blue-600 hover:underline`,children:s.size===re.length?`取消全选`:`全选当前页`})]}),children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[re?.map((e,t)=>{let n=J9[e.node_type]||Ns,r=Y9[e.node_type]||`#6b7280`;return(0,B.jsx)(Mx.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 ${s.has(e.id)?`border-blue-300 bg-blue-50`: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)(`input`,{type:`checkbox`,checked:s.has(e.id),onChange:t=>{t.stopPropagation(),c(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 cursor-pointer flex-shrink-0 mt-1`}),(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)(Fx,{size:`sm`,variant:e.node_type===`outcome`?`success`:e.node_type===`decision`?`info`:`default`,children:X9[e.node_type]||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(),v({id:e.id,title:e.title,content:e.content,tags:e.tags||``}),g(!0)},className:`p-1.5 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-600`,children:(0,B.jsx)(Pc,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),ie(e.id)},className:`p-1.5 rounded hover:bg-red-100 text-gray-400 hover:text-red-600`,children:(0,B.jsx)(zc,{className:`h-3.5 w-3.5`})})]})]})},e.id)}),(!re||re.length===0)&&(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-gray-400`,children:[(0,B.jsx)(Ns,{className:`h-12 w-12 mb-4`}),(0,B.jsx)(`p`,{children:`暂无知识节点`}),(0,B.jsx)(`p`,{className:`text-sm mt-1`,children:`使用 Claude Code 进行开发后,知识会自动沉淀`})]})]}),P&&P.length>0&&(0,B.jsx)(`div`,{className:`mt-4`,children:(0,B.jsx)(j4,{currentPage:l,totalPages:ne,onPageChange:u,pageSize:d,onPageSizeChange:e=>{f(e),u(1)},totalItems:P.length})})]})}),(0,B.jsx)(`div`,{children:(0,B.jsx)(X,{title:`节点详情`,children:a&&P?(()=>{let e=P.find(e=>e.id===a);if(!e)return(0,B.jsx)(`div`,{className:`text-gray-400 text-center py-8`,children:`节点未找到`});let t=J9[e.node_type]||Ns,n=Y9[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)(Fx,{size:`sm`,children:X9[e.node_type]||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))})]}),k&&k.items.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-xs font-semibold text-gray-500 mb-2`,children:[`关联节点 (`,k.total,`)`]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:k.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)(Oc,{className:`h-8 w-8 mb-3`}),(0,B.jsx)(`p`,{className:`text-sm`,children:`点击左侧节点查看详情`})]})})})]}),p&&(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`,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)(Y,{type:`button`,variant:`secondary`,onClick:()=>m(!1),children:`取消`}),(0,B.jsx)(Y,{type:`submit`,variant:`primary`,loading:j.isPending,children:`创建`})]})]})]})}),h&&_&&(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,onClick:()=>g(!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:R,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:_.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:_.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:_.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)(Y,{type:`button`,variant:`secondary`,onClick:()=>g(!1),children:`取消`}),(0,B.jsx)(Y,{type:`submit`,variant:`primary`,loading:M.isPending,children:`保存`})]})]})]})}),(0,B.jsx)(O4,{open:C.open,title:C.title,description:C.description,variant:`danger`,onConfirm:C.onConfirm,onCancel:()=>w({...C,open:!1})})]})}function Aue(){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)(``),[b,x]=(0,z.useState)(new Set),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(``),[E,D]=(0,z.useState)(!1),{data:O}=ct({queryKey:[`project-meta-all`],queryFn:()=>W.get(`/projects/meta/all`).then(e=>e.data),staleTime:3e4}),k=O||{},A=lt({mutationFn:({projectPath:e,meta:t})=>W.put(`/projects/${encodeURIComponent(e)}/meta`,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`project-meta-all`]})},onError:e=>Zc(e.message||`操作失败`,`error`)}),j=(e,t)=>{t.stopPropagation();let n=k[e]||{notes:``,tags:[],archived:!1};_(n.notes),y(n.tags.join(`, `)),h(e)},M=()=>{if(!m)return;let e=k[m]||{notes:``,tags:[],archived:!1};A.mutate({projectPath:m,meta:{notes:g.trim(),tags:v.split(`,`).map(e=>e.trim()).filter(Boolean),archived:e.archived}}),h(null)},N=(e,t)=>{t.stopPropagation();let n=k[e]||{notes:``,tags:[],archived:!1};A.mutate({projectPath:e,meta:{...n,archived:!n.archived}})},ee=(e,t)=>{t.stopPropagation(),x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},P=()=>{for(let e of b){let t=k[e]||{notes:``,tags:[],archived:!1};A.mutate({projectPath:e,meta:{...t,archived:!0}})}Zc(`已归档 ${b.size} 个项目`,`success`),x(new Set)},F=async()=>{D(!0);let e=0;for(let t of b)try{await Al(encodeURIComponent(t)),e++}catch{}D(!1),C(!1),T(``),x(new Set),t.invalidateQueries({queryKey:[`projects`]}),Zc(`已删除 ${e} 个项目`,`success`)},{data:I,isLoading:te}=ct({queryKey:[`projects`],queryFn:()=>Ol({limit:1e3}).then(e=>e.data),refetchInterval:3e4});if(te)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 ne=I?.items||[],re=e=>{c===e?d(e=>!e):(l(e),d(!1)),a(1)},L=ne.filter(e=>{if(k[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}),R=Math.ceil(L.length/o),ie=L.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.jsx)(`div`,{className:`flex items-center gap-3`,children:b.size>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Fx,{variant:`info`,children:[b.size,` 个已选`]}),(0,B.jsxs)(`button`,{onClick:P,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:[(0,B.jsx)(Es,{className:`h-4 w-4`}),`批量归档`]}),(0,B.jsxs)(`button`,{onClick:()=>C(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors`,children:[(0,B.jsx)(zc,{className:`h-4 w-4`}),`批量删除`]}),(0,B.jsxs)(`button`,{onClick:()=>x(new Set),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)(Gc,{className:`h-4 w-4`}),`取消选择`]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Fx,{variant:`info`,children:[L.length,` 个项目`]}),(0,B.jsxs)(`button`,{onClick:()=>p(!f),className:q(`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=L.map(e=>[e.projectName,e.projectPath,e.sessionCount,e.pipelineCount,e.qualityIssueCount,e.totalEvents,e.lastActivity||``]);M4(`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)(X,{children:(0,B.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1`,children:[(0,B.jsx)(Oc,{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:()=>re(e),className:q(`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:q(`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:ie.map((t,n)=>{let r=t.projectPath,i=k[r]||{notes:``,tags:[],archived:!1};return(0,B.jsx)(Mx.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:n*.03},children:(0,B.jsx)(X,{className:q(`!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)(oc,{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)(Ic,{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=>ee(r,e),className:q(`p-1 rounded transition-colors`,b.has(r)?`text-blue-600`:`text-gray-300 hover:text-gray-500`),title:`选择`,children:b.has(r)?(0,B.jsx)(Nc,{className:`h-3.5 w-3.5`}):(0,B.jsx)(Fc,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{onClick:e=>N(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=>j(r,e),className:`p-1 text-gray-400 hover:text-gray-600 rounded`,title:`项目设置`,children:(0,B.jsx)(kc,{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)(cc,{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)(Ac,{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)(Ns,{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)(Ks,{className:`h-3 w-3 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[`最近活动:`,T4(tf(t.lastActivity),`MM-dd HH:mm`)]})]})]})})},r)})}),L.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)(oc,{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 后,项目将自动出现在这里`})]}),L.length>0&&(0,B.jsx)(j4,{currentPage:i,totalPages:R,onPageChange:a,pageSize:o,onPageSizeChange:e=>{s(e),a(1)},totalItems:L.length}),S&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onClick:()=>{C(!1),T(``)},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)(`h3`,{className:`text-lg font-bold text-red-600 mb-3 flex items-center gap-2`,children:[(0,B.jsx)(zc,{className:`h-5 w-5`}),`危险操作:批量删除项目`]}),(0,B.jsxs)(`div`,{className:`bg-red-50 border border-red-200 rounded-lg p-3 mb-4`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-red-800 font-medium mb-2`,children:[`⚠️ 此操作将永久删除 `,(0,B.jsxs)(`strong`,{children:[b.size,` 个项目`]}),` 的所有监控数据:`]}),(0,B.jsxs)(`ul`,{className:`text-xs text-red-700 space-y-1 ml-4 list-disc`,children:[(0,B.jsx)(`li`,{children:`所有会话记录`}),(0,B.jsx)(`li`,{children:`所有 Pipeline 历史`}),(0,B.jsx)(`li`,{children:`所有质量问题记录`}),(0,B.jsx)(`li`,{children:`所有事件日志`}),(0,B.jsx)(`li`,{children:`所有知识节点`})]}),(0,B.jsx)(`p`,{className:`text-xs text-red-800 font-bold mt-2`,children:`此操作无法撤销,无法恢复!`})]}),(0,B.jsxs)(`div`,{className:`mb-4`,children:[(0,B.jsxs)(`label`,{className:`block text-sm font-medium text-gray-700 mb-2`,children:[`请输入 `,(0,B.jsx)(`code`,{className:`px-1.5 py-0.5 bg-gray-100 rounded text-red-600`,children:`删除`}),` 以确认批量删除:`]}),(0,B.jsx)(`input`,{type:`text`,value:w,onChange:e=>T(e.target.value),placeholder:`输入「删除」二字`,className:`w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 focus:border-red-500`,autoFocus:!0})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,B.jsx)(`button`,{onClick:()=>{C(!1),T(``)},className:`px-4 py-2 text-sm text-gray-600 hover:bg-gray-50 rounded-lg`,children:`取消`}),(0,B.jsx)(`button`,{disabled:w!==`删除`||E,onClick:F,className:`px-4 py-2 text-sm bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed`,children:E?`删除中...`:`确认删除`})]})]})}),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)(Gc,{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:M,className:`px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700`,children:`保存`})]})]})})]})}var jue={spec:{label:`规格`,icon:ic,color:`text-blue-600`,bg:`bg-blue-50`,border:`border-blue-200`},security:{label:`安全`,icon:jc,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-200`},quality:{label:`质量`,icon:nc,color:`text-purple-600`,bg:`bg-purple-50`,border:`border-purple-200`},test:{label:`测试`,icon:Rc,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-200`},performance:{label:`性能`,icon:Kc,color:`text-orange-600`,bg:`bg-orange-50`,border:`border-orange-200`}},Mue={fail:{label:`失败`,icon:Gs,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-300`},warn:{label:`警告`,icon:Vc,color:`text-yellow-600`,bg:`bg-yellow-50`,border:`border-yellow-300`},pass:{label:`通过`,icon:Us,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-300`}};function Nue({level:e}){let t=Mue[e];if(!t)return(0,B.jsx)(Fx,{size:`sm`,children:e});let n=t.icon;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),t.label]})}function Pue({category:e}){let t=jue[e];if(!t)return(0,B.jsx)(Fx,{size:`sm`,children:e});let n=t.icon;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),t.label]})}function Fue(){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)(``),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(1),[_,v]=(0,z.useState)(20),[y,b]=(0,z.useState)(null),x=async e=>{try{let t=await Jl(e);await navigator.clipboard.writeText(t.data.context),b(e),Zc(`上下文已复制,请粘贴到 Claude Code 进行修复`,`success`),setTimeout(()=>b(null),3e3)}catch{Zc(`复制失败`,`error`)}},{data:S,isLoading:C,isError:w,error:T}=ct({queryKey:[`project`,e],queryFn:()=>kl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e}),{data:E}=ct({queryKey:[`claudemd`,e],queryFn:()=>Rl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e&&r===`claudemd`}),{data:D}=ct({queryKey:[`claudemd-modules`,e],queryFn:()=>Vl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e&&r===`claudemd`}),O=lt({mutationFn:()=>Al(encodeURIComponent(decodeURIComponent(e))),onSuccess:()=>{n.invalidateQueries({queryKey:[`projects`]}),t(`/projects`)},onError:e=>Zc(e.message||`删除失败`,`error`)}),k=lt({mutationFn:t=>zl(encodeURIComponent(decodeURIComponent(e)),t),onSuccess:()=>{n.invalidateQueries({queryKey:[`claudemd`,e]}),u(!1)},onError:e=>Zc(e.message||`保存失败`,`error`)}),A=lt({mutationFn:()=>Hl(encodeURIComponent(decodeURIComponent(e))),onSuccess:t=>{n.invalidateQueries({queryKey:[`claudemd`,e]}),m({success:!0,message:t.data.distilled?`蒸馏完成,压缩 ${t.data.reduction}%(${t.data.before} → ${t.data.after} 字符):${t.data.summary}`:t.data.message??`无需蒸馏`})},onError:e=>{m({success:!1,message:e.message})}}),[j,M]=(0,z.useState)(null),[N,ee]=(0,z.useState)(!1),[P,F]=(0,z.useState)(!1),[I,te]=(0,z.useState)(null),[ne,re]=(0,z.useState)(!1),[L,R]=(0,z.useState)(null);return w?(0,B.jsxs)(`div`,{className:`flex items-center justify-center h-96 text-red-500`,children:[`加载失败:`,T?.message||`未知错误`]}):C||!S?(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)(F4,{items:[{label:`项目列表`,path:`/projects`},{label:S.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)(Y,{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)(oc,{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:S.projectName}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:S.projectPath})]})]})]}),(0,B.jsx)(Y,{variant:`danger`,size:`sm`,icon:zc,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)(X,{className:`max-w-md`,children:[(0,B.jsxs)(`h3`,{className:`text-lg font-bold text-red-600 mb-3 flex items-center gap-2`,children:[(0,B.jsx)(Vc,{className:`h-5 w-5`}),`危险操作:删除项目`]}),(0,B.jsxs)(`div`,{className:`bg-red-50 border border-red-200 rounded-lg p-3 mb-4`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-red-800 font-medium mb-2`,children:[`⚠️ 此操作将永久删除项目 `,(0,B.jsx)(`strong`,{children:S.projectName}),` 的所有监控数据:`]}),(0,B.jsxs)(`ul`,{className:`text-xs text-red-700 space-y-1 ml-4 list-disc`,children:[(0,B.jsx)(`li`,{children:`所有会话记录`}),(0,B.jsx)(`li`,{children:`所有 Pipeline 历史`}),(0,B.jsx)(`li`,{children:`所有质量问题记录`}),(0,B.jsx)(`li`,{children:`所有事件日志`}),(0,B.jsx)(`li`,{children:`所有知识节点`})]}),(0,B.jsx)(`p`,{className:`text-xs text-red-800 font-bold mt-2`,children:`此操作无法撤销,无法恢复!`})]}),(0,B.jsxs)(`div`,{className:`mb-4`,children:[(0,B.jsxs)(`label`,{className:`block text-sm font-medium text-gray-700 mb-2`,children:[`请输入项目名称 `,(0,B.jsx)(`code`,{className:`px-1.5 py-0.5 bg-gray-100 rounded text-red-600`,children:S.projectName}),` 以确认删除:`]}),(0,B.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`输入项目名称`,className:`w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 focus:border-red-500`,autoFocus:!0})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>{o(!1),c(``)},children:`取消`}),(0,B.jsx)(Y,{variant:`danger`,size:`sm`,disabled:s!==S.projectName,onClick:()=>{s===S.projectName&&(O.mutate(),o(!1),c(``))},children:`确认删除`})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-4`,children:[(0,B.jsx)(X,{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:S.sessions.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`会话`})]})]})}),(0,B.jsx)(X,{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)(cc,{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:S.pipelines.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Pipeline`})]})]})}),(0,B.jsx)(X,{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)(Lc,{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:S.events.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`事件`})]})]})}),(0,B.jsx)(X,{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)(Ac,{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:S.quality.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`质量`})]})]})}),(0,B.jsx)(X,{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)(Ns,{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:S.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:`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)(X,{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=S.sessions.items;return Math.ceil(n.length/_),(0,B.jsxs)(B.Fragment,{children:[n.slice((h-1)*_,h*_).map(n=>(0,B.jsxs)(`tr`,{onClick:()=>t(`/sessions/${n.session_id}`,{state:{from:`/projects/${encodeURIComponent(decodeURIComponent(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)(Fx,{size:`sm`,className:ef(n.status),children:n.status})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:T4(tf(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=S.sessions.items,t=Math.ceil(e.length/_);return e.length>_?(0,B.jsx)(`div`,{className:`mt-4`,children:(0,B.jsx)(j4,{currentPage:h,totalPages:t,onPageChange:g,pageSize:_,onPageSizeChange:e=>{v(e),g(1)},totalItems:e.length})}):null})()]}),r===`pipelines`&&(0,B.jsx)(X,{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:S.pipelines.items.map(n=>(0,B.jsxs)(`tr`,{onClick:()=>t(`/pipelines/${n.id}`,{state:{from:`/projects/${encodeURIComponent(decodeURIComponent(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)(Fx,{size:`sm`,children:n.phase})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:T4(tf(n.updated_at),`MM-dd HH:mm`)})]},n.id))})]})})}),r===`quality`&&(0,B.jsxs)(X,{children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,B.jsxs)(`p`,{className:`text-sm text-gray-600`,children:[`共 `,S.quality.total,` 个质量问题`]})}),(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`})]})}),(0,B.jsx)(`tbody`,{className:`text-sm`,children:S.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)(Nue,{level:e.level})}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Pue,{category:e.category})}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Fx,{size:`sm`,variant:e.resolved?`success`:`default`,children:e.resolved?`已解决`:`未解决`})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:T4(tf(e.created_at),`MM-dd HH:mm`)}),(0,B.jsx)(`td`,{className:`py-3`,children:!e.resolved&&(0,B.jsxs)(`button`,{onClick:()=>x(e.id),className:`flex items-center gap-1 px-2 py-1 text-xs text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors`,title:`复制上下文到剪贴板`,children:[y===e.id?(0,B.jsx)(Is,{className:`h-3.5 w-3.5 text-green-500`}):(0,B.jsx)(Ys,{className:`h-3.5 w-3.5`}),y===e.id?`已复制`:`复制`]})})]},e.id))})]})})]}),r===`knowledge`&&(0,B.jsx)(X,{children:(0,B.jsx)(`div`,{className:`space-y-3`,children:S.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)(ic,{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)(Fx,{size:`sm`,children:e.node_type}),(0,B.jsxs)(`span`,{children:[`更新于 `,T4(tf(e.updated_at),`MM-dd HH:mm`)]})]})]})]})},e.id))})}),r===`rules`&&(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(X,{title:`意图识别规则`,children:(0,B.jsx)(`div`,{className:`space-y-2`,children:S.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)(Fx,{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)(X,{title:`任务模式`,children:(0,B.jsx)(`div`,{className:`space-y-2`,children:S.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)(Fx,{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)(Bc,{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===`convention`&&e&&(0,B.jsx)(Iue,{encodedPath:encodeURIComponent(decodeURIComponent(e))}),r===`claudemd`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(X,{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)(ic,{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:E?.exists?`${(E.size/1024).toFixed(1)} KB · ${E.hasAutoSection?`含自动区块`:`纯用户内容`}`:`文件不存在`})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Tc,onClick:()=>n.invalidateQueries({queryKey:[`claudemd`,e]}),children:`刷新`}),E?.exists&&(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Kc,onClick:()=>{m(null),A.mutate()},disabled:A.isPending,title:`AI 蒸馏:压缩冗余内容,保留核心规范`,children:A.isPending?`蒸馏中...`:`蒸馏`}),E?.exists&&!l&&(0,B.jsx)(Y,{size:`sm`,icon:xc,onClick:()=>{f(E.content||``),u(!0)},children:`编辑`})]})]})}),p&&(0,B.jsx)(X,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsx)(`p`,{className:`text-sm ${p.success?`text-gray-900`:`text-red-600`}`,children:p.message}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Gc,onClick:()=>m(null)})]})}),l&&(0,B.jsxs)(X,{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:d,onChange:e=>f(e.target.value)}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end mt-3`,children:[(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Gc,onClick:()=>u(!1),children:`取消`}),(0,B.jsx)(Y,{size:`sm`,icon:Ls,onClick:()=>k.mutate(d),children:`保存`})]})]}),!l&&E?.exists&&(0,B.jsx)(X,{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:E.content})}),(0,B.jsx)(X,{title:`子模块 (${D?.total??0})`,children:D?.items.length===0?(0,B.jsx)(`p`,{className:`text-sm text-gray-400`,children:`未检测到子模块`}):(0,B.jsx)(`div`,{className:`space-y-2`,children:D?.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)(oc,{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)(Fx,{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)(X,{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)(Y,{variant:`secondary`,size:`sm`,icon:kc,onClick:async()=>{ee(!0),M(null);try{M((await Bl(encodeURIComponent(decodeURIComponent(e)))).data.profile)}catch(e){M({error:String(e)})}finally{ee(!1)}},disabled:N,children:N?`检测中...`:`环境检测`}),(0,B.jsx)(Y,{size:`sm`,icon:Kc,onClick:async()=>{F(!0),te(null);try{let t=await Ul(encodeURIComponent(decodeURIComponent(e)));te({success:t.data.success,message:t.data.message,claudeMdGenerated:t.data.claudeMdGenerated}),M(t.data.profile),n.invalidateQueries({queryKey:[`claudemd`,e]}),n.invalidateQueries({queryKey:[`project`,e]})}catch(e){te({success:!1,message:String(e)})}finally{F(!1)}},disabled:P,children:P?`初始化中...`:`一键初始化`}),(0,B.jsx)(Y,{size:`sm`,icon:ic,onClick:async()=>{re(!0),R(null);try{let t=await jl(encodeURIComponent(decodeURIComponent(e)));R({success:t.data.success,message:t.data.message}),t.data.skipped||(n.invalidateQueries({queryKey:[`conventions`,e]}),n.invalidateQueries({queryKey:[`claudemd`,e]}))}catch(e){R({success:!1,message:String(e)})}finally{re(!1)}},disabled:ne,children:ne?`生成中...`:`初始化规范`})]})]})}),I&&(0,B.jsx)(X,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[I.success?(0,B.jsx)(Ls,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,B.jsx)(Gc,{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 ${I.success?`text-gray-900`:`text-red-600`}`,children:I.message}),I.claudeMdGenerated&&(0,B.jsx)(`p`,{className:`text-xs text-green-600 mt-0.5`,children:`CLAUDE.md 已自动生成`})]})]}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Gc,onClick:()=>te(null)})]})}),L&&(0,B.jsx)(X,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[L.success?(0,B.jsx)(Ls,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,B.jsx)(Gc,{className:`h-4 w-4 text-red-500 mt-0.5 flex-shrink-0`}),(0,B.jsx)(`p`,{className:q(`text-sm font-medium`,L.success?`text-gray-900`:`text-red-600`),children:L.message})]}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Gc,onClick:()=>R(null)})]})}),j&&!(`error`in j)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(X,{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:j.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:j.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:j.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:j.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:j.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:j.formatter||`未检测到`})]})]})}),j.languages.length>0&&(0,B.jsx)(X,{title:`检测到的语言`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:j.languages.map((e,t)=>(0,B.jsxs)(Fx,{size:`sm`,children:[e.name,e.version?` ${e.version}`:``]},t))})}),j.frameworks.length>0&&(0,B.jsx)(X,{title:`检测到的框架`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:j.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(j.scripts).length>0&&(0,B.jsx)(X,{title:`常用脚本`,children:(0,B.jsx)(`div`,{className:`space-y-1`,children:Object.entries(j.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))})}),j.keyDirectories.length>0&&(0,B.jsx)(X,{title:`关键目录`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:j.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)(oc,{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))})})]}),j&&`error`in j&&(0,B.jsx)(X,{children:(0,B.jsxs)(`p`,{className:`text-sm text-red-600`,children:[`检测失败:`,j.error]})})]})]})}function Iue({encodedPath:e}){let[t,n]=(0,z.useState)(`bindings`),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),l=qe(),{data:u,isLoading:d}=ct({queryKey:[`project-conventions`,e],queryFn:()=>Ml(e).then(e=>e.data)}),{data:f}=ct({queryKey:[`global-conventions`],queryFn:()=>mu().then(e=>e.data),enabled:r}),{data:p}=ct({queryKey:[`project-custom-yaml`,e],queryFn:()=>Fl(e).then(e=>e.data),enabled:s}),m=lt({mutationFn:t=>Nl(e,t).then(e=>e.data),onSuccess:t=>{Zc(`已绑定:${t.convention.name}`,`success`),i(!1),l.invalidateQueries({queryKey:[`project-conventions`,e]})}}),h=lt({mutationFn:t=>Pl(e,t).then(e=>e.data),onSuccess:()=>{Zc(`已解绑`,`success`),l.invalidateQueries({queryKey:[`project-conventions`,e]})}}),g=lt({mutationFn:()=>Ll(e).then(e=>e.data),onSuccess:t=>{Zc(t.isIncremental?`增量蒸馏完成,版本 ${t.convention.version}`:`蒸馏完成,生成 ${t.convention.name}`,`success`),l.invalidateQueries({queryKey:[`project-conventions`,e]}),n(`custom`)}}),_=lt({mutationFn:t=>Il(e,t).then(e=>e.data),onSuccess:()=>{Zc(`保存成功`,`success`),c(!1),l.invalidateQueries({queryKey:[`project-conventions`,e]})}}),v=u?.bindings||[],y=u?.custom,b=(f?.items||[]).filter(e=>!v.some(t=>t.id===e.id)),x={official:`bg-amber-50 text-amber-700`,user:`bg-blue-50 text-blue-700`,community:`bg-purple-50 text-purple-700`},S={official:`官方`,user:`用户`,community:`社区`};return d?(0,B.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,B.jsx)(Tc,{className:`h-6 w-6 animate-spin text-blue-500`})}):(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`div`,{className:`flex gap-1 bg-gray-100 rounded-lg p-1`,children:[`bindings`,`custom`].map(e=>(0,B.jsx)(`button`,{onClick:()=>n(e),className:`px-4 py-1.5 text-sm font-medium rounded-md transition-colors flex items-center gap-1.5 ${t===e?`bg-white text-gray-900 shadow-sm`:`text-gray-500 hover:text-gray-700`}`,children:e===`bindings`?`绑定的规范 (${v.length})`:(0,B.jsxs)(B.Fragment,{children:[`蒸馏规范`,y&&(0,B.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-700`,children:`实际生效`})]})},e))}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[t===`bindings`&&(0,B.jsxs)(`button`,{onClick:()=>i(!r),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:[(0,B.jsx)(mc,{className:`h-3.5 w-3.5`}),`绑定规范`]}),t===`custom`&&(0,B.jsxs)(`button`,{onClick:()=>g.mutate(),disabled:g.isPending||v.length===0,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 transition-colors`,title:v.length===0?`请先绑定至少一个规范`:``,children:[(0,B.jsx)(Kc,{className:`h-3.5 w-3.5 ${g.isPending?`animate-pulse`:``}`}),g.isPending?`蒸馏中...`:y?`重新蒸馏`:`生成蒸馏规范`]})]})]}),r&&(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-blue-200 p-4 space-y-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-medium text-gray-700`,children:`从全局规范库选择绑定`}),b.length===0?(0,B.jsx)(`p`,{className:`text-sm text-gray-400`,children:`所有全局规范已全部绑定`}):(0,B.jsx)(`div`,{className:`grid gap-2`,children:b.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-gray-50 rounded-lg`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium text-gray-900`,children:e.name}),(0,B.jsx)(`span`,{className:`px-1.5 py-0.5 text-xs rounded-full ${x[e.source]||`bg-gray-100 text-gray-600`}`,children:S[e.source]||e.source}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`v`,e.version]})]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:e.description})]}),(0,B.jsx)(`button`,{onClick:()=>m.mutate(e.id),disabled:m.isPending,className:`px-3 py-1.5 text-xs bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:`绑定`})]},e.id))}),(0,B.jsx)(`button`,{onClick:()=>i(!1),className:`text-xs text-gray-400 hover:text-gray-600`,children:`关闭`})]}),t===`bindings`&&(0,B.jsx)(`div`,{className:`space-y-3`,children:v.length===0?(0,B.jsxs)(`div`,{className:`text-center py-12 bg-white rounded-xl border border-gray-200`,children:[(0,B.jsx)(As,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500 text-sm`,children:`尚未绑定任何规范`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-1`,children:`点击「绑定规范」从全局规范库选择`})]}):v.map(e=>(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(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)(`span`,{className:`font-medium text-gray-900`,children:e.name}),(0,B.jsx)(`span`,{className:`px-1.5 py-0.5 text-xs rounded-full font-medium ${x[e.source]||`bg-gray-100 text-gray-600`}`,children:S[e.source]||e.source}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`v`,e.version]})]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:e.description}),(0,B.jsxs)(`div`,{className:`flex gap-3 mt-2 text-xs text-gray-400`,children:[(0,B.jsxs)(`span`,{children:[e.roles?Object.keys(e.roles).length:0,` 个角色`]}),(0,B.jsxs)(`span`,{children:[e.quality_standards?.length||0,` 条质量标准`]})]})]}),(0,B.jsx)(`button`,{onClick:()=>h.mutate(e.id),disabled:h.isPending,className:`ml-4 p-1.5 text-gray-400 hover:text-red-500 rounded transition-colors`,title:`解绑`,children:(0,B.jsx)(Gc,{className:`h-4 w-4`})})]})},e.id))}),t===`custom`&&(0,B.jsx)(`div`,{className:`space-y-4`,children:y?(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-gray-100`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`font-semibold text-gray-900`,children:y.name}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`v`,y.version]}),(0,B.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-700 border border-green-200`,children:`项目真实规范`})]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:y.description})]}),!s&&(0,B.jsxs)(`button`,{onClick:()=>{o(p?.yaml||``),c(!0)},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-gray-100 text-gray-700 hover:bg-gray-200 rounded-lg transition-colors`,children:[(0,B.jsx)(xc,{className:`h-3.5 w-3.5`}),`编辑 YAML`]})]}),(0,B.jsx)(`div`,{className:`p-5`,children:s?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`textarea`,{value:a||p?.yaml||``,onChange:e=>o(e.target.value),rows:24,className:`w-full px-3 py-2 text-xs border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsxs)(`button`,{onClick:()=>_.mutate(a),disabled:_.isPending,className:`flex items-center gap-1.5 px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:[(0,B.jsx)(Dc,{className:`h-3.5 w-3.5`}),_.isPending?`保存中...`:`保存`]}),(0,B.jsx)(`button`,{onClick:()=>c(!1),className:`px-4 py-2 text-sm bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors`,children:`取消`})]})]}):(0,B.jsxs)(`div`,{className:`space-y-4 text-sm`,children:[y.principles&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-xs font-medium text-gray-500 uppercase tracking-wide mb-2`,children:`核心原则`}),(0,B.jsx)(`pre`,{className:`text-xs text-gray-700 bg-gray-50 rounded-lg p-3 whitespace-pre-wrap border border-gray-100 max-h-48 overflow-y-auto`,children:typeof y.principles==`string`?y.principles:JSON.stringify(y.principles,null,2)})]}),y.quality_standards&&y.quality_standards.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-xs font-medium text-gray-500 uppercase tracking-wide mb-2`,children:[`质量标准 (`,y.quality_standards.length,`)`]}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[y.quality_standards.slice(0,5).map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-gray-600`,children:[(0,B.jsx)(`span`,{className:`mt-0.5 px-1.5 py-0.5 rounded text-xs font-medium ${e.severity===`must`?`bg-red-50 text-red-600`:e.severity===`should`?`bg-yellow-50 text-yellow-600`:`bg-gray-100 text-gray-500`}`,children:e.severity||`rule`}),(0,B.jsx)(`span`,{children:e.rule||String(e)})]},t)),y.quality_standards.length>5&&(0,B.jsxs)(`p`,{className:`text-xs text-gray-400`,children:[`...还有 `,y.quality_standards.length-5,` 条`]})]})]})]})})]}):(0,B.jsxs)(`div`,{className:`text-center py-12 bg-white rounded-xl border border-gray-200`,children:[(0,B.jsx)(Kc,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500 text-sm`,children:`尚未生成蒸馏规范`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-1`,children:v.length>0?`点击「生成蒸馏规范」将绑定的规范融合为项目专属规范`:`请先绑定至少一个规范,再生成蒸馏规范`})]})})]})}var Q9={local:`bg-blue-50 text-blue-700`,remote:`bg-purple-50 text-purple-700`,generated:`bg-green-50 text-green-700`,official:`bg-amber-50 text-amber-700`,user:`bg-pink-50 text-pink-700`},$9={local:`本地`,remote:`远程`,generated:`AI生成`,official:`官方`,user:`用户`};function Lue(){let[e,t]=(0,z.useState)(`list`),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(new Set),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(null),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),v=qe(),{data:y,isLoading:b}=ct({queryKey:[`skills`,n,i],queryFn:()=>iu({source:n||void 0,tag:i||void 0}).then(e=>e.data),refetchInterval:3e4}),{data:x}=ct({queryKey:[`skills-status`],queryFn:()=>au().then(e=>e.data),refetchInterval:3e4}),S=lt({mutationFn:e=>su(e).then(e=>e.data),onSuccess:e=>{d(e),Zc(`找到 ${e.github.length+e.npm.length} 个结果`,`success`)}}),C=lt({mutationFn:e=>cu(e).then(e=>e.data),onSuccess:e=>{Zc(`已安装: ${e.skill.name}`,`success`),v.invalidateQueries({queryKey:[`skills`]}),v.invalidateQueries({queryKey:[`skills-status`]})}}),w=lt({mutationFn:e=>lu(e).then(e=>e.data),onSuccess:(e,t)=>{Zc(`已删除: ${t}`,`success`),s(e=>{let n=new Set(e);return n.delete(t),n}),v.invalidateQueries({queryKey:[`skills`]}),v.invalidateQueries({queryKey:[`skills-status`]})}}),T=lt({mutationFn:e=>uu(e).then(e=>e.data),onSuccess:e=>{Zc(`已删除 ${e.success.length} 个技能`,`success`),s(new Set),v.invalidateQueries({queryKey:[`skills`]}),v.invalidateQueries({queryKey:[`skills-status`]})}}),E=lt({mutationFn:()=>du().then(e=>e.data),onSuccess:e=>{Zc(`进化完成:${e.repaired.length+e.retired.length+e.optimized.length+e.generated.length} 项变更`,`success`),v.invalidateQueries({queryKey:[`skills`]}),v.invalidateQueries({queryKey:[`skills-status`]})}}),D=lt({mutationFn:()=>fu().then(e=>e.data),onSuccess:e=>{Zc(`蒸馏完成:新增 ${e.distilled.length} 个技能`,`success`),v.invalidateQueries({queryKey:[`skills`]}),v.invalidateQueries({queryKey:[`skills-status`]})}}),O=lt({mutationFn:()=>pu().then(e=>e.data),onSuccess:e=>{Zc(`修复完成:${e.repaired.length} 个技能已修复`,`success`),v.invalidateQueries({queryKey:[`skills`]})}}),k=y?.items||[],A=k.length>0&&o.size===k.length,j=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-start 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:`管理 Claude Code 技能库,搜索安装、进化优化`})]}),x&&(0,B.jsx)(`div`,{className:`flex items-center gap-3`,children:[{label:`全部`,value:x.total,color:`text-gray-700`},{label:`官方`,value:x.official,color:`text-amber-600`},{label:`本地`,value:x.local,color:`text-blue-600`},{label:`AI生成`,value:x.generated,color:`text-green-600`}].map(({label:e,value:t,color:n})=>(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:q(`text-xl font-bold`,n),children:t}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:e})]},e))})]}),(0,B.jsx)(`div`,{className:`border-b border-gray-200`,children:(0,B.jsx)(`nav`,{className:`flex gap-1`,children:[{key:`list`,label:`技能列表`},{key:`search`,label:`搜索安装`},{key:`evolve`,label:`进化管理`},{key:`sources`,label:`技能源`}].map(n=>(0,B.jsx)(`button`,{onClick:()=>t(n.key),className:q(`px-4 py-2.5 text-sm font-medium border-b-2 transition-colors`,e===n.key?`border-blue-600 text-blue-600`:`border-transparent text-gray-500 hover:text-gray-700`),children:n.label},n.key))})}),e===`list`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`button`,{onClick:()=>p(!f),className:q(`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)(sc,{className:`h-4 w-4`}),`筛选`,(0,B.jsx)(Rs,{className:q(`h-3.5 w-3.5 transition-transform`,f&&`rotate-180`)})]}),(0,B.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[k.length,` 个技能`]}),o.size>0&&(0,B.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,B.jsxs)(`span`,{className:`text-sm text-gray-600`,children:[`已选 `,o.size,` 个`]}),(0,B.jsxs)(`button`,{onClick:()=>{_({open:!0,title:`批量删除技能`,description:`确定要删除选中的 ${o.size} 个技能吗?此操作不可恢复。`,onConfirm:()=>{T.mutate(Array.from(o)),_(e=>({...e,open:!1}))}})},disabled:T.isPending,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-red-50 text-red-600 hover:bg-red-100 rounded-lg transition-colors`,children:[(0,B.jsx)(zc,{className:`h-3.5 w-3.5`}),`批量删除`]})]})]}),f&&(0,B.jsxs)(`div`,{className:`flex gap-3 mt-3 pt-3 border-t border-gray-100`,children:[(0,B.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,B.jsx)(`option`,{value:``,children:`全部来源`}),(0,B.jsx)(`option`,{value:`local`,children:`本地`}),(0,B.jsx)(`option`,{value:`official`,children:`官方`}),(0,B.jsx)(`option`,{value:`remote`,children:`远程`}),(0,B.jsx)(`option`,{value:`generated`,children:`AI生成`}),(0,B.jsx)(`option`,{value:`user`,children:`用户`})]}),(0,B.jsx)(`input`,{type:`text`,placeholder:`按标签筛选...`,value:i,onChange:e=>a(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]})]}),b?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-48`,children:(0,B.jsx)(hc,{className:`h-8 w-8 animate-spin text-blue-500`})}):(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 overflow-hidden`,children:[(0,B.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,B.jsx)(`thead`,{className:`bg-gray-50 border-b border-gray-200`,children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`w-10 px-4 py-3`,children:(0,B.jsx)(`input`,{type:`checkbox`,checked:A,onChange:()=>{s(A?new Set:new Set(k.map(e=>e.name)))},className:`rounded`})}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`技能名称`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`来源`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`版本`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`调用次数`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`成功率`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`最近使用`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`操作`})]})}),(0,B.jsx)(`tbody`,{className:`divide-y divide-gray-100`,children:k.map(e=>(0,B.jsxs)(`tr`,{className:`hover:bg-gray-50 transition-colors`,children:[(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`input`,{type:`checkbox`,checked:o.has(e.name),onChange:()=>j(e.name),className:`rounded`})}),(0,B.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,B.jsx)(`button`,{onClick:()=>h(e.name),className:`font-medium text-blue-600 hover:text-blue-700 cursor-pointer`,children:e.name}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500 truncate max-w-xs`,children:e.description}),e.tags&&e.tags.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:e.tags.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 bg-gray-100 text-gray-600 text-xs rounded`,children:[(0,B.jsx)(Ic,{className:`h-2.5 w-2.5`}),e]},e))})]}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`span`,{className:q(`px-2 py-0.5 text-xs rounded-full font-medium`,Q9[e.source]||`bg-gray-100 text-gray-600`),children:$9[e.source]||e.source})}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.version}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.stats.callCount}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:e.stats.callCount>0?(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`div`,{className:`w-16 h-1.5 bg-gray-200 rounded-full overflow-hidden`,children:(0,B.jsx)(`div`,{className:q(`h-full rounded-full`,e.stats.successRate>=.8?`bg-green-500`:e.stats.successRate>=.5?`bg-yellow-500`:`bg-red-500`),style:{width:`${e.stats.successRate*100}%`}})}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-600`,children:[(e.stats.successRate*100).toFixed(0),`%`]})]}):(0,B.jsx)(`span`,{className:`text-xs text-gray-400`,children:`未使用`})}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-xs text-gray-500`,children:e.stats.lastUsed?new Date(e.stats.lastUsed).toLocaleDateString(`zh-CN`):`—`}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`button`,{onClick:()=>{_({open:!0,title:`删除技能`,description:`确定要删除技能 "${e.name}" 吗?此操作不可恢复。`,onConfirm:()=>{w.mutate(e.name),_(e=>({...e,open:!1}))}})},disabled:w.isPending,className:`p-1.5 text-gray-400 hover:text-red-500 rounded transition-colors`,title:`删除`,children:(0,B.jsx)(zc,{className:`h-4 w-4`})})})]},e.name))})]}),k.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)(yc,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`暂无技能`})]})]}),x&&(x.topUsed.length>0||x.topRated.length>0)&&(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[x.topUsed.length>0&&(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3 flex items-center gap-2`,children:[(0,B.jsx)(Bc,{className:`h-4 w-4 text-blue-500`}),`最常用技能`]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:x.topUsed.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-xs text-gray-400 w-4`,children:t+1}),(0,B.jsx)(`span`,{className:`text-gray-700`,children:e.name})]}),(0,B.jsxs)(`span`,{className:`text-gray-500`,children:[e.calls,` 次`]})]},e.name))})]}),x.topRated.length>0&&(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3 flex items-center gap-2`,children:[(0,B.jsx)(Ws,{className:`h-4 w-4 text-green-500`}),`评分最高技能`]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:x.topRated.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-xs text-gray-400 w-4`,children:t+1}),(0,B.jsx)(`span`,{className:`text-gray-700`,children:e.name})]}),(0,B.jsxs)(`span`,{className:`text-gray-500`,children:[(e.rating*100).toFixed(0),`%`]})]},e.name))})]})]})]}),e===`search`&&(0,B.jsx)(zue,{searchQuery:c,setSearchQuery:l,searchResults:u,onSearch:()=>S.mutate(c),onInstall:e=>C.mutate(e),isSearching:S.isPending,isInstalling:C.isPending}),e===`evolve`&&(0,B.jsx)(Bue,{onEvolve:()=>E.mutate(),onDistill:()=>D.mutate(),onRepair:()=>O.mutate(),isEvolving:E.isPending,isDistilling:D.isPending,isRepairing:O.isPending,evolveResult:E.data,distillResult:D.data,repairResult:O.data}),e===`sources`&&(0,B.jsx)(Vue,{}),m&&(0,B.jsx)(Rue,{name:m,onClose:()=>h(null)}),(0,B.jsx)(O4,{open:g.open,title:g.title,description:g.description,onConfirm:g.onConfirm,onCancel:()=>_(e=>({...e,open:!1}))})]})}function Rue({name:e,onClose:t}){let[n,r]=(0,z.useState)(`content`),{data:i,isLoading:a}=ct({queryKey:[`skill-detail`,e],queryFn:()=>ou(e).then(e=>e.data)});return(0,B.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40`,onClick:t,children:(0,B.jsxs)(`div`,{className:`bg-white rounded-2xl shadow-2xl w-full max-w-3xl max-h-[85vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-gray-100`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(yc,{className:`h-5 w-5 text-blue-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900`,children:e}),i&&(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:i.description})]})]}),(0,B.jsx)(`button`,{onClick:t,className:`p-1.5 text-gray-400 hover:text-gray-600 rounded-lg transition-colors`,children:(0,B.jsx)(Gc,{className:`h-5 w-5`})})]}),(0,B.jsx)(`div`,{className:`flex gap-1 px-6 pt-3 border-b border-gray-100`,children:[`content`,`stats`].map(e=>(0,B.jsx)(`button`,{onClick:()=>r(e),className:`px-3 py-1.5 text-sm font-medium border-b-2 transition-colors ${n===e?`border-blue-600 text-blue-600`:`border-transparent text-gray-500 hover:text-gray-700`}`,children:e===`content`?`技能内容`:`使用情况`},e))}),(0,B.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5`,children:a?(0,B.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,B.jsx)(hc,{className:`h-6 w-6 animate-spin text-blue-500`})}):i?n===`content`?(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded-full font-medium ${Q9[i.source]||`bg-gray-100 text-gray-600`}`,children:$9[i.source]||i.source}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`v`,i.version]}),i.requires?.bins&&i.requires.bins.length>0&&(0,B.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`需要:`,i.requires.bins.join(`, `)]}),i.filePath&&(0,B.jsx)(`span`,{className:`text-xs text-gray-400 font-mono truncate max-w-xs`,children:i.filePath})]}),i.tags&&i.tags.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.tags.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 bg-blue-50 text-blue-700 text-xs rounded-full`,children:[(0,B.jsx)(Ic,{className:`h-2.5 w-2.5`}),e]},e))}),i.content?(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-xs text-gray-500 mb-2 flex items-center gap-1`,children:[(0,B.jsx)(ic,{className:`h-3.5 w-3.5`}),`技能文件内容`]}),(0,B.jsx)(`pre`,{className:`text-xs text-gray-800 bg-gray-50 rounded-lg p-4 overflow-auto whitespace-pre-wrap border border-gray-200 max-h-[50vh] leading-relaxed`,children:i.content})]}):(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无文件内容`}),i.sourceUrl&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,B.jsx)($s,{className:`h-3.5 w-3.5 text-gray-400`}),(0,B.jsx)(`a`,{href:i.sourceUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 hover:underline truncate`,children:i.sourceUrl})]})]}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,B.jsxs)(`div`,{className:`bg-blue-50 rounded-xl p-4 text-center`,children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold text-blue-700`,children:i.stats.callCount}),(0,B.jsx)(`div`,{className:`text-xs text-blue-600 mt-1`,children:`总调用次数`})]}),(0,B.jsxs)(`div`,{className:`bg-green-50 rounded-xl p-4 text-center`,children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold text-green-700`,children:i.stats.callCount>0?`${(i.stats.successRate*100).toFixed(0)}%`:`—`}),(0,B.jsx)(`div`,{className:`text-xs text-green-600 mt-1`,children:`成功率`})]}),(0,B.jsxs)(`div`,{className:`bg-purple-50 rounded-xl p-4 text-center`,children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold text-purple-700`,children:i.stats.userFeedback.positive+i.stats.userFeedback.negative>0?`${i.stats.userFeedback.positive} / ${i.stats.userFeedback.negative}`:`—`}),(0,B.jsx)(`div`,{className:`text-xs text-purple-600 mt-1`,children:`用户反馈(正向/负向)`})]})]}),i.stats.callCount>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-gray-500 mb-1.5`,children:[(0,B.jsx)(`span`,{children:`成功率`}),(0,B.jsxs)(`span`,{children:[(i.stats.successRate*100).toFixed(1),`%`]})]}),(0,B.jsx)(`div`,{className:`w-full h-2 bg-gray-200 rounded-full overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full rounded-full transition-all ${i.stats.successRate>=.8?`bg-green-500`:i.stats.successRate>=.5?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${i.stats.successRate*100}%`}})})]}),(0,B.jsxs)(`div`,{className:`bg-gray-50 rounded-xl p-4`,children:[(0,B.jsx)(`div`,{className:`text-xs text-gray-500 mb-1`,children:`最近使用时间`}),(0,B.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:i.stats.lastUsed?new Date(i.stats.lastUsed).toLocaleString(`zh-CN`):`从未使用`})]}),i.stats.callCount===0&&(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`该技能尚未被调用过`})]}):(0,B.jsx)(`div`,{className:`text-center py-16 text-gray-500`,children:`技能不存在`})})]})})}function zue({searchQuery:e,setSearchQuery:t,searchResults:n,onSearch:r,onInstall:i,isSearching:a,isInstalling:o}){return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:(0,B.jsxs)(`div`,{className:`flex gap-3`,children:[(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索技能(GitHub / npm)...`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&r(),className:`flex-1 px-4 py-2.5 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,B.jsxs)(`button`,{onClick:r,disabled:a||!e.trim(),className:`flex items-center gap-2 px-6 py-2.5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[a?(0,B.jsx)(hc,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(Oc,{className:`h-4 w-4`}),`搜索`]})]})}),n&&(0,B.jsxs)(`div`,{className:`space-y-6`,children:[n.github.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3`,children:[`GitHub 结果 (`,n.github.length,`)`]}),(0,B.jsx)(`div`,{className:`grid gap-3`,children:n.github.map((e,t)=>(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4 hover:border-blue-300 transition-colors`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,B.jsx)(`h4`,{className:`font-semibold text-gray-900`,children:e.skill.name}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`v`,e.skill.version]})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mb-2`,children:e.skill.description}),(0,B.jsxs)(`a`,{href:e.sourceUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-blue-600 hover:underline`,children:[(0,B.jsx)($s,{className:`h-3 w-3`}),e.sourceUrl]})]}),(0,B.jsxs)(`button`,{onClick:()=>i(e.sourceUrl),disabled:o,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-blue-50 text-blue-600 hover:bg-blue-100 rounded-lg transition-colors`,children:[(0,B.jsx)(Qs,{className:`h-3.5 w-3.5`}),`安装`]})]})},t))})]}),n.npm.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3`,children:[`npm 结果 (`,n.npm.length,`)`]}),(0,B.jsx)(`div`,{className:`grid gap-3`,children:n.npm.map((e,t)=>(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4 hover:border-purple-300 transition-colors`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,B.jsx)(`h4`,{className:`font-semibold text-gray-900`,children:e.skill.name}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`v`,e.skill.version]})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mb-2`,children:e.skill.description}),e.installCommand&&(0,B.jsx)(`code`,{className:`text-xs bg-gray-100 px-2 py-1 rounded`,children:e.installCommand})]}),(0,B.jsxs)(`button`,{onClick:()=>i(e.sourceUrl),disabled:o,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-purple-50 text-purple-600 hover:bg-purple-100 rounded-lg transition-colors`,children:[(0,B.jsx)(Qs,{className:`h-3.5 w-3.5`}),`安装`]})]})},t))})]}),n.github.length===0&&n.npm.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 bg-white rounded-xl border border-gray-200`,children:[(0,B.jsx)(Oc,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`未找到匹配的技能`})]})]})]})}function Bue({onEvolve:e,onDistill:t,onRepair:n,isEvolving:r,isDistilling:i,isRepairing:a,evolveResult:o,distillResult:s,repairResult:c}){return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,B.jsx)(`div`,{className:`p-2 bg-blue-50 rounded-lg`,children:(0,B.jsx)(Mc,{className:`h-5 w-5 text-blue-600`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900`,children:`技能进化`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`淘汰、优化、生成`})]})]}),(0,B.jsxs)(`button`,{onClick:e,disabled:r,className:`w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:[r?(0,B.jsx)(hc,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(Tc,{className:`h-4 w-4`}),r?`进化中...`:`开始进化`]}),o&&(0,B.jsxs)(`div`,{className:`mt-4 space-y-2 text-sm`,children:[o.repaired?.length>0&&(0,B.jsxs)(`div`,{className:`text-green-600`,children:[`✔ 修复 `,o.repaired.length,` 个`]}),o.retired?.length>0&&(0,B.jsxs)(`div`,{className:`text-red-600`,children:[`- 淘汰 `,o.retired.length,` 个`]}),o.optimized?.length>0&&(0,B.jsxs)(`div`,{className:`text-blue-600`,children:[`↑ 优化 `,o.optimized.length,` 个`]}),o.generated?.length>0&&(0,B.jsxs)(`div`,{className:`text-green-600`,children:[`+ 生成 `,o.generated.length,` 个`]})]})]}),(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,B.jsx)(`div`,{className:`p-2 bg-purple-50 rounded-lg`,children:(0,B.jsx)(Qs,{className:`h-5 w-5 text-purple-600`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900`,children:`社区蒸馏`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`从精选源采集`})]})]}),(0,B.jsxs)(`button`,{onClick:t,disabled:i,className:`w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:[i?(0,B.jsx)(hc,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(Qs,{className:`h-4 w-4`}),i?`蒸馏中...`:`开始蒸馏`]}),s&&s.distilled?.length>0&&(0,B.jsxs)(`div`,{className:`mt-4 text-sm text-purple-600`,children:[`✦ 新增 `,s.distilled.length,` 个技能`]})]}),(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,B.jsx)(`div`,{className:`p-2 bg-amber-50 rounded-lg`,children:(0,B.jsx)(Wc,{className:`h-5 w-5 text-amber-600`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900`,children:`修复残缺`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`AI 修复低质量技能`})]})]}),(0,B.jsxs)(`button`,{onClick:n,disabled:a,className:`w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-amber-600 text-white rounded-lg hover:bg-amber-700 disabled:opacity-50 transition-colors`,children:[a?(0,B.jsx)(hc,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(Wc,{className:`h-4 w-4`}),a?`修复中...`:`开始修复`]}),c&&c.repaired?.length>0&&(0,B.jsxs)(`div`,{className:`mt-4 text-sm text-amber-600`,children:[`✔ 修复 `,c.repaired.length,` 个技能`]})]})]}),(0,B.jsxs)(`div`,{className:`bg-blue-50 rounded-xl border border-blue-200 p-4`,children:[(0,B.jsx)(`h4`,{className:`text-sm font-semibold text-blue-900 mb-2`,children:`进化机制说明`}),(0,B.jsxs)(`ul`,{className:`text-sm text-blue-700 space-y-1`,children:[(0,B.jsxs)(`li`,{children:[`• `,(0,B.jsx)(`strong`,{children:`技能进化`}),`:根据使用统计自动淘汰低效技能、优化高频技能、生成新技能`]}),(0,B.jsxs)(`li`,{children:[`• `,(0,B.jsx)(`strong`,{children:`社区蒸馏`}),`:从 GitHub 精选仓库采集优质技能并蒸馏为官方技能`]}),(0,B.jsxs)(`li`,{children:[`• `,(0,B.jsx)(`strong`,{children:`修复残缺`}),`:检测并修复缺少描述、版本号或格式错误的技能文件`]})]})]})]})}function Vue(){let e=qe(),[t,n]=(0,z.useState)(!1),[r,i]=(0,z.useState)({repo:``,dir:``,branch:`main`,format:`command-md`,description:``}),{data:a}=ct({queryKey:[`skill-sources`],queryFn:()=>W.get(`/skills/sources`).then(e=>e.data)}),o=lt({mutationFn:e=>W.post(`/skills/sources`,e).then(e=>e.data),onSuccess:()=>{Zc(`技能源已添加`,`success`),n(!1),i({repo:``,dir:``,branch:`main`,format:`command-md`,description:``}),e.invalidateQueries({queryKey:[`skill-sources`]})}}),s=lt({mutationFn:e=>W.delete(`/skills/sources/${encodeURIComponent(e)}`).then(e=>e.data),onSuccess:()=>{Zc(`技能源已删除`,`success`),e.invalidateQueries({queryKey:[`skill-sources`]})}}),c=a?.builtIn||[],l=a?.user||[];return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`div`,{className:`flex justify-end`,children:(0,B.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:[(0,B.jsx)(Qs,{className:`h-4 w-4`}),`添加技能源`]})}),t&&(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900 mb-4`,children:`添加自定义技能源`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,B.jsx)(`input`,{type:`text`,placeholder:`仓库 (owner/repo)`,value:r.repo,onChange:e=>i({...r,repo:e.target.value}),className:`px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`目录路径`,value:r.dir,onChange:e=>i({...r,dir:e.target.value}),className:`px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`分支 (默认 main)`,value:r.branch,onChange:e=>i({...r,branch:e.target.value}),className:`px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,B.jsxs)(`select`,{value:r.format,onChange:e=>i({...r,format:e.target.value}),className:`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:`command-md`,children:`command-md`}),(0,B.jsx)(`option`,{value:`skill-md`,children:`skill-md`})]}),(0,B.jsx)(`input`,{type:`text`,placeholder:`描述`,value:r.description,onChange:e=>i({...r,description:e.target.value}),className:`col-span-2 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 mt-4`,children:[(0,B.jsx)(`button`,{onClick:()=>o.mutate(r),disabled:!r.repo||!r.dir||o.isPending,className:`px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:o.isPending?`添加中...`:`确认添加`}),(0,B.jsx)(`button`,{onClick:()=>n(!1),className:`px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors`,children:`取消`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3`,children:`内置技能源`}),(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 divide-y divide-gray-100`,children:c.map((e,t)=>(0,B.jsxs)(`div`,{className:`p-4 flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`font-medium text-gray-900`,children:[e.repo,`/`,e.dir]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:e.description})]}),(0,B.jsx)(`span`,{className:`px-2 py-1 bg-gray-100 text-gray-600 text-xs rounded`,children:`内置`})]},t))})]}),l.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3`,children:`用户自定义源`}),(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 divide-y divide-gray-100`,children:l.map((e,t)=>(0,B.jsxs)(`div`,{className:`p-4 flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`font-medium text-gray-900`,children:[e.repo,`/`,e.dir]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:e.description})]}),(0,B.jsx)(`button`,{onClick:()=>s.mutate(e.repo),disabled:s.isPending,className:`p-1.5 text-gray-400 hover:text-red-500 rounded transition-colors`,children:(0,B.jsx)(zc,{className:`h-4 w-4`})})]},t))})]})]})}function Hue(){let[e,t]=(0,z.useState)(`library`),[n,r]=(0,z.useState)(`all`),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(new Set),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(null),g=qe(),{data:_,isLoading:v}=ct({queryKey:[`global-conventions`],queryFn:()=>mu().then(e=>e.data),refetchInterval:6e4}),{data:y}=ct({queryKey:[`convention-usage-stats`],queryFn:()=>yu().then(e=>e.data),enabled:e===`usage`}),b=lt({mutationFn:()=>gu().then(e=>e.data),onSuccess:e=>{Zc(e.added.length+e.updated.length>0?`同步完成:新增 ${e.added.length},更新 ${e.updated.length}`:`已是最新`,`success`),g.invalidateQueries({queryKey:[`global-conventions`]})}}),x=lt({mutationFn:e=>_u(e).then(e=>e.data),onSuccess:e=>{Zc(`已安装:${e.convention.name}`,`success`),d(``),p(!1),g.invalidateQueries({queryKey:[`global-conventions`]})}}),S=lt({mutationFn:e=>vu(e).then(e=>e.data),onSuccess:(e,t)=>{Zc(`规范已删除`,`success`),h(null),g.invalidateQueries({queryKey:[`global-conventions`]})}}),C=lt({mutationFn:e=>xu(e.length>0?e:void 0).then(e=>e.data),onSuccess:e=>{Zc(`进化完成:${e.results.success.length} 个规范已更新`,`success`),g.invalidateQueries({queryKey:[`global-conventions`]})}}),w=(_?.items||[]).filter(e=>!(n!==`all`&&e.source!==n||i&&!e.name.toLowerCase().includes(i.toLowerCase()))),T=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},E=w.length>0&&o.size===w.length,D=()=>s(E?new Set:new Set(w.map(e=>e.id))),O={official:`bg-amber-50 text-amber-700`,user:`bg-blue-50 text-blue-700`,community:`bg-purple-50 text-purple-700`},k={official:`官方`,user:`用户`,community:`社区`};return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-start 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:`管理全局规范模板,绑定到项目,追踪使用情况`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(`button`,{onClick:()=>b.mutate(),disabled:b.isPending,className:`flex items-center gap-1.5 px-3 py-2 text-sm bg-amber-50 text-amber-700 hover:bg-amber-100 rounded-lg transition-colors`,children:[(0,B.jsx)(Tc,{className:`h-4 w-4 ${b.isPending?`animate-spin`:``}`}),`同步官方规范`]}),(0,B.jsxs)(`button`,{onClick:()=>p(!f),className:`flex items-center gap-1.5 px-3 py-2 text-sm bg-blue-600 text-white hover:bg-blue-700 rounded-lg transition-colors`,children:[(0,B.jsx)(Qs,{className:`h-4 w-4`}),`从 URL 安装`]})]})]}),f&&(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:(0,B.jsxs)(`div`,{className:`flex gap-3`,children:[(0,B.jsx)(`input`,{type:`text`,placeholder:`规范 YAML 文件 URL...`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>e.key===`Enter`&&u.trim()&&x.mutate(u.trim()),className:`flex-1 px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,B.jsx)(`button`,{onClick:()=>x.mutate(u.trim()),disabled:!u.trim()||x.isPending,className:`px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:x.isPending?`安装中...`:`安装`}),(0,B.jsx)(`button`,{onClick:()=>p(!1),className:`p-2 text-gray-400 hover:text-gray-600 rounded-lg`,children:(0,B.jsx)(Gc,{className:`h-4 w-4`})})]})}),(0,B.jsx)(`div`,{className:`border-b border-gray-200`,children:(0,B.jsx)(`nav`,{className:`flex gap-1`,children:[{key:`library`,label:`规范库`},{key:`usage`,label:`使用统计`},{key:`evolution`,label:`进化历史`}].map(n=>(0,B.jsx)(`button`,{onClick:()=>t(n.key),className:`px-4 py-2.5 text-sm font-medium border-b-2 transition-colors ${e===n.key?`border-blue-600 text-blue-600`:`border-transparent text-gray-500 hover:text-gray-700`}`,children:n.label},n.key))})}),e===`library`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4 flex items-center gap-3 flex-wrap`,children:[(0,B.jsx)(`div`,{className:`flex gap-1`,children:[`all`,`official`,`user`,`community`].map(e=>(0,B.jsx)(`button`,{onClick:()=>r(e),className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${n===e?`bg-blue-600 text-white`:`bg-gray-100 text-gray-600 hover:bg-gray-200`}`,children:{all:`全部`,official:`官方`,user:`用户`,community:`社区`}[e]},e))}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(Oc,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索规范名称...`,value:i,onChange:e=>a(e.target.value),className:`pl-8 pr-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 w-48`})]}),(0,B.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[w.length,` 个规范`]}),o.size>0&&(0,B.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,B.jsxs)(`span`,{className:`text-sm text-gray-600`,children:[`已选 `,o.size,` 个`]}),(0,B.jsxs)(`button`,{onClick:()=>C.mutate(Array.from(o)),disabled:C.isPending,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-green-50 text-green-600 hover:bg-green-100 rounded-lg transition-colors`,children:[(0,B.jsx)(Tc,{className:`h-3.5 w-3.5 ${C.isPending?`animate-spin`:``}`}),`批量进化`]})]})]}),v?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-48 bg-white rounded-xl border border-gray-200`,children:(0,B.jsx)(Tc,{className:`h-8 w-8 animate-spin text-blue-500`})}):(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 overflow-hidden`,children:[(0,B.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,B.jsx)(`thead`,{className:`bg-gray-50 border-b border-gray-200`,children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`w-10 px-4 py-3`,children:(0,B.jsx)(`input`,{type:`checkbox`,checked:E,onChange:D,className:`rounded`})}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`规范名称`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`来源`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`版本`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`角色数`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`质量标准`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`操作`})]})}),(0,B.jsx)(`tbody`,{className:`divide-y divide-gray-100`,children:w.map(e=>(0,B.jsxs)(`tr`,{className:`hover:bg-gray-50 transition-colors`,children:[(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`input`,{type:`checkbox`,checked:o.has(e.id),onChange:()=>T(e.id),className:`rounded`})}),(0,B.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,B.jsx)(`button`,{onClick:()=>l(e.id),className:`font-medium text-blue-600 hover:text-blue-700 text-left`,children:e.name}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500 truncate max-w-xs mt-0.5`,children:e.description})]}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded-full font-medium ${O[e.source]||`bg-gray-100 text-gray-600`}`,children:k[e.source]||e.source})}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.version||`—`}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.roles?Object.keys(e.roles).length:0}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.quality_standards?.length||0}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`button`,{onClick:()=>l(e.id),className:`p-1.5 text-gray-400 hover:text-blue-500 rounded transition-colors`,title:`查看/编辑`,children:(0,B.jsx)(ic,{className:`h-4 w-4`})}),e.source!==`official`&&(0,B.jsx)(`button`,{onClick:()=>h(e),className:`p-1.5 text-gray-400 hover:text-red-500 rounded transition-colors`,title:`删除`,children:(0,B.jsx)(zc,{className:`h-4 w-4`})})]})})]},e.id))})]}),w.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)(As,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`暂无规范`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-1`,children:`点击「同步官方规范」获取内置规范`})]})]})]}),e===`usage`&&(0,B.jsx)(Uue,{data:y?.items||[]}),e===`evolution`&&(0,B.jsx)(Wue,{conventions:_?.items||[]}),c&&(0,B.jsx)(Gue,{id:c,onClose:()=>l(null)}),m&&(0,B.jsx)(O4,{title:`删除规范`,message:`确定要删除规范「${m.name}」吗?此操作不可撤销。`,onConfirm:()=>S.mutate(m.id),onCancel:()=>h(null)})]})}function Uue({data:e}){let[t,n]=(0,z.useState)(null);return(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 overflow-hidden`,children:e.length===0?(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)(Bc,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`暂无使用数据`})]}):(0,B.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,B.jsx)(`thead`,{className:`bg-gray-50 border-b border-gray-200`,children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`规范名称`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`来源`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`使用项目数`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`操作`})]})}),(0,B.jsx)(`tbody`,{className:`divide-y divide-gray-100`,children:e.map(e=>(0,B.jsxs)(z.Fragment,{children:[(0,B.jsxs)(`tr`,{className:`hover:bg-gray-50 transition-colors`,children:[(0,B.jsx)(`td`,{className:`px-4 py-3 font-medium text-gray-900`,children:e.name}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.source}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.projectCount}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`button`,{onClick:()=>n(t===e.id?null:e.id),className:`text-xs text-blue-600 hover:text-blue-700`,children:t===e.id?`收起`:`查看项目`})})]}),t===e.id&&(0,B.jsx)(`tr`,{children:(0,B.jsx)(`td`,{colSpan:4,className:`px-4 py-3 bg-gray-50`,children:(0,B.jsx)(`div`,{className:`text-xs text-gray-600 space-y-1`,children:e.projects.map((e,t)=>(0,B.jsx)(`div`,{className:`font-mono`,children:e},t))})})})]},e.id))})]})})}function Wue({conventions:e}){let[t,n]=(0,z.useState)(null),{data:r,isLoading:i}=ct({queryKey:[`convention-evolution`,t],queryFn:()=>t?bu(t).then(e=>e.data):null,enabled:!!t});return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-2`,children:`选择规范`}),(0,B.jsxs)(`select`,{value:t||``,onChange:e=>n(e.target.value||null),className:`w-full px-3 py-2 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:`— 请选择 —`}),e.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` (v`,e.version,`)`]},e.id))]})]}),t&&(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:i?(0,B.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,B.jsx)(Tc,{className:`h-8 w-8 animate-spin text-blue-500`})}):!r||r.history.length===0?(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)(Ks,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`暂无进化记录`})]}):(0,B.jsx)(`div`,{className:`space-y-4`,children:r.history.map((e,t)=>(0,B.jsxs)(`div`,{className:`border-l-2 border-blue-200 pl-4 pb-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,B.jsx)(Us,{className:`h-4 w-4 text-green-500`}),(0,B.jsxs)(`span`,{className:`text-sm font-medium text-gray-900`,children:[e.previousVersion,` → `,e.newVersion]}),(0,B.jsx)(`span`,{className:`text-xs text-gray-500`,children:new Date(e.timestamp).toLocaleString(`zh-CN`)})]}),e.changes.length>0&&(0,B.jsx)(`ul`,{className:`text-sm text-gray-600 space-y-1 ml-6`,children:e.changes.map((e,t)=>(0,B.jsx)(`li`,{className:`list-disc`,children:e},t))})]},t))})})]})}function Gue({id:e,onClose:t}){let[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(!1),o=qe(),{data:s,isLoading:c}=ct({queryKey:[`global-convention`,e],queryFn:()=>hu(e).then(e=>e.data)}),{data:l}=ct({queryKey:[`convention-yaml`,e],queryFn:()=>Su(e).then(e=>e.data),enabled:i});(0,z.useEffect)(()=>{l?.yaml!==void 0&&r(l.yaml)},[l]);let u=lt({mutationFn:t=>Cu(e,t).then(e=>e.data),onSuccess:()=>{Zc(`保存成功`,`success`),a(!1),o.invalidateQueries({queryKey:[`global-convention`,e]}),o.invalidateQueries({queryKey:[`global-conventions`]})},onError:()=>{Zc(`保存失败`,`error`)}}),d=lt({mutationFn:()=>xu([e]).then(e=>e.data),onSuccess:t=>{t.results.success.length>0?(Zc(`规范已进化更新`,`success`),o.invalidateQueries({queryKey:[`global-convention`,e]}),o.invalidateQueries({queryKey:[`global-conventions`]})):Zc(`进化失败:`+(t.results.failed[0]?.error||`未知错误`),`error`)},onError:()=>{Zc(`进化失败`,`error`)}});if(c)return(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,B.jsx)(`div`,{className:`bg-white rounded-xl p-8`,children:(0,B.jsx)(Tc,{className:`h-8 w-8 animate-spin text-blue-500 mx-auto`})})});if(!s)return null;let f=s.source===`official`;return(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:t,children:(0,B.jsxs)(`div`,{className:`bg-white rounded-xl max-w-4xl w-full max-h-[90vh] overflow-hidden flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between p-6 border-b border-gray-200`,children:[(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-bold text-gray-900`,children:s.name}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:s.description})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,B.jsxs)(`button`,{onClick:()=>d.mutate(),disabled:d.isPending,className:`flex items-center gap-1.5 px-3 py-2 text-sm bg-green-50 text-green-600 hover:bg-green-100 rounded-lg transition-colors disabled:opacity-50`,title:`AI 进化优化`,children:[(0,B.jsx)(Tc,{className:`h-4 w-4 ${d.isPending?`animate-spin`:``}`}),d.isPending?`进化中...`:`手动进化`]}),(0,B.jsx)(`button`,{onClick:t,className:`p-2 text-gray-400 hover:text-gray-600 rounded-lg transition-colors`,children:(0,B.jsx)(Gc,{className:`h-5 w-5`})})]})]}),(0,B.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-4`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 text-sm`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`版本`}),(0,B.jsx)(`div`,{className:`font-medium text-gray-900 mt-1`,children:s.version})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`来源`}),(0,B.jsx)(`div`,{className:`font-medium text-gray-900 mt-1`,children:s.source===`official`?`官方`:s.source===`user`?`用户`:`社区`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`角色数`}),(0,B.jsx)(`div`,{className:`font-medium text-gray-900 mt-1`,children:s.roles?Object.keys(s.roles).length:0})]})]}),i?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`label`,{className:`text-sm font-medium text-gray-700`,children:`YAML 内容`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsxs)(`button`,{onClick:()=>u.mutate(n),disabled:u.isPending,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:[(0,B.jsx)(Dc,{className:`h-3.5 w-3.5`}),u.isPending?`保存中...`:`保存`]}),(0,B.jsx)(`button`,{onClick:()=>a(!1),className:`px-3 py-1.5 text-sm bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors`,children:`取消`})]})]}),(0,B.jsx)(`textarea`,{value:n,onChange:e=>r(e.target.value),rows:20,className:`w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono`})]}):(0,B.jsxs)(`div`,{className:`space-y-4`,children:[s.principles&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 mb-2`,children:`核心原则`}),(0,B.jsx)(`pre`,{className:`text-sm text-gray-600 bg-gray-50 p-3 rounded-lg overflow-x-auto whitespace-pre-wrap`,children:s.principles})]}),s.roles&&Object.keys(s.roles).length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 mb-2`,children:`角色定义`}),(0,B.jsx)(`div`,{className:`space-y-2`,children:Object.entries(s.roles).map(([e,t])=>(0,B.jsxs)(`div`,{className:`bg-gray-50 p-3 rounded-lg`,children:[(0,B.jsx)(`div`,{className:`font-medium text-gray-900 text-sm`,children:t.name||e}),t.responsibilities&&(0,B.jsxs)(`div`,{className:`text-xs text-gray-600 mt-1`,children:[`职责:`,t.responsibilities]}),t.constraints&&(0,B.jsxs)(`div`,{className:`text-xs text-gray-500 mt-1`,children:[`约束:`,t.constraints]})]},e))})]}),s.quality_standards&&s.quality_standards.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 mb-2`,children:`质量标准`}),(0,B.jsx)(`div`,{className:`space-y-1.5`,children:s.quality_standards.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`px-1.5 py-0.5 text-xs rounded font-medium ${e.severity===`must`?`bg-red-50 text-red-600`:e.severity===`should`?`bg-amber-50 text-amber-600`:`bg-blue-50 text-blue-600`}`,children:e.severity===`must`?`必须`:e.severity===`should`?`应该`:`可以`}),(0,B.jsxs)(`span`,{className:`text-gray-500`,children:[`[`,e.category,`]`]}),(0,B.jsx)(`span`,{className:`text-gray-700 flex-1`,children:e.rule})]},t))})]}),s.active_prompt&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 mb-2`,children:`Active Prompt`}),(0,B.jsx)(`pre`,{className:`text-xs text-gray-600 bg-gray-50 p-3 rounded-lg overflow-x-auto whitespace-pre-wrap`,children:s.active_prompt})]}),!f&&(0,B.jsxs)(`button`,{onClick:()=>a(!0),className:`flex items-center gap-1.5 px-3 py-2 text-sm bg-blue-50 text-blue-600 hover:bg-blue-100 rounded-lg transition-colors`,children:[(0,B.jsx)(ic,{className:`h-4 w-4`}),`编辑 YAML`]})]})]})]})})}function Kue(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(void 0),{data:o}=ct({queryKey:[`projects`],queryFn:()=>Ol().then(e=>e.data)});(0,z.useEffect)(()=>{o?.items?.[0]?.projectPath&&a(o.items[0].projectPath)},[o]);let{data:s,isLoading:c}=ct({queryKey:[`node-types`,i],queryFn:()=>wu(i),enabled:!!i}),{data:l,isLoading:u}=ct({queryKey:[`node-type`,e],queryFn:()=>Tu(e),enabled:!!e}),d=s?.data.items||[],f=l?.data,p=e=>({analysis:`bg-blue-100 text-blue-700`,design:`bg-purple-100 text-purple-700`,implementation:`bg-green-100 text-green-700`,validation:`bg-orange-100 text-orange-700`})[e]||`bg-gray-100 text-gray-700`;return(0,B.jsxs)(`div`,{className:`p-6 max-w-7xl mx-auto`,children:[(0,B.jsxs)(`div`,{className:`mb-6`,children:[(0,B.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900`,children:`流水线节点类型管理`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mt-1`,children:`浏览所有可用的节点类型,点击查看详细配置`})]}),c?(0,B.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,B.jsx)(hc,{className:`h-6 w-6 animate-spin text-gray-400`})}):(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,B.jsx)(`div`,{className:`space-y-3`,children:d.map(n=>(0,B.jsxs)(`div`,{onClick:()=>{t(n.id),r(!1)},className:`p-4 border rounded-lg cursor-pointer transition-all ${e===n.id?`border-blue-500 bg-blue-50 shadow-sm`:`border-gray-200 hover:border-gray-300 hover:shadow-sm`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Ms,{className:`h-5 w-5 text-gray-600`}),(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900`,children:n.name})]}),(0,B.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded-full ${p(n.semanticCategory)}`,children:n.semanticCategory})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mt-2`,children:n.description}),(0,B.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 text-xs text-gray-500`,children:[n.isBuiltin&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Us,{className:`h-3 w-3`}),`内置`]}),n.defaultSkills.length>0&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Kc,{className:`h-3 w-3`}),n.defaultSkills.length,` 个默认技能`]})]})]},n.id))}),(0,B.jsx)(`div`,{className:`lg:sticky lg:top-6 lg:self-start`,children:e?u?(0,B.jsx)(`div`,{className:`border border-gray-200 rounded-lg p-8 flex items-center justify-center`,children:(0,B.jsx)(hc,{className:`h-6 w-6 animate-spin text-gray-400`})}):f?(0,B.jsxs)(`div`,{className:`border border-gray-200 rounded-lg p-6 space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-bold text-gray-900`,children:f.name}),(0,B.jsx)(`span`,{className:`px-2 py-1 text-xs rounded-full ${p(f.semanticCategory)}`,children:f.semanticCategory})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600`,children:f.description}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mt-2 text-xs text-gray-500`,children:[(0,B.jsx)(`code`,{className:`bg-gray-100 px-2 py-0.5 rounded`,children:f.id}),f.isBuiltin&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-green-600`,children:[(0,B.jsx)(Us,{className:`h-3 w-3`}),`内置节点`]})]})]}),f.defaultSkills.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-2 flex items-center gap-1`,children:[(0,B.jsx)(Kc,{className:`h-4 w-4`}),`默认技能`]}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:f.defaultSkills.map(e=>(0,B.jsx)(`span`,{className:`px-2 py-1 bg-blue-50 text-blue-700 text-xs rounded`,children:e},e))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-2 flex items-center gap-1`,children:[(0,B.jsx)(Us,{className:`h-4 w-4`}),`完成条件`]}),(0,B.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[f.completion.explicitSignal&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`显式信号:`}),(0,B.jsx)(`code`,{className:`ml-2 bg-gray-100 px-2 py-0.5 rounded text-xs`,children:f.completion.explicitSignal})]}),f.completion.requireWrite!==void 0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`需要写入操作:`}),(0,B.jsx)(`span`,{className:`ml-2 text-gray-900`,children:f.completion.requireWrite?`是`:`否`})]}),f.completion.keywords.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`关键词:`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:f.completion.keywords.map((e,t)=>(0,B.jsx)(`code`,{className:`bg-gray-100 px-2 py-0.5 rounded text-xs`,children:e},t))})]}),f.completion.filePatterns.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`文件模式:`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:f.completion.filePatterns.map((e,t)=>(0,B.jsx)(`code`,{className:`bg-gray-100 px-2 py-0.5 rounded text-xs`,children:e},t))})]})]})]}),(f.activityThreshold.minToolCalls!==void 0||f.activityThreshold.stagnationStrategy)&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-2 flex items-center gap-1`,children:[(0,B.jsx)(ic,{className:`h-4 w-4`}),`活跃度阈值`]}),(0,B.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[f.activityThreshold.minToolCalls!==void 0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`最小工具调用次数:`}),(0,B.jsx)(`span`,{className:`ml-2 text-gray-900`,children:f.activityThreshold.minToolCalls})]}),f.activityThreshold.stagnationStrategy&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`停滞策略:`}),(0,B.jsx)(`code`,{className:`ml-2 bg-gray-100 px-2 py-0.5 rounded text-xs`,children:f.activityThreshold.stagnationStrategy})]})]})]}),f.heuristic&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>r(!n),className:`flex items-center gap-2 text-sm font-semibold text-gray-700 hover:text-gray-900`,children:[n?(0,B.jsx)(Vs,{className:`h-4 w-4`}):(0,B.jsx)(Rs,{className:`h-4 w-4`}),`原始配置(JSON)`]}),n&&(0,B.jsx)(`pre`,{className:`mt-2 p-3 bg-gray-50 rounded text-xs overflow-auto max-h-64`,children:JSON.stringify(f.heuristic,null,2)})]})]}):null:(0,B.jsxs)(`div`,{className:`border border-gray-200 rounded-lg p-8 text-center text-gray-500`,children:[(0,B.jsx)(Ms,{className:`h-12 w-12 mx-auto mb-3 text-gray-300`}),(0,B.jsx)(`p`,{children:`选择左侧节点类型查看详细信息`})]})})]})]})}function que(){return(0,B.jsx)(vte,{children:(0,B.jsxs)(Qc,{children:[(0,B.jsx)(Nx,{}),(0,B.jsx)(rf,{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)(A4,{})}),(0,B.jsx)(sr,{path:`/sessions`,element:(0,B.jsx)(P4,{})}),(0,B.jsx)(sr,{path:`/sessions/:id`,element:(0,B.jsx)(I4,{})}),(0,B.jsx)(sr,{path:`/events`,element:(0,B.jsx)(a3,{})}),(0,B.jsx)(sr,{path:`/pipelines`,element:(0,B.jsx)(o3,{})}),(0,B.jsx)(sr,{path:`/pipelines/:id`,element:(0,B.jsx)(_3,{})}),(0,B.jsx)(sr,{path:`/projects`,element:(0,B.jsx)(Aue,{})}),(0,B.jsx)(sr,{path:`/projects/:encodedPath`,element:(0,B.jsx)(Fue,{})}),(0,B.jsx)(sr,{path:`/quality`,element:(0,B.jsx)(S3,{})}),(0,B.jsx)(sr,{path:`/analytics`,element:(0,B.jsx)(O3,{})}),(0,B.jsx)(sr,{path:`/knowledge`,element:(0,B.jsx)(kue,{})}),(0,B.jsx)(sr,{path:`/skills`,element:(0,B.jsx)(Lue,{})}),(0,B.jsx)(sr,{path:`/conventions`,element:(0,B.jsx)(Hue,{})}),(0,B.jsx)(sr,{path:`/node-types`,element:(0,B.jsx)(Kue,{})}),(0,B.jsx)(sr,{path:`/config`,element:(0,B.jsx)(w3,{})})]})})]})})}var Jue=new Ue({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});qc.createRoot(document.getElementById(`root`)).render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Je,{client:Jue,children:(0,B.jsx)(Xr,{children:(0,B.jsx)(que,{})})})}));
|
|
76
|
+
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}G9.displayName=`MiniMap`;var K9=(0,z.memo)(G9),Tue=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Eue={[f7.Line]:`right`,[f7.Handle]:`bottom-right`};function Due({nodeId:e,position:t,variant:n=f7.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=o9(),y=typeof e==`string`?e:v,b=E7(),x=(0,z.useRef)(null),S=n===f7.Handle,C=T7((0,z.useCallback)(Tue(S&&p),[S,p]),S7),w=(0,z.useRef)(null),T=t??Eue[n];return(0,z.useEffect)(()=>{if(!(!x.current||!y))return w.current||=lce({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=Y5([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...y5({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:k3([`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)(Due);var q9={requirement:`#3b82f6`,decision:`#8b5cf6`,code_change:`#10b981`,outcome:`#f59e0b`};function Oue({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:q9[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:B8.ArrowClosed,color:`#d1d5db`}})),[t]),[a,,o]=$le(r),[s,,c]=eue(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)(Qle,{nodes:a,edges:s,onNodesChange:o,onEdgesChange:c,onNodeClick:l,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[(0,B.jsx)(aue,{color:`#f3f4f6`,gap:20}),(0,B.jsx)(fue,{}),(0,B.jsx)(K9,{nodeColor:t=>q9[e.find(e=>e.id===t.id)?.node_type||``]||`#6b7280`,style:{background:`#f9fafb`}})]})}var J9={requirement:ic,decision:pc,code_change:qs,outcome:Us},Y9={requirement:`#3b82f6`,decision:`#8b5cf6`,code_change:`#10b981`,outcome:`#f59e0b`},X9={requirement:`需求`,decision:`决策`,code_change:`代码变更`,outcome:`结果`},Z9=[`#3b82f6`,`#8b5cf6`,`#10b981`,`#f59e0b`,`#ef4444`,`#06b6d4`];function kue(){let e=qe(),[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(new Set),[l,u]=(0,z.useState)(1),[d,f]=(0,z.useState)(20),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(``),[x,S]=(0,z.useState)(`list`),[C,w]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:T}=ct({queryKey:[`knowledge-overview`],queryFn:()=>gl().then(e=>e.data)}),{data:E}=ct({queryKey:[`knowledge-search`,t,r,y],queryFn:()=>hl(t,y||void 0,r||void 0).then(e=>e.data),enabled:t.length>0}),{data:D}=ct({queryKey:[`knowledge-all`],queryFn:()=>hl(``,void 0,void 0,500).then(e=>e.data)}),{data:O}=ct({queryKey:[`knowledge-filtered`,r,y],queryFn:()=>hl(``,y||void 0,r||void 0,500).then(e=>e.data),enabled:t.length===0&&(!!r||!!y)}),{data:k}=ct({queryKey:[`knowledge-neighbors`,a],queryFn:()=>_l(a).then(e=>e.data),enabled:!!a}),{data:A}=ct({queryKey:[`knowledge-graph`,y,r],queryFn:()=>vl(y||void 0,r||void 0).then(e=>e.data),enabled:x===`graph`}),j=lt({mutationFn:yl,onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-filtered`]}),e.invalidateQueries({queryKey:[`knowledge-search`]}),e.invalidateQueries({queryKey:[`knowledge-overview`]}),m(!1)}}),M=lt({mutationFn:({id:e,data:t})=>bl(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-filtered`]}),e.invalidateQueries({queryKey:[`knowledge-search`]}),g(!1),v(null)}}),N=lt({mutationFn:xl,onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-filtered`]}),e.invalidateQueries({queryKey:[`knowledge-search`]}),e.invalidateQueries({queryKey:[`knowledge-overview`]}),o(null)}}),ee=lt({mutationFn:async e=>{for(let t of e)await xl(t)},onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-filtered`]}),e.invalidateQueries({queryKey:[`knowledge-search`]}),e.invalidateQueries({queryKey:[`knowledge-overview`]}),c(new Set),o(null)}}),P=t?E?.items:r||y?O?.items:D?.items,F=Array.from(new Set(D?.items.map(e=>e.node_type)||[])),I=Array.from(new Set(D?.items.map(e=>e.project_path||``).filter(Boolean)||[])),te=T?.byType?Object.entries(T.byType).map(([e,t])=>({name:e,value:t})):[],ne=Math.ceil((P?.length||0)/d),re=P?.slice((l-1)*d,l*d),L=e=>{e.preventDefault();let t=new FormData(e.currentTarget);j.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`)})},R=e=>{if(e.preventDefault(),!_)return;let t=new FormData(e.currentTarget);M.mutate({id:_.id,data:{title:t.get(`title`),content:t.get(`content`),tags:t.get(`tags`)}})},ie=e=>{w({open:!0,title:`删除知识节点`,description:`确认删除此知识节点?关联的边也会被删除。`,onConfirm:()=>{N.mutate(e),w(e=>({...e,open:!1}))}})};return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(X,{children:(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1`,children:[(0,B.jsx)(Oc,{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),u(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),u(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:`全部类型`}),F.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsxs)(`select`,{value:y,onChange:e=>{b(e.target.value),u(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:`全部项目`}),I.map(e=>(0,B.jsx)(`option`,{value:e,children:e.split(`/`).pop()},e))]}),(0,B.jsx)(Y,{variant:`primary`,size:`sm`,icon:Cc,onClick:()=>m(!0),children:`创建节点`}),s.size>0&&(0,B.jsxs)(Y,{variant:`danger`,size:`sm`,icon:zc,onClick:()=>{w({open:!0,title:`批量删除知识节点`,description:`确定删除选中的 ${s.size} 个知识节点吗?关联的边也会被删除。此操作不可撤销。`,onConfirm:()=>{ee.mutate(Array.from(s)),w(e=>({...e,open:!1}))}})},loading:ee.isPending,children:[`删除 (`,s.size,`)`]}),(0,B.jsxs)(`div`,{className:`flex border border-gray-200 rounded-lg overflow-hidden`,children:[(0,B.jsx)(`button`,{onClick:()=>S(`list`),className:`px-3 py-2 text-sm transition-colors ${x===`list`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`}`,children:`列表`}),(0,B.jsxs)(`button`,{onClick:()=>S(`graph`),className:`px-3 py-2 text-sm transition-colors flex items-center gap-1 ${x===`graph`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`}`,children:[(0,B.jsx)(vc,{className:`h-4 w-4`}),`图谱`]})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,B.jsxs)(X,{title:`知识图谱概览`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 mb-4`,children:[(0,B.jsxs)(`button`,{className:`text-center p-4 bg-blue-50 rounded-xl hover:bg-blue-100 transition-colors cursor-pointer`,onClick:()=>{i(``),b(``),u(1)},title:`点击查看全部节点`,children:[(0,B.jsx)(Ns,{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:T?.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)(cc,{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:te.length}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`节点类型`})]})]}),te.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:te.map((e,t)=>(0,B.jsxs)(`button`,{onClick:()=>{i(r===e.name?``:e.name),u(1)},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${r===e.name?`text-white`:`bg-gray-100 text-gray-700 hover:bg-gray-200`}`,style:r===e.name?{backgroundColor:Z9[t%Z9.length]}:{},children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:Z9[t%Z9.length]}}),X9[e.name]||e.name,(0,B.jsxs)(`span`,{className:`opacity-70`,children:[`(`,e.value,`)`]})]},e.name))})]}),(0,B.jsx)(X,{title:`节点类型分布`,children:te.length>0?(0,B.jsx)($O,{width:`100%`,height:220,children:(0,B.jsxs)(h2,{margin:{top:20,right:20,bottom:20,left:20},children:[(0,B.jsx)(HJ,{data:te,cx:`50%`,cy:`50%`,innerRadius:50,outerRadius:80,dataKey:`value`,label:({name:e,percent:t})=>t>=.05?`${X9[e]||e} ${(t*100).toFixed(0)}%`:``,labelLine:({percent:e})=>e>=.05,onClick:e=>{i(r===e.name?``:e.name),u(1)},style:{cursor:`pointer`},children:te.map((e,t)=>(0,B.jsx)(GW,{fill:Z9[t%Z9.length],opacity:r&&r!==e.name?.4:1},t))}),(0,B.jsx)(WW,{formatter:(e,t)=>[e,X9[t]||t]})]})}):(0,B.jsx)(`div`,{className:`flex items-center justify-center h-48 text-gray-400`,children:`暂无数据`})})]}),x===`graph`&&(0,B.jsx)(X,{title:`知识图谱`,children:(0,B.jsx)(`div`,{className:`h-[600px] border border-gray-200 rounded-lg overflow-hidden`,children:A?(0,B.jsx)(Oue,{nodes:A.nodes,edges:A.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`})})})}),x===`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)(X,{title:`知识节点 (${P?.length||0})`,action:(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[P&&P.length>0&&(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Qs,onClick:()=>{if(!P||P.length===0)return;let e=[`ID`,`标题`,`类型`,`内容`,`标签`,`项目路径`],t=P.map(e=>[e.id,e.title,e.node_type,e.content,e.tags||``,e.project_path||``]);M4(`knowledge-nodes-${T4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},children:`导出 CSV`}),re&&re.length>0&&(0,B.jsx)(`button`,{onClick:()=>{s.size===re.length?c(new Set):c(new Set(re.map(e=>e.id)))},className:`text-xs text-blue-600 hover:underline`,children:s.size===re.length?`取消全选`:`全选当前页`})]}),children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[re?.map((e,t)=>{let n=J9[e.node_type]||Ns,r=Y9[e.node_type]||`#6b7280`;return(0,B.jsx)(Mx.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 ${s.has(e.id)?`border-blue-300 bg-blue-50`: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)(`input`,{type:`checkbox`,checked:s.has(e.id),onChange:t=>{t.stopPropagation(),c(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 cursor-pointer flex-shrink-0 mt-1`}),(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)(Fx,{size:`sm`,variant:e.node_type===`outcome`?`success`:e.node_type===`decision`?`info`:`default`,children:X9[e.node_type]||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(),v({id:e.id,title:e.title,content:e.content,tags:e.tags||``}),g(!0)},className:`p-1.5 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-600`,children:(0,B.jsx)(Pc,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),ie(e.id)},className:`p-1.5 rounded hover:bg-red-100 text-gray-400 hover:text-red-600`,children:(0,B.jsx)(zc,{className:`h-3.5 w-3.5`})})]})]})},e.id)}),(!re||re.length===0)&&(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-gray-400`,children:[(0,B.jsx)(Ns,{className:`h-12 w-12 mb-4`}),(0,B.jsx)(`p`,{children:`暂无知识节点`}),(0,B.jsx)(`p`,{className:`text-sm mt-1`,children:`使用 Claude Code 进行开发后,知识会自动沉淀`})]})]}),P&&P.length>0&&(0,B.jsx)(`div`,{className:`mt-4`,children:(0,B.jsx)(j4,{currentPage:l,totalPages:ne,onPageChange:u,pageSize:d,onPageSizeChange:e=>{f(e),u(1)},totalItems:P.length})})]})}),(0,B.jsx)(`div`,{children:(0,B.jsx)(X,{title:`节点详情`,children:a&&P?(()=>{let e=P.find(e=>e.id===a);if(!e)return(0,B.jsx)(`div`,{className:`text-gray-400 text-center py-8`,children:`节点未找到`});let t=J9[e.node_type]||Ns,n=Y9[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)(Fx,{size:`sm`,children:X9[e.node_type]||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))})]}),k&&k.items.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-xs font-semibold text-gray-500 mb-2`,children:[`关联节点 (`,k.total,`)`]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:k.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)(Oc,{className:`h-8 w-8 mb-3`}),(0,B.jsx)(`p`,{className:`text-sm`,children:`点击左侧节点查看详情`})]})})})]}),p&&(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`,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)(Y,{type:`button`,variant:`secondary`,onClick:()=>m(!1),children:`取消`}),(0,B.jsx)(Y,{type:`submit`,variant:`primary`,loading:j.isPending,children:`创建`})]})]})]})}),h&&_&&(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,onClick:()=>g(!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:R,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:_.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:_.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:_.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)(Y,{type:`button`,variant:`secondary`,onClick:()=>g(!1),children:`取消`}),(0,B.jsx)(Y,{type:`submit`,variant:`primary`,loading:M.isPending,children:`保存`})]})]})]})}),(0,B.jsx)(O4,{open:C.open,title:C.title,description:C.description,variant:`danger`,onConfirm:C.onConfirm,onCancel:()=>w({...C,open:!1})})]})}function Aue(){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)(``),[b,x]=(0,z.useState)(new Set),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(``),[E,D]=(0,z.useState)(!1),{data:O}=ct({queryKey:[`project-meta-all`],queryFn:()=>W.get(`/projects/meta/all`).then(e=>e.data),staleTime:3e4}),k=O||{},A=lt({mutationFn:({projectPath:e,meta:t})=>W.put(`/projects/${encodeURIComponent(e)}/meta`,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`project-meta-all`]})},onError:e=>Zc(e.message||`操作失败`,`error`)}),j=(e,t)=>{t.stopPropagation();let n=k[e]||{notes:``,tags:[],archived:!1};_(n.notes),y(n.tags.join(`, `)),h(e)},M=()=>{if(!m)return;let e=k[m]||{notes:``,tags:[],archived:!1};A.mutate({projectPath:m,meta:{notes:g.trim(),tags:v.split(`,`).map(e=>e.trim()).filter(Boolean),archived:e.archived}}),h(null)},N=(e,t)=>{t.stopPropagation();let n=k[e]||{notes:``,tags:[],archived:!1};A.mutate({projectPath:e,meta:{...n,archived:!n.archived}})},ee=(e,t)=>{t.stopPropagation(),x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},P=()=>{for(let e of b){let t=k[e]||{notes:``,tags:[],archived:!1};A.mutate({projectPath:e,meta:{...t,archived:!0}})}Zc(`已归档 ${b.size} 个项目`,`success`),x(new Set)},F=async()=>{D(!0);let e=0;for(let t of b)try{await Al(encodeURIComponent(t)),e++}catch{}D(!1),C(!1),T(``),x(new Set),t.invalidateQueries({queryKey:[`projects`]}),Zc(`已删除 ${e} 个项目`,`success`)},{data:I,isLoading:te}=ct({queryKey:[`projects`],queryFn:()=>Ol({limit:1e3}).then(e=>e.data),refetchInterval:3e4});if(te)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 ne=I?.items||[],re=e=>{c===e?d(e=>!e):(l(e),d(!1)),a(1)},L=ne.filter(e=>{if(k[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}),R=Math.ceil(L.length/o),ie=L.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.jsx)(`div`,{className:`flex items-center gap-3`,children:b.size>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Fx,{variant:`info`,children:[b.size,` 个已选`]}),(0,B.jsxs)(`button`,{onClick:P,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:[(0,B.jsx)(Es,{className:`h-4 w-4`}),`批量归档`]}),(0,B.jsxs)(`button`,{onClick:()=>C(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors`,children:[(0,B.jsx)(zc,{className:`h-4 w-4`}),`批量删除`]}),(0,B.jsxs)(`button`,{onClick:()=>x(new Set),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)(Gc,{className:`h-4 w-4`}),`取消选择`]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Fx,{variant:`info`,children:[L.length,` 个项目`]}),(0,B.jsxs)(`button`,{onClick:()=>p(!f),className:q(`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=L.map(e=>[e.projectName,e.projectPath,e.sessionCount,e.pipelineCount,e.qualityIssueCount,e.totalEvents,e.lastActivity||``]);M4(`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)(X,{children:(0,B.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1`,children:[(0,B.jsx)(Oc,{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:()=>re(e),className:q(`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:q(`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:ie.map((t,n)=>{let r=t.projectPath,i=k[r]||{notes:``,tags:[],archived:!1};return(0,B.jsx)(Mx.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:n*.03},children:(0,B.jsx)(X,{className:q(`!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)(oc,{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)(Ic,{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=>ee(r,e),className:q(`p-1 rounded transition-colors`,b.has(r)?`text-blue-600`:`text-gray-300 hover:text-gray-500`),title:`选择`,children:b.has(r)?(0,B.jsx)(Nc,{className:`h-3.5 w-3.5`}):(0,B.jsx)(Fc,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{onClick:e=>N(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=>j(r,e),className:`p-1 text-gray-400 hover:text-gray-600 rounded`,title:`项目设置`,children:(0,B.jsx)(kc,{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)(cc,{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)(Ac,{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)(Ns,{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)(Ks,{className:`h-3 w-3 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[`最近活动:`,T4(tf(t.lastActivity),`MM-dd HH:mm`)]})]})]})})},r)})}),L.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)(oc,{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 后,项目将自动出现在这里`})]}),L.length>0&&(0,B.jsx)(j4,{currentPage:i,totalPages:R,onPageChange:a,pageSize:o,onPageSizeChange:e=>{s(e),a(1)},totalItems:L.length}),S&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onClick:()=>{C(!1),T(``)},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)(`h3`,{className:`text-lg font-bold text-red-600 mb-3 flex items-center gap-2`,children:[(0,B.jsx)(zc,{className:`h-5 w-5`}),`危险操作:批量删除项目`]}),(0,B.jsxs)(`div`,{className:`bg-red-50 border border-red-200 rounded-lg p-3 mb-4`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-red-800 font-medium mb-2`,children:[`⚠️ 此操作将永久删除 `,(0,B.jsxs)(`strong`,{children:[b.size,` 个项目`]}),` 的所有监控数据:`]}),(0,B.jsxs)(`ul`,{className:`text-xs text-red-700 space-y-1 ml-4 list-disc`,children:[(0,B.jsx)(`li`,{children:`所有会话记录`}),(0,B.jsx)(`li`,{children:`所有 Pipeline 历史`}),(0,B.jsx)(`li`,{children:`所有质量问题记录`}),(0,B.jsx)(`li`,{children:`所有事件日志`}),(0,B.jsx)(`li`,{children:`所有知识节点`})]}),(0,B.jsx)(`p`,{className:`text-xs text-red-800 font-bold mt-2`,children:`此操作无法撤销,无法恢复!`})]}),(0,B.jsxs)(`div`,{className:`mb-4`,children:[(0,B.jsxs)(`label`,{className:`block text-sm font-medium text-gray-700 mb-2`,children:[`请输入 `,(0,B.jsx)(`code`,{className:`px-1.5 py-0.5 bg-gray-100 rounded text-red-600`,children:`删除`}),` 以确认批量删除:`]}),(0,B.jsx)(`input`,{type:`text`,value:w,onChange:e=>T(e.target.value),placeholder:`输入「删除」二字`,className:`w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 focus:border-red-500`,autoFocus:!0})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,B.jsx)(`button`,{onClick:()=>{C(!1),T(``)},className:`px-4 py-2 text-sm text-gray-600 hover:bg-gray-50 rounded-lg`,children:`取消`}),(0,B.jsx)(`button`,{disabled:w!==`删除`||E,onClick:F,className:`px-4 py-2 text-sm bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed`,children:E?`删除中...`:`确认删除`})]})]})}),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)(Gc,{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:M,className:`px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700`,children:`保存`})]})]})})]})}var jue={spec:{label:`规格`,icon:ic,color:`text-blue-600`,bg:`bg-blue-50`,border:`border-blue-200`},security:{label:`安全`,icon:jc,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-200`},quality:{label:`质量`,icon:nc,color:`text-purple-600`,bg:`bg-purple-50`,border:`border-purple-200`},test:{label:`测试`,icon:Rc,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-200`},performance:{label:`性能`,icon:Kc,color:`text-orange-600`,bg:`bg-orange-50`,border:`border-orange-200`}},Mue={fail:{label:`失败`,icon:Gs,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-300`},warn:{label:`警告`,icon:Vc,color:`text-yellow-600`,bg:`bg-yellow-50`,border:`border-yellow-300`},pass:{label:`通过`,icon:Us,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-300`}};function Nue({level:e}){let t=Mue[e];if(!t)return(0,B.jsx)(Fx,{size:`sm`,children:e});let n=t.icon;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),t.label]})}function Pue({category:e}){let t=jue[e];if(!t)return(0,B.jsx)(Fx,{size:`sm`,children:e});let n=t.icon;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),t.label]})}function Fue(){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)(``),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(1),[_,v]=(0,z.useState)(20),[y,b]=(0,z.useState)(null),x=async e=>{try{let t=await Jl(e);await navigator.clipboard.writeText(t.data.context),b(e),Zc(`上下文已复制,请粘贴到 Claude Code 进行修复`,`success`),setTimeout(()=>b(null),3e3)}catch{Zc(`复制失败`,`error`)}},{data:S,isLoading:C,isError:w,error:T}=ct({queryKey:[`project`,e],queryFn:()=>kl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e}),{data:E}=ct({queryKey:[`claudemd`,e],queryFn:()=>Rl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e&&r===`claudemd`}),{data:D}=ct({queryKey:[`claudemd-modules`,e],queryFn:()=>Vl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e&&r===`claudemd`}),O=lt({mutationFn:()=>Al(encodeURIComponent(decodeURIComponent(e))),onSuccess:()=>{n.invalidateQueries({queryKey:[`projects`]}),t(`/projects`)},onError:e=>Zc(e.message||`删除失败`,`error`)}),k=lt({mutationFn:t=>zl(encodeURIComponent(decodeURIComponent(e)),t),onSuccess:()=>{n.invalidateQueries({queryKey:[`claudemd`,e]}),u(!1)},onError:e=>Zc(e.message||`保存失败`,`error`)}),A=lt({mutationFn:()=>Hl(encodeURIComponent(decodeURIComponent(e))),onSuccess:t=>{n.invalidateQueries({queryKey:[`claudemd`,e]}),m({success:!0,message:t.data.distilled?`蒸馏完成,压缩 ${t.data.reduction}%(${t.data.before} → ${t.data.after} 字符):${t.data.summary}`:t.data.message??`无需蒸馏`})},onError:e=>{m({success:!1,message:e.message})}}),[j,M]=(0,z.useState)(null),[N,ee]=(0,z.useState)(!1),[P,F]=(0,z.useState)(!1),[I,te]=(0,z.useState)(null),[ne,re]=(0,z.useState)(!1),[L,R]=(0,z.useState)(null);return w?(0,B.jsxs)(`div`,{className:`flex items-center justify-center h-96 text-red-500`,children:[`加载失败:`,T?.message||`未知错误`]}):C||!S?(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)(F4,{items:[{label:`项目列表`,path:`/projects`},{label:S.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)(Y,{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)(oc,{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:S.projectName}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:S.projectPath})]})]})]}),(0,B.jsx)(Y,{variant:`danger`,size:`sm`,icon:zc,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)(X,{className:`max-w-md`,children:[(0,B.jsxs)(`h3`,{className:`text-lg font-bold text-red-600 mb-3 flex items-center gap-2`,children:[(0,B.jsx)(Vc,{className:`h-5 w-5`}),`危险操作:删除项目`]}),(0,B.jsxs)(`div`,{className:`bg-red-50 border border-red-200 rounded-lg p-3 mb-4`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-red-800 font-medium mb-2`,children:[`⚠️ 此操作将永久删除项目 `,(0,B.jsx)(`strong`,{children:S.projectName}),` 的所有监控数据:`]}),(0,B.jsxs)(`ul`,{className:`text-xs text-red-700 space-y-1 ml-4 list-disc`,children:[(0,B.jsx)(`li`,{children:`所有会话记录`}),(0,B.jsx)(`li`,{children:`所有 Pipeline 历史`}),(0,B.jsx)(`li`,{children:`所有质量问题记录`}),(0,B.jsx)(`li`,{children:`所有事件日志`}),(0,B.jsx)(`li`,{children:`所有知识节点`})]}),(0,B.jsx)(`p`,{className:`text-xs text-red-800 font-bold mt-2`,children:`此操作无法撤销,无法恢复!`})]}),(0,B.jsxs)(`div`,{className:`mb-4`,children:[(0,B.jsxs)(`label`,{className:`block text-sm font-medium text-gray-700 mb-2`,children:[`请输入项目名称 `,(0,B.jsx)(`code`,{className:`px-1.5 py-0.5 bg-gray-100 rounded text-red-600`,children:S.projectName}),` 以确认删除:`]}),(0,B.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`输入项目名称`,className:`w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 focus:border-red-500`,autoFocus:!0})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>{o(!1),c(``)},children:`取消`}),(0,B.jsx)(Y,{variant:`danger`,size:`sm`,disabled:s!==S.projectName,onClick:()=>{s===S.projectName&&(O.mutate(),o(!1),c(``))},children:`确认删除`})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-4`,children:[(0,B.jsx)(X,{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:S.sessions.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`会话`})]})]})}),(0,B.jsx)(X,{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)(cc,{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:S.pipelines.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Pipeline`})]})]})}),(0,B.jsx)(X,{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)(Lc,{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:S.events.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`事件`})]})]})}),(0,B.jsx)(X,{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)(Ac,{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:S.quality.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`质量`})]})]})}),(0,B.jsx)(X,{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)(Ns,{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:S.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:`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)(X,{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=S.sessions.items;return Math.ceil(n.length/_),(0,B.jsxs)(B.Fragment,{children:[n.slice((h-1)*_,h*_).map(n=>(0,B.jsxs)(`tr`,{onClick:()=>t(`/sessions/${n.session_id}`,{state:{from:`/projects/${encodeURIComponent(decodeURIComponent(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)(Fx,{size:`sm`,className:ef(n.status),children:n.status})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:T4(tf(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=S.sessions.items,t=Math.ceil(e.length/_);return e.length>_?(0,B.jsx)(`div`,{className:`mt-4`,children:(0,B.jsx)(j4,{currentPage:h,totalPages:t,onPageChange:g,pageSize:_,onPageSizeChange:e=>{v(e),g(1)},totalItems:e.length})}):null})()]}),r===`pipelines`&&(0,B.jsx)(X,{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:S.pipelines.items.map(n=>(0,B.jsxs)(`tr`,{onClick:()=>t(`/pipelines/${n.id}`,{state:{from:`/projects/${encodeURIComponent(decodeURIComponent(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)(Fx,{size:`sm`,children:n.phase})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:T4(tf(n.updated_at),`MM-dd HH:mm`)})]},n.id))})]})})}),r===`quality`&&(0,B.jsxs)(X,{children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,B.jsxs)(`p`,{className:`text-sm text-gray-600`,children:[`共 `,S.quality.total,` 个质量问题`]})}),(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`})]})}),(0,B.jsx)(`tbody`,{className:`text-sm`,children:S.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)(Nue,{level:e.level})}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Pue,{category:e.category})}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Fx,{size:`sm`,variant:e.resolved?`success`:`default`,children:e.resolved?`已解决`:`未解决`})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:T4(tf(e.created_at),`MM-dd HH:mm`)}),(0,B.jsx)(`td`,{className:`py-3`,children:!e.resolved&&(0,B.jsxs)(`button`,{onClick:()=>x(e.id),className:`flex items-center gap-1 px-2 py-1 text-xs text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors`,title:`复制上下文到剪贴板`,children:[y===e.id?(0,B.jsx)(Is,{className:`h-3.5 w-3.5 text-green-500`}):(0,B.jsx)(Ys,{className:`h-3.5 w-3.5`}),y===e.id?`已复制`:`复制`]})})]},e.id))})]})})]}),r===`knowledge`&&(0,B.jsx)(X,{children:(0,B.jsx)(`div`,{className:`space-y-3`,children:S.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)(ic,{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)(Fx,{size:`sm`,children:e.node_type}),(0,B.jsxs)(`span`,{children:[`更新于 `,T4(tf(e.updated_at),`MM-dd HH:mm`)]})]})]})]})},e.id))})}),r===`rules`&&(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(X,{title:`意图识别规则`,children:(0,B.jsx)(`div`,{className:`space-y-2`,children:S.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)(Fx,{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)(X,{title:`任务模式`,children:(0,B.jsx)(`div`,{className:`space-y-2`,children:S.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)(Fx,{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)(Bc,{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===`convention`&&e&&(0,B.jsx)(Iue,{encodedPath:encodeURIComponent(decodeURIComponent(e))}),r===`claudemd`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(X,{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)(ic,{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:E?.exists?`${(E.size/1024).toFixed(1)} KB · ${E.hasAutoSection?`含自动区块`:`纯用户内容`}`:`文件不存在`})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Tc,onClick:()=>n.invalidateQueries({queryKey:[`claudemd`,e]}),children:`刷新`}),E?.exists&&(0,B.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Kc,onClick:()=>{m(null),A.mutate()},disabled:A.isPending,title:`AI 蒸馏:压缩冗余内容,保留核心规范`,children:A.isPending?`蒸馏中...`:`蒸馏`}),E?.exists&&!l&&(0,B.jsx)(Y,{size:`sm`,icon:xc,onClick:()=>{f(E.content||``),u(!0)},children:`编辑`})]})]})}),p&&(0,B.jsx)(X,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsx)(`p`,{className:`text-sm ${p.success?`text-gray-900`:`text-red-600`}`,children:p.message}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Gc,onClick:()=>m(null)})]})}),l&&(0,B.jsxs)(X,{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:d,onChange:e=>f(e.target.value)}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end mt-3`,children:[(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Gc,onClick:()=>u(!1),children:`取消`}),(0,B.jsx)(Y,{size:`sm`,icon:Ls,onClick:()=>k.mutate(d),children:`保存`})]})]}),!l&&E?.exists&&(0,B.jsx)(X,{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:E.content})}),(0,B.jsx)(X,{title:`子模块 (${D?.total??0})`,children:D?.items.length===0?(0,B.jsx)(`p`,{className:`text-sm text-gray-400`,children:`未检测到子模块`}):(0,B.jsx)(`div`,{className:`space-y-2`,children:D?.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)(oc,{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)(Fx,{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)(X,{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)(Y,{variant:`secondary`,size:`sm`,icon:kc,onClick:async()=>{ee(!0),M(null);try{M((await Bl(encodeURIComponent(decodeURIComponent(e)))).data.profile)}catch(e){M({error:String(e)})}finally{ee(!1)}},disabled:N,children:N?`检测中...`:`环境检测`}),(0,B.jsx)(Y,{size:`sm`,icon:Kc,onClick:async()=>{F(!0),te(null);try{let t=await Ul(encodeURIComponent(decodeURIComponent(e)));te({success:t.data.success,message:t.data.message,claudeMdGenerated:t.data.claudeMdGenerated}),M(t.data.profile),n.invalidateQueries({queryKey:[`claudemd`,e]}),n.invalidateQueries({queryKey:[`project`,e]})}catch(e){te({success:!1,message:String(e)})}finally{F(!1)}},disabled:P,children:P?`初始化中...`:`一键初始化`}),(0,B.jsx)(Y,{size:`sm`,icon:ic,onClick:async()=>{re(!0),R(null);try{let t=await jl(encodeURIComponent(decodeURIComponent(e)));R({success:t.data.success,message:t.data.message}),t.data.skipped||(n.invalidateQueries({queryKey:[`conventions`,e]}),n.invalidateQueries({queryKey:[`claudemd`,e]}))}catch(e){R({success:!1,message:String(e)})}finally{re(!1)}},disabled:ne,children:ne?`生成中...`:`初始化规范`})]})]})}),I&&(0,B.jsx)(X,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[I.success?(0,B.jsx)(Ls,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,B.jsx)(Gc,{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 ${I.success?`text-gray-900`:`text-red-600`}`,children:I.message}),I.claudeMdGenerated&&(0,B.jsx)(`p`,{className:`text-xs text-green-600 mt-0.5`,children:`CLAUDE.md 已自动生成`})]})]}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Gc,onClick:()=>te(null)})]})}),L&&(0,B.jsx)(X,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[L.success?(0,B.jsx)(Ls,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,B.jsx)(Gc,{className:`h-4 w-4 text-red-500 mt-0.5 flex-shrink-0`}),(0,B.jsx)(`p`,{className:q(`text-sm font-medium`,L.success?`text-gray-900`:`text-red-600`),children:L.message})]}),(0,B.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Gc,onClick:()=>R(null)})]})}),j&&!(`error`in j)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(X,{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:j.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:j.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:j.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:j.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:j.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:j.formatter||`未检测到`})]})]})}),j.languages.length>0&&(0,B.jsx)(X,{title:`检测到的语言`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:j.languages.map((e,t)=>(0,B.jsxs)(Fx,{size:`sm`,children:[e.name,e.version?` ${e.version}`:``]},t))})}),j.frameworks.length>0&&(0,B.jsx)(X,{title:`检测到的框架`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:j.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(j.scripts).length>0&&(0,B.jsx)(X,{title:`常用脚本`,children:(0,B.jsx)(`div`,{className:`space-y-1`,children:Object.entries(j.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))})}),j.keyDirectories.length>0&&(0,B.jsx)(X,{title:`关键目录`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:j.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)(oc,{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))})})]}),j&&`error`in j&&(0,B.jsx)(X,{children:(0,B.jsxs)(`p`,{className:`text-sm text-red-600`,children:[`检测失败:`,j.error]})})]})]})}function Iue({encodedPath:e}){let[t,n]=(0,z.useState)(`bindings`),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),l=qe(),{data:u,isLoading:d}=ct({queryKey:[`project-conventions`,e],queryFn:()=>Ml(e).then(e=>e.data)}),{data:f}=ct({queryKey:[`global-conventions`],queryFn:()=>mu().then(e=>e.data),enabled:r}),{data:p}=ct({queryKey:[`project-custom-yaml`,e],queryFn:()=>Fl(e).then(e=>e.data),enabled:s}),m=lt({mutationFn:t=>Nl(e,t).then(e=>e.data),onSuccess:t=>{Zc(`已绑定:${t.convention.name}`,`success`),i(!1),l.invalidateQueries({queryKey:[`project-conventions`,e]})}}),h=lt({mutationFn:t=>Pl(e,t).then(e=>e.data),onSuccess:()=>{Zc(`已解绑`,`success`),l.invalidateQueries({queryKey:[`project-conventions`,e]})}}),g=lt({mutationFn:()=>Ll(e).then(e=>e.data),onSuccess:t=>{Zc(t.isIncremental?`增量蒸馏完成,版本 ${t.convention.version}`:`蒸馏完成,生成 ${t.convention.name}`,`success`),l.invalidateQueries({queryKey:[`project-conventions`,e]}),n(`custom`)}}),_=lt({mutationFn:t=>Il(e,t).then(e=>e.data),onSuccess:()=>{Zc(`保存成功`,`success`),c(!1),l.invalidateQueries({queryKey:[`project-conventions`,e]})}}),v=u?.bindings||[],y=u?.custom,b=(f?.items||[]).filter(e=>!v.some(t=>t.id===e.id)),x={official:`bg-amber-50 text-amber-700`,user:`bg-blue-50 text-blue-700`,community:`bg-purple-50 text-purple-700`},S={official:`官方`,user:`用户`,community:`社区`};return d?(0,B.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,B.jsx)(Tc,{className:`h-6 w-6 animate-spin text-blue-500`})}):(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`div`,{className:`flex gap-1 bg-gray-100 rounded-lg p-1`,children:[`bindings`,`custom`].map(e=>(0,B.jsx)(`button`,{onClick:()=>n(e),className:`px-4 py-1.5 text-sm font-medium rounded-md transition-colors flex items-center gap-1.5 ${t===e?`bg-white text-gray-900 shadow-sm`:`text-gray-500 hover:text-gray-700`}`,children:e===`bindings`?`绑定的规范 (${v.length})`:(0,B.jsxs)(B.Fragment,{children:[`蒸馏规范`,y&&(0,B.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-700`,children:`实际生效`})]})},e))}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[t===`bindings`&&(0,B.jsxs)(`button`,{onClick:()=>i(!r),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:[(0,B.jsx)(mc,{className:`h-3.5 w-3.5`}),`绑定规范`]}),t===`custom`&&(0,B.jsxs)(`button`,{onClick:()=>g.mutate(),disabled:g.isPending||v.length===0,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 transition-colors`,title:v.length===0?`请先绑定至少一个规范`:``,children:[(0,B.jsx)(Kc,{className:`h-3.5 w-3.5 ${g.isPending?`animate-pulse`:``}`}),g.isPending?`蒸馏中...`:y?`重新蒸馏`:`生成蒸馏规范`]})]})]}),r&&(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-blue-200 p-4 space-y-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-medium text-gray-700`,children:`从全局规范库选择绑定`}),b.length===0?(0,B.jsx)(`p`,{className:`text-sm text-gray-400`,children:`所有全局规范已全部绑定`}):(0,B.jsx)(`div`,{className:`grid gap-2`,children:b.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-gray-50 rounded-lg`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium text-gray-900`,children:e.name}),(0,B.jsx)(`span`,{className:`px-1.5 py-0.5 text-xs rounded-full ${x[e.source]||`bg-gray-100 text-gray-600`}`,children:S[e.source]||e.source}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`v`,e.version]})]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:e.description})]}),(0,B.jsx)(`button`,{onClick:()=>m.mutate(e.id),disabled:m.isPending,className:`px-3 py-1.5 text-xs bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:`绑定`})]},e.id))}),(0,B.jsx)(`button`,{onClick:()=>i(!1),className:`text-xs text-gray-400 hover:text-gray-600`,children:`关闭`})]}),t===`bindings`&&(0,B.jsx)(`div`,{className:`space-y-3`,children:v.length===0?(0,B.jsxs)(`div`,{className:`text-center py-12 bg-white rounded-xl border border-gray-200`,children:[(0,B.jsx)(As,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500 text-sm`,children:`尚未绑定任何规范`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-1`,children:`点击「绑定规范」从全局规范库选择`})]}):v.map(e=>(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(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)(`span`,{className:`font-medium text-gray-900`,children:e.name}),(0,B.jsx)(`span`,{className:`px-1.5 py-0.5 text-xs rounded-full font-medium ${x[e.source]||`bg-gray-100 text-gray-600`}`,children:S[e.source]||e.source}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`v`,e.version]})]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:e.description}),(0,B.jsxs)(`div`,{className:`flex gap-3 mt-2 text-xs text-gray-400`,children:[(0,B.jsxs)(`span`,{children:[e.roles?Object.keys(e.roles).length:0,` 个角色`]}),(0,B.jsxs)(`span`,{children:[e.quality_standards?.length||0,` 条质量标准`]})]})]}),(0,B.jsx)(`button`,{onClick:()=>h.mutate(e.id),disabled:h.isPending,className:`ml-4 p-1.5 text-gray-400 hover:text-red-500 rounded transition-colors`,title:`解绑`,children:(0,B.jsx)(Gc,{className:`h-4 w-4`})})]})},e.id))}),t===`custom`&&(0,B.jsx)(`div`,{className:`space-y-4`,children:y?(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-gray-100`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`font-semibold text-gray-900`,children:y.name}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`v`,y.version]}),(0,B.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-700 border border-green-200`,children:`项目真实规范`})]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:y.description})]}),!s&&(0,B.jsxs)(`button`,{onClick:()=>{o(p?.yaml||``),c(!0)},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-gray-100 text-gray-700 hover:bg-gray-200 rounded-lg transition-colors`,children:[(0,B.jsx)(xc,{className:`h-3.5 w-3.5`}),`编辑 YAML`]})]}),(0,B.jsx)(`div`,{className:`p-5`,children:s?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`textarea`,{value:a||p?.yaml||``,onChange:e=>o(e.target.value),rows:24,className:`w-full px-3 py-2 text-xs border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsxs)(`button`,{onClick:()=>_.mutate(a),disabled:_.isPending,className:`flex items-center gap-1.5 px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:[(0,B.jsx)(Dc,{className:`h-3.5 w-3.5`}),_.isPending?`保存中...`:`保存`]}),(0,B.jsx)(`button`,{onClick:()=>c(!1),className:`px-4 py-2 text-sm bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors`,children:`取消`})]})]}):(0,B.jsxs)(`div`,{className:`space-y-4 text-sm`,children:[y.principles&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-xs font-medium text-gray-500 uppercase tracking-wide mb-2`,children:`核心原则`}),(0,B.jsx)(`pre`,{className:`text-xs text-gray-700 bg-gray-50 rounded-lg p-3 whitespace-pre-wrap border border-gray-100 max-h-48 overflow-y-auto`,children:typeof y.principles==`string`?y.principles:JSON.stringify(y.principles,null,2)})]}),y.quality_standards&&y.quality_standards.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-xs font-medium text-gray-500 uppercase tracking-wide mb-2`,children:[`质量标准 (`,y.quality_standards.length,`)`]}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[y.quality_standards.slice(0,5).map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-gray-600`,children:[(0,B.jsx)(`span`,{className:`mt-0.5 px-1.5 py-0.5 rounded text-xs font-medium ${e.severity===`must`?`bg-red-50 text-red-600`:e.severity===`should`?`bg-yellow-50 text-yellow-600`:`bg-gray-100 text-gray-500`}`,children:e.severity||`rule`}),(0,B.jsx)(`span`,{children:e.rule||String(e)})]},t)),y.quality_standards.length>5&&(0,B.jsxs)(`p`,{className:`text-xs text-gray-400`,children:[`...还有 `,y.quality_standards.length-5,` 条`]})]})]})]})})]}):(0,B.jsxs)(`div`,{className:`text-center py-12 bg-white rounded-xl border border-gray-200`,children:[(0,B.jsx)(Kc,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500 text-sm`,children:`尚未生成蒸馏规范`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-1`,children:v.length>0?`点击「生成蒸馏规范」将绑定的规范融合为项目专属规范`:`请先绑定至少一个规范,再生成蒸馏规范`})]})})]})}var Q9={local:`bg-blue-50 text-blue-700`,remote:`bg-purple-50 text-purple-700`,generated:`bg-green-50 text-green-700`,official:`bg-amber-50 text-amber-700`,user:`bg-pink-50 text-pink-700`},$9={local:`本地`,remote:`远程`,generated:`AI生成`,official:`官方`,user:`用户`};function Lue(){let[e,t]=(0,z.useState)(`list`),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(new Set),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(null),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),v=qe(),{data:y,isLoading:b}=ct({queryKey:[`skills`,n,i],queryFn:()=>iu({source:n||void 0,tag:i||void 0}).then(e=>e.data),refetchInterval:3e4}),{data:x}=ct({queryKey:[`skills-status`],queryFn:()=>au().then(e=>e.data),refetchInterval:3e4}),S=lt({mutationFn:e=>su(e).then(e=>e.data),onSuccess:e=>{d(e),Zc(`找到 ${e.github.length+e.npm.length} 个结果`,`success`)}}),C=lt({mutationFn:e=>cu(e).then(e=>e.data),onSuccess:e=>{Zc(`已安装: ${e.skill.name}`,`success`),v.invalidateQueries({queryKey:[`skills`]}),v.invalidateQueries({queryKey:[`skills-status`]})}}),w=lt({mutationFn:e=>lu(e).then(e=>e.data),onSuccess:(e,t)=>{Zc(`已删除: ${t}`,`success`),s(e=>{let n=new Set(e);return n.delete(t),n}),v.invalidateQueries({queryKey:[`skills`]}),v.invalidateQueries({queryKey:[`skills-status`]})}}),T=lt({mutationFn:e=>uu(e).then(e=>e.data),onSuccess:e=>{Zc(`已删除 ${e.success.length} 个技能`,`success`),s(new Set),v.invalidateQueries({queryKey:[`skills`]}),v.invalidateQueries({queryKey:[`skills-status`]})}}),E=lt({mutationFn:()=>du().then(e=>e.data),onSuccess:e=>{Zc(`进化完成:${e.repaired.length+e.retired.length+e.optimized.length+e.generated.length} 项变更`,`success`),v.invalidateQueries({queryKey:[`skills`]}),v.invalidateQueries({queryKey:[`skills-status`]})}}),D=lt({mutationFn:()=>fu().then(e=>e.data),onSuccess:e=>{Zc(`蒸馏完成:新增 ${e.distilled.length} 个技能`,`success`),v.invalidateQueries({queryKey:[`skills`]}),v.invalidateQueries({queryKey:[`skills-status`]})}}),O=lt({mutationFn:()=>pu().then(e=>e.data),onSuccess:e=>{Zc(`修复完成:${e.repaired.length} 个技能已修复`,`success`),v.invalidateQueries({queryKey:[`skills`]})}}),k=y?.items||[],A=k.length>0&&o.size===k.length,j=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-start 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:`管理 Claude Code 技能库,搜索安装、进化优化`})]}),x&&(0,B.jsx)(`div`,{className:`flex items-center gap-3`,children:[{label:`全部`,value:x.total,color:`text-gray-700`},{label:`官方`,value:x.official,color:`text-amber-600`},{label:`本地`,value:x.local,color:`text-blue-600`},{label:`AI生成`,value:x.generated,color:`text-green-600`}].map(({label:e,value:t,color:n})=>(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:q(`text-xl font-bold`,n),children:t}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:e})]},e))})]}),(0,B.jsx)(`div`,{className:`border-b border-gray-200`,children:(0,B.jsx)(`nav`,{className:`flex gap-1`,children:[{key:`list`,label:`技能列表`},{key:`search`,label:`搜索安装`},{key:`evolve`,label:`进化管理`},{key:`sources`,label:`技能源`}].map(n=>(0,B.jsx)(`button`,{onClick:()=>t(n.key),className:q(`px-4 py-2.5 text-sm font-medium border-b-2 transition-colors`,e===n.key?`border-blue-600 text-blue-600`:`border-transparent text-gray-500 hover:text-gray-700`),children:n.label},n.key))})}),e===`list`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`button`,{onClick:()=>p(!f),className:q(`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)(sc,{className:`h-4 w-4`}),`筛选`,(0,B.jsx)(Rs,{className:q(`h-3.5 w-3.5 transition-transform`,f&&`rotate-180`)})]}),(0,B.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[k.length,` 个技能`]}),o.size>0&&(0,B.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,B.jsxs)(`span`,{className:`text-sm text-gray-600`,children:[`已选 `,o.size,` 个`]}),(0,B.jsxs)(`button`,{onClick:()=>{_({open:!0,title:`批量删除技能`,description:`确定要删除选中的 ${o.size} 个技能吗?此操作不可恢复。`,onConfirm:()=>{T.mutate(Array.from(o)),_(e=>({...e,open:!1}))}})},disabled:T.isPending,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-red-50 text-red-600 hover:bg-red-100 rounded-lg transition-colors`,children:[(0,B.jsx)(zc,{className:`h-3.5 w-3.5`}),`批量删除`]})]})]}),f&&(0,B.jsxs)(`div`,{className:`flex gap-3 mt-3 pt-3 border-t border-gray-100`,children:[(0,B.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,B.jsx)(`option`,{value:``,children:`全部来源`}),(0,B.jsx)(`option`,{value:`local`,children:`本地`}),(0,B.jsx)(`option`,{value:`official`,children:`官方`}),(0,B.jsx)(`option`,{value:`remote`,children:`远程`}),(0,B.jsx)(`option`,{value:`generated`,children:`AI生成`}),(0,B.jsx)(`option`,{value:`user`,children:`用户`})]}),(0,B.jsx)(`input`,{type:`text`,placeholder:`按标签筛选...`,value:i,onChange:e=>a(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]})]}),b?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-48`,children:(0,B.jsx)(hc,{className:`h-8 w-8 animate-spin text-blue-500`})}):(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 overflow-hidden`,children:[(0,B.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,B.jsx)(`thead`,{className:`bg-gray-50 border-b border-gray-200`,children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`w-10 px-4 py-3`,children:(0,B.jsx)(`input`,{type:`checkbox`,checked:A,onChange:()=>{s(A?new Set:new Set(k.map(e=>e.name)))},className:`rounded`})}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`技能名称`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`来源`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`版本`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`调用次数`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`成功率`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`最近使用`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`操作`})]})}),(0,B.jsx)(`tbody`,{className:`divide-y divide-gray-100`,children:k.map(e=>(0,B.jsxs)(`tr`,{className:`hover:bg-gray-50 transition-colors`,children:[(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`input`,{type:`checkbox`,checked:o.has(e.name),onChange:()=>j(e.name),className:`rounded`})}),(0,B.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,B.jsx)(`button`,{onClick:()=>h(e.name),className:`font-medium text-blue-600 hover:text-blue-700 cursor-pointer`,children:e.name}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500 truncate max-w-xs`,children:e.description}),e.tags&&e.tags.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:e.tags.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 bg-gray-100 text-gray-600 text-xs rounded`,children:[(0,B.jsx)(Ic,{className:`h-2.5 w-2.5`}),e]},e))})]}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`span`,{className:q(`px-2 py-0.5 text-xs rounded-full font-medium`,Q9[e.source]||`bg-gray-100 text-gray-600`),children:$9[e.source]||e.source})}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.version}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.stats.callCount}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:e.stats.callCount>0?(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`div`,{className:`w-16 h-1.5 bg-gray-200 rounded-full overflow-hidden`,children:(0,B.jsx)(`div`,{className:q(`h-full rounded-full`,e.stats.successRate>=.8?`bg-green-500`:e.stats.successRate>=.5?`bg-yellow-500`:`bg-red-500`),style:{width:`${e.stats.successRate*100}%`}})}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-600`,children:[(e.stats.successRate*100).toFixed(0),`%`]})]}):(0,B.jsx)(`span`,{className:`text-xs text-gray-400`,children:`未使用`})}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-xs text-gray-500`,children:e.stats.lastUsed?new Date(e.stats.lastUsed).toLocaleDateString(`zh-CN`):`—`}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`button`,{onClick:()=>{_({open:!0,title:`删除技能`,description:`确定要删除技能 "${e.name}" 吗?此操作不可恢复。`,onConfirm:()=>{w.mutate(e.name),_(e=>({...e,open:!1}))}})},disabled:w.isPending,className:`p-1.5 text-gray-400 hover:text-red-500 rounded transition-colors`,title:`删除`,children:(0,B.jsx)(zc,{className:`h-4 w-4`})})})]},e.name))})]}),k.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)(yc,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`暂无技能`})]})]}),x&&(x.topUsed.length>0||x.topRated.length>0)&&(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[x.topUsed.length>0&&(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3 flex items-center gap-2`,children:[(0,B.jsx)(Bc,{className:`h-4 w-4 text-blue-500`}),`最常用技能`]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:x.topUsed.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-xs text-gray-400 w-4`,children:t+1}),(0,B.jsx)(`span`,{className:`text-gray-700`,children:e.name})]}),(0,B.jsxs)(`span`,{className:`text-gray-500`,children:[e.calls,` 次`]})]},e.name))})]}),x.topRated.length>0&&(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3 flex items-center gap-2`,children:[(0,B.jsx)(Ws,{className:`h-4 w-4 text-green-500`}),`评分最高技能`]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:x.topRated.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-xs text-gray-400 w-4`,children:t+1}),(0,B.jsx)(`span`,{className:`text-gray-700`,children:e.name})]}),(0,B.jsxs)(`span`,{className:`text-gray-500`,children:[(e.rating*100).toFixed(0),`%`]})]},e.name))})]})]})]}),e===`search`&&(0,B.jsx)(zue,{searchQuery:c,setSearchQuery:l,searchResults:u,onSearch:()=>S.mutate(c),onInstall:e=>C.mutate(e),isSearching:S.isPending,isInstalling:C.isPending}),e===`evolve`&&(0,B.jsx)(Bue,{onEvolve:()=>E.mutate(),onDistill:()=>D.mutate(),onRepair:()=>O.mutate(),isEvolving:E.isPending,isDistilling:D.isPending,isRepairing:O.isPending,evolveResult:E.data,distillResult:D.data,repairResult:O.data}),e===`sources`&&(0,B.jsx)(Vue,{}),m&&(0,B.jsx)(Rue,{name:m,onClose:()=>h(null)}),(0,B.jsx)(O4,{open:g.open,title:g.title,description:g.description,onConfirm:g.onConfirm,onCancel:()=>_(e=>({...e,open:!1}))})]})}function Rue({name:e,onClose:t}){let[n,r]=(0,z.useState)(`content`),{data:i,isLoading:a}=ct({queryKey:[`skill-detail`,e],queryFn:()=>ou(e).then(e=>e.data)});return(0,B.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40`,onClick:t,children:(0,B.jsxs)(`div`,{className:`bg-white rounded-2xl shadow-2xl w-full max-w-3xl max-h-[85vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-gray-100`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(yc,{className:`h-5 w-5 text-blue-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900`,children:e}),i&&(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:i.description})]})]}),(0,B.jsx)(`button`,{onClick:t,className:`p-1.5 text-gray-400 hover:text-gray-600 rounded-lg transition-colors`,children:(0,B.jsx)(Gc,{className:`h-5 w-5`})})]}),(0,B.jsx)(`div`,{className:`flex gap-1 px-6 pt-3 border-b border-gray-100`,children:[`content`,`stats`].map(e=>(0,B.jsx)(`button`,{onClick:()=>r(e),className:`px-3 py-1.5 text-sm font-medium border-b-2 transition-colors ${n===e?`border-blue-600 text-blue-600`:`border-transparent text-gray-500 hover:text-gray-700`}`,children:e===`content`?`技能内容`:`使用情况`},e))}),(0,B.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5`,children:a?(0,B.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,B.jsx)(hc,{className:`h-6 w-6 animate-spin text-blue-500`})}):i?n===`content`?(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded-full font-medium ${Q9[i.source]||`bg-gray-100 text-gray-600`}`,children:$9[i.source]||i.source}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`v`,i.version]}),i.requires?.bins&&i.requires.bins.length>0&&(0,B.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`需要:`,i.requires.bins.join(`, `)]}),i.filePath&&(0,B.jsx)(`span`,{className:`text-xs text-gray-400 font-mono truncate max-w-xs`,children:i.filePath})]}),i.tags&&i.tags.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.tags.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 bg-blue-50 text-blue-700 text-xs rounded-full`,children:[(0,B.jsx)(Ic,{className:`h-2.5 w-2.5`}),e]},e))}),i.content?(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-xs text-gray-500 mb-2 flex items-center gap-1`,children:[(0,B.jsx)(ic,{className:`h-3.5 w-3.5`}),`技能文件内容`]}),(0,B.jsx)(`pre`,{className:`text-xs text-gray-800 bg-gray-50 rounded-lg p-4 overflow-auto whitespace-pre-wrap border border-gray-200 max-h-[50vh] leading-relaxed`,children:i.content})]}):(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无文件内容`}),i.sourceUrl&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,B.jsx)($s,{className:`h-3.5 w-3.5 text-gray-400`}),(0,B.jsx)(`a`,{href:i.sourceUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 hover:underline truncate`,children:i.sourceUrl})]})]}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,B.jsxs)(`div`,{className:`bg-blue-50 rounded-xl p-4 text-center`,children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold text-blue-700`,children:i.stats.callCount}),(0,B.jsx)(`div`,{className:`text-xs text-blue-600 mt-1`,children:`总调用次数`})]}),(0,B.jsxs)(`div`,{className:`bg-green-50 rounded-xl p-4 text-center`,children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold text-green-700`,children:i.stats.callCount>0?`${(i.stats.successRate*100).toFixed(0)}%`:`—`}),(0,B.jsx)(`div`,{className:`text-xs text-green-600 mt-1`,children:`成功率`})]}),(0,B.jsxs)(`div`,{className:`bg-purple-50 rounded-xl p-4 text-center`,children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold text-purple-700`,children:i.stats.userFeedback.positive+i.stats.userFeedback.negative>0?`${i.stats.userFeedback.positive} / ${i.stats.userFeedback.negative}`:`—`}),(0,B.jsx)(`div`,{className:`text-xs text-purple-600 mt-1`,children:`用户反馈(正向/负向)`})]})]}),i.stats.callCount>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-gray-500 mb-1.5`,children:[(0,B.jsx)(`span`,{children:`成功率`}),(0,B.jsxs)(`span`,{children:[(i.stats.successRate*100).toFixed(1),`%`]})]}),(0,B.jsx)(`div`,{className:`w-full h-2 bg-gray-200 rounded-full overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full rounded-full transition-all ${i.stats.successRate>=.8?`bg-green-500`:i.stats.successRate>=.5?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${i.stats.successRate*100}%`}})})]}),(0,B.jsxs)(`div`,{className:`bg-gray-50 rounded-xl p-4`,children:[(0,B.jsx)(`div`,{className:`text-xs text-gray-500 mb-1`,children:`最近使用时间`}),(0,B.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:i.stats.lastUsed?new Date(i.stats.lastUsed).toLocaleString(`zh-CN`):`从未使用`})]}),i.stats.callCount===0&&(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`该技能尚未被调用过`})]}):(0,B.jsx)(`div`,{className:`text-center py-16 text-gray-500`,children:`技能不存在`})})]})})}function zue({searchQuery:e,setSearchQuery:t,searchResults:n,onSearch:r,onInstall:i,isSearching:a,isInstalling:o}){return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:(0,B.jsxs)(`div`,{className:`flex gap-3`,children:[(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索技能(GitHub / npm)...`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&r(),className:`flex-1 px-4 py-2.5 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,B.jsxs)(`button`,{onClick:r,disabled:a||!e.trim(),className:`flex items-center gap-2 px-6 py-2.5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[a?(0,B.jsx)(hc,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(Oc,{className:`h-4 w-4`}),`搜索`]})]})}),n&&(0,B.jsxs)(`div`,{className:`space-y-6`,children:[n.github.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3`,children:[`GitHub 结果 (`,n.github.length,`)`]}),(0,B.jsx)(`div`,{className:`grid gap-3`,children:n.github.map((e,t)=>(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4 hover:border-blue-300 transition-colors`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,B.jsx)(`h4`,{className:`font-semibold text-gray-900`,children:e.skill.name}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`v`,e.skill.version]})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mb-2`,children:e.skill.description}),(0,B.jsxs)(`a`,{href:e.sourceUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-blue-600 hover:underline`,children:[(0,B.jsx)($s,{className:`h-3 w-3`}),e.sourceUrl]})]}),(0,B.jsxs)(`button`,{onClick:()=>i(e.sourceUrl),disabled:o,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-blue-50 text-blue-600 hover:bg-blue-100 rounded-lg transition-colors`,children:[(0,B.jsx)(Qs,{className:`h-3.5 w-3.5`}),`安装`]})]})},t))})]}),n.npm.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3`,children:[`npm 结果 (`,n.npm.length,`)`]}),(0,B.jsx)(`div`,{className:`grid gap-3`,children:n.npm.map((e,t)=>(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4 hover:border-purple-300 transition-colors`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,B.jsx)(`h4`,{className:`font-semibold text-gray-900`,children:e.skill.name}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`v`,e.skill.version]})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mb-2`,children:e.skill.description}),e.installCommand&&(0,B.jsx)(`code`,{className:`text-xs bg-gray-100 px-2 py-1 rounded`,children:e.installCommand})]}),(0,B.jsxs)(`button`,{onClick:()=>i(e.sourceUrl),disabled:o,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-purple-50 text-purple-600 hover:bg-purple-100 rounded-lg transition-colors`,children:[(0,B.jsx)(Qs,{className:`h-3.5 w-3.5`}),`安装`]})]})},t))})]}),n.github.length===0&&n.npm.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 bg-white rounded-xl border border-gray-200`,children:[(0,B.jsx)(Oc,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`未找到匹配的技能`})]})]})]})}function Bue({onEvolve:e,onDistill:t,onRepair:n,isEvolving:r,isDistilling:i,isRepairing:a,evolveResult:o,distillResult:s,repairResult:c}){return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,B.jsx)(`div`,{className:`p-2 bg-blue-50 rounded-lg`,children:(0,B.jsx)(Mc,{className:`h-5 w-5 text-blue-600`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900`,children:`技能进化`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`淘汰、优化、生成`})]})]}),(0,B.jsxs)(`button`,{onClick:e,disabled:r,className:`w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:[r?(0,B.jsx)(hc,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(Tc,{className:`h-4 w-4`}),r?`进化中...`:`开始进化`]}),o&&(0,B.jsxs)(`div`,{className:`mt-4 space-y-2 text-sm`,children:[o.repaired?.length>0&&(0,B.jsxs)(`div`,{className:`text-green-600`,children:[`✔ 修复 `,o.repaired.length,` 个`]}),o.retired?.length>0&&(0,B.jsxs)(`div`,{className:`text-red-600`,children:[`- 淘汰 `,o.retired.length,` 个`]}),o.optimized?.length>0&&(0,B.jsxs)(`div`,{className:`text-blue-600`,children:[`↑ 优化 `,o.optimized.length,` 个`]}),o.generated?.length>0&&(0,B.jsxs)(`div`,{className:`text-green-600`,children:[`+ 生成 `,o.generated.length,` 个`]})]})]}),(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,B.jsx)(`div`,{className:`p-2 bg-purple-50 rounded-lg`,children:(0,B.jsx)(Qs,{className:`h-5 w-5 text-purple-600`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900`,children:`社区蒸馏`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`从精选源采集`})]})]}),(0,B.jsxs)(`button`,{onClick:t,disabled:i,className:`w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 transition-colors`,children:[i?(0,B.jsx)(hc,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(Qs,{className:`h-4 w-4`}),i?`蒸馏中...`:`开始蒸馏`]}),s&&s.distilled?.length>0&&(0,B.jsxs)(`div`,{className:`mt-4 text-sm text-purple-600`,children:[`✦ 新增 `,s.distilled.length,` 个技能`]})]}),(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,B.jsx)(`div`,{className:`p-2 bg-amber-50 rounded-lg`,children:(0,B.jsx)(Wc,{className:`h-5 w-5 text-amber-600`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900`,children:`修复残缺`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`AI 修复低质量技能`})]})]}),(0,B.jsxs)(`button`,{onClick:n,disabled:a,className:`w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-amber-600 text-white rounded-lg hover:bg-amber-700 disabled:opacity-50 transition-colors`,children:[a?(0,B.jsx)(hc,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(Wc,{className:`h-4 w-4`}),a?`修复中...`:`开始修复`]}),c&&c.repaired?.length>0&&(0,B.jsxs)(`div`,{className:`mt-4 text-sm text-amber-600`,children:[`✔ 修复 `,c.repaired.length,` 个技能`]})]})]}),(0,B.jsxs)(`div`,{className:`bg-blue-50 rounded-xl border border-blue-200 p-4`,children:[(0,B.jsx)(`h4`,{className:`text-sm font-semibold text-blue-900 mb-2`,children:`进化机制说明`}),(0,B.jsxs)(`ul`,{className:`text-sm text-blue-700 space-y-1`,children:[(0,B.jsxs)(`li`,{children:[`• `,(0,B.jsx)(`strong`,{children:`技能进化`}),`:根据使用统计自动淘汰低效技能、优化高频技能、生成新技能`]}),(0,B.jsxs)(`li`,{children:[`• `,(0,B.jsx)(`strong`,{children:`社区蒸馏`}),`:从 GitHub 精选仓库采集优质技能并蒸馏为官方技能`]}),(0,B.jsxs)(`li`,{children:[`• `,(0,B.jsx)(`strong`,{children:`修复残缺`}),`:检测并修复缺少描述、版本号或格式错误的技能文件`]})]})]})]})}function Vue(){let e=qe(),[t,n]=(0,z.useState)(!1),[r,i]=(0,z.useState)({repo:``,dir:``,branch:`main`,format:`command-md`,description:``}),{data:a}=ct({queryKey:[`skill-sources`],queryFn:()=>W.get(`/skills/sources`).then(e=>e.data)}),o=lt({mutationFn:e=>W.post(`/skills/sources`,e).then(e=>e.data),onSuccess:()=>{Zc(`技能源已添加`,`success`),n(!1),i({repo:``,dir:``,branch:`main`,format:`command-md`,description:``}),e.invalidateQueries({queryKey:[`skill-sources`]})}}),s=lt({mutationFn:e=>W.delete(`/skills/sources/${encodeURIComponent(e)}`).then(e=>e.data),onSuccess:()=>{Zc(`技能源已删除`,`success`),e.invalidateQueries({queryKey:[`skill-sources`]})}}),c=a?.builtIn||[],l=a?.user||[];return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`div`,{className:`flex justify-end`,children:(0,B.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:[(0,B.jsx)(Qs,{className:`h-4 w-4`}),`添加技能源`]})}),t&&(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900 mb-4`,children:`添加自定义技能源`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,B.jsx)(`input`,{type:`text`,placeholder:`仓库 (owner/repo)`,value:r.repo,onChange:e=>i({...r,repo:e.target.value}),className:`px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`目录路径`,value:r.dir,onChange:e=>i({...r,dir:e.target.value}),className:`px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`分支 (默认 main)`,value:r.branch,onChange:e=>i({...r,branch:e.target.value}),className:`px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,B.jsxs)(`select`,{value:r.format,onChange:e=>i({...r,format:e.target.value}),className:`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:`command-md`,children:`command-md`}),(0,B.jsx)(`option`,{value:`skill-md`,children:`skill-md`})]}),(0,B.jsx)(`input`,{type:`text`,placeholder:`描述`,value:r.description,onChange:e=>i({...r,description:e.target.value}),className:`col-span-2 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 mt-4`,children:[(0,B.jsx)(`button`,{onClick:()=>o.mutate(r),disabled:!r.repo||!r.dir||o.isPending,className:`px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:o.isPending?`添加中...`:`确认添加`}),(0,B.jsx)(`button`,{onClick:()=>n(!1),className:`px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors`,children:`取消`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3`,children:`内置技能源`}),(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 divide-y divide-gray-100`,children:c.map((e,t)=>(0,B.jsxs)(`div`,{className:`p-4 flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`font-medium text-gray-900`,children:[e.repo,`/`,e.dir]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:e.description})]}),(0,B.jsx)(`span`,{className:`px-2 py-1 bg-gray-100 text-gray-600 text-xs rounded`,children:`内置`})]},t))})]}),l.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-3`,children:`用户自定义源`}),(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 divide-y divide-gray-100`,children:l.map((e,t)=>(0,B.jsxs)(`div`,{className:`p-4 flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`font-medium text-gray-900`,children:[e.repo,`/`,e.dir]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:e.description})]}),(0,B.jsx)(`button`,{onClick:()=>s.mutate(e.repo),disabled:s.isPending,className:`p-1.5 text-gray-400 hover:text-red-500 rounded transition-colors`,children:(0,B.jsx)(zc,{className:`h-4 w-4`})})]},t))})]})]})}function Hue(){let[e,t]=(0,z.useState)(`library`),[n,r]=(0,z.useState)(`all`),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(new Set),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(null),g=qe(),{data:_,isLoading:v}=ct({queryKey:[`global-conventions`],queryFn:()=>mu().then(e=>e.data),refetchInterval:6e4}),{data:y}=ct({queryKey:[`convention-usage-stats`],queryFn:()=>yu().then(e=>e.data),enabled:e===`usage`}),b=lt({mutationFn:()=>gu().then(e=>e.data),onSuccess:e=>{Zc(e.added.length+e.updated.length>0?`同步完成:新增 ${e.added.length},更新 ${e.updated.length}`:`已是最新`,`success`),g.invalidateQueries({queryKey:[`global-conventions`]})}}),x=lt({mutationFn:e=>_u(e).then(e=>e.data),onSuccess:e=>{Zc(`已安装:${e.convention.name}`,`success`),d(``),p(!1),g.invalidateQueries({queryKey:[`global-conventions`]})}}),S=lt({mutationFn:e=>vu(e).then(e=>e.data),onSuccess:(e,t)=>{Zc(`规范已删除`,`success`),h(null),g.invalidateQueries({queryKey:[`global-conventions`]})}}),C=lt({mutationFn:e=>xu(e.length>0?e:void 0).then(e=>e.data),onSuccess:e=>{Zc(`进化完成:${e.results.success.length} 个规范已更新`,`success`),g.invalidateQueries({queryKey:[`global-conventions`]})}}),w=(_?.items||[]).filter(e=>!(n!==`all`&&e.source!==n||i&&!e.name.toLowerCase().includes(i.toLowerCase()))),T=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},E=w.length>0&&o.size===w.length,D=()=>s(E?new Set:new Set(w.map(e=>e.id))),O={official:`bg-amber-50 text-amber-700`,user:`bg-blue-50 text-blue-700`,community:`bg-purple-50 text-purple-700`},k={official:`官方`,user:`用户`,community:`社区`};return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-start 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:`管理全局规范模板,绑定到项目,追踪使用情况`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(`button`,{onClick:()=>b.mutate(),disabled:b.isPending,className:`flex items-center gap-1.5 px-3 py-2 text-sm bg-amber-50 text-amber-700 hover:bg-amber-100 rounded-lg transition-colors`,children:[(0,B.jsx)(Tc,{className:`h-4 w-4 ${b.isPending?`animate-spin`:``}`}),`同步官方规范`]}),(0,B.jsxs)(`button`,{onClick:()=>p(!f),className:`flex items-center gap-1.5 px-3 py-2 text-sm bg-blue-600 text-white hover:bg-blue-700 rounded-lg transition-colors`,children:[(0,B.jsx)(Qs,{className:`h-4 w-4`}),`从 URL 安装`]})]})]}),f&&(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:(0,B.jsxs)(`div`,{className:`flex gap-3`,children:[(0,B.jsx)(`input`,{type:`text`,placeholder:`规范 YAML 文件 URL...`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>e.key===`Enter`&&u.trim()&&x.mutate(u.trim()),className:`flex-1 px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,B.jsx)(`button`,{onClick:()=>x.mutate(u.trim()),disabled:!u.trim()||x.isPending,className:`px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:x.isPending?`安装中...`:`安装`}),(0,B.jsx)(`button`,{onClick:()=>p(!1),className:`p-2 text-gray-400 hover:text-gray-600 rounded-lg`,children:(0,B.jsx)(Gc,{className:`h-4 w-4`})})]})}),(0,B.jsx)(`div`,{className:`border-b border-gray-200`,children:(0,B.jsx)(`nav`,{className:`flex gap-1`,children:[{key:`library`,label:`规范库`},{key:`usage`,label:`使用统计`},{key:`evolution`,label:`进化历史`}].map(n=>(0,B.jsx)(`button`,{onClick:()=>t(n.key),className:`px-4 py-2.5 text-sm font-medium border-b-2 transition-colors ${e===n.key?`border-blue-600 text-blue-600`:`border-transparent text-gray-500 hover:text-gray-700`}`,children:n.label},n.key))})}),e===`library`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4 flex items-center gap-3 flex-wrap`,children:[(0,B.jsx)(`div`,{className:`flex gap-1`,children:[`all`,`official`,`user`,`community`].map(e=>(0,B.jsx)(`button`,{onClick:()=>r(e),className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${n===e?`bg-blue-600 text-white`:`bg-gray-100 text-gray-600 hover:bg-gray-200`}`,children:{all:`全部`,official:`官方`,user:`用户`,community:`社区`}[e]},e))}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(Oc,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索规范名称...`,value:i,onChange:e=>a(e.target.value),className:`pl-8 pr-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 w-48`})]}),(0,B.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[w.length,` 个规范`]}),o.size>0&&(0,B.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,B.jsxs)(`span`,{className:`text-sm text-gray-600`,children:[`已选 `,o.size,` 个`]}),(0,B.jsxs)(`button`,{onClick:()=>C.mutate(Array.from(o)),disabled:C.isPending,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-green-50 text-green-600 hover:bg-green-100 rounded-lg transition-colors`,children:[(0,B.jsx)(Tc,{className:`h-3.5 w-3.5 ${C.isPending?`animate-spin`:``}`}),`批量进化`]})]})]}),v?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-48 bg-white rounded-xl border border-gray-200`,children:(0,B.jsx)(Tc,{className:`h-8 w-8 animate-spin text-blue-500`})}):(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 overflow-hidden`,children:[(0,B.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,B.jsx)(`thead`,{className:`bg-gray-50 border-b border-gray-200`,children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`w-10 px-4 py-3`,children:(0,B.jsx)(`input`,{type:`checkbox`,checked:E,onChange:D,className:`rounded`})}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`规范名称`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`来源`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`版本`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`角色数`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`质量标准`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`操作`})]})}),(0,B.jsx)(`tbody`,{className:`divide-y divide-gray-100`,children:w.map(e=>(0,B.jsxs)(`tr`,{className:`hover:bg-gray-50 transition-colors`,children:[(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`input`,{type:`checkbox`,checked:o.has(e.id),onChange:()=>T(e.id),className:`rounded`})}),(0,B.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,B.jsx)(`button`,{onClick:()=>l(e.id),className:`font-medium text-blue-600 hover:text-blue-700 text-left`,children:e.name}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500 truncate max-w-xs mt-0.5`,children:e.description})]}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded-full font-medium ${O[e.source]||`bg-gray-100 text-gray-600`}`,children:k[e.source]||e.source})}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.version||`—`}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.roles?Object.keys(e.roles).length:0}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.quality_standards?.length||0}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`button`,{onClick:()=>l(e.id),className:`p-1.5 text-gray-400 hover:text-blue-500 rounded transition-colors`,title:`查看/编辑`,children:(0,B.jsx)(ic,{className:`h-4 w-4`})}),e.source!==`official`&&(0,B.jsx)(`button`,{onClick:()=>h(e),className:`p-1.5 text-gray-400 hover:text-red-500 rounded transition-colors`,title:`删除`,children:(0,B.jsx)(zc,{className:`h-4 w-4`})})]})})]},e.id))})]}),w.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)(As,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`暂无规范`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-1`,children:`点击「同步官方规范」获取内置规范`})]})]})]}),e===`usage`&&(0,B.jsx)(Uue,{data:y?.items||[]}),e===`evolution`&&(0,B.jsx)(Wue,{conventions:_?.items||[]}),c&&(0,B.jsx)(Gue,{id:c,onClose:()=>l(null)}),m&&(0,B.jsx)(O4,{title:`删除规范`,message:`确定要删除规范「${m.name}」吗?此操作不可撤销。`,onConfirm:()=>S.mutate(m.id),onCancel:()=>h(null)})]})}function Uue({data:e}){let[t,n]=(0,z.useState)(null);return(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 overflow-hidden`,children:e.length===0?(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)(Bc,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`暂无使用数据`})]}):(0,B.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,B.jsx)(`thead`,{className:`bg-gray-50 border-b border-gray-200`,children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`规范名称`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`来源`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`使用项目数`}),(0,B.jsx)(`th`,{className:`px-4 py-3 text-left font-medium text-gray-600`,children:`操作`})]})}),(0,B.jsx)(`tbody`,{className:`divide-y divide-gray-100`,children:e.map(e=>(0,B.jsxs)(z.Fragment,{children:[(0,B.jsxs)(`tr`,{className:`hover:bg-gray-50 transition-colors`,children:[(0,B.jsx)(`td`,{className:`px-4 py-3 font-medium text-gray-900`,children:e.name}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.source}),(0,B.jsx)(`td`,{className:`px-4 py-3 text-gray-600`,children:e.projectCount}),(0,B.jsx)(`td`,{className:`px-4 py-3`,children:(0,B.jsx)(`button`,{onClick:()=>n(t===e.id?null:e.id),className:`text-xs text-blue-600 hover:text-blue-700`,children:t===e.id?`收起`:`查看项目`})})]}),t===e.id&&(0,B.jsx)(`tr`,{children:(0,B.jsx)(`td`,{colSpan:4,className:`px-4 py-3 bg-gray-50`,children:(0,B.jsx)(`div`,{className:`text-xs text-gray-600 space-y-1`,children:e.projects.map((e,t)=>(0,B.jsx)(`div`,{className:`font-mono`,children:e},t))})})})]},e.id))})]})})}function Wue({conventions:e}){let[t,n]=(0,z.useState)(null),{data:r,isLoading:i}=ct({queryKey:[`convention-evolution`,t],queryFn:()=>t?bu(t).then(e=>e.data):null,enabled:!!t});return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-4`,children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-2`,children:`选择规范`}),(0,B.jsxs)(`select`,{value:t||``,onChange:e=>n(e.target.value||null),className:`w-full px-3 py-2 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:`— 请选择 —`}),e.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` (v`,e.version,`)`]},e.id))]})]}),t&&(0,B.jsx)(`div`,{className:`bg-white rounded-xl border border-gray-200 p-6`,children:i?(0,B.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,B.jsx)(Tc,{className:`h-8 w-8 animate-spin text-blue-500`})}):!r||r.history.length===0?(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)(Ks,{className:`h-10 w-10 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`暂无进化记录`})]}):(0,B.jsx)(`div`,{className:`space-y-4`,children:r.history.map((e,t)=>(0,B.jsxs)(`div`,{className:`border-l-2 border-blue-200 pl-4 pb-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,B.jsx)(Us,{className:`h-4 w-4 text-green-500`}),(0,B.jsxs)(`span`,{className:`text-sm font-medium text-gray-900`,children:[e.previousVersion,` → `,e.newVersion]}),(0,B.jsx)(`span`,{className:`text-xs text-gray-500`,children:new Date(e.timestamp).toLocaleString(`zh-CN`)})]}),e.changes.length>0&&(0,B.jsx)(`ul`,{className:`text-sm text-gray-600 space-y-1 ml-6`,children:e.changes.map((e,t)=>(0,B.jsx)(`li`,{className:`list-disc`,children:e},t))})]},t))})})]})}function Gue({id:e,onClose:t}){let[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(!1),o=qe(),{data:s,isLoading:c}=ct({queryKey:[`global-convention`,e],queryFn:()=>hu(e).then(e=>e.data)}),{data:l}=ct({queryKey:[`convention-yaml`,e],queryFn:()=>Su(e).then(e=>e.data),enabled:i});(0,z.useEffect)(()=>{l?.yaml!==void 0&&r(l.yaml)},[l]);let u=lt({mutationFn:t=>Cu(e,t).then(e=>e.data),onSuccess:()=>{Zc(`保存成功`,`success`),a(!1),o.invalidateQueries({queryKey:[`global-convention`,e]}),o.invalidateQueries({queryKey:[`global-conventions`]})},onError:()=>{Zc(`保存失败`,`error`)}}),d=lt({mutationFn:()=>xu([e]).then(e=>e.data),onSuccess:t=>{t.results.success.length>0?(Zc(`规范已进化更新`,`success`),o.invalidateQueries({queryKey:[`global-convention`,e]}),o.invalidateQueries({queryKey:[`global-conventions`]})):Zc(`进化失败:`+(t.results.failed[0]?.error||`未知错误`),`error`)},onError:()=>{Zc(`进化失败`,`error`)}});if(c)return(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,B.jsx)(`div`,{className:`bg-white rounded-xl p-8`,children:(0,B.jsx)(Tc,{className:`h-8 w-8 animate-spin text-blue-500 mx-auto`})})});if(!s)return null;let f=s.source===`official`;return(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:t,children:(0,B.jsxs)(`div`,{className:`bg-white rounded-xl max-w-4xl w-full max-h-[90vh] overflow-hidden flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between p-6 border-b border-gray-200`,children:[(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-bold text-gray-900`,children:s.name}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:s.description})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,B.jsxs)(`button`,{onClick:()=>d.mutate(),disabled:d.isPending,className:`flex items-center gap-1.5 px-3 py-2 text-sm bg-green-50 text-green-600 hover:bg-green-100 rounded-lg transition-colors disabled:opacity-50`,title:`AI 进化优化`,children:[(0,B.jsx)(Tc,{className:`h-4 w-4 ${d.isPending?`animate-spin`:``}`}),d.isPending?`进化中...`:`手动进化`]}),(0,B.jsx)(`button`,{onClick:t,className:`p-2 text-gray-400 hover:text-gray-600 rounded-lg transition-colors`,children:(0,B.jsx)(Gc,{className:`h-5 w-5`})})]})]}),(0,B.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-4`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 text-sm`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`版本`}),(0,B.jsx)(`div`,{className:`font-medium text-gray-900 mt-1`,children:s.version})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`来源`}),(0,B.jsx)(`div`,{className:`font-medium text-gray-900 mt-1`,children:s.source===`official`?`官方`:s.source===`user`?`用户`:`社区`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`角色数`}),(0,B.jsx)(`div`,{className:`font-medium text-gray-900 mt-1`,children:s.roles?Object.keys(s.roles).length:0})]})]}),i?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`label`,{className:`text-sm font-medium text-gray-700`,children:`YAML 内容`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsxs)(`button`,{onClick:()=>u.mutate(n),disabled:u.isPending,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 transition-colors`,children:[(0,B.jsx)(Dc,{className:`h-3.5 w-3.5`}),u.isPending?`保存中...`:`保存`]}),(0,B.jsx)(`button`,{onClick:()=>a(!1),className:`px-3 py-1.5 text-sm bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors`,children:`取消`})]})]}),(0,B.jsx)(`textarea`,{value:n,onChange:e=>r(e.target.value),rows:20,className:`w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono`})]}):(0,B.jsxs)(`div`,{className:`space-y-4`,children:[s.principles&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 mb-2`,children:`核心原则`}),(0,B.jsx)(`pre`,{className:`text-sm text-gray-600 bg-gray-50 p-3 rounded-lg overflow-x-auto whitespace-pre-wrap`,children:s.principles})]}),s.roles&&Object.keys(s.roles).length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 mb-2`,children:`角色定义`}),(0,B.jsx)(`div`,{className:`space-y-2`,children:Object.entries(s.roles).map(([e,t])=>(0,B.jsxs)(`div`,{className:`bg-gray-50 p-3 rounded-lg`,children:[(0,B.jsx)(`div`,{className:`font-medium text-gray-900 text-sm`,children:t.name||e}),t.responsibilities&&(0,B.jsxs)(`div`,{className:`text-xs text-gray-600 mt-1`,children:[`职责:`,t.responsibilities]}),t.constraints&&(0,B.jsxs)(`div`,{className:`text-xs text-gray-500 mt-1`,children:[`约束:`,t.constraints]})]},e))})]}),s.quality_standards&&s.quality_standards.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 mb-2`,children:`质量标准`}),(0,B.jsx)(`div`,{className:`space-y-1.5`,children:s.quality_standards.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`px-1.5 py-0.5 text-xs rounded font-medium ${e.severity===`must`?`bg-red-50 text-red-600`:e.severity===`should`?`bg-amber-50 text-amber-600`:`bg-blue-50 text-blue-600`}`,children:e.severity===`must`?`必须`:e.severity===`should`?`应该`:`可以`}),(0,B.jsxs)(`span`,{className:`text-gray-500`,children:[`[`,e.category,`]`]}),(0,B.jsx)(`span`,{className:`text-gray-700 flex-1`,children:e.rule})]},t))})]}),s.active_prompt&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 mb-2`,children:`Active Prompt`}),(0,B.jsx)(`pre`,{className:`text-xs text-gray-600 bg-gray-50 p-3 rounded-lg overflow-x-auto whitespace-pre-wrap`,children:s.active_prompt})]}),!f&&(0,B.jsxs)(`button`,{onClick:()=>a(!0),className:`flex items-center gap-1.5 px-3 py-2 text-sm bg-blue-50 text-blue-600 hover:bg-blue-100 rounded-lg transition-colors`,children:[(0,B.jsx)(ic,{className:`h-4 w-4`}),`编辑 YAML`]})]})]})]})})}function Kue(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(void 0),{data:o}=ct({queryKey:[`projects`],queryFn:()=>Ol().then(e=>e.data)});(0,z.useEffect)(()=>{o?.items?.[0]?.projectPath&&a(o.items[0].projectPath)},[o]);let{data:s,isLoading:c}=ct({queryKey:[`node-types`,i],queryFn:()=>wu(i),enabled:!!i}),{data:l,isLoading:u}=ct({queryKey:[`node-type`,e],queryFn:()=>Tu(e),enabled:!!e}),d=s?.data.items||[],f=l?.data,p=e=>({analysis:`bg-blue-100 text-blue-700`,design:`bg-purple-100 text-purple-700`,implementation:`bg-green-100 text-green-700`,validation:`bg-orange-100 text-orange-700`})[e]||`bg-gray-100 text-gray-700`;return(0,B.jsxs)(`div`,{className:`p-6 max-w-7xl mx-auto`,children:[(0,B.jsxs)(`div`,{className:`mb-6`,children:[(0,B.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900`,children:`流水线节点类型管理`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mt-1`,children:`浏览所有可用的节点类型,点击查看详细配置`})]}),c?(0,B.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,B.jsx)(hc,{className:`h-6 w-6 animate-spin text-gray-400`})}):(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,B.jsx)(`div`,{className:`space-y-3`,children:d.map(n=>(0,B.jsxs)(`div`,{onClick:()=>{t(n.id),r(!1)},className:`p-4 border rounded-lg cursor-pointer transition-all ${e===n.id?`border-blue-500 bg-blue-50 shadow-sm`:`border-gray-200 hover:border-gray-300 hover:shadow-sm`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Ms,{className:`h-5 w-5 text-gray-600`}),(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900`,children:n.name})]}),(0,B.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded-full ${p(n.semanticCategory)}`,children:n.semanticCategory})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mt-2`,children:n.description}),(0,B.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 text-xs text-gray-500`,children:[n.isBuiltin&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Us,{className:`h-3 w-3`}),`内置`]}),n.defaultSkills.length>0&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Kc,{className:`h-3 w-3`}),n.defaultSkills.length,` 个默认技能`]})]})]},n.id))}),(0,B.jsx)(`div`,{className:`lg:sticky lg:top-6 lg:self-start`,children:e?u?(0,B.jsx)(`div`,{className:`border border-gray-200 rounded-lg p-8 flex items-center justify-center`,children:(0,B.jsx)(hc,{className:`h-6 w-6 animate-spin text-gray-400`})}):f?(0,B.jsxs)(`div`,{className:`border border-gray-200 rounded-lg p-6 space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-bold text-gray-900`,children:f.name}),(0,B.jsx)(`span`,{className:`px-2 py-1 text-xs rounded-full ${p(f.semanticCategory)}`,children:f.semanticCategory})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600`,children:f.description}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mt-2 text-xs text-gray-500`,children:[(0,B.jsx)(`code`,{className:`bg-gray-100 px-2 py-0.5 rounded`,children:f.id}),f.isBuiltin&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-green-600`,children:[(0,B.jsx)(Us,{className:`h-3 w-3`}),`内置节点`]})]})]}),f.defaultSkills.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-2 flex items-center gap-1`,children:[(0,B.jsx)(Kc,{className:`h-4 w-4`}),`默认技能`]}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:f.defaultSkills.map(e=>(0,B.jsx)(`span`,{className:`px-2 py-1 bg-blue-50 text-blue-700 text-xs rounded`,children:e},e))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-2 flex items-center gap-1`,children:[(0,B.jsx)(Us,{className:`h-4 w-4`}),`完成条件`]}),(0,B.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[f.completion.explicitSignal&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`显式信号:`}),(0,B.jsx)(`code`,{className:`ml-2 bg-gray-100 px-2 py-0.5 rounded text-xs`,children:f.completion.explicitSignal})]}),f.completion.requireWrite!==void 0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`需要写入操作:`}),(0,B.jsx)(`span`,{className:`ml-2 text-gray-900`,children:f.completion.requireWrite?`是`:`否`})]}),f.completion.keywords.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`关键词:`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:f.completion.keywords.map((e,t)=>(0,B.jsx)(`code`,{className:`bg-gray-100 px-2 py-0.5 rounded text-xs`,children:e},t))})]}),f.completion.filePatterns.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`文件模式:`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:f.completion.filePatterns.map((e,t)=>(0,B.jsx)(`code`,{className:`bg-gray-100 px-2 py-0.5 rounded text-xs`,children:e},t))})]})]})]}),(f.activityThreshold.minToolCalls!==void 0||f.activityThreshold.stagnationStrategy)&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-700 mb-2 flex items-center gap-1`,children:[(0,B.jsx)(ic,{className:`h-4 w-4`}),`活跃度阈值`]}),(0,B.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[f.activityThreshold.minToolCalls!==void 0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`最小工具调用次数:`}),(0,B.jsx)(`span`,{className:`ml-2 text-gray-900`,children:f.activityThreshold.minToolCalls})]}),f.activityThreshold.stagnationStrategy&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-600`,children:`停滞策略:`}),(0,B.jsx)(`code`,{className:`ml-2 bg-gray-100 px-2 py-0.5 rounded text-xs`,children:f.activityThreshold.stagnationStrategy})]})]})]}),f.heuristic&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>r(!n),className:`flex items-center gap-2 text-sm font-semibold text-gray-700 hover:text-gray-900`,children:[n?(0,B.jsx)(Vs,{className:`h-4 w-4`}):(0,B.jsx)(Rs,{className:`h-4 w-4`}),`原始配置(JSON)`]}),n&&(0,B.jsx)(`pre`,{className:`mt-2 p-3 bg-gray-50 rounded text-xs overflow-auto max-h-64`,children:JSON.stringify(f.heuristic,null,2)})]})]}):null:(0,B.jsxs)(`div`,{className:`border border-gray-200 rounded-lg p-8 text-center text-gray-500`,children:[(0,B.jsx)(Ms,{className:`h-12 w-12 mx-auto mb-3 text-gray-300`}),(0,B.jsx)(`p`,{children:`选择左侧节点类型查看详细信息`})]})})]})]})}function que(){return(0,B.jsx)(vte,{children:(0,B.jsxs)(Qc,{children:[(0,B.jsx)(Nx,{}),(0,B.jsx)(rf,{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)(A4,{})}),(0,B.jsx)(sr,{path:`/sessions`,element:(0,B.jsx)(P4,{})}),(0,B.jsx)(sr,{path:`/sessions/:id`,element:(0,B.jsx)(I4,{})}),(0,B.jsx)(sr,{path:`/events`,element:(0,B.jsx)(a3,{})}),(0,B.jsx)(sr,{path:`/pipelines`,element:(0,B.jsx)(o3,{})}),(0,B.jsx)(sr,{path:`/pipelines/:id`,element:(0,B.jsx)(_3,{})}),(0,B.jsx)(sr,{path:`/projects`,element:(0,B.jsx)(Aue,{})}),(0,B.jsx)(sr,{path:`/projects/:encodedPath`,element:(0,B.jsx)(Fue,{})}),(0,B.jsx)(sr,{path:`/quality`,element:(0,B.jsx)(S3,{})}),(0,B.jsx)(sr,{path:`/analytics`,element:(0,B.jsx)(O3,{})}),(0,B.jsx)(sr,{path:`/knowledge`,element:(0,B.jsx)(kue,{})}),(0,B.jsx)(sr,{path:`/skills`,element:(0,B.jsx)(Lue,{})}),(0,B.jsx)(sr,{path:`/conventions`,element:(0,B.jsx)(Hue,{})}),(0,B.jsx)(sr,{path:`/node-types`,element:(0,B.jsx)(Kue,{})}),(0,B.jsx)(sr,{path:`/config`,element:(0,B.jsx)(w3,{})})]})})]})})}var Jue=new Ue({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});qc.createRoot(document.getElementById(`root`)).render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Je,{client:Jue,children:(0,B.jsx)(Xr,{children:(0,B.jsx)(que,{})})})}));
|