@alook/app 0.0.73 → 0.0.75
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/bundled/email-worker/index.js +12 -6
- package/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
- package/bundled/web/.open-next/assets/BUILD_ID +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{060hy1yx9.8u4.js → 0eab27fokr42h.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{0hxwcjbgkr~0_.js → 0q68ch~b~z8vz.js} +1 -1
- package/bundled/web/.open-next/cache/{hO1_nTdFBzjO6p-ajc4L9 → UGFwPwgKnzZSC1Cx-oKdE}/_global-error.cache +1 -1
- package/bundled/web/.open-next/cache/{hO1_nTdFBzjO6p-ajc4L9 → UGFwPwgKnzZSC1Cx-oKdE}/_not-found.cache +1 -1
- package/bundled/web/.open-next/cache/{hO1_nTdFBzjO6p-ajc4L9 → UGFwPwgKnzZSC1Cx-oKdE}/sitemap.xml.cache +1 -1
- package/bundled/web/.open-next/cloudflare/cache-assets-manifest.sql +1 -1
- package/bundled/web/.open-next/cloudflare/init.js +1 -1
- package/bundled/web/.open-next/dynamodb-provider/dynamodb-cache.json +1 -1
- package/bundled/web/.open-next/middleware/handler.mjs +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/BUILD_ID +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/prerender-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/invite/[token]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/studio/new/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/activity/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/[convId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/email/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/files/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/meetings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/new/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/help/email-setup/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/threads/[traceId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/threads/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/workspaces/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(auth)/sign-in/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/agent-links/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/agents/[id]/whitelist/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/calendar/[id]/route.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/calendar/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/channels/[id]/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/channels/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/conversations/[id]/buffered-messages/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/email/notify/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/email/send/route.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/issues/[id]/route.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/issues/route.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/machine-tokens/activate/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/studios/route.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/workspaces/[id]/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0..x3e2._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0.1j36e._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0.1vmoe._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__009_wu3._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__00_g5g4._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__01crkpf._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__01~--ue._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__027mioa._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__02_0idg._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__02rso~7._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__02tc9uk._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__02wurdb._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__034wlco._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__04ds4z_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__04icw5-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__06j-6ja._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__06tjmxh._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__06y_c-r._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__06~zt4i._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__09cer93._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__09ud9_1._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0ars103._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0b9cycy._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0dkg608._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0dy~25_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0e7o6zp._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0faxj6t._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0flvgaf._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0grx101._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0gzp~d6._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0h1bbqr._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0hx4le1._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0j6wy8r._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0jvwtv1._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0k4l9.h._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0kc1f.6._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0ko5xa_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0kruv9u._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0lc586o._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0lp-qwk._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0m5a1_f._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0m_ya4f._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0n6p6k4._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0niqi98._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0ntc1ld._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0om99x0._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0oofrc0._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0p769.0._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0p8t~on._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0pyyhr-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0qmcw57._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0r73dmn._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0s0l_.j._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0s9v7kt._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0sho.f4._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0ud56v.._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0v.x5_r._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0vc50cl._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0vvh~.2._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0w._3fo._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0wjwi1-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0wp61q0._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0y4q15f._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0y_pjkm._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0~afpm2._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__10b3oxj._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__13imtgy._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0--kvw_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0266t8u._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_07-798_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_08z6pkf._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_09ivzvb._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_09j_99x._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0csh82a._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0exm5_w._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0k3wl-3._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0r0h9so._.js +4 -4
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0w6dw.t._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__04mf.th._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__0e65njz._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_063q-hj._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0ilz5db._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_12e18r-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_0liq_10._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_home_page_tsx_0lkx78f._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +40 -40
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +181 -181
- package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +3 -3
- package/bundled/web/migrations/0031_query_performance_indexes.sql +21 -0
- package/bundled/ws-do/index.js +12 -6
- package/dist/cli/index.js +4 -1
- package/dist/cli/session-runner.js +4 -1
- package/dist/index.js +4 -1
- package/package.json +1 -1
- /package/bundled/web/.open-next/assets/_next/static/{hO1_nTdFBzjO6p-ajc4L9 → UGFwPwgKnzZSC1Cx-oKdE}/_buildManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{hO1_nTdFBzjO6p-ajc4L9 → UGFwPwgKnzZSC1Cx-oKdE}/_clientMiddlewareManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{hO1_nTdFBzjO6p-ajc4L9 → UGFwPwgKnzZSC1Cx-oKdE}/_ssgManifest.js +0 -0
- /package/bundled/web/.open-next/cache/{hO1_nTdFBzjO6p-ajc4L9 → UGFwPwgKnzZSC1Cx-oKdE}/robots.txt.cache +0 -0
package/bundled/web/.open-next/assets/_next/static/chunks/{060hy1yx9.8u4.js → 0eab27fokr42h.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,614191,e=>{"use strict";var t,n,r,o,i,a,s,l,u,d,c,h,f,g,p,m,y,v=e.i(368075),x=e.i(298699),b=e.i(208020);function w(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)""!==(r=w(e[n]))&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}e.i(459119);var _={value:()=>{}};function E(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r||/[\s.]/.test(e))throw Error("illegal type: "+e);r[e]=[]}return new k(r)}function k(e){this._=e}function S(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=_,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}function N(){}function M(e){return null==e?N:function(){return this.querySelector(e)}}function C(){return[]}function j(e){return null==e?C:function(){return this.querySelectorAll(e)}}function A(e){return function(){return this.matches(e)}}function O(e){return function(t){return t.matches(e)}}k.prototype=E.prototype={constructor:k,on:function(e,t){var n,r=this._,o=(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:t}}),i=-1,a=o.length;if(arguments.length<2){for(;++i<a;)if((n=(e=o[i]).type)&&(n=function(e,t){for(var n,r=0,o=e.length;r<o;++r)if((n=e[r]).name===t)return n.value}(r[n],e.name)))return n;return}if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++i<a;)if(n=(e=o[i]).type)r[n]=S(r[n],e.name,t);else if(null==t)for(n in r)r[n]=S(r[n],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new k(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,r,o=Array(n),i=0;i<n;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(r=this._[e],i=0,n=r.length;i<n;++i)r[i].value.apply(t,o)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};var z=Array.prototype.find;function P(){return this.firstElementChild}var $=Array.prototype.filter;function I(){return Array.from(this.children)}function R(e){return Array(e.length)}function L(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function D(e,t,n,r,o,i){for(var a,s=0,l=t.length,u=i.length;s<u;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new L(e,i[s]);for(;s<l;++s)(a=t[s])&&(o[s]=a)}function T(e,t,n,r,o,i,a){var s,l,u,d=new Map,c=t.length,h=i.length,f=Array(c);for(s=0;s<c;++s)(l=t[s])&&(f[s]=u=a.call(l,l.__data__,s,t)+"",d.has(u)?o[s]=l:d.set(u,l));for(s=0;s<h;++s)u=a.call(e,i[s],s,i)+"",(l=d.get(u))?(r[s]=l,l.__data__=i[s],d.delete(u)):n[s]=new L(e,i[s]);for(s=0;s<c;++s)(l=t[s])&&d.get(f[s])===l&&(o[s]=l)}function B(e){return e.__data__}function H(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}L.prototype={constructor:L,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)}};var V="http://www.w3.org/1999/xhtml";let F={svg:"http://www.w3.org/2000/svg",xhtml:V,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function X(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),F.hasOwnProperty(t)?{space:F[t],local:e}:e}function Y(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function K(e,t){return e.style.getPropertyValue(t)||Y(e).getComputedStyle(e,null).getPropertyValue(t)}function Z(e){return e.trim().split(/^|\s+/)}function q(e){return e.classList||new W(e)}function W(e){this._node=e,this._names=Z(e.getAttribute("class")||"")}function U(e,t){for(var n=q(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function G(e,t){for(var n=q(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Q(){this.textContent=""}function J(){this.innerHTML=""}function ee(){this.nextSibling&&this.parentNode.appendChild(this)}function et(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function en(e){var t=X(e);return(t.local?function(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}:function(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===V&&t.documentElement.namespaceURI===V?t.createElement(e):t.createElementNS(n,e)}})(t)}function er(){return null}function eo(){var e=this.parentNode;e&&e.removeChild(this)}function ei(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ea(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function es(e){return function(){var t=this.__on;if(t){for(var n,r=0,o=-1,i=t.length;r<i;++r)(n=t[r],e.type&&n.type!==e.type||n.name!==e.name)?t[++o]=n:this.removeEventListener(n.type,n.listener,n.options);++o?t.length=o:delete this.__on}}}function el(e,t,n){return function(){var r,o=this.__on,i=function(e){t.call(this,e,this.__data__)};if(o){for(var a=0,s=o.length;a<s;++a)if((r=o[a]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function eu(e,t,n){var r=Y(e),o=r.CustomEvent;"function"==typeof o?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}W.prototype={add:function(e){0>this._names.indexOf(e)&&(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}};var ed=[null];function ec(e,t){this._groups=e,this._parents=t}function eh(){return new ec([[document.documentElement]],ed)}function ef(e){return"string"==typeof e?new ec([[document.querySelector(e)]],[document.documentElement]):new ec([[e]],ed)}function eg(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(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())).x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}ec.prototype=eh.prototype={constructor:ec,select:function(e){"function"!=typeof e&&(e=M(e));for(var t=this._groups,n=t.length,r=Array(n),o=0;o<n;++o)for(var i,a,s=t[o],l=s.length,u=r[o]=Array(l),d=0;d<l;++d)(i=s[d])&&(a=e.call(i,i.__data__,d,s))&&("__data__"in i&&(a.__data__=i.__data__),u[d]=a);return new ec(r,this._parents)},selectAll:function(e){if("function"==typeof e){var t;t=e,e=function(){var e;return e=t.apply(this,arguments),null==e?[]:Array.isArray(e)?e:Array.from(e)}}else e=j(e);for(var n=this._groups,r=n.length,o=[],i=[],a=0;a<r;++a)for(var s,l=n[a],u=l.length,d=0;d<u;++d)(s=l[d])&&(o.push(e.call(s,s.__data__,d,l)),i.push(s));return new ec(o,i)},selectChild:function(e){var t;return this.select(null==e?P:(t="function"==typeof e?e:O(e),function(){return z.call(this.children,t)}))},selectChildren:function(e){var t;return this.selectAll(null==e?I:(t="function"==typeof e?e:O(e),function(){return $.call(this.children,t)}))},filter:function(e){"function"!=typeof e&&(e=A(e));for(var t=this._groups,n=t.length,r=Array(n),o=0;o<n;++o)for(var i,a=t[o],s=a.length,l=r[o]=[],u=0;u<s;++u)(i=a[u])&&e.call(i,i.__data__,u,a)&&l.push(i);return new ec(r,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,B);var n=t?T:D,r=this._parents,o=this._groups;"function"!=typeof e&&(v=e,e=function(){return v});for(var i=o.length,a=Array(i),s=Array(i),l=Array(i),u=0;u<i;++u){var d=r[u],c=o[u],h=c.length,f="object"==typeof(y=e.call(d,d&&d.__data__,u,r))&&"length"in y?y:Array.from(y),g=f.length,p=s[u]=Array(g),m=a[u]=Array(g);n(d,c,p,m,l[u]=Array(h),f,t);for(var y,v,x,b,w=0,_=0;w<g;++w)if(x=p[w]){for(w>=_&&(_=w+1);!(b=m[_])&&++_<g;);x._next=b||null}}return(a=new ec(a,r))._enter=s,a._exit=l,a},enter:function(){return new ec(this._enter||this._groups.map(R),this._parents)},exit:function(){return new ec(this._exit||this._groups.map(R),this._parents)},join:function(e,t,n){var r=this.enter(),o=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=t&&(o=t(o))&&(o=o.selection()),null==n?i.remove():n(i),r&&o?r.merge(o).order():o},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,a=Math.min(o,i),s=Array(o),l=0;l<a;++l)for(var u,d=n[l],c=r[l],h=d.length,f=s[l]=Array(h),g=0;g<h;++g)(u=d[g]||c[g])&&(f[g]=u);for(;l<o;++l)s[l]=n[l];return new ec(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,o=e[t],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=H);for(var n=this._groups,r=n.length,o=Array(r),i=0;i<r;++i){for(var a,s=n[i],l=s.length,u=o[i]=Array(l),d=0;d<l;++d)(a=s[d])&&(u[d]=a);u.sort(t)}return new ec(o,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o,i=t[n],a=0,s=i.length;a<s;++a)(o=i[a])&&e.call(o,o.__data__,a,i);return this},attr:function(e,t){var n=X(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?function(e){return function(){this.removeAttributeNS(e.space,e.local)}}:function(e){return function(){this.removeAttribute(e)}}:"function"==typeof t?n.local?function(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}:function(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}:n.local?function(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}:function(e,t){return function(){this.setAttribute(e,t)}})(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?function(e){return function(){this.style.removeProperty(e)}}:"function"==typeof t?function(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}:function(e,t,n){return function(){this.style.setProperty(e,t,n)}})(e,t,null==n?"":n)):K(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?function(e){return function(){delete this[e]}}:"function"==typeof t?function(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}:function(e,t){return function(){this[e]=t}})(e,t)):this.node()[e]},classed:function(e,t){var n=Z(e+"");if(arguments.length<2){for(var r=q(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof t?function(e,t){return function(){(t.apply(this,arguments)?U:G)(this,e)}}:t?function(e){return function(){U(this,e)}}:function(e){return function(){G(this,e)}})(n,t))},text:function(e){return arguments.length?this.each(null==e?Q:("function"==typeof e?function(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}:function(e){return function(){this.textContent=e}})(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?J:("function"==typeof e?function(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}:function(e){return function(){this.innerHTML=e}})(e)):this.node().innerHTML},raise:function(){return this.each(ee)},lower:function(){return this.each(et)},append:function(e){var t="function"==typeof e?e:en(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:en(e),r=null==t?er:"function"==typeof t?t:M(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(eo)},clone:function(e){return this.select(e?ea:ei)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,o,i=(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}}),a=i.length;if(arguments.length<2){var s=this.node().__on;if(s){for(var l,u=0,d=s.length;u<d;++u)for(r=0,l=s[u];r<a;++r)if((o=i[r]).type===l.type&&o.name===l.name)return l.value}return}for(r=0,s=t?el:es;r<a;++r)this.each(s(i[r],t,n));return this},dispatch:function(e,t){return this.each(("function"==typeof t?function(e,t){return function(){return eu(this,e,t.apply(this,arguments))}}:function(e,t){return function(){return eu(this,e,t)}})(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r,o=e[t],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};let ep={passive:!1},em={capture:!0,passive:!1};function ey(e){e.stopImmediatePropagation()}function ev(e){e.preventDefault(),e.stopImmediatePropagation()}function ex(e){var t=e.document.documentElement,n=ef(e).on("dragstart.drag",ev,em);"onselectstart"in t?n.on("selectstart.drag",ev,em):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function eb(e,t){var n=e.document.documentElement,r=ef(e).on("dragstart.drag",null);t&&(r.on("click.drag",ev,em),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}let ew=e=>()=>e;function e_(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:a,y:s,dx:l,dy:u,dispatch:d}){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:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}function eE(e){return!e.ctrlKey&&!e.button}function ek(){return this.parentNode}function eS(e,t){return null==t?{x:e.x,y:e.y}:t}function eN(){return navigator.maxTouchPoints||"ontouchstart"in this}function eM(){var e,t,n,r,o=eE,i=ek,a=eS,s=eN,l={},u=E("start","drag","end"),d=0,c=0;function h(e){e.on("mousedown.drag",f).filter(s).on("touchstart.drag",m).on("touchmove.drag",y,ep).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,s){if(!r&&o.call(this,a,s)){var l=x(this,i.call(this,a,s),a,s,"mouse");l&&(ef(a.view).on("mousemove.drag",g,em).on("mouseup.drag",p,em),ex(a.view),ey(a),n=!1,e=a.clientX,t=a.clientY,l("start",a))}}function g(r){if(ev(r),!n){var o=r.clientX-e,i=r.clientY-t;n=o*o+i*i>c}l.mouse("drag",r)}function p(e){ef(e.view).on("mousemove.drag mouseup.drag",null),eb(e.view,n),ev(e),l.mouse("end",e)}function m(e,t){if(o.call(this,e,t)){var n,r,a=e.changedTouches,s=i.call(this,e,t),l=a.length;for(n=0;n<l;++n)(r=x(this,s,e,t,a[n].identifier,a[n]))&&(ey(e),r("start",e,a[n]))}}function y(e){var t,n,r=e.changedTouches,o=r.length;for(t=0;t<o;++t)(n=l[r[t].identifier])&&(ev(e),n("drag",e,r[t]))}function v(e){var t,n,o=e.changedTouches,i=o.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),t=0;t<i;++t)(n=l[o[t].identifier])&&(ey(e),n("end",e,o[t]))}function x(e,t,n,r,o,i){var s,c,f,g=u.copy(),p=eg(i||n,t);if(null!=(f=a.call(e,new e_("beforestart",{sourceEvent:n,target:h,identifier:o,active:d,x:p[0],y:p[1],dx:0,dy:0,dispatch:g}),r)))return s=f.x-p[0]||0,c=f.y-p[1]||0,function n(i,a,u){var m,y=p;switch(i){case"start":l[o]=n,m=d++;break;case"end":delete l[o],--d;case"drag":p=eg(u||a,t),m=d}g.call(i,e,new e_(i,{sourceEvent:a,subject:f,target:h,identifier:o,active:m,x:p[0]+s,y:p[1]+c,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:g}),r)}}return h.filter=function(e){return arguments.length?(o="function"==typeof e?e:ew(!!e),h):o},h.container=function(e){return arguments.length?(i="function"==typeof e?e:ew(e),h):i},h.subject=function(e){return arguments.length?(a="function"==typeof e?e:ew(e),h):a},h.touchable=function(e){return arguments.length?(s="function"==typeof e?e:ew(!!e),h):s},h.on=function(){var e=u.on.apply(u,arguments);return e===u?h:e},h.clickDistance=function(e){return arguments.length?(c=(e*=1)*e,h):Math.sqrt(c)},h}function eC(e){return((e=Math.exp(e))+1/e)/2}e_.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};let ej=function e(t,n,r){function o(e,o){var i,a,s=e[0],l=e[1],u=e[2],d=o[0],c=o[1],h=o[2],f=d-s,g=c-l,p=f*f+g*g;if(p<1e-12)a=Math.log(h/u)/t,i=function(e){return[s+e*f,l+e*g,u*Math.exp(t*e*a)]};else{var m=Math.sqrt(p),y=(h*h-u*u+r*p)/(2*u*n*m),v=(h*h-u*u-r*p)/(2*h*n*m),x=Math.log(Math.sqrt(y*y+1)-y);a=(Math.log(Math.sqrt(v*v+1)-v)-x)/t,i=function(e){var r,o,i=e*a,d=eC(x),c=u/(n*m)*(d*(((r=Math.exp(2*(r=t*i+x)))-1)/(r+1))-((o=Math.exp(o=x))-1/o)/2);return[s+c*f,l+c*g,u*d/eC(t*i+x)]}}return i.duration=1e3*a*t/Math.SQRT2,i}return o.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},o}(Math.SQRT2,2,4);var eA,eO,ez=0,eP=0,e$=0,eI=0,eR=0,eL=0,eD="object"==typeof performance&&performance.now?performance:Date,eT="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function eB(){return eR||(eT(eH),eR=eD.now()+eL)}function eH(){eR=0}function eV(){this._call=this._time=this._next=null}function eF(e,t,n){var r=new eV;return r.restart(e,t,n),r}function eX(){eR=(eI=eD.now())+eL,ez=eP=0;try{eB(),++ez;for(var e,t=eA;t;)(e=eR-t._time)>=0&&t._call.call(void 0,e),t=t._next;--ez}finally{ez=0,function(){for(var e,t,n=eA,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:eA=t);eO=e,eK(r)}(),eR=0}}function eY(){var e=eD.now(),t=e-eI;t>1e3&&(eL-=t,eI=e)}function eK(e){!ez&&(eP&&(eP=clearTimeout(eP)),e-eR>24?(e<1/0&&(eP=setTimeout(eX,e-eD.now()-eL)),e$&&(e$=clearInterval(e$))):(e$||(eI=eD.now(),e$=setInterval(eY,1e3)),ez=1,eT(eX)))}function eZ(e,t,n){var r=new eV;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}eV.prototype=eF.prototype={constructor:eV,restart:function(e,t,n){if("function"!=typeof e)throw TypeError("callback is not a function");n=(null==n?eB():+n)+(null==t?0:+t),this._next||eO===this||(eO?eO._next=this:eA=this,eO=this),this._call=e,this._time=n,eK()},stop:function(){this._call&&(this._call=null,this._time=1/0,eK())}};var eq=E("start","end","cancel","interrupt"),eW=[];function eU(e,t,n,r,o,i){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var r,o=e.__transition;function i(l){var u,d,c,h;if(1!==n.state)return s();for(u in o)if((h=o[u]).name===n.name){if(3===h.state)return eZ(i);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=6,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(eZ(function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(u=0,n.state=3,r=Array(c=n.tween.length),d=-1;u<c;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function a(t){for(var o=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(s),n.state=5,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),s())}function s(){for(var r in n.state=6,n.timer.stop(),delete o[t],o)return;delete e.__transition}o[t]=n,n.timer=eF(function(e){n.state=1,n.timer.restart(i,n.delay,n.time),n.delay<=e&&i(e-n.delay)},0,n.time)}(e,n,{name:t,index:r,group:o,on:eq,tween:eW,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function eG(e,t){var n=eJ(e,t);if(n.state>0)throw Error("too late; already scheduled");return n}function eQ(e,t){var n=eJ(e,t);if(n.state>3)throw Error("too late; already running");return n}function eJ(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error("transition not found");return n}function e0(e,t){var n,r,o,i=e.__transition,a=!0;if(i){for(o in t=null==t?null:t+"",i){if((n=i[o]).name!==t){a=!1;continue}r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[o]}a&&delete e.__transition}}function e1(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}var e2=180/Math.PI,e5={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function e3(e,t,n,r,o,i){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),e*r<t*n&&(e=-e,t=-t,l=-l,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*e2,skewX:Math.atan(l)*e2,scaleX:a,scaleY:s}}function e4(e,t,n,r){function o(e){return e.length?e.pop()+" ":""}return function(i,a){var s,l,u,d,c=[],h=[];return i=e(i),a=e(a),!function(e,r,o,i,a,s){if(e!==o||r!==i){var l=a.push("translate(",null,t,null,n);s.push({i:l-4,x:e1(e,o)},{i:l-2,x:e1(r,i)})}else(o||i)&&a.push("translate("+o+t+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,c,h),s=i.rotate,l=a.rotate,s!==l?(s-l>180?l+=360:l-s>180&&(s+=360),h.push({i:c.push(o(c)+"rotate(",null,r)-2,x:e1(s,l)})):l&&c.push(o(c)+"rotate("+l+r),u=i.skewX,d=a.skewX,u!==d?h.push({i:c.push(o(c)+"skewX(",null,r)-2,x:e1(u,d)}):d&&c.push(o(c)+"skewX("+d+r),!function(e,t,n,r,i,a){if(e!==n||t!==r){var s=i.push(o(i)+"scale(",null,",",null,")");a.push({i:s-4,x:e1(e,n)},{i:s-2,x:e1(t,r)})}else(1!==n||1!==r)&&i.push(o(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,c,h),i=a=null,function(e){for(var t,n=-1,r=h.length;++n<r;)c[(t=h[n]).i]=t.x(e);return c.join("")}}}var e6=e4(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?e5:e3(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),e8=e4(function(e){return null==e?e5:(u||(u=document.createElementNS("http://www.w3.org/2000/svg","g")),u.setAttribute("transform",e),e=u.transform.baseVal.consolidate())?e3((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):e5},", ",")",")");function e9(e,t,n){var r=e._id;return e.each(function(){var e=eQ(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return eJ(e,r).value[t]}}function e7(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function te(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function tt(){}var tn="\\s*([+-]?\\d+)\\s*",tr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",to="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ti=/^#([0-9a-f]{3,8})$/,ta=RegExp(`^rgb\\(${tn},${tn},${tn}\\)$`),ts=RegExp(`^rgb\\(${to},${to},${to}\\)$`),tl=RegExp(`^rgba\\(${tn},${tn},${tn},${tr}\\)$`),tu=RegExp(`^rgba\\(${to},${to},${to},${tr}\\)$`),td=RegExp(`^hsl\\(${tr},${to},${to}\\)$`),tc=RegExp(`^hsla\\(${tr},${to},${to},${tr}\\)$`),th={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function tf(){return this.rgb().formatHex()}function tg(){return this.rgb().formatRgb()}function tp(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ti.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?tm(t):3===n?new tx(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ty(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ty(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=ta.exec(e))?new tx(t[1],t[2],t[3],1):(t=ts.exec(e))?new tx(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=tl.exec(e))?ty(t[1],t[2],t[3],t[4]):(t=tu.exec(e))?ty(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=td.exec(e))?tS(t[1],t[2]/100,t[3]/100,1):(t=tc.exec(e))?tS(t[1],t[2]/100,t[3]/100,t[4]):th.hasOwnProperty(e)?tm(th[e]):"transparent"===e?new tx(NaN,NaN,NaN,0):null}function tm(e){return new tx(e>>16&255,e>>8&255,255&e,1)}function ty(e,t,n,r){return r<=0&&(e=t=n=NaN),new tx(e,t,n,r)}function tv(e,t,n,r){var o;return 1==arguments.length?((o=e)instanceof tt||(o=tp(o)),o)?new tx((o=o.rgb()).r,o.g,o.b,o.opacity):new tx:new tx(e,t,n,null==r?1:r)}function tx(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function tb(){return`#${tk(this.r)}${tk(this.g)}${tk(this.b)}`}function tw(){let e=t_(this.opacity);return`${1===e?"rgb(":"rgba("}${tE(this.r)}, ${tE(this.g)}, ${tE(this.b)}${1===e?")":`, ${e})`}`}function t_(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function tE(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tk(e){return((e=tE(e))<16?"0":"")+e.toString(16)}function tS(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new tM(e,t,n,r)}function tN(e){if(e instanceof tM)return new tM(e.h,e.s,e.l,e.opacity);if(e instanceof tt||(e=tp(e)),!e)return new tM;if(e instanceof tM)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,s=i-o,l=(i+o)/2;return s?(a=t===i?(n-r)/s+(n<r)*6:n===i?(r-t)/s+2:(t-n)/s+4,s/=l<.5?i+o:2-i-o,a*=60):s=l>0&&l<1?0:a,new tM(a,s,l,e.opacity)}function tM(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function tC(e){return(e=(e||0)%360)<0?e+360:e}function tj(e){return Math.max(0,Math.min(1,e||0))}function tA(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}function tO(e,t,n,r,o){var i=e*e,a=i*e;return((1-3*e+3*i-a)*t+(4-6*i+3*a)*n+(1+3*e+3*i-3*a)*r+a*o)/6}e7(tt,tp,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tf,formatHex:tf,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return tN(this).formatHsl()},formatRgb:tg,toString:tg}),e7(tx,tv,te(tt,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new tx(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new tx(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new tx(tE(this.r),tE(this.g),tE(this.b),t_(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tb,formatHex:tb,formatHex8:function(){return`#${tk(this.r)}${tk(this.g)}${tk(this.b)}${tk((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:tw,toString:tw})),e7(tM,function(e,t,n,r){return 1==arguments.length?tN(e):new tM(e,t,n,null==r?1:r)},te(tt,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new tM(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new tM(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new tx(tA(e>=240?e-240:e+120,o,r),tA(e,o,r),tA(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new tM(tC(this.h),tj(this.s),tj(this.l),t_(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=t_(this.opacity);return`${1===e?"hsl(":"hsla("}${tC(this.h)}, ${100*tj(this.s)}%, ${100*tj(this.l)}%${1===e?")":`, ${e})`}`}}));let tz=e=>()=>e;function tP(e,t){var n=t-e;return n?function(t){return e+t*n}:tz(isNaN(e)?t:e)}let t$=function e(t){var n,r=1==(n=+t)?tP:function(e,t){var r,o,i;return t-e?(r=e,o=t,r=Math.pow(r,i=n),o=Math.pow(o,i)-r,i=1/i,function(e){return Math.pow(r+e*o,i)}):tz(isNaN(e)?t:e)};function o(e,t){var n=r((e=tv(e)).r,(t=tv(t)).r),o=r(e.g,t.g),i=r(e.b,t.b),a=tP(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=o(t),e.b=i(t),e.opacity=a(t),e+""}}return o.gamma=e,o}(1);function tI(e){return function(t){var n,r,o=t.length,i=Array(o),a=Array(o),s=Array(o);for(n=0;n<o;++n)r=tv(t[n]),i[n]=r.r||0,a[n]=r.g||0,s[n]=r.b||0;return i=e(i),a=e(a),s=e(s),r.opacity=1,function(e){return r.r=i(e),r.g=a(e),r.b=s(e),r+""}}}tI(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),o=e[r],i=e[r+1],a=r>0?e[r-1]:2*o-i,s=r<t-1?e[r+2]:2*i-o;return tO((n-r/t)*t,a,o,i,s)}}),tI(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),o=e[(r+t-1)%t],i=e[r%t],a=e[(r+1)%t],s=e[(r+2)%t];return tO((n-r/t)*t,o,i,a,s)}});var tR=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tL=RegExp(tR.source,"g");function tD(e,t){var n,r,o,i,a,s=tR.lastIndex=tL.lastIndex=0,l=-1,u=[],d=[];for(e+="",t+="";(o=tR.exec(e))&&(i=tL.exec(t));)(a=i.index)>s&&(a=t.slice(s,a),u[l]?u[l]+=a:u[++l]=a),(o=o[0])===(i=i[0])?u[l]?u[l]+=i:u[++l]=i:(u[++l]=null,d.push({i:l,x:e1(o,i)})),s=tL.lastIndex;return s<t.length&&(a=t.slice(s),u[l]?u[l]+=a:u[++l]=a),u.length<2?d[0]?(n=d[0].x,function(e){return n(e)+""}):(r=t,function(){return r}):(t=d.length,function(e){for(var n,r=0;r<t;++r)u[(n=d[r]).i]=n.x(e);return u.join("")})}function tT(e,t){var n;return("number"==typeof t?e1:t instanceof tp?t$:(n=tp(t))?(t=n,t$):tD)(e,t)}var tB=eh.prototype.constructor;function tH(e){return function(){this.style.removeProperty(e)}}var tV=0;function tF(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}var tX=eh.prototype;tF.prototype=(function(e){return eh().transition(e)}).prototype={constructor:tF,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=M(e));for(var r=this._groups,o=r.length,i=Array(o),a=0;a<o;++a)for(var s,l,u=r[a],d=u.length,c=i[a]=Array(d),h=0;h<d;++h)(s=u[h])&&(l=e.call(s,s.__data__,h,u))&&("__data__"in s&&(l.__data__=s.__data__),c[h]=l,eU(c[h],t,n,h,c,eJ(s,n)));return new tF(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=j(e));for(var r=this._groups,o=r.length,i=[],a=[],s=0;s<o;++s)for(var l,u=r[s],d=u.length,c=0;c<d;++c)if(l=u[c]){for(var h,f=e.call(l,l.__data__,c,u),g=eJ(l,n),p=0,m=f.length;p<m;++p)(h=f[p])&&eU(h,t,n,p,f,g);i.push(f),a.push(l)}return new tF(i,a,t,n)},selectChild:tX.selectChild,selectChildren:tX.selectChildren,filter:function(e){"function"!=typeof e&&(e=A(e));for(var t=this._groups,n=t.length,r=Array(n),o=0;o<n;++o)for(var i,a=t[o],s=a.length,l=r[o]=[],u=0;u<s;++u)(i=a[u])&&e.call(i,i.__data__,u,a)&&l.push(i);return new tF(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),a=Array(r),s=0;s<i;++s)for(var l,u=t[s],d=n[s],c=u.length,h=a[s]=Array(c),f=0;f<c;++f)(l=u[f]||d[f])&&(h[f]=l);for(;s<r;++s)a[s]=t[s];return new tF(a,this._parents,this._name,this._id)},selection:function(){return new tB(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=++tV,r=this._groups,o=r.length,i=0;i<o;++i)for(var a,s=r[i],l=s.length,u=0;u<l;++u)if(a=s[u]){var d=eJ(a,t);eU(a,e,n,u,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new tF(r,this._parents,e,n)},call:tX.call,nodes:tX.nodes,node:tX.node,size:tX.size,empty:tX.empty,each:tX.each,on:function(e,t){var n,r,o,i,a,s,l=this._id;return arguments.length<2?eJ(this.node(),l).on.on(e):this.each((n=l,r=e,o=t,s=(r+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})?eG:eQ,function(){var e=s(this,n),t=e.on;t!==i&&(a=(i=t).copy()).on(r,o),e.on=a}))},attr:function(e,t){var n=X(e),r="transform"===n?e8:tT;return this.attrTween(e,"function"==typeof t?(n.local?function(e,t,n){var r,o,i;return function(){var a,s,l=n(this);return null==l?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:a===r&&s===o?i:(o=s,i=t(r=a,l))}}:function(e,t,n){var r,o,i;return function(){var a,s,l=n(this);return null==l?void this.removeAttribute(e):(a=this.getAttribute(e))===(s=l+"")?null:a===r&&s===o?i:(o=s,i=t(r=a,l))}})(n,r,e9(this,"attr."+e,t)):null==t?(n.local?function(e){return function(){this.removeAttributeNS(e.space,e.local)}}:function(e){return function(){this.removeAttribute(e)}})(n):(n.local?function(e,t,n){var r,o,i=n+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=t(r=a,n)}}:function(e,t,n){var r,o,i=n+"";return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=t(r=a,n)}})(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();var r=X(e);return this.tween(n,(r.local?function(e,t){var n,r;function o(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t){this.setAttributeNS(e.space,e.local,o.call(this,t))}),n}return o._value=t,o}:function(e,t){var n,r;function o(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t){this.setAttribute(e,o.call(this,t))}),n}return o._value=t,o})(r,t))},style:function(e,t,n){var r,o,i,a,s,l,u,d,c,h,f,g,p,m,y,v,x,b,w,_,E,k="transform"==(e+="")?e6:tT;return null==t?this.styleTween(e,(r=e,function(){var e=K(this,r),t=(this.style.removeProperty(r),K(this,r));return e===t?null:e===o&&t===i?a:a=k(o=e,i=t)})).on("end.style."+e,tH(e)):"function"==typeof t?this.styleTween(e,(s=e,l=e9(this,"style."+e,t),function(){var e=K(this,s),t=l(this),n=t+"";return null==t&&(this.style.removeProperty(s),n=t=K(this,s)),e===n?null:e===u&&n===d?c:(d=n,c=k(u=e,t))})).each((h=this._id,x="end."+(v="style."+(f=e)),function(){var e=eQ(this,h),t=e.on,n=null==e.value[v]?y||(y=tH(f)):void 0;(t!==g||m!==n)&&(p=(g=t).copy()).on(x,m=n),e.on=p})):this.styleTween(e,(b=e,E=t+"",function(){var e=K(this,b);return e===E?null:e===w?_:_=k(w=e,t)}),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();return this.tween(r,function(e,t,n){var r,o;function i(){var i=t.apply(this,arguments);return i!==o&&(r=(o=i)&&function(t){this.style.setProperty(e,i.call(this,t),n)}),r}return i._value=t,i}(e,t,null==n?"":n))},text:function(e){var t,n;return this.tween("text","function"==typeof e?(t=e9(this,"text",e),function(){var e=t(this);this.textContent=null==e?"":e}):(n=null==e?"":e+"",function(){this.textContent=n}))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){this.textContent=r.call(this,e)}),t}return r._value=e,r}(e))},remove:function(){var e;return this.on("end.remove",(e=this._id,function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,o=eJ(this.node(),n).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===e)return r.value;return null}return this.each((null==t?function(e,t){var n,r;return function(){var o=eQ(this,e),i=o.tween;if(i!==n){r=n=i;for(var a=0,s=r.length;a<s;++a)if(r[a].name===t){(r=r.slice()).splice(a,1);break}}o.tween=r}}:function(e,t,n){var r,o;if("function"!=typeof n)throw Error();return function(){var i=eQ(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var s={name:t,value:n},l=0,u=o.length;l<u;++l)if(o[l].name===t){o[l]=s;break}l===u&&o.push(s)}i.tween=o}})(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?function(e,t){return function(){eG(this,e).delay=+t.apply(this,arguments)}}:function(e,t){return t*=1,function(){eG(this,e).delay=t}})(t,e)):eJ(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?function(e,t){return function(){eQ(this,e).duration=+t.apply(this,arguments)}}:function(e,t){return t*=1,function(){eQ(this,e).duration=t}})(t,e)):eJ(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){eQ(this,e).ease=t}}(t,e)):eJ(this.node(),t).ease},easeVarying:function(e){var t;if("function"!=typeof e)throw Error();return this.each((t=this._id,function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw Error();eQ(this,t).ease=n}))},end:function(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,a){var s={value:a},l={value:function(){0==--o&&i()}};n.each(function(){var n=eQ(this,r),o=n.on;o!==e&&((t=(e=o).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===o&&i()})},[Symbol.iterator]:tX[Symbol.iterator]};var tY={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};eh.prototype.interrupt=function(e){return this.each(function(){e0(this,e)})},eh.prototype.transition=function(e){var t,n;e instanceof tF?(t=e._id,e=e._name):(t=++tV,(n=tY).time=eB(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,s=r[i],l=s.length,u=0;u<l;++u)(a=s[u])&&eU(a,e,t,u,s,n||function(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}(a,t));return new tF(r,this._parents,e,t)};let tK=e=>()=>e;function tZ(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:o}})}function tq(e,t,n){this.k=e,this.x=t,this.y=n}tq.prototype={constructor:tq,scale:function(e){return 1===e?this:new tq(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new tq(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 tW=new tq(1,0,0);function tU(e){for(;!e.__zoom;)if(!(e=e.parentNode))return tW;return e.__zoom}function tG(e){e.stopImmediatePropagation()}function tQ(e){e.preventDefault(),e.stopImmediatePropagation()}function tJ(e){return(!e.ctrlKey||"wheel"===e.type)&&!e.button}function t0(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).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 t1(){return this.__zoom||tW}function t2(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function t5(){return navigator.maxTouchPoints||"ontouchstart"in this}function t3(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function t4(){var e,t,n,r=tJ,o=t0,i=t3,a=t2,s=t5,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,c=ej,h=E("start","zoom","end"),f=0,g=10;function p(e){e.property("__zoom",t1).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",S).filter(s).on("touchstart.zoom",N).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new tq(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,o=t[1]-n[1]*e.k;return r===e.x&&o===e.y?e:new tq(e.k,r,o)}function v(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,t,n,r){e.on("start.zoom",function(){b(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(r).end()}).tween("zoom",function(){var e=arguments,i=b(this,e).event(r),a=o.apply(this,e),s=null==n?v(a):"function"==typeof n?n.apply(this,e):n,l=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),u=this.__zoom,d="function"==typeof t?t.apply(this,e):t,h=c(u.invert(s).concat(l/u.k),d.invert(s).concat(l/d.k));return function(e){if(1===e)e=d;else{var t=h(e),n=l/t[2];e=new tq(n,s[0]-t[0]*n,s[1]-t[1]*n)}i.zoom(null,e)}})}function b(e,t,n){return!n&&e.__zooming||new w(e,t)}function w(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,t),this.taps=0}function _(e,...t){if(r.apply(this,arguments)){var n=b(this,t).event(e),o=this.__zoom,s=Math.max(l[0],Math.min(l[1],o.k*Math.pow(2,a.apply(this,arguments)))),d=eg(e);if(n.wheel)(n.mouse[0][0]!==d[0]||n.mouse[0][1]!==d[1])&&(n.mouse[1]=o.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(o.k===s)return;n.mouse=[d,o.invert(d)],e0(this),n.start()}tQ(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(y(m(o,s),n.mouse[0],n.mouse[1]),n.extent,u))}}function k(e,...t){if(!n&&r.apply(this,arguments)){var o=e.currentTarget,a=b(this,t,!0).event(e),s=ef(e.view).on("mousemove.zoom",function(e){if(tQ(e),!a.moved){var t=e.clientX-d,n=e.clientY-c;a.moved=t*t+n*n>f}a.event(e).zoom("mouse",i(y(a.that.__zoom,a.mouse[0]=eg(e,o),a.mouse[1]),a.extent,u))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),eb(e.view,a.moved),tQ(e),a.event(e).end()},!0),l=eg(e,o),d=e.clientX,c=e.clientY;ex(e.view),tG(e),a.mouse=[l,this.__zoom.invert(l)],e0(this),a.start()}}function S(e,...t){if(r.apply(this,arguments)){var n=this.__zoom,a=eg(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(a),l=n.k*(e.shiftKey?.5:2),c=i(y(m(n,l),a,s),o.apply(this,t),u);tQ(e),d>0?ef(this).transition().duration(d).call(x,c,a,e):ef(this).call(p.transform,c,a,e)}}function N(n,...o){if(r.apply(this,arguments)){var i,a,s,l,u=n.touches,d=u.length,c=b(this,o,n.changedTouches.length===d).event(n);for(tG(n),a=0;a<d;++a)l=[l=eg(s=u[a],this),this.__zoom.invert(l),s.identifier],c.touch0?c.touch1||c.touch0[2]===l[2]||(c.touch1=l,c.taps=0):(c.touch0=l,i=!0,c.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(c.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),e0(this),c.start())}}function M(e,...t){if(this.__zooming){var n,r,o,a,s=b(this,t).event(e),l=e.changedTouches,d=l.length;for(tQ(e),n=0;n<d;++n)o=eg(r=l[n],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=o:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=o);if(r=s.that.__zoom,s.touch1){var c=s.touch0[0],h=s.touch0[1],f=s.touch1[0],g=s.touch1[1],p=(p=f[0]-c[0])*p+(p=f[1]-c[1])*p,v=(v=g[0]-h[0])*v+(v=g[1]-h[1])*v;r=m(r,Math.sqrt(p/v)),o=[(c[0]+f[0])/2,(c[1]+f[1])/2],a=[(h[0]+g[0])/2,(h[1]+g[1])/2]}else{if(!s.touch0)return;o=s.touch0[0],a=s.touch0[1]}s.zoom("touch",i(y(r,o,a),s.extent,u))}}function C(e,...r){if(this.__zooming){var o,i,a=b(this,r).event(e),s=e.changedTouches,l=s.length;for(tG(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),o=0;o<l;++o)i=s[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=eg(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<g)){var u=ef(this).on("dblclick.zoom");u&&u.apply(this,arguments)}}}return p.transform=function(e,t,n,r){var o=e.selection?e.selection():e;o.property("__zoom",t1),e!==o?x(e,t,n,r):o.interrupt().each(function(){b(this,arguments).event(r).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},p.scaleBy=function(e,t,n,r){p.scaleTo(e,function(){var e=this.__zoom.k,n="function"==typeof t?t.apply(this,arguments):t;return e*n},n,r)},p.scaleTo=function(e,t,n,r){p.transform(e,function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==n?v(e):"function"==typeof n?n.apply(this,arguments):n,s=r.invert(a),l="function"==typeof t?t.apply(this,arguments):t;return i(y(m(r,l),a,s),e,u)},n,r)},p.translateBy=function(e,t,n,r){p.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),o.apply(this,arguments),u)},null,r)},p.translateTo=function(e,t,n,r,a){p.transform(e,function(){var e=o.apply(this,arguments),a=this.__zoom,s=null==r?v(e):"function"==typeof r?r.apply(this,arguments):r;return i(tW.translate(s[0],s[1]).scale(a.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,u)},r,a)},w.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=ef(this.that).datum();h.call(e,this.that,new tZ(e,{sourceEvent:this.sourceEvent,target:p,type:e,transform:this.that.__zoom,dispatch:h}),t)}},p.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:tK(+e),p):a},p.filter=function(e){return arguments.length?(r="function"==typeof e?e:tK(!!e),p):r},p.touchable=function(e){return arguments.length?(s="function"==typeof e?e:tK(!!e),p):s},p.extent=function(e){return arguments.length?(o="function"==typeof e?e:tK([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),p):o},p.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],p):[l[0],l[1]]},p.translateExtent=function(e){return arguments.length?(u[0][0]=+e[0][0],u[1][0]=+e[1][0],u[0][1]=+e[0][1],u[1][1]=+e[1][1],p):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},p.constrain=function(e){return arguments.length?(i=e,p):i},p.duration=function(e){return arguments.length?(d=+e,p):d},p.interpolate=function(e){return arguments.length?(c=e,p):c},p.on=function(){var e=h.on.apply(h,arguments);return e===h?p:e},p.clickDistance=function(e){return arguments.length?(f=(e*=1)*e,p):Math.sqrt(f)},p.tapDistance=function(e){return arguments.length?(g=+e,p):g},p}function t6(e,t){var n,r,o=typeof t;return null==t||"boolean"===o?tz(t):("number"===o?e1:"string"===o?(r=tp(t))?(t=r,t$):tD:t instanceof tp?t$:t instanceof Date?function(e,t){var n=new Date;return e*=1,t*=1,function(r){return n.setTime(e*(1-r)+t*r),n}}:!ArrayBuffer.isView(n=t)||n instanceof DataView?Array.isArray(t)?function(e,t){var n,r=t?t.length:0,o=e?Math.min(r,e.length):0,i=Array(o),a=Array(r);for(n=0;n<o;++n)i[n]=t6(e[n],t[n]);for(;n<r;++n)a[n]=t[n];return function(e){for(n=0;n<o;++n)a[n]=i[n](e);return a}}:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?function(e,t){var n,r={},o={};for(n in(null===e||"object"!=typeof e)&&(e={}),(null===t||"object"!=typeof t)&&(t={}),t)n in e?r[n]=t6(e[n],t[n]):o[n]=t[n];return function(e){for(n in r)o[n]=r[n](e);return o}}:e1:function(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,o=t.slice();return function(i){for(n=0;n<r;++n)o[n]=e[n]*(1-i)+t[n]*i;return o}})(e,t)}tU.prototype=tq.prototype;let t8=[[-1/0,-1/0],[1/0,1/0]],t9=["Enter"," ","Escape"],t7={"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"};(t=d||(d={})).Strict="strict",t.Loose="loose",(n=c||(c={})).Free="free",n.Vertical="vertical",n.Horizontal="horizontal",(r=h||(h={})).Partial="partial",r.Full="full";let ne={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};(o=f||(f={})).Bezier="default",o.Straight="straight",o.Step="step",o.SmoothStep="smoothstep",o.SimpleBezier="simplebezier",(i=g||(g={})).Arrow="arrow",i.ArrowClosed="arrowclosed",(a=p||(p={})).Left="left",a.Top="top",a.Right="right",a.Bottom="bottom";let nt={[p.Left]:p.Right,[p.Right]:p.Left,[p.Top]:p.Bottom,[p.Bottom]:p.Top};function nn(e){return null===e?null:e?"valid":"invalid"}let nr=e=>"id"in e&&"source"in e&&"target"in e,no=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ni=(e,t=[0,0])=>{let{width:n,height:r}=nP(e),o=e.origin??t,i=n*o[0],a=r*o[1];return{x:e.position.x-i,y:e.position.y-a}},na=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=nm(n,nb(e)),r=!0)}),r?nv(n):{x:0,y:0,width:0,height:0}},ns=(e,t,[n,r,o]=[0,0,1],i=!1,a=!1)=>{let s={...nM(t,[n,r,o]),width:t.width/o,height:t.height/o},l=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(a&&!n||r)continue;let o=e.width??t.width??t.initialWidth??null,u=e.height??t.height??t.initialHeight??null,d=n_(s,nx(t)),c=(o??0)*(u??0),h=i&&d>0;(!t.internals.handleBounds||h||d>=c||t.dragging)&&l.push(t)}return l};async function nl({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},a){let s,l;if(0===e.size)return Promise.resolve(!0);let u=nA(na((s=new Map,l=a?.nodes?new Set(a.nodes.map(e=>e.id)):null,e.forEach(e=>{e.measured.width&&e.measured.height&&(a?.includeHiddenNodes||!e.hidden)&&(!l||l.has(e.id))&&s.set(e.id,e)}),s)),t,n,a?.minZoom??o,a?.maxZoom??i,a?.padding??.1);return await r.setViewport(u,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function nu({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){let a=n.get(e),s=a.parentId?n.get(a.parentId):void 0,{x:l,y:u}=s?s.internals.positionAbsolute:{x:0,y:0},d=a.origin??r,c=a.extent||o;if("parent"!==a.extent||a.expandParent)s&&nz(a.extent)&&(c=[[a.extent[0][0]+l,a.extent[0][1]+u],[a.extent[1][0]+l,a.extent[1][1]+u]]);else if(s){let e=s.measured.width,t=s.measured.height;e&&t&&(c=[[l,u],[l+e,u+t]])}else i?.("005","Only child nodes can use a parent extent.");let h=nz(c)?nh(t,c,a.measured):t;return(void 0===a.measured.width||void 0===a.measured.height)&&i?.("015","It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."),{position:{x:h.x-l+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function nd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){let i,a=new Set(e.map(e=>e.id)),s=[];for(let e of n){if(!1===e.deletable)continue;let t=a.has(e.id),n=!t&&e.parentId&&s.find(t=>t.id===e.parentId);(t||n)&&s.push(e)}let l=new Set(t.map(e=>e.id)),u=r.filter(e=>!1!==e.deletable),d=(i=new Set,s.forEach(e=>{i.add(e.id)}),u.filter(e=>i.has(e.source)||i.has(e.target)));for(let e of u)l.has(e.id)&&!d.find(t=>t.id===e.id)&&d.push(e);if(!o)return{edges:d,nodes:s};let c=await o({nodes:s,edges:d});return"boolean"==typeof c?c?{edges:d,nodes:s}:{edges:[],nodes:[]}:c}let nc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),nh=(e={x:0,y:0},t,n)=>({x:nc(e.x,t[0][0],t[1][0]-(n?.width??0)),y:nc(e.y,t[0][1],t[1][1]-(n?.height??0))});function nf(e,t,n){let{width:r,height:o}=nP(n),{x:i,y:a}=n.internals.positionAbsolute;return nh(e,[[i,a],[i+r,a+o]],t)}let ng=(e,t,n)=>e<t?nc(Math.abs(e-t),1,t)/t:e>n?-nc(Math.abs(e-n),1,t)/t:0,np=(e,t,n=15,r=40)=>[ng(e.x,r,t.width-r)*n,ng(e.y,r,t.height-r)*n],nm=(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)}),ny=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),nv=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),nx=(e,t=[0,0])=>{let{x:n,y:r}=no(e)?e.internals.positionAbsolute:ni(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}},nb=(e,t=[0,0])=>{let{x:n,y:r}=no(e)?e.internals.positionAbsolute:ni(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)}},nw=(e,t)=>nv(nm(ny(e),ny(t))),n_=(e,t)=>Math.ceil(Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))),nE=e=>nk(e.width)&&nk(e.height)&&nk(e.x)&&nk(e.y),nk=e=>!isNaN(e)&&isFinite(e),nS=(e,t)=>{},nN=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),nM=({x:e,y:t},[n,r,o],i=!1,a=[1,1])=>{let s={x:(e-n)/o,y:(t-r)/o};return i?nN(s,a):s},nC=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function nj(e,t){if("number"==typeof e)return Math.floor((t-t/(1+e))*.5);if("string"==typeof e&&e.endsWith("px")){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&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}let nA=(e,t,n,r,o,i)=>{let a=function(e,t,n){if("string"==typeof e||"number"==typeof e){let r=nj(e,n),o=nj(e,t);return{top:r,right:o,bottom:r,left:o,x:2*o,y:2*r}}if("object"==typeof e){let r=nj(e.top??e.y??0,n),o=nj(e.bottom??e.y??0,n),i=nj(e.left??e.x??0,t),a=nj(e.right??e.x??0,t);return{top:r,right:a,bottom:o,left:i,x:i+a,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),s=nc(Math.min((t-a.x)/e.width,(n-a.y)/e.height),r,o),l=e.x+e.width/2,u=e.y+e.height/2,d=t/2-l*s,c=n/2-u*s,h=function(e,t,n,r,o,i){let{x:a,y:s}=nC(e,[t,n,r]),{x:l,y:u}=nC({x:e.x+e.width,y:e.y+e.height},[t,n,r]);return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(o-l),bottom:Math.floor(i-u)}}(e,d,c,s,t,n),f={left:Math.min(h.left-a.left,0),top:Math.min(h.top-a.top,0),right:Math.min(h.right-a.right,0),bottom:Math.min(h.bottom-a.bottom,0)};return{x:d-f.left+f.right,y:c-f.top+f.bottom,zoom:s}},nO=()=>"u">typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function nz(e){return null!=e&&"parent"!==e}function nP(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function n$(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function nI(e,t={width:0,height:0},n,r,o){let i={...e},a=r.get(n);if(a){let e=a.origin||o;i.x+=a.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function nR(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function nL(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){let{x:i,y:a}=nV(e),s=nM({x:i-(o?.left??0),y:a-(o?.top??0)},r),{x:l,y:u}=n?nN(s,t):s;return{xSnapped:l,ySnapped:u,...s}}let nD=e=>({width:e.offsetWidth,height:e.offsetHeight}),nT=e=>e?.getRootNode?.()||window?.document,nB=["INPUT","SELECT","TEXTAREA"];function nH(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1&&(nB.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey"))}let nV=(e,t)=>{let n="clientX"in e,r=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:o-(t?.top??0)}},nF=(e,t,n,r,o)=>{let i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{let i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:o,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/r,y:(i.top-n.top)/r,...nD(t)}}):null};function nX({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:a,targetControlY:s}){let l=.125*e+.375*o+.375*a+.125*n,u=.125*t+.375*i+.375*s+.125*r,d=Math.abs(l-e),c=Math.abs(u-t);return[l,u,d,c]}function nY(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function nK({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case p.Left:return[t-nY(t-r,i),n];case p.Right:return[t+nY(r-t,i),n];case p.Top:return[t,n-nY(n-o,i)];case p.Bottom:return[t,n+nY(o-n,i)]}}function nZ({sourceX:e,sourceY:t,sourcePosition:n=p.Bottom,targetX:r,targetY:o,targetPosition:i=p.Top,curvature:a=.25}){let[s,l]=nK({pos:n,x1:e,y1:t,x2:r,y2:o,c:a}),[u,d]=nK({pos:i,x1:r,y1:o,x2:e,y2:t,c:a}),[c,h,f,g]=nX({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${t} C${s},${l} ${u},${d} ${r},${o}`,c,h,f,g]}function nq({sourceX:e,sourceY:t,targetX:n,targetY:r}){let o=Math.abs(n-e)/2,i=Math.abs(r-t)/2;return[n<e?n+o:n-o,r<t?r+i:r-i,o,i]}let nW=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`;function nU({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[o,i,a,s]=nq({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,a,s]}let nG={[p.Left]:{x:-1,y:0},[p.Right]:{x:1,y:0},[p.Top]:{x:0,y:-1},[p.Bottom]:{x:0,y:1}},nQ=({source:e,sourcePosition:t=p.Bottom,target:n})=>t===p.Left||t===p.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},nJ=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function n0({sourceX:e,sourceY:t,sourcePosition:n=p.Bottom,targetX:r,targetY:o,targetPosition:i=p.Top,borderRadius:a=5,centerX:s,centerY:l,offset:u=20,stepPosition:d=.5}){let[c,h,f,g,m]=function({source:e,sourcePosition:t=p.Bottom,target:n,targetPosition:r=p.Top,center:o,offset:i,stepPosition:a}){let s,l,u=nG[t],d=nG[r],c={x:e.x+u.x*i,y:e.y+u.y*i},h={x:n.x+d.x*i,y:n.y+d.y*i},f=nQ({source:c,sourcePosition:t,target:h}),g=0!==f.x?"x":"y",m=f[g],y=[],v={x:0,y:0},x={x:0,y:0},[,,b,w]=nq({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(u[g]*d[g]==-1){"x"===g?(s=o.x??c.x+(h.x-c.x)*a,l=o.y??(c.y+h.y)/2):(s=o.x??(c.x+h.x)/2,l=o.y??c.y+(h.y-c.y)*a);let e=[{x:s,y:c.y},{x:s,y:h.y}],t=[{x:c.x,y:l},{x:h.x,y:l}];y=u[g]===m?"x"===g?e:t:"x"===g?t:e}else{let o=[{x:c.x,y:h.y}],a=[{x:h.x,y:c.y}];if(y="x"===g?u.x===m?a:o:u.y===m?o:a,t===r){let t=Math.abs(e[g]-n[g]);if(t<=i){let r=Math.min(i-1,i-t);u[g]===m?v[g]=(c[g]>e[g]?-1:1)*r:x[g]=(h[g]>n[g]?-1:1)*r}}if(t!==r){let e="x"===g?"y":"x",t=u[g]===d[e],n=c[e]>h[e],r=c[e]<h[e];(1===u[g]&&(!t&&n||t&&r)||1!==u[g]&&(!t&&r||t&&n))&&(y="x"===g?o:a)}let f={x:c.x+v.x,y:c.y+v.y},p={x:h.x+x.x,y:h.y+x.y};Math.max(Math.abs(f.x-y[0].x),Math.abs(p.x-y[0].x))>=Math.max(Math.abs(f.y-y[0].y),Math.abs(p.y-y[0].y))?(s=(f.x+p.x)/2,l=y[0].y):(s=y[0].x,l=(f.y+p.y)/2)}let _={x:c.x+v.x,y:c.y+v.y},E={x:h.x+x.x,y:h.y+x.y};return[[e,..._.x!==y[0].x||_.y!==y[0].y?[_]:[],...y,...E.x!==y[y.length-1].x||E.y!==y[y.length-1].y?[E]:[],n],s,l,b,w]}({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:s,y:l},offset:u,stepPosition:d}),y=`M${c[0].x} ${c[0].y}`;for(let e=1;e<c.length-1;e++)y+=function(e,t,n,r){let o=Math.min(nJ(e,t)/2,nJ(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${i+o*t},${a}Q ${i},${a} ${i},${a+o*r}`}let s=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${a+o*l}Q ${i},${a} ${i+o*s},${a}`}(c[e-1],c[e],c[e+1],a);return[y+=`L${c[c.length-1].x} ${c[c.length-1].y}`,h,f,g,m]}function n1(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function n2(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,"source"===r.type?t.push(r):"target"===r.type&&n.push(r);return{source:t,target:n}}function n5(e,t,n=p.Left,r=!1){let o=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:s}=t??nP(e);if(r)return{x:o+a/2,y:i+s/2};switch(t?.position??n){case p.Top:return{x:o+a/2,y:i};case p.Right:return{x:o+a,y:i+s/2};case p.Bottom:return{x:o+a/2,y:i+s};case p.Left:return{x:o,y:i+s/2}}}function n3(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function n4(e,t){if(!e)return"";if("string"==typeof e)return e;let n=t?`${t}__`:"";return`${n}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`}let n6={nodeOrigin:[0,0],nodeExtent:t8,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},n8={...n6,checkEquality:!0};function n9(e,t){let n={...e};for(let e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function n7(e){return"manual"===e}function re(e,t,n,r={}){let o=n9(n8,r),i={i:0},a=new Map(t),s=o?.elevateNodesOnSelect&&!n7(o.zIndexMode)?1e3:0,l=e.length>0,u=!1;for(let d of(t.clear(),n.clear(),e)){let e=a.get(d.id);if(o.checkEquality&&d===e?.internals.userNode)t.set(d.id,e);else{let n=nh(ni(d,o.nodeOrigin),nz(d.extent)?d.extent:o.nodeExtent,nP(d));e={...o.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:n,handleBounds:function(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let o={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};"source"===t.type?n.push(o):"target"===t.type&&r.push(o)}return{source:n,target:r}}(d,e),z:rn(d,s,o.zIndexMode),userNode:d}},t.set(d.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(l=!1),d.parentId&&rt(e,t,n,r,i),u||=d.selected??!1}return{nodesInitialized:l,hasSelectedNodes:u}}function rt(e,t,n,r,o){let{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:s,zIndexMode:l}=n9(n6,r),u=e.parentId,d=t.get(u);if(!d)return void console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(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]]))}(e,n),o&&!d.parentId&&void 0===d.internals.rootParentIndex&&"auto"===l&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+10*o.i),o&&void 0!==d.internals.rootParentIndex&&(o.i=d.internals.rootParentIndex);let{x:c,y:h,z:f}=function(e,t,n,r,o,i){let{x:a,y:s}=t.internals.positionAbsolute,l=nP(e),u=ni(e,n),d=nz(e.extent)?nh(u,e.extent,l):u,c=nh({x:a+d.x,y:s+d.y},r,l);"parent"===e.extent&&(c=nf(c,l,t));let h=rn(e,o,i),f=t.internals.z??0;return{x:c.x,y:c.y,z:f>=h?f+1:h}}(e,d,a,s,i&&!n7(l)?1e3:0,l),{positionAbsolute:g}=e.internals,p=c!==g.x||h!==g.y;(p||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:c,y:h}:g,z:f}})}function rn(e,t,n){let r=nk(e.zIndex)?e.zIndex:0;return n7(n)?r:r+(e.selected?t:0)}function rr(e,t,n,r=[0,0]){let o=[],i=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=nw(i.get(n.parentId)?.expandedRect??nx(e),n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},a)=>{let s=i.internals.positionAbsolute,l=nP(i),u=i.origin??r,d=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,c=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,h=Math.max(l.width,Math.round(t.width)),f=Math.max(l.height,Math.round(t.height)),g=(h-l.width)*u[0],p=(f-l.height)*u[1];(d>0||c>0||g||p)&&(o.push({id:a,type:"position",position:{x:i.position.x-d+g,y:i.position.y-c+p}}),n.get(a)?.forEach(t=>{e.some(e=>e.id===t.id)||o.push({id:t.id,type:"position",position:{x:t.position.x+d,y:t.position.y+c}})})),(l.width<t.width||l.height<t.height||d||c)&&o.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?u[0]*d-g:0),height:f+(c?u[1]*c-p:0)}})}),o}async function ro({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return Promise.resolve(!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]))}function ri(e,t,n,r,o,i){let a=o,s=r.get(a)||new Map;r.set(a,s.set(n,t)),a=`${o}-${e}`;let l=r.get(a)||new Map;if(r.set(a,l.set(n,t)),i){a=`${o}-${e}-${i}`;let s=r.get(a)||new Map;r.set(a,s.set(n,t))}}function ra(e,t,n){for(let r of(e.clear(),t.clear(),n)){let{source:n,target:o,sourceHandle:i=null,targetHandle:a=null}=r,s={edgeId:r.id,source:n,target:o,sourceHandle:i,targetHandle:a},l=`${n}-${i}--${o}-${a}`;ri("source",s,`${o}-${a}--${n}-${i}`,e,n,i),ri("target",s,l,e,o,a),t.set(r.id,r)}}function rs(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)break;r=r?.parentElement}while(r)return!1}function rl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let o=[];for(let[e,i]of t){let t=n.get(e)?.internals.userNode;t&&o.push({...t,position:i.position,dragging:r})}if(!e)return[o[0],o];let i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:r}:o[0],o]}function ru(e,t,n,r,o,i=!1){let a=r.get(e);if(!a)return null;let s="strict"===o?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],l=(n?s?.find(e=>e.id===n):s?.[0])??null;return l&&i?{...l,...n5(a,l,l.position,!0)}:l}function rd(e,t){return e?e:t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null}let rc=()=>!0;function rh(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:a,lib:s,flowId:l,isValidConnection:u=rc,nodeLookup:c}){let h="target"===i,f=t?a.querySelector(`.${s}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:p}=nV(e),m=a.elementFromPoint(g,p),y=m?.classList.contains(`${s}-flow__handle`)?m:f,v={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=rd(void 0,y),t=y.getAttribute("data-nodeid"),i=y.getAttribute("data-handleid"),a=y.classList.contains("connectable"),s=y.classList.contains("connectableend");if(!t||!e)return v;let l={source:h?t:r,sourceHandle:h?i:o,target:h?r:t,targetHandle:h?o:i};v.connection=l,v.isValid=a&&s&&(n===d.Strict?h&&"source"===e||!h&&"target"===e:t!==r||i!==o)&&u(l),v.toHandle=ru(t,e,i,c,n,!0)}return v}let rf=function(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:a,domNode:s,nodeLookup:l,lib:u,autoPanOnConnect:d,flowId:c,panBy:h,cancelConnection:f,onConnectStart:g,onConnect:m,onConnectEnd:y,isValidConnection:v=rc,onReconnectEnd:x,updateConnection:b,getTransform:w,getFromHandle:_,autoPanSpeed:E,dragThreshold:k=1,handleDomNode:S}){let N,M=nT(e.target),C=0,{x:j,y:A}=nV(e),O=rd(i,S),z=s?.getBoundingClientRect(),P=!1;if(!z||!O)return;let $=ru(o,O,r,l,t);if(!$)return;let I=nV(e,z),R=!1,L=null,D=!1,T=null,B={...$,nodeId:o,type:O,position:$.position},H=l.get(o),V={inProgress:!0,isValid:null,from:n5(H,B,p.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:H,to:I,toHandle:null,toPosition:nt[B.position],toNode:null,pointer:I};function F(){P=!0,b(V),g?.(e,{nodeId:o,handleId:r,handleType:O})}function X(e){var i,s;let f;if(!P){let{x:t,y:n}=nV(e),r=t-j,o=n-A;if(!(r*r+o*o>k*k))return;F()}if(!_()||!B)return void Y(e);let g=w();N=function(e,t,n,r){let o=[],i=1/0;for(let a of function(e,t,n){let r=[],o={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(let e of t.values())n_(o,nx(e))>0&&r.push(e);return r}(e,n,t+250))for(let n of[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]]){if(r.nodeId===n.nodeId&&r.type===n.type&&r.id===n.id)continue;let{x:s,y:l}=n5(a,n,n.position,!0),u=Math.sqrt(Math.pow(s-e.x,2)+Math.pow(l-e.y,2));u>t||(u<i?(o=[{...n,x:s,y:l}],i=u):u===i&&o.push({...n,x:s,y:l}))}if(!o.length)return null;if(o.length>1){let e="source"===r.type?"target":"source";return o.find(t=>t.type===e)??o[0]}return o[0]}(nM(I=nV(e,z),g,!1,[1,1]),n,l,B),R||(!function e(){if(!d||!z)return;let[t,n]=np(I,z,E);h({x:t,y:n}),C=requestAnimationFrame(e)}(),R=!0);let m=rh(e,{handle:N,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:a?"target":"source",isValidConnection:v,doc:M,lib:u,flowId:c,nodeLookup:l});T=m.handleDomNode,L=m.connection,i=!!N,s=m.isValid,f=null,s?f=!0:i&&!s&&(f=!1),D=f;let y=l.get(o),x=y?n5(y,B,p.Left,!0):V.from,S={...V,from:x,isValid:D,to:m.toHandle&&D?nC({x:m.toHandle.x,y:m.toHandle.y},g):I,toHandle:m.toHandle,toPosition:D&&m.toHandle?m.toHandle.position:nt[B.position],toNode:m.toHandle?l.get(m.toHandle.nodeId):null,pointer:I};b(S),V=S}function Y(e){if(!("touches"in e)||!(e.touches.length>0)){if(P){(N||T)&&L&&D&&m?.(L);let{inProgress:t,...n}=V,r={...n,toPosition:V.toHandle?V.toPosition:null};y?.(e,r),i&&x?.(e,r)}f(),cancelAnimationFrame(C),R=!1,D=!1,L=null,T=null,M.removeEventListener("mousemove",X),M.removeEventListener("mouseup",Y),M.removeEventListener("touchmove",X),M.removeEventListener("touchend",Y)}}0===k&&F(),M.addEventListener("mousemove",X),M.addEventListener("mouseup",Y),M.addEventListener("touchmove",X),M.addEventListener("touchend",Y)},rg=e=>({x:e.x,y:e.y,zoom:e.k}),rp=({x:e,y:t,zoom:n})=>tW.translate(e,t).scale(n),rm=(e,t)=>e.target.closest(`.${t}`),ry=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),rv=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,rx=(e,t=0,n=rv,r=()=>{})=>{let o="number"==typeof t&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},rb=e=>{let t=e.ctrlKey&&nO()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function rw(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:e.includes("left"),affectsY:e.includes("top")}}function r_(e,t){return Math.max(0,t-e)}function rE(e,t){return Math.max(0,e-t)}function rk(e,t,n){return Math.max(0,t-e,e-n)}(s=m||(m={})).Line="line",s.Handle="handle";let rS={width:0,height:0,x:0,y:0},rN={...rS,pointerX:0,pointerY:0,aspectRatio:1};var rM=e.i(673295);let rC={get url(){return`file://${e.P("node_modules/.pnpm/zustand@4.5.7_@types+react@19.2.14_react@19.2.6/node_modules/zustand/esm/vanilla.mjs")}`}},rj=e=>{let t,n=new Set,r=(e,r)=>{let o="function"==typeof e?e(t):e;if(!Object.is(o,t)){let e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach(n=>n(t,e))}},o=()=>t,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{(rC.env?rC.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(r,o,i);return i},{useDebugValue:rA}=x.default,{useSyncExternalStoreWithSelector:rO}=rM.default,rz=e=>e;function rP(e,t=rz,n){let r=rO(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return rA(r),r}let r$=(e,t)=>{let n=e?rj(e):rj,r=(e,r=t)=>rP(n,e,r);return Object.assign(r,n),r};function rI(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===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 rR=e.i(550008);let rL=(0,x.createContext)(null),rD=rL.Provider,rT="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function rB(e,t){let n=(0,x.useContext)(rL);if(null===n)throw Error(rT);return rP(n,e,t)}function rH(){let e=(0,x.useContext)(rL);if(null===e)throw Error(rT);return(0,x.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}let rV={display:"none"},rF={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},rX="react-flow__node-desc",rY="react-flow__edge-desc",rK=e=>e.ariaLiveMessage,rZ=e=>e.ariaLabelConfig;function rq({rfId:e}){let t=rB(rK);return(0,v.jsx)("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:rF,children:t})}function rW({rfId:e,disableKeyboardA11y:t}){let n=rB(rZ);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{id:`${rX}-${e}`,style:rV,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,v.jsx)("div",{id:`${rY}-${e}`,style:rV,children:n["edge.a11yDescription.default"]}),!t&&(0,v.jsx)(rq,{rfId:e})]})}let rU=(0,x.forwardRef)(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{let a=`${e}`.split("-");return(0,v.jsx)("div",{className:w(["react-flow__panel",n,...a]),style:r,ref:i,...o,children:t})});function rG({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,v.jsx)(rU,{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,v.jsx)("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}rU.displayName="Panel";let rQ=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}},rJ=e=>e.id;function r0(e,t){return rI(e.selectedNodes.map(rJ),t.selectedNodes.map(rJ))&&rI(e.selectedEdges.map(rJ),t.selectedEdges.map(rJ))}function r1({onSelectionChange:e}){let t=rH(),{selectedNodes:n,selectedEdges:r}=rB(rQ,r0);return(0,x.useEffect)(()=>{let o={nodes:n,edges:r};e?.(o),t.getState().onSelectionChangeHandlers.forEach(e=>e(o))},[n,r,e]),null}let r2=e=>!!e.onSelectionChangeHandlers;function r5({onSelectionChange:e}){let t=rB(r2);return e||t?(0,v.jsx)(r1,{onSelectionChange:e}):null}let r3="u">typeof window?x.useLayoutEffect:x.useEffect,r4=[0,0],r6={x:0,y:0,zoom:1},r8=["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","rfId"],r9=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}),r7={translateExtent:t8,nodeOrigin:r4,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function oe(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:a,reset:s,setDefaultNodesAndEdges:l}=rB(r9,rI),u=rH();r3(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=r7,s()}),[]);let d=(0,x.useRef)(r7);return r3(()=>{for(let s of r8){let l=e[s];if(l!==d.current[s]&&void 0!==e[s])if("nodes"===s)t(l);else if("edges"===s)n(l);else if("minZoom"===s)r(l);else if("maxZoom"===s)o(l);else if("translateExtent"===s)i(l);else if("nodeExtent"===s)a(l);else if("ariaLabelConfig"===s)u.setState({ariaLabelConfig:{...t7,...l||{}}});else"fitView"===s?u.setState({fitViewQueued:l}):"fitViewOptions"===s?u.setState({fitViewOptions:l}):u.setState({[s]:l})}d.current=e},r8.map(t=>e[t])),null}function ot(){return"u"<typeof window||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}let on="u">typeof document?document:null;function or(e=null,t={target:on,actInsideInputWithModifier:!0}){let[n,r]=(0,x.useState)(!1),o=(0,x.useRef)(!1),i=(0,x.useRef)(new Set([])),[a,s]=(0,x.useMemo)(()=>{if(null!==e){let t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace("+","\n").replace("\n\n","\n+").split("\n")),n=t.reduce((e,t)=>e.concat(...t),[]);return[t,n]}return[[],[]]},[e]);return(0,x.useEffect)(()=>{let n=t?.target??on,l=t?.actInsideInputWithModifier??!0;if(null!==e){let e=e=>{if(o.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!o.current||o.current&&!l)&&nH(e))return!1;let n=oi(e.code,s);if(i.current.add(e[n]),oo(a,i.current,!1)){let n=e.composedPath?.()?.[0]||e.target,i=n?.nodeName==="BUTTON"||n?.nodeName==="A";!1!==t.preventDefault&&(o.current||!i)&&e.preventDefault(),r(!0)}},u=e=>{let t=oi(e.code,s);oo(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(e[t]),"Meta"===e.key&&i.current.clear(),o.current=!1},d=()=>{i.current.clear(),r(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",u),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",u),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function oo(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function oi(e,t){return t.includes(e)?"code":"key"}function oa(e,t){let n=[],r=new Map,o=[];for(let t of e)if("add"===t.type){o.push(t);continue}else if("remove"===t.type||"replace"===t.type)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("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}let o={...e};for(let e of t){var i=e,a=o;switch(i.type){case"select":a.selected=i.selected;break;case"position":void 0!==i.position&&(a.position=i.position),void 0!==i.dragging&&(a.dragging=i.dragging);break;case"dimensions":void 0!==i.dimensions&&(a.measured={...i.dimensions},i.setAttributes&&((!0===i.setAttributes||"width"===i.setAttributes)&&(a.width=i.dimensions.width),(!0===i.setAttributes||"height"===i.setAttributes)&&(a.height=i.dimensions.height))),"boolean"==typeof i.resizing&&(a.resizing=i.resizing)}}n.push(o)}return o.length&&o.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function os(e,t){return{id:e,type:"select",selected:t}}function ol(e,t=new Set,n=!1){let r=[];for(let[o,i]of e){let e=t.has(o);(void 0!==i.selected||e)&&i.selected!==e&&(n&&(i.selected=e),r.push(os(i.id,e)))}return r}function ou({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,o]of e.entries()){let e=t.get(o.id),i=e?.internals?.userNode??e;void 0!==i&&i!==o&&n.push({id:o.id,item:o,type:"replace"}),void 0===i&&n.push({item:o,type:"add",index:r})}for(let[e]of t)void 0===r.get(e)&&n.push({id:e,type:"remove"});return n}function od(e){return{id:e.id,type:"remove"}}let oc=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e);function oh(e){return(0,x.forwardRef)(e)}function of(e){let[t,n]=(0,x.useState)(BigInt(0)),[r]=(0,x.useState)(()=>{var e;let t;return e=()=>n(e=>e+BigInt(1)),t=[],{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}});return r3(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}let og=(0,x.createContext)(null);function op({children:e}){let t=rH(),n=of((0,x.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:o,onNodesChange:i,nodeLookup:a,fitViewQueued:s,onNodesChangeMiddlewareMap:l}=t.getState(),u=n;for(let t of e)u="function"==typeof t?t(u):t;let d=ou({items:u,lookup:a});for(let e of l.values())d=e(d);o&&r(u),d.length>0?i?.(d):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=of((0,x.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:o,onEdgesChange:i,edgeLookup:a}=t.getState(),s=n;for(let t of e)s="function"==typeof t?t(s):t;o?r(s):i&&i(ou({items:s,lookup:a}))},[])),o=(0,x.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,v.jsx)(og.Provider,{value:o,children:e})}let om=e=>!!e.panZoom;function oy(){let e,t=(e=rH(),(0,x.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,o,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},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:o,minZoom:i,maxZoom:a,panZoom:s}=e.getState(),l=nA(t,r,o,i,a,n?.padding??.1);return s?(await s.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:o,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;let{x:s,y:l}=a.getBoundingClientRect(),u={x:t.x-s,y:t.y-l},d=n.snapGrid??o;return nM(u,r,n.snapToGrid??i,d)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:o,y:i}=r.getBoundingClientRect(),a=nC(t,n);return{x:a.x+o,y:a.y+i}}}),[])),n=rH(),r=function(){let e=(0,x.useContext)(og);if(!e)throw Error("useBatchContext must be used within a BatchProvider");return e}(),o=rB(om),i=(0,x.useMemo)(()=>{let e=e=>n.getState().nodeLookup.get(e),t=e=>{r.nodeQueue.push(e)},o=e=>{r.edgeQueue.push(e)},i=e=>{let{nodeLookup:t,nodeOrigin:r}=n.getState(),o=oc(e)?e:t.get(e.id),i=o.parentId?nI(o.position,o.measured,o.parentId,t,r):o.position;return nx({...o,position:i,width:o.measured?.width??o.width,height:o.measured?.height??o.height})},a=(e,n,r={replace:!1})=>{t(t=>t.map(t=>{if(t.id===e){let e="function"==typeof n?n(t):n;return r.replace&&oc(e)?e:{...t,...e}}return t}))},s=(e,t,n={replace:!1})=>{o(r=>r.map(r=>{if(r.id===e){let e="function"==typeof t?t(r):t;return n.replace&&nr(e)?e:{...r,...e}}return r}))};return{getNodes:()=>n.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=n.getState();return e.map(e=>({...e}))},getEdge:e=>n.getState().edgeLookup.get(e),setNodes:t,setEdges:o,addNodes:e=>{let t=Array.isArray(e)?e:[e];r.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];r.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:t=[],transform:r}=n.getState(),[o,i,a]=r;return{nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),viewport:{x:o,y:i,zoom:a}}},deleteElements:async({nodes:e=[],edges:t=[]})=>{let{nodes:r,edges:o,onNodesDelete:i,onEdgesDelete:a,triggerNodeChanges:s,triggerEdgeChanges:l,onDelete:u,onBeforeDelete:d}=n.getState(),{nodes:c,edges:h}=await nd({nodesToRemove:e,edgesToRemove:t,nodes:r,edges:o,onBeforeDelete:d}),f=h.length>0,g=c.length>0;if(f){let e=h.map(od);a?.(h),l(e)}if(g){let e=c.map(od);i?.(c),s(e)}return(g||f)&&u?.({nodes:c,edges:h}),{deletedNodes:c,deletedEdges:h}},getIntersectingNodes:(e,t=!0,r)=>{let o=nE(e),a=o?e:i(e),s=void 0!==r;return a?(r||n.getState().nodes).filter(r=>{let i=n.getState().nodeLookup.get(r.id);if(i&&!o&&(r.id===e.id||!i.internals.positionAbsolute))return!1;let l=nx(s?r:i),u=n_(l,a);return t&&u>0||u>=l.width*l.height||u>=a.width*a.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=nE(e)?e:i(e);if(!r)return!1;let o=n_(r,t);return n&&o>0||o>=t.width*t.height||o>=r.width*r.height},updateNode:a,updateNodeData:(e,t,n={replace:!1})=>{a(e,e=>{let r="function"==typeof t?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="function"==typeof t?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:t,nodeOrigin:r}=n.getState();return((e,t={nodeOrigin:[0,0]})=>0===e.length?{x:0,y:0,width:0,height:0}:nv(e.reduce((e,n)=>{let r="string"==typeof n,o=t.nodeLookup||r?void 0:n;return t.nodeLookup&&(o=r?t.nodeLookup.get(n):no(n)?n:t.nodeLookup.get(n.id)),nm(e,o?nb(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})))(e,{nodeLookup:t,nodeOrigin:r})},getHandleConnections:({type:e,id:t,nodeId:r})=>Array.from(n.getState().connectionLookup.get(`${r}-${e}${t?`-${t}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:t,nodeId:r})=>Array.from(n.getState().connectionLookup.get(`${r}${e?t?`-${e}-${t}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{let t,o,i=n.getState().fitViewResolver??{promise:new Promise((e,n)=>{t=e,o=n}),resolve:t,reject:o};return n.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:i}),r.nodeQueue.push(e=>[...e]),i.promise}}},[]);return(0,x.useMemo)(()=>({...i,...t,viewportInitialized:o}),[o])}let ov=e=>e.selected,ox="u">typeof window?window:void 0,ob={position:"absolute",width:"100%",height:"100%",top:0,left:0},ow=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function o_({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=c.Free,zoomOnDoubleClick:a=!0,panOnDrag:s=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:h,zoomActivationKeyCode:f,preventScrolling:g=!0,children:p,noWheelClassName:m,noPanClassName:y,onViewportChange:b,isControlledViewport:w,paneClickDistance:_,selectionOnDrag:E}){let k,S=rH(),N=(0,x.useRef)(null),{userSelectionActive:M,lib:C,connectionInProgress:j}=rB(ow,rI),A=or(f),O=(0,x.useRef)();k=rH(),(0,x.useEffect)(()=>{let e=()=>{if(!N.current||!(N.current.checkVisibility?.()??!0))return!1;let e=nD(N.current);(0===e.height||0===e.width)&&k.getState().onError?.("004","The React Flow parent container needs a width and a height to render the graph."),k.setState({width:e.width||500,height:e.height||500})};if(N.current){e(),window.addEventListener("resize",e);let t=new ResizeObserver(()=>e());return t.observe(N.current),()=>{window.removeEventListener("resize",e),t&&N.current&&t.unobserve(N.current)}}},[]);let z=(0,x.useCallback)(e=>{b?.({x:e[0],y:e[1],zoom:e[2]}),w||S.setState({transform:e})},[b,w]);return(0,x.useEffect)(()=>{if(N.current){O.current=function({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:s,onDraggingChange:l}){let u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),h=t4().scaleExtent([t,n]).translateExtent(r),f=ef(e).call(h);v({x:o.x,y:o.y,zoom:nc(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);let g=f.on("wheel.zoom"),p=f.on("dblclick.zoom");function m(e,t){return f?new Promise(n=>{h?.interpolate(t?.interpolate==="linear"?t6:ej).transform(rx(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function y(){h.on("zoom",null)}async function v(e,t,n){let r=rp(e),o=h?.constrain()(r,t,n);return o&&await m(o),new Promise(e=>e(o))}return h.wheelDelta(rb),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:o,panOnDrag:d,panOnScrollMode:m,panOnScrollSpeed:v,preventScrolling:x,zoomOnPinch:b,zoomOnScroll:w,zoomOnDoubleClick:_,zoomActivationKeyPressed:E,lib:k,onTransformChange:S,connectionInProgress:N,paneClickDistance:M,selectionOnDrag:C}){r&&!u.isZoomingOrPanning&&y();let j=o&&!E&&!r;h.clickDistance(C?1/0:!nk(M)||M<0?0:M);let A=j?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:s,onPanZoom:l,onPanZoomEnd:u}){return d=>{if(rm(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();let h=n.property("__zoom").k||1;if(d.ctrlKey&&a){let e=eg(d),t=h*Math.pow(2,rb(d));r.scaleTo(n,t,e,d);return}let f=1===d.deltaMode?20:1,g=o===c.Vertical?0:d.deltaX*f,p=o===c.Horizontal?0:d.deltaY*f;!nO()&&d.shiftKey&&o!==c.Vertical&&(g=d.deltaY*f,p=0),r.translateBy(n,-(g/h)*i,-(p/h)*i,{internal:!0});let m=rg(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(d,m),e.panScrollTimeout=setTimeout(()=>{u?.(d,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(d,m))}}({zoomPanValues:u,noWheelClassName:e,d3Selection:f,d3Zoom:h,panOnScrollMode:m,panOnScrollSpeed:v,zoomOnPinch:b,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:s}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){let i="wheel"===r.type,a=!t&&i&&!r.ctrlKey,s=rm(r,e);if(r.ctrlKey&&i&&s&&r.preventDefault(),a||s)return null;r.preventDefault(),n.call(this,r,o)}}({noWheelClassName:e,preventScrolling:x,d3ZoomHandler:g});if(f.on("wheel.zoom",A,{passive:!1}),!r){let e=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let o=rg(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,o)}}({zoomPanValues:u,onDraggingChange:l,onPanZoomStart:a});h.on("start",e);let t=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{e.usedRightMouseButton=!!(n&&ry(t,e.mouseButton??0)),i.sourceEvent?.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!i.sourceEvent?.internal&&o?.(i.sourceEvent,rg(i.transform))}}({zoomPanValues:u,panOnDrag:d,onPaneContextMenu:!!n,onPanZoom:i,onTransformChange:S});h.on("zoom",t);let r=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&ry(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){let t=rg(a.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(a.sourceEvent,t)},150*!!n)}}}({zoomPanValues:u,panOnDrag:d,panOnScroll:o,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:l});h.on("end",r)}let O=function({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:s,noPanClassName:l,lib:u,connectionInProgress:d}){return c=>{let h=e||t,f=n&&c.ctrlKey,g="wheel"===c.type;if(1===c.button&&"mousedown"===c.type&&(rm(c,`${u}-flow__node`)||rm(c,`${u}-flow__edge`)))return!0;if(!r&&!h&&!o&&!i&&!n||a||d&&!g||rm(c,s)&&g||rm(c,l)&&(!g||o&&g&&!e)||!n&&c.ctrlKey&&g)return!1;if(!n&&"touchstart"===c.type&&c.touches?.length>1)return c.preventDefault(),!1;if(!h&&!o&&!f&&g||!r&&("mousedown"===c.type||"touchstart"===c.type)||Array.isArray(r)&&!r.includes(c.button)&&"mousedown"===c.type)return!1;let p=Array.isArray(r)&&r.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||g)&&p}}({zoomActivationKeyPressed:E,panOnDrag:d,zoomOnScroll:w,panOnScroll:o,zoomOnDoubleClick:_,zoomOnPinch:b,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:k,connectionInProgress:N});h.filter(O),_?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)},destroy:y,setViewport:async function e(e,t){let n=rp(e);return await m(n,t),new Promise(e=>e(n))},setViewportConstrained:v,getViewport:function(){let e=f?tU(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,t){return f?new Promise(n=>{h?.interpolate(t?.interpolate==="linear"?t6:ej).scaleTo(rx(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},scaleBy:function(e,t){return f?new Promise(n=>{h?.interpolate(t?.interpolate==="linear"?t6:ej).scaleBy(rx(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},setScaleExtent:function(e){h?.scaleExtent(e)},setTranslateExtent:function(e){h?.translateExtent(e)},syncViewport:function(e){if(f){let t=rp(e),n=f.property("__zoom");(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&h?.transform(f,t,null,{sync:!0})}},setClickDistance:function(e){let t=!nk(e)||e<0?0:e;h?.clickDistance(t)}}}({domNode:N.current,minZoom:d,maxZoom:h,translateExtent:u,viewport:l,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return S.setState({panZoom:O.current,transform:[e,t,n],domNode:N.current.closest(".react-flow")}),()=>{O.current?.destroy()}}},[]),(0,x.useEffect)(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:s,zoomActivationKeyPressed:A,preventScrolling:g,noPanClassName:y,userSelectionActive:M,noWheelClassName:m,lib:C,onTransformChange:z,connectionInProgress:j,selectionOnDrag:E,paneClickDistance:_})},[e,t,n,r,o,i,a,s,A,g,y,M,m,C,z,j,E,_]),(0,v.jsx)("div",{className:"react-flow__renderer",ref:N,style:ob,children:p})}let oE=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function ok(){let{userSelectionActive:e,userSelectionRect:t}=rB(oE,rI);return e&&t?(0,v.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}let oS=(e,t)=>n=>{n.target===t.current&&e?.(n)},oN=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function oM({isSelecting:e,selectionKeyPressed:t,selectionMode:n=h.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:s,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:c,onPaneMouseMove:f,onPaneMouseLeave:g,children:p}){let m=rH(),{userSelectionActive:y,elementsSelectable:b,dragging:_,connectionInProgress:E}=rB(oN,rI),k=b&&(e||y),S=(0,x.useRef)(null),N=(0,x.useRef)(),M=(0,x.useRef)(new Set),C=(0,x.useRef)(new Set),j=(0,x.useRef)(!1),A=e=>{if(j.current||E){j.current=!1;return}l?.(e),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},O=!0===r||Array.isArray(r)&&r.includes(0);return(0,v.jsxs)("div",{className:w(["react-flow__pane",{draggable:O,dragging:_,selection:e}]),onClick:k?void 0:oS(A,S),onContextMenu:oS(e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():u?.(e)},S),onWheel:oS(d?e=>d(e):void 0,S),onPointerEnter:k?void 0:c,onPointerMove:k?e=>{let{userSelectionRect:r,transform:i,nodeLookup:s,edgeLookup:l,connectionLookup:u,triggerNodeChanges:d,triggerEdgeChanges:c,defaultEdgeOptions:f,resetSelectedElements:g}=m.getState();if(!N.current||!r)return;let{x:p,y:y}=nV(e.nativeEvent,N.current),{startX:v,startY:x}=r;if(!j.current){if(Math.hypot(p-v,y-x)<=(t?0:o))return;g(),a?.(e)}j.current=!0;let b={startX:v,startY:x,x:p<v?p:v,y:y<x?y:x,width:Math.abs(p-v),height:Math.abs(y-x)},w=M.current,_=C.current;M.current=new Set(ns(s,b,i,n===h.Partial,!0).map(e=>e.id)),C.current=new Set;let E=f?.selectable??!0;for(let e of M.current){let t=u.get(e);if(t)for(let{edgeId:e}of t.values()){let t=l.get(e);t&&(t.selectable??E)&&C.current.add(e)}}nR(w,M.current)||d(ol(s,M.current,!0)),nR(_,C.current)||c(ol(l,C.current)),m.setState({userSelectionRect:b,userSelectionActive:!0,nodesSelectionActive:!1})}:f,onPointerUp:k?e=>{0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!y&&e.target===S.current&&m.getState().userSelectionRect&&A?.(e),m.setState({userSelectionActive:!1,userSelectionRect:null}),j.current&&(s?.(e),m.setState({nodesSelectionActive:M.current.size>0})))}:void 0,onPointerDownCapture:k?n=>{let{domNode:r}=m.getState();if(N.current=r?.getBoundingClientRect(),!N.current)return;let o=n.target===S.current;if(!o&&n.target.closest(".nokey")||!e||!(i&&o||t)||0!==n.button||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),j.current=!1;let{x:a,y:s}=nV(n.nativeEvent,N.current);m.setState({userSelectionRect:{width:0,height:0,startX:a,startY:s,x:a,y:s}}),o||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:k?e=>{j.current&&(e.stopPropagation(),j.current=!1)}:void 0,onPointerLeave:g,ref:S,style:ob,children:[p,(0,v.jsx)(ok,{})]})}function oC({id:e,store:t,unselect:n=!1,nodeRef:r}){let o,{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:s,nodeLookup:l,onError:u}=t.getState(),d=l.get(e);d?(t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&s)&&(a({nodes:[d],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):u?.("012",(o=e,`Node with id "${o}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`))}function oj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:a}){let s=rH(),[l,u]=(0,x.useState)(!1),d=(0,x.useRef)();return(0,x.useEffect)(()=>{d.current=function({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},a=0,s=new Map,l=!1,u={x:0,y:0},d=null,c=!1,h=null,f=!1,g=!1,p=null;return{update:function({noDragClassName:m,handleSelector:y,domNode:v,isSelectable:x,nodeId:b,nodeClickDistance:w=0}){function _({x:e,y:n}){let{nodeLookup:o,nodeExtent:a,snapGrid:l,snapToGrid:u,nodeOrigin:d,onNodeDrag:c,onSelectionDrag:h,onError:f,updateNodePositions:m}=t();i={x:e,y:n};let y=!1,v=s.size>1,x=v&&a?ny(na(s)):null,w=v&&u?function({dragItems:e,snapGrid:t,x:n,y:r}){let o=e.values().next().value;if(!o)return null;let i={x:n-o.distance.x,y:r-o.distance.y},a=nN(i,t);return{x:a.x-i.x,y:a.y-i.y}}({dragItems:s,snapGrid:l,x:e,y:n}):null;for(let[t,r]of s){if(!o.has(t))continue;let i={x:e-r.distance.x,y:n-r.distance.y};u&&(i=w?{x:Math.round(i.x+w.x),y:Math.round(i.y+w.y)}:nN(i,l));let s=null;if(v&&a&&!r.extent&&x){let{positionAbsolute:e}=r.internals,t=e.x-x.x+a[0][0],n=e.x+r.measured.width-x.x2+a[1][0];s=[[t,e.y-x.y+a[0][1]],[n,e.y+r.measured.height-x.y2+a[1][1]]]}let{position:c,positionAbsolute:h}=nu({nodeId:t,nextPosition:i,nodeLookup:o,nodeExtent:s||a,nodeOrigin:d,onError:f});y=y||r.position.x!==c.x||r.position.y!==c.y,r.position=c,r.internals.positionAbsolute=h}if(g=g||y,y&&(m(s,!0),p&&(r||c||!b&&h))){let[e,t]=rl({nodeId:b,dragItems:s,nodeLookup:o});r?.(p,s,e,t),c?.(p,e,t),b||h?.(p,t)}}async function E(){if(!d)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:o}=t();if(!o){l=!1,cancelAnimationFrame(a);return}let[s,c]=np(u,d,r);(0!==s||0!==c)&&(i.x=(i.x??0)-s/e[2],i.y=(i.y??0)-c/e[2],await n({x:s,y:c})&&_(i)),a=requestAnimationFrame(E)}function k(r){let{nodeLookup:o,multiSelectionActive:a,nodesDraggable:l,transform:u,snapGrid:h,snapToGrid:f,selectNodesOnDrag:g,onNodeDragStart:p,onSelectionDragStart:m,unselectNodesAndEdges:y}=t();c=!0,g&&x||a||!b||o.get(b)?.selected||y(),x&&g&&b&&e?.(b);let v=nL(r.sourceEvent,{transform:u,snapGrid:h,snapToGrid:f,containerBounds:d});if(i=v,(s=function(e,t,n,r){let o=new Map;for(let[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!function e(t,n){if(!t.parentId)return!1;let r=n.get(t.parentId);return!!r&&(!!r.selected||e(r,n))}(a,e))&&(a.draggable||t&&void 0===a.draggable)){let t=e.get(i);t&&o.set(i,{id:i,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 o}(o,l,v,b)).size>0&&(n||p||!b&&m)){let[e,t]=rl({nodeId:b,dragItems:s,nodeLookup:o});n?.(r.sourceEvent,s,e,t),p?.(r.sourceEvent,e,t),b||m?.(r.sourceEvent,t)}}h=ef(v);let S=eM().clickDistance(w).on("start",e=>{let{domNode:n,nodeDragThreshold:r,transform:o,snapGrid:a,snapToGrid:s}=t();d=n?.getBoundingClientRect()||null,f=!1,g=!1,p=e.sourceEvent,0===r&&k(e),i=nL(e.sourceEvent,{transform:o,snapGrid:a,snapToGrid:s,containerBounds:d}),u=nV(e.sourceEvent,d)}).on("drag",e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:o,snapToGrid:a,nodeDragThreshold:h,nodeLookup:g}=t(),m=nL(e.sourceEvent,{transform:r,snapGrid:o,snapToGrid:a,containerBounds:d});if(p=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||b&&!g.has(b))&&(f=!0),!f){if(!l&&n&&c&&(l=!0,E()),!c){let t=nV(e.sourceEvent,d),n=t.x-u.x,r=t.y-u.y;Math.sqrt(n*n+r*r)>h&&k(e)}(i.x!==m.xSnapped||i.y!==m.ySnapped)&&s&&c&&(u=nV(e.sourceEvent,d),_(m))}}).on("end",e=>{if(c&&!f&&(l=!1,c=!1,cancelAnimationFrame(a),s.size>0)){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:i,onSelectionDragStop:a}=t();if(g&&(r(s,!1),g=!1),o||i||!b&&a){let[t,r]=rl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});o?.(e.sourceEvent,s,t,r),i?.(e.sourceEvent,t,r),b||a?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!m||!rs(t,`.${m}`,v))&&(!y||rs(t,y,v))});h.call(S)},destroy:function(){h?.on(".drag",null)}}}({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{oC({id:t,store:s,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),(0,x.useEffect)(()=>{if(!t&&e.current&&d.current)return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:a}),()=>{d.current?.destroy()}},[n,r,t,i,e,o,a]),l}function oA(){let e=rH();return(0,x.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:o,nodesDraggable:i,onError:a,updateNodePositions:s,nodeLookup:l,nodeOrigin:u}=e.getState(),d=new Map,c=e=>e.selected&&(e.draggable||i&&void 0===e.draggable),h=r?o[0]:5,f=r?o[1]:5,g=t.direction.x*h*t.factor,p=t.direction.y*f*t.factor;for(let[,e]of l){if(!c(e))continue;let t={x:e.internals.positionAbsolute.x+g,y:e.internals.positionAbsolute.y+p};r&&(t=nN(t,o));let{position:i,positionAbsolute:s}=nu({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:u,onError:a});e.position=i,e.internals.positionAbsolute=s,d.set(e.id,e)}s(d)},[])}let oO=(0,x.createContext)(null),oz=oO.Provider;oO.Consumer;let oP=()=>(0,x.useContext)(oO),o$=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),oI=(0,x.memo)(oh(function({type:e="source",position:t=p.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:a,onConnect:s,children:l,className:u,onMouseDown:c,onTouchStart:h,...f},g){let m=a||null,y="target"===e,x=rH(),b=oP(),{connectOnClick:_,noPanClassName:E,rfId:k}=rB(o$,rI),{connectingFrom:S,connectingTo:N,clickConnecting:M,isPossibleEndHandle:C,connectionInProcess:j,clickConnectionInProcess:A,valid:O}=rB(t=>{let{connectionClickStartHandle:n,connectionMode:r,connection:o}=t,{fromHandle:i,toHandle:a,isValid:s}=o,l=a?.nodeId===b&&a?.id===m&&a?.type===e;return{connectingFrom:i?.nodeId===b&&i?.id===m&&i?.type===e,connectingTo:l,clickConnecting:n?.nodeId===b&&n?.id===m&&n?.type===e,isPossibleEndHandle:r===d.Strict?i?.type!==e:b!==i?.nodeId||m!==i?.id,connectionInProcess:!!i,clickConnectionInProcess:!!n,valid:l&&s}},rI);b||x.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");let z=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=x.getState(),o={...t,...e};if(r){let{edges:e,setEdges:t}=x.getState();t(((e,t,n={})=>{let r,o;if(!e.source||!e.target)return nS("006","Can't create edge. An edge needs a source and a target."),t;let i=n.getEdgeId||nW;return(o=r=nr(e)?{...e}:{...e,id:i(e)},t.some(e=>e.source===o.source&&e.target===o.target&&(e.sourceHandle===o.sourceHandle||!e.sourceHandle&&!o.sourceHandle)&&(e.targetHandle===o.targetHandle||!e.targetHandle&&!o.targetHandle)))?t:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,t.concat(r))})(o,e))}n?.(o),s?.(o)},P=e=>{if(!b)return;let t="clientX"in e.nativeEvent;if(o&&(t&&0===e.button||!t)){let t=x.getState();rf(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:y,handleId:m,nodeId:b,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>x.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:z,isValidConnection:n||((...e)=>x.getState().isValidConnection?.(...e)??!0),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?c?.(e):h?.(e)};return(0,v.jsx)("div",{"data-handleid":m,"data-nodeid":b,"data-handlepos":t,"data-id":`${k}-${b}-${m}-${e}`,className:w(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,u,{source:!y,target:y,connectable:r,connectablestart:o,connectableend:i,clickconnecting:M,connectingfrom:S,connectingto:N,valid:O,connectionindicator:r&&(!j||C)&&(j||A?i:o)}]),onMouseDown:P,onTouchStart:P,onClick:_?t=>{let{onClickConnectStart:r,onClickConnectEnd:i,connectionClickStartHandle:a,connectionMode:s,isValidConnection:l,lib:u,rfId:d,nodeLookup:c,connection:h}=x.getState();if(!b||!a&&!o)return;if(!a){r?.(t.nativeEvent,{nodeId:b,handleId:m,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:b,type:e,id:m}});return}let f=nT(t.target),g=n||l,{connection:p,isValid:y}=rh(t.nativeEvent,{handle:{nodeId:b,id:m,type:e},connectionMode:s,fromNodeId:a.nodeId,fromHandleId:a.id||null,fromType:a.type,isValidConnection:g,flowId:d,doc:f,lib:u,nodeLookup:c});y&&p&&z(p);let v=structuredClone(h);delete v.inProgress,v.toPosition=v.toHandle?v.toHandle.position:null,i?.(t,v),x.setState({connectionClickStartHandle:null})}:void 0,ref:g,...f,children:l})})),oR={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},oL={input:function({data:e,isConnectable:t,sourcePosition:n=p.Bottom}){return(0,v.jsxs)(v.Fragment,{children:[e?.label,(0,v.jsx)(oI,{type:"source",position:n,isConnectable:t})]})},default:function({data:e,isConnectable:t,targetPosition:n=p.Top,sourcePosition:r=p.Bottom}){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oI,{type:"target",position:n,isConnectable:t}),e?.label,(0,v.jsx)(oI,{type:"source",position:r,isConnectable:t})]})},output:function({data:e,isConnectable:t,targetPosition:n=p.Top}){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oI,{type:"target",position:n,isConnectable:t}),e?.label]})},group:function(){return null}},oD=e=>{let{width:t,height:n,x:r,y:o}=na(e.nodeLookup,{filter:e=>!!e.selected});return{width:nk(t)?t:null,height:nk(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function oT({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=rH(),{width:o,height:i,transformString:a,userSelectionActive:s}=rB(oD,rI),l=oA(),u=(0,x.useRef)(null);(0,x.useEffect)(()=>{n||u.current?.focus({preventScroll:!0})},[n]);let d=!s&&null!==o&&null!==i;if(oj({nodeRef:u,disabled:!d}),!d)return null;let c=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,v.jsx)("div",{className:w(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:(0,v.jsx)("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(oR,e.key)&&(e.preventDefault(),l({direction:oR[e.key],factor:e.shiftKey?4:1}))},style:{width:o,height:i}})})}let oB="u">typeof window?window:void 0,oH=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function oV({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:s,deleteKeyCode:l,selectionKeyCode:u,selectionOnDrag:d,selectionMode:c,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:g,panActivationKeyCode:p,zoomActivationKeyCode:m,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:_,panOnScrollSpeed:E,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:N,defaultViewport:M,translateExtent:C,minZoom:j,maxZoom:A,preventScrolling:O,onSelectionContextMenu:z,noWheelClassName:P,noPanClassName:$,disableKeyboardA11y:I,onViewportChange:R,isControlledViewport:L}){let{nodesSelectionActive:D,userSelectionActive:T}=rB(oH,rI),B=or(u,{target:oB}),H=or(p,{target:oB}),V=H||N,F=H||_,X=d&&!0!==V,Y=B||T||X;return!function({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=rH(),{deleteElements:r}=oy(),o=or(e,{actInsideInputWithModifier:!1}),i=or(t,{target:ox});(0,x.useEffect)(()=>{if(o){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(ov),edges:e.filter(ov)}),n.setState({nodesSelectionActive:!1})}},[o]),(0,x.useEffect)(()=>{n.setState({multiSelectionActive:i})},[i])}({deleteKeyCode:l,multiSelectionKeyCode:g}),(0,v.jsx)(o_,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:F,panOnScrollSpeed:E,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:!B&&V,defaultViewport:M,translateExtent:C,minZoom:j,maxZoom:A,zoomActivationKeyCode:m,preventScrolling:O,noWheelClassName:P,noPanClassName:$,onViewportChange:R,isControlledViewport:L,paneClickDistance:s,selectionOnDrag:X,children:(0,v.jsxs)(oM,{onSelectionStart:h,onSelectionEnd:f,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:V,isSelecting:!!Y,selectionMode:c,selectionKeyPressed:B,paneClickDistance:s,selectionOnDrag:X,children:[e,D&&(0,v.jsx)(oT,{onSelectionContextMenu:z,noPanClassName:$,disableKeyboardA11y:I})]})})}oV.displayName="FlowRenderer";let oF=(0,x.memo)(oV),oX=e=>e.updateNodeInternals;var oY=(0,x.memo)(function({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:a,nodesDraggable:s,elementsSelectable:l,nodesConnectable:u,nodesFocusable:d,resizeObserver:c,noDragClassName:h,noPanClassName:f,disableKeyboardA11y:g,rfId:p,nodeTypes:m,nodeClickDistance:y,onError:b}){let _,{node:E,internals:k,isParent:S}=rB(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},rI),N=E.type||"default",M=m?.[N]||oL[N];void 0===M&&(b?.("003",(_=N,`Node type "${_}" not found. Using fallback type "default".`)),N="default",M=m?.default||oL.default);let C=!!(E.draggable||s&&void 0===E.draggable),j=!!(E.selectable||l&&void 0===E.selectable),A=!!(E.connectable||u&&void 0===E.connectable),O=!!(E.focusable||d&&void 0===E.focusable),z=rH(),P=n$(E),$=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let o=rH(),i=(0,x.useRef)(null),a=(0,x.useRef)(null),s=(0,x.useRef)(e.sourcePosition),l=(0,x.useRef)(e.targetPosition),u=(0,x.useRef)(t),d=n&&!!e.internals.handleBounds;return(0,x.useEffect)(()=>{!i.current||e.hidden||d&&a.current===i.current||(a.current&&r?.unobserve(a.current),r?.observe(i.current),a.current=i.current)},[d,e.hidden]),(0,x.useEffect)(()=>()=>{a.current&&(r?.unobserve(a.current),a.current=null)},[]),(0,x.useEffect)(()=>{if(i.current){let n=u.current!==t,r=s.current!==e.sourcePosition,a=l.current!==e.targetPosition;(n||r||a)&&(u.current=t,s.current=e.sourcePosition,l.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}({node:E,nodeType:N,hasDimensions:P,resizeObserver:c}),I=oj({nodeRef:$,disabled:E.hidden||!C,noDragClassName:h,handleSelector:E.dragHandle,nodeId:e,isSelectable:j,nodeClickDistance:y}),R=oA();if(E.hidden)return null;let L=nP(E),D=void 0===E.internals.handleBounds?{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},T=j||C||t||n||r||o,B=n?e=>n(e,{...k.userNode}):void 0,H=r?e=>r(e,{...k.userNode}):void 0,V=o?e=>o(e,{...k.userNode}):void 0,F=i?e=>i(e,{...k.userNode}):void 0,X=a?e=>a(e,{...k.userNode}):void 0;return(0,v.jsx)("div",{className:w(["react-flow__node",`react-flow__node-${N}`,{[f]:C},E.className,{selected:E.selected,selectable:j,parent:S,draggable:C,dragging:I}]),ref:$,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:P?"visible":"hidden",...E.style,...D},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:H,onMouseLeave:V,onContextMenu:F,onClick:n=>{let{selectNodesOnDrag:r,nodeDragThreshold:o}=z.getState();j&&(!r||!C||o>0)&&oC({id:e,store:z,nodeRef:$}),t&&t(n,{...k.userNode})},onDoubleClick:X,onKeyDown:O?t=>{if(!nH(t.nativeEvent)&&!g){if(t9.includes(t.key)&&j)oC({id:e,store:z,unselect:"Escape"===t.key,nodeRef:$});else if(C&&E.selected&&Object.prototype.hasOwnProperty.call(oR,t.key)){t.preventDefault();let{ariaLabelConfig:e}=z.getState();z.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),R({direction:oR[t.key],factor:t.shiftKey?4:1})}}}:void 0,tabIndex:O?0:void 0,onFocus:O?()=>{if(g||!$.current?.matches(":focus-visible"))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:o,setCenter:i}=z.getState();!o||ns(new Map([[e,E]]),{x:0,y:0,width:n,height:r},t,!0).length>0||i(E.position.x+L.width/2,E.position.y+L.height/2,{zoom:t[2]})}:void 0,role:E.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${rX}-${p}`,"aria-label":E.ariaLabel,...E.domAttributes,children:(0,v.jsx)(oz,{value:e,children:(0,v.jsx)(M,{id:e,data:E.data,type:N,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:E.selected??!1,selectable:j,draggable:C,deletable:E.deletable??!0,isConnectable:A,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:I,dragHandle:E.dragHandle,zIndex:k.z,parentId:E.parentId,...L})})})});let oK=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function oZ(e){var t;let{nodesDraggable:n,nodesConnectable:r,nodesFocusable:o,elementsSelectable:i,onError:a}=rB(oK,rI),s=(t=e.onlyRenderVisibleElements,rB((0,x.useCallback)(e=>t?ns(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(e=>e.id):Array.from(e.nodeLookup.keys()),[t]),rI)),l=function(){let e=rB(oX),[t]=(0,x.useState)(()=>"u"<typeof ResizeObserver?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,x.useEffect)(()=>()=>{t?.disconnect()},[t]),t}();return(0,v.jsx)("div",{className:"react-flow__nodes",style:ob,children:s.map(t=>(0,v.jsx)(oY,{id:t,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:l,nodesDraggable:n,nodesConnectable:r,nodesFocusable:o,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},t))})}oZ.displayName="NodeRenderer";let oq=(0,x.memo)(oZ),oW={[g.Arrow]:({color:e="none",strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,v.jsx)("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[g.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,v.jsx)("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},oU=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:s="auto-start-reverse"})=>{let l,u=(l=rH(),(0,x.useMemo)(()=>{let e;return Object.prototype.hasOwnProperty.call(oW,t)?oW[t]:(l.getState().onError?.("009",(e=t,`Marker type "${e}" doesn't exist.`)),null)},[t]));return u?(0,v.jsx)("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:s,refX:"0",refY:"0",children:(0,v.jsx)(u,{color:n,strokeWidth:a})}):null},oG=({defaultColor:e,rfId:t})=>{let n=rB(e=>e.edges),r=rB(e=>e.defaultEdgeOptions),o=(0,x.useMemo)(()=>(function(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){let i=new Set;return e.reduce((e,a)=>([a.markerStart||r,a.markerEnd||o].forEach(r=>{if(r&&"object"==typeof r){let o=n4(r,t);i.has(o)||(e.push({id:o,color:r.color||n,...r}),i.add(o))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))})(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return o.length?(0,v.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,v.jsx)("defs",{children:o.map(e=>(0,v.jsx)(oU,{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};oG.displayName="MarkerDefinitions";var oQ=(0,x.memo)(oG);function oJ({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:l,className:u,...d}){let[c,h]=(0,x.useState)({x:1,y:0,width:0,height:0}),f=w(["react-flow__edge-textwrapper",u]),g=(0,x.useRef)(null);return((0,x.useEffect)(()=>{if(g.current){let e=g.current.getBBox();h({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n)?(0,v.jsxs)("g",{transform:`translate(${e-c.width/2} ${t-c.height/2})`,className:f,visibility:c.width?"visible":"hidden",...d,children:[o&&(0,v.jsx)("rect",{width:c.width+2*a[0],x:-a[0],y:-a[1],height:c.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:s,ry:s}),(0,v.jsx)("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:g,style:r,children:n}),l]}):null}oJ.displayName="EdgeText";let o0=(0,x.memo)(oJ);function o1({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:s,labelBgBorderRadius:l,interactionWidth:u=20,...d}){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("path",{...d,d:e,fill:"none",className:w(["react-flow__edge-path",d.className])}),u?(0,v.jsx)("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&nk(t)&&nk(n)?(0,v.jsx)(o0,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:s,labelBgBorderRadius:l}):null]})}function o2({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===p.Left||e===p.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function o5({sourceX:e,sourceY:t,sourcePosition:n=p.Bottom,targetX:r,targetY:o,targetPosition:i=p.Top}){let[a,s]=o2({pos:n,x1:e,y1:t,x2:r,y2:o}),[l,u]=o2({pos:i,x1:r,y1:o,x2:e,y2:t}),[d,c,h,f]=nX({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:s,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${s} ${l},${u} ${r},${o}`,d,c,h,f]}function o3(e){return(0,x.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a,targetPosition:s,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:p,markerStart:m,interactionWidth:y})=>{let[x,b,w]=o5({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:s}),_=e.isInternal?void 0:t;return(0,v.jsx)(o1,{id:_,path:x,labelX:b,labelY:w,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:p,markerStart:m,interactionWidth:y})})}let o4=o3({isInternal:!1}),o6=o3({isInternal:!0});function o8(e){return(0,x.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:h,sourcePosition:f=p.Bottom,targetPosition:g=p.Top,markerEnd:m,markerStart:y,pathOptions:x,interactionWidth:b})=>{let[w,_,E]=n0({sourceX:n,sourceY:r,sourcePosition:f,targetX:o,targetY:i,targetPosition:g,borderRadius:x?.borderRadius,offset:x?.offset,stepPosition:x?.stepPosition}),k=e.isInternal?void 0:t;return(0,v.jsx)(o1,{id:k,path:w,labelX:_,labelY:E,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:h,markerEnd:m,markerStart:y,interactionWidth:b})})}o4.displayName="SimpleBezierEdge",o6.displayName="SimpleBezierEdgeInternal";let o9=o8({isInternal:!1}),o7=o8({isInternal:!0});function ie(e){return(0,x.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,v.jsx)(o9,{...n,id:r,pathOptions:(0,x.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}o9.displayName="SmoothStepEdge",o7.displayName="SmoothStepEdgeInternal";let it=ie({isInternal:!1}),ir=ie({isInternal:!0});function io(e){return(0,x.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:h,markerEnd:f,markerStart:g,interactionWidth:p})=>{let[m,y,x]=nU({sourceX:n,sourceY:r,targetX:o,targetY:i}),b=e.isInternal?void 0:t;return(0,v.jsx)(o1,{id:b,path:m,labelX:y,labelY:x,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:h,markerEnd:f,markerStart:g,interactionWidth:p})})}it.displayName="StepEdge",ir.displayName="StepEdgeInternal";let ii=io({isInternal:!1}),ia=io({isInternal:!0});function is(e){return(0,x.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a=p.Bottom,targetPosition:s=p.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:m,markerStart:y,pathOptions:x,interactionWidth:b})=>{let[w,_,E]=nZ({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:s,curvature:x?.curvature}),k=e.isInternal?void 0:t;return(0,v.jsx)(o1,{id:k,path:w,labelX:_,labelY:E,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:m,markerStart:y,interactionWidth:b})})}ii.displayName="StraightEdge",ia.displayName="StraightEdgeInternal";let il=is({isInternal:!1}),iu=is({isInternal:!0});il.displayName="BezierEdge",iu.displayName="BezierEdgeInternal";let id={default:iu,straight:ia,step:ir,smoothstep:o7,simplebezier:o6},ic={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},ih="react-flow__edgeupdater";function ig({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:a,type:s}){return(0,v.jsx)("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:a,className:w([ih,`${ih}-${s}`]),cx:e===p.Left?t-r:e===p.Right?t+r:t,cy:e===p.Top?n-r:e===p.Bottom?n+r:n,r:r,stroke:"transparent",fill:"transparent"})}function ip({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,onReconnect:u,onReconnectStart:d,onReconnectEnd:c,setReconnecting:h,setUpdateHover:f}){let g=rH(),p=(e,t)=>{if(0!==e.button)return;let{autoPanOnConnect:r,domNode:o,connectionMode:i,connectionRadius:a,lib:s,onConnectStart:l,cancelConnection:f,nodeLookup:p,rfId:m,panBy:y,updateConnection:v}=g.getState(),x="target"===t.type;rf(e.nativeEvent,{autoPanOnConnect:r,connectionMode:i,connectionRadius:a,domNode:o,handleId:t.id,nodeId:t.nodeId,nodeLookup:p,isTarget:x,edgeUpdaterType:t.type,lib:s,flowId:m,cancelConnection:f,panBy:y,isValidConnection:(...e)=>g.getState().isValidConnection?.(...e)??!0,onConnect:e=>u?.(n,e),onConnectStart:(r,o)=>{h(!0),d?.(e,n,t.type),l?.(r,o)},onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{h(!1),c?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},m=()=>f(!0),y=()=>f(!1);return(0,v.jsxs)(v.Fragment,{children:[(!0===e||"source"===e)&&(0,v.jsx)(ig,{position:s,centerX:r,centerY:o,radius:t,onMouseDown:e=>p(e,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),onMouseEnter:m,onMouseOut:y,type:"source"}),(!0===e||"target"===e)&&(0,v.jsx)(ig,{position:l,centerX:i,centerY:a,radius:t,onMouseDown:e=>p(e,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),onMouseEnter:m,onMouseOut:y,type:"target"})]})}var im=(0,x.memo)(function({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:a,onMouseEnter:s,onMouseMove:l,onMouseLeave:u,reconnectRadius:c,onReconnect:h,onReconnectStart:f,onReconnectEnd:g,rfId:m,edgeTypes:y,noPanClassName:b,onError:_,disableKeyboardA11y:E}){let k,S=rB(t=>t.edgeLookup.get(e)),N=rB(e=>e.defaultEdgeOptions),M=(S=N?{...N,...S}:S).type||"default",C=y?.[M]||id[M];void 0===C&&(_?.("011",(k=M,`Edge type "${k}" not found. Using fallback type "default".`)),M="default",C=y?.default||id.default);let j=!!(S.focusable||t&&void 0===S.focusable),A=void 0!==h&&(S.reconnectable||n&&void 0===S.reconnectable),O=!!(S.selectable||r&&void 0===S.selectable),z=(0,x.useRef)(null),[P,$]=(0,x.useState)(!1),[I,R]=(0,x.useState)(!1),L=rH(),{zIndex:D,sourceX:T,sourceY:B,targetX:H,targetY:V,sourcePosition:F,targetPosition:X}=rB((0,x.useCallback)(t=>{let n=t.nodeLookup.get(S.source),r=t.nodeLookup.get(S.target);if(!n||!r)return{zIndex:S.zIndex,...ic};let o=function(e){let{sourceNode:t,targetNode:n}=e;if(!n1(t)||!n1(n))return null;let r=t.internals.handleBounds||n2(t.handles),o=n.internals.handleBounds||n2(n.handles),i=n3(r?.source??[],e.sourceHandle),a=n3(e.connectionMode===d.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!i||!a)return e.onError?.("008",((e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:r}", edge id: ${t}.`)(!i?"source":"target",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=i?.position||p.Bottom,l=a?.position||p.Top,u=n5(t,i,s),c=n5(n,a,l);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y,sourcePosition:s,targetPosition:l}}({id:e,sourceNode:n,targetNode:r,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:t.connectionMode,onError:_});return{zIndex:function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if("manual"===i)return r;let a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return(o&&n?r+1e3:r)+a}({selected:S.selected,zIndex:S.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode}),...o||ic}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),rI),Y=(0,x.useMemo)(()=>S.markerStart?`url('#${n4(S.markerStart,m)}')`:void 0,[S.markerStart,m]),K=(0,x.useMemo)(()=>S.markerEnd?`url('#${n4(S.markerEnd,m)}')`:void 0,[S.markerEnd,m]);if(S.hidden||null===T||null===B||null===H||null===V)return null;let Z=i?e=>{i(e,{...S})}:void 0,q=a?e=>{a(e,{...S})}:void 0,W=s?e=>{s(e,{...S})}:void 0,U=l?e=>{l(e,{...S})}:void 0,G=u?e=>{u(e,{...S})}:void 0;return(0,v.jsx)("svg",{style:{zIndex:D},children:(0,v.jsxs)("g",{className:w(["react-flow__edge",`react-flow__edge-${M}`,S.className,b,{selected:S.selected,animated:S.animated,inactive:!O&&!o,updating:P,selectable:O}]),onClick:t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:i}=L.getState();O&&(L.setState({nodesSelectionActive:!1}),S.selected&&i?(r({nodes:[],edges:[S]}),z.current?.blur()):n([e])),o&&o(t,S)},onDoubleClick:Z,onContextMenu:q,onMouseEnter:W,onMouseMove:U,onMouseLeave:G,onKeyDown:j?t=>{if(!E&&t9.includes(t.key)&&O){let{unselectNodesAndEdges:n,addSelectedEdges:r}=L.getState();"Escape"===t.key?(z.current?.blur(),n({edges:[S]})):r([e])}}:void 0,tabIndex:j?0:void 0,role:S.ariaRole??(j?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===S.ariaLabel?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":j?`${rY}-${m}`:void 0,ref:z,...S.domAttributes,children:[!I&&(0,v.jsx)(C,{id:e,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:O,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:T,sourceY:B,targetX:H,targetY:V,sourcePosition:F,targetPosition:X,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:Y,markerEnd:K,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),A&&(0,v.jsx)(ip,{edge:S,isReconnectable:A,reconnectRadius:c,onReconnect:h,onReconnectStart:f,onReconnectEnd:g,sourceX:T,sourceY:B,targetX:H,targetY:V,sourcePosition:F,targetPosition:X,setUpdateHover:$,setReconnecting:R})]})})});let iy=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function iv({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:s,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:c,onEdgeDoubleClick:h,onReconnectStart:f,onReconnectEnd:g,disableKeyboardA11y:p}){let{edgesFocusable:m,edgesReconnectable:y,elementsSelectable:b,onError:w}=rB(iy,rI),_=rB((0,x.useCallback)(e=>{if(!t)return e.edges.map(e=>e.id);let n=[];if(e.width&&e.height)for(let t of e.edges){let r=e.nodeLookup.get(t.source),o=e.nodeLookup.get(t.target);r&&o&&function({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){let i=nm(nb(e),nb(t));return i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1),n_({x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]},nv(i))>0}({sourceNode:r,targetNode:o,width:e.width,height:e.height,transform:e.transform})&&n.push(t.id)}return n},[t]),rI);return(0,v.jsxs)("div",{className:"react-flow__edges",children:[(0,v.jsx)(oQ,{defaultColor:e,rfId:n}),_.map(e=>(0,v.jsx)(im,{id:e,edgesFocusable:m,edgesReconnectable:y,elementsSelectable:b,noPanClassName:o,onReconnect:i,onContextMenu:a,onMouseEnter:s,onMouseMove:l,onMouseLeave:u,onClick:d,reconnectRadius:c,onDoubleClick:h,onReconnectStart:f,onReconnectEnd:g,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:p},e))]})}iv.displayName="EdgeRenderer";let ix=(0,x.memo)(iv),ib=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function iw({children:e}){let t=rB(ib);return(0,v.jsx)("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}let i_=e=>e.panZoom?.syncViewport;function iE(e){return e.connection.inProgress?{...e.connection,to:nM(e.connection.to,e.transform)}:{...e.connection}}let ik=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function iS({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:o,width:i,height:a,isValid:s,inProgress:l}=rB(ik,rI);return i&&o&&l?(0,v.jsx)("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:(0,v.jsx)("g",{className:w(["react-flow__connection",nn(s)]),children:(0,v.jsx)(iN,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}let iN=({style:e,type:t=f.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:o,from:i,fromNode:a,fromHandle:s,fromPosition:l,to:u,toNode:d,toHandle:c,toPosition:h,pointer:g}=rB(iE,rI);if(!o)return;if(n)return(0,v.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:s,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:l,toPosition:h,connectionStatus:nn(r),toNode:d,toHandle:c,pointer:g});let p="",m={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case f.Bezier:[p]=nZ(m);break;case f.SimpleBezier:[p]=o5(m);break;case f.Step:[p]=n0({...m,borderRadius:0});break;case f.SmoothStep:[p]=n0(m);break;default:[p]=nU(m)}return(0,v.jsx)("path",{d:p,fill:"none",className:"react-flow__connection-path",style:e})};iN.displayName="ConnectionLine";let iM={};function iC(e=iM){(0,x.useRef)(e),rH(),(0,x.useEffect)(()=>{},[e])}function ij({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:c,onSelectionStart:h,onSelectionEnd:f,connectionLineType:g,connectionLineStyle:p,connectionLineComponent:m,connectionLineContainerStyle:y,selectionKeyCode:b,selectionOnDrag:w,selectionMode:_,multiSelectionKeyCode:E,panActivationKeyCode:k,zoomActivationKeyCode:S,deleteKeyCode:N,onlyRenderVisibleElements:M,elementsSelectable:C,defaultViewport:j,translateExtent:A,minZoom:O,maxZoom:z,preventScrolling:P,defaultMarkerColor:$,zoomOnScroll:I,zoomOnPinch:R,panOnScroll:L,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:B,panOnDrag:H,onPaneClick:V,onPaneMouseEnter:F,onPaneMouseMove:X,onPaneMouseLeave:Y,onPaneScroll:K,onPaneContextMenu:Z,paneClickDistance:q,nodeClickDistance:W,onEdgeContextMenu:U,onEdgeMouseEnter:G,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,onReconnect:et,onReconnectStart:en,onReconnectEnd:er,noDragClassName:eo,noWheelClassName:ei,noPanClassName:ea,disableKeyboardA11y:es,nodeExtent:el,rfId:eu,viewport:ed,onViewportChange:ec}){let eh,ef,eg,ep;return iC(e),iC(t),rH(),(0,x.useRef)(!1),(0,x.useEffect)(()=>{},[]),eh=oy(),ef=(0,x.useRef)(!1),(0,x.useEffect)(()=>{!ef.current&&eh.viewportInitialized&&n&&(setTimeout(()=>n(eh),1),ef.current=!0)},[n,eh.viewportInitialized]),eg=rB(i_),ep=rH(),(0,x.useEffect)(()=>{ed&&(eg?.(ed),ep.setState({transform:[ed.x,ed.y,ed.zoom]}))},[ed,eg]),(0,v.jsx)(oF,{onPaneClick:V,onPaneMouseEnter:F,onPaneMouseMove:X,onPaneMouseLeave:Y,onPaneContextMenu:Z,onPaneScroll:K,paneClickDistance:q,deleteKeyCode:N,selectionKeyCode:b,selectionOnDrag:w,selectionMode:_,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:E,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:C,zoomOnScroll:I,zoomOnPinch:R,zoomOnDoubleClick:B,panOnScroll:L,panOnScrollSpeed:D,panOnScrollMode:T,panOnDrag:H,defaultViewport:j,translateExtent:A,minZoom:O,maxZoom:z,onSelectionContextMenu:c,preventScrolling:P,noDragClassName:eo,noWheelClassName:ei,noPanClassName:ea,disableKeyboardA11y:es,onViewportChange:ec,isControlledViewport:!!ed,children:(0,v.jsxs)(iw,{children:[(0,v.jsx)(ix,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:a,onReconnect:et,onReconnectStart:en,onReconnectEnd:er,onlyRenderVisibleElements:M,onEdgeContextMenu:U,onEdgeMouseEnter:G,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,defaultMarkerColor:$,noPanClassName:ea,disableKeyboardA11y:es,rfId:eu}),(0,v.jsx)(iS,{style:p,type:g,component:m,containerStyle:y}),(0,v.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,v.jsx)(oq,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:s,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:W,onlyRenderVisibleElements:M,noPanClassName:ea,noDragClassName:eo,disableKeyboardA11y:es,nodeExtent:el,rfId:eu}),(0,v.jsx)("div",{className:"react-flow__viewport-portal"})]})})}ij.displayName="GraphView";let iA=(0,x.memo)(ij),iO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:s,minZoom:l=.5,maxZoom:u=2,nodeOrigin:c,nodeExtent:h,zIndexMode:f="basic"}={})=>{let g=new Map,p=new Map,m=new Map,y=new Map,v=r??t??[],x=n??e??[],b=c??[0,0],w=h??t8;ra(m,y,v);let{nodesInitialized:_}=re(x,g,p,{nodeOrigin:b,nodeExtent:w,zIndexMode:f}),E=[0,0,1];if(a&&o&&i){let{x:e,y:t,zoom:n}=nA(na(g,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),o,i,l,u,s?.padding??.1);E=[e,t,n]}return{rfId:"1",width:o??0,height:i??0,transform:E,nodes:x,nodesInitialized:_,nodeLookup:g,parentLookup:p,edges:v,edgeLookup:y,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==r,panZoom:null,minZoom:l,maxZoom:u,translateExtent:t8,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:d.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,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:a??!1,fitViewOptions:s,fitViewResolver:null,connection:{...ne},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:nS,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:t7,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}};function iz({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:a,initialMaxZoom:s,initialFitViewOptions:l,fitView:u,nodeOrigin:d,nodeExtent:c,zIndexMode:h,children:f}){let[g]=(0,x.useState)(()=>(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:c,zIndexMode:h})=>{let f,g;return f=(f,g)=>{async function m(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:o,height:i,minZoom:a,maxZoom:s}=g();t&&(await nl({nodes:e,width:o,height:i,panZoom:t,minZoom:a,maxZoom:s},n),r?.resolve(!0),f({fitViewResolver:null}))}return{...iO({nodes:e,edges:t,width:o,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:c,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:o,fitViewQueued:i,zIndexMode:a,nodesSelectionActive:s}=g(),{nodesInitialized:l,hasSelectedNodes:u}=re(e,t,n,{nodeOrigin:r,nodeExtent:c,elevateNodesOnSelect:o,checkEquality:!0,zIndexMode:a}),d=s&&u;i&&l?(m(),f({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):f({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=g();ra(t,n,e),f({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=g();t(e),f({hasDefaultNodes:!0})}if(t){let{setEdges:e}=g();e(t),f({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:o,nodeOrigin:i,nodeExtent:a,debug:s,fitViewQueued:l,zIndexMode:u}=g(),{changes:d,updatedInternals:c}=function(e,t,n,r,o,i,a){let s=r?.querySelector(".xyflow__viewport"),l=!1;if(!s)return{changes:[],updatedInternals:l};let u=[],d=window.getComputedStyle(s),{m22:c}=new window.DOMMatrixReadOnly(d.transform),h=[];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}}),l=!0;continue}let s=nD(r.nodeElement),d=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(d||!e.internals.handleBounds||r.force)){let f=r.nodeElement.getBoundingClientRect(),g=nz(e.extent)?e.extent:i,{positionAbsolute:p}=e.internals;e.parentId&&"parent"===e.extent?p=nf(p,s,t.get(e.parentId)):g&&(p=nh(p,g,s));let m={...e,measured:s,internals:{...e.internals,positionAbsolute:p,handleBounds:{source:nF("source",r.nodeElement,f,c,e.id),target:nF("target",r.nodeElement,f,c,e.id)}}};t.set(e.id,m),e.parentId&&rt(m,t,n,{nodeOrigin:o,zIndexMode:a}),l=!0,d&&(u.push({id:e.id,type:"dimensions",dimensions:s}),e.expandParent&&e.parentId&&h.push({id:e.id,parentId:e.parentId,rect:nx(m,o)}))}}if(h.length>0){let e=rr(h,t,n,o);u.push(...e)}return{changes:u,updatedInternals:l}}(e,n,r,o,i,a,u);c&&(!function(e,t,n){let r=n9(n6,n);for(let n of e.values())if(n.parentId)rt(n,e,t,r);else{let e=nh(ni(n,r.nodeOrigin),nz(n.extent)?n.extent:r.nodeExtent,nP(n));n.internals.positionAbsolute=e}}(n,r,{nodeOrigin:i,nodeExtent:a,zIndexMode:u}),l?(m(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),d?.length>0&&(s&&console.log("React Flow: trigger node changes",d),t?.(d)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:o,triggerNodeChanges:i,connection:a,updateConnection:s,onNodesChangeMiddlewareMap:l}=g();for(let[i,l]of e){let e=o.get(i),u=!!(e?.expandParent&&e?.parentId&&l?.position),d={id:i,type:"position",position:u?{x:Math.max(0,l.position.x),y:Math.max(0,l.position.y)}:l.position,dragging:t};if(e&&a.inProgress&&a.fromNode.id===e.id){let t=n5(e,a.fromHandle,p.Left,!0);s({...a,from:t})}u&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...l.internals.positionAbsolute,width:l.measured.width??0,height:l.measured.height??0}}),r.push(d)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=g(),i=rr(n,o,e,t);r.push(...i)}for(let e of l.values())r=e(r);i(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:o,debug:i}=g();e?.length&&(o&&n(oa(e,r)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:o,debug:i}=g();e?.length&&(o&&n(oa(e,r)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:o,triggerEdgeChanges:i}=g();t?o(e.map(e=>os(e,!0))):(o(ol(r,new Set([...e]),!0)),i(ol(n)))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:o,triggerEdgeChanges:i}=g();t?i(e.map(e=>os(e,!0))):(i(ol(n,new Set([...e]))),o(ol(r,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:o,triggerNodeChanges:i,triggerEdgeChanges:a}=g(),s=[];for(let t of e||r){if(!t.selected)continue;let e=o.get(t.id);e&&(e.selected=!1),s.push(os(t.id,!1))}let l=[];for(let e of t||n)e.selected&&l.push(os(e.id,!1));i(s),a(l)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=g();t?.setScaleExtent([e,n]),f({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=g();t?.setScaleExtent([n,e]),f({maxZoom:e})},setTranslateExtent:e=>{g().panZoom?.setTranslateExtent(e),f({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:o}=g();if(!o)return;let i=t.reduce((e,t)=>t.selected?[...e,os(t.id,!1)]:e,[]),a=e.reduce((e,t)=>t.selected?[...e,os(t.id,!1)]:e,[]);n(i),r(a)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:o,elevateNodesOnSelect:i,nodeExtent:a,zIndexMode:s}=g();(e[0][0]!==a[0][0]||e[0][1]!==a[0][1]||e[1][0]!==a[1][0]||e[1][1]!==a[1][1])&&(re(t,n,r,{nodeOrigin:o,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1,zIndexMode:s}),f({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:o,translateExtent:i}=g();return ro({delta:e,panZoom:o,transform:t,translateExtent:i,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:o,maxZoom:i,panZoom:a}=g();if(!a)return Promise.resolve(!1);let s=void 0!==n?.zoom?n.zoom:i;return await a.setViewport({x:r/2-e*s,y:o/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{f({connection:{...ne}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...iO()})}},g=Object.is,f?r$(f,g):r$})({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:u,minZoom:a,maxZoom:s,fitViewOptions:l,nodeOrigin:d,nodeExtent:c,zIndexMode:h}));return(0,v.jsx)(rD,{value:g,children:(0,v.jsx)(op,{children:f})})}function iP({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:a,fitView:s,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:c,nodeExtent:h,zIndexMode:f}){return(0,x.useContext)(rL)?(0,v.jsx)(v.Fragment,{children:e}):(0,v.jsx)(iz,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:a,fitView:s,initialFitViewOptions:l,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:c,nodeExtent:h,zIndexMode:f,children:e})}let i$={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var iI=oh(function({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:a,onNodeClick:s,onEdgeClick:l,onInit:u,onMove:d,onMoveStart:g,onMoveEnd:p,onConnect:m,onConnectStart:y,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:E,onNodeMouseEnter:k,onNodeMouseMove:S,onNodeMouseLeave:N,onNodeContextMenu:M,onNodeDoubleClick:C,onNodeDragStart:j,onNodeDrag:A,onNodeDragStop:O,onNodesDelete:z,onEdgesDelete:P,onDelete:$,onSelectionChange:I,onSelectionDragStart:R,onSelectionDrag:L,onSelectionDragStop:D,onSelectionContextMenu:T,onSelectionStart:B,onSelectionEnd:H,onBeforeDelete:V,connectionMode:F,connectionLineType:X=f.Bezier,connectionLineStyle:Y,connectionLineComponent:K,connectionLineContainerStyle:Z,deleteKeyCode:q="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:U=!1,selectionMode:G=h.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:J=nO()?"Meta":"Control",zoomActivationKeyCode:ee=nO()?"Meta":"Control",snapToGrid:et,snapGrid:en,onlyRenderVisibleElements:er=!1,selectNodesOnDrag:eo,nodesDraggable:ei,autoPanOnNodeFocus:ea,nodesConnectable:es,nodesFocusable:el,nodeOrigin:eu=r4,edgesFocusable:ed,edgesReconnectable:ec,elementsSelectable:eh=!0,defaultViewport:ef=r6,minZoom:eg=.5,maxZoom:ep=2,translateExtent:em=t8,preventScrolling:ey=!0,nodeExtent:ev,defaultMarkerColor:ex="#b1b1b7",zoomOnScroll:eb=!0,zoomOnPinch:ew=!0,panOnScroll:e_=!1,panOnScrollSpeed:eE=.5,panOnScrollMode:ek=c.Free,zoomOnDoubleClick:eS=!0,panOnDrag:eN=!0,onPaneClick:eM,onPaneMouseEnter:eC,onPaneMouseMove:ej,onPaneMouseLeave:eA,onPaneScroll:eO,onPaneContextMenu:ez,paneClickDistance:eP=1,nodeClickDistance:e$=0,children:eI,onReconnect:eR,onReconnectStart:eL,onReconnectEnd:eD,onEdgeContextMenu:eT,onEdgeDoubleClick:eB,onEdgeMouseEnter:eH,onEdgeMouseMove:eV,onEdgeMouseLeave:eF,reconnectRadius:eX=10,onNodesChange:eY,onEdgesChange:eK,noDragClassName:eZ="nodrag",noWheelClassName:eq="nowheel",noPanClassName:eW="nopan",fitView:eU,fitViewOptions:eG,connectOnClick:eQ,attributionPosition:eJ,proOptions:e0,defaultEdgeOptions:e1,elevateNodesOnSelect:e2=!0,elevateEdgesOnSelect:e5=!1,disableKeyboardA11y:e3=!1,autoPanOnConnect:e4,autoPanOnNodeDrag:e6,autoPanSpeed:e8,connectionRadius:e9,isValidConnection:e7,onError:te,style:tt,id:tn,nodeDragThreshold:tr,connectionDragThreshold:to,viewport:ti,onViewportChange:ta,width:ts,height:tl,colorMode:tu="light",debug:td,onScroll:tc,ariaLabelConfig:th,zIndexMode:tf="basic",...tg},tp){let tm=tn||"1",ty=function(e){let[t,n]=(0,x.useState)("system"===e?null:e);return(0,x.useEffect)(()=>{if("system"!==e)return void n(e);let t=ot(),r=()=>n(t?.matches?"dark":"light");return r(),t?.addEventListener("change",r),()=>{t?.removeEventListener("change",r)}},[e]),null!==t?t:ot()?.matches?"dark":"light"}(tu),tv=(0,x.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),tc?.(e)},[tc]);return(0,v.jsx)("div",{"data-testid":"rf__wrapper",...tg,onScroll:tv,style:{...tt,...i$},ref:tp,className:w(["react-flow",o,ty]),id:tn,role:"application",children:(0,v.jsxs)(iP,{nodes:e,edges:t,width:ts,height:tl,fitView:eU,fitViewOptions:eG,minZoom:eg,maxZoom:ep,nodeOrigin:eu,nodeExtent:ev,zIndexMode:tf,children:[(0,v.jsx)(oe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:y,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:E,nodesDraggable:ei,autoPanOnNodeFocus:ea,nodesConnectable:es,nodesFocusable:el,edgesFocusable:ed,edgesReconnectable:ec,elementsSelectable:eh,elevateNodesOnSelect:e2,elevateEdgesOnSelect:e5,minZoom:eg,maxZoom:ep,nodeExtent:ev,onNodesChange:eY,onEdgesChange:eK,snapToGrid:et,snapGrid:en,connectionMode:F,translateExtent:em,connectOnClick:eQ,defaultEdgeOptions:e1,fitView:eU,fitViewOptions:eG,onNodesDelete:z,onEdgesDelete:P,onDelete:$,onNodeDragStart:j,onNodeDrag:A,onNodeDragStop:O,onSelectionDrag:L,onSelectionDragStart:R,onSelectionDragStop:D,onMove:d,onMoveStart:g,onMoveEnd:p,noPanClassName:eW,nodeOrigin:eu,rfId:tm,autoPanOnConnect:e4,autoPanOnNodeDrag:e6,autoPanSpeed:e8,onError:te,connectionRadius:e9,isValidConnection:e7,selectNodesOnDrag:eo,nodeDragThreshold:tr,connectionDragThreshold:to,onBeforeDelete:V,debug:td,ariaLabelConfig:th,zIndexMode:tf}),(0,v.jsx)(iA,{onInit:u,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:k,onNodeMouseMove:S,onNodeMouseLeave:N,onNodeContextMenu:M,onNodeDoubleClick:C,nodeTypes:i,edgeTypes:a,connectionLineType:X,connectionLineStyle:Y,connectionLineComponent:K,connectionLineContainerStyle:Z,selectionKeyCode:W,selectionOnDrag:U,selectionMode:G,deleteKeyCode:q,multiSelectionKeyCode:J,panActivationKeyCode:Q,zoomActivationKeyCode:ee,onlyRenderVisibleElements:er,defaultViewport:ef,translateExtent:em,minZoom:eg,maxZoom:ep,preventScrolling:ey,zoomOnScroll:eb,zoomOnPinch:ew,zoomOnDoubleClick:eS,panOnScroll:e_,panOnScrollSpeed:eE,panOnScrollMode:ek,panOnDrag:eN,onPaneClick:eM,onPaneMouseEnter:eC,onPaneMouseMove:ej,onPaneMouseLeave:eA,onPaneScroll:eO,onPaneContextMenu:ez,paneClickDistance:eP,nodeClickDistance:e$,onSelectionContextMenu:T,onSelectionStart:B,onSelectionEnd:H,onReconnect:eR,onReconnectStart:eL,onReconnectEnd:eD,onEdgeContextMenu:eT,onEdgeDoubleClick:eB,onEdgeMouseEnter:eH,onEdgeMouseMove:eV,onEdgeMouseLeave:eF,reconnectRadius:eX,defaultMarkerColor:ex,noDragClassName:eZ,noWheelClassName:eq,noPanClassName:eW,rfId:tm,disableKeyboardA11y:e3,nodeExtent:ev,viewport:ti,onViewportChange:ta}),(0,v.jsx)(r5,{onSelectionChange:I}),eI,(0,v.jsx)(rG,{proOptions:e0,position:eJ}),(0,v.jsx)(rW,{rfId:tm,disableKeyboardA11y:e3})]})})});let iR=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function iL({children:e}){let t=rB(iR);return t?(0,rR.createPortal)(e,t):null}function iD({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,v.jsx)("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:w(["react-flow__background-pattern",n,r])})}function iT({radius:e,className:t}){return(0,v.jsx)("circle",{cx:e,cy:e,r:e,className:w(["react-flow__background-pattern","dots",t])})}(l=y||(y={})).Lines="lines",l.Dots="dots",l.Cross="cross";let iB={[y.Dots]:1,[y.Lines]:1,[y.Cross]:6},iH=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function iV({id:e,variant:t=y.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:a,bgColor:s,style:l,className:u,patternClassName:d}){let c=(0,x.useRef)(null),{transform:h,patternId:f}=rB(iH,rI),g=r||iB[t],p=t===y.Dots,m=t===y.Cross,b=Array.isArray(n)?n:[n,n],_=[b[0]*h[2]||1,b[1]*h[2]||1],E=g*h[2],k=Array.isArray(i)?i:[i,i],S=m?[E,E]:_,N=[k[0]*h[2]||1+S[0]/2,k[1]*h[2]||1+S[1]/2],M=`${f}${e||""}`;return(0,v.jsxs)("svg",{className:w(["react-flow__background",u]),style:{...l,...ob,"--xy-background-color-props":s,"--xy-background-pattern-color-props":a},ref:c,"data-testid":"rf__background",children:[(0,v.jsx)("pattern",{id:M,x:h[0]%_[0],y:h[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:p?(0,v.jsx)(iT,{radius:E/2,className:d}):(0,v.jsx)(iD,{dimensions:S,lineWidth:o,variant:t,className:d})}),(0,v.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}iV.displayName="Background";let iF=(0,x.memo)(iV);function iX(){return(0,v.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:(0,v.jsx)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function iY(){return(0,v.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:(0,v.jsx)("path",{d:"M0 0h32v4.2H0z"})})}function iK(){return(0,v.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:(0,v.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 iZ(){return(0,v.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,v.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 iq(){return(0,v.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,v.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 iW({children:e,className:t,...n}){return(0,v.jsx)("button",{type:"button",className:w(["react-flow__controls-button",t]),...n,children:e})}let iU=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function iG({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:a,onFitView:s,onInteractiveChange:l,className:u,children:d,position:c="bottom-left",orientation:h="vertical","aria-label":f}){let g=rH(),{isInteractive:p,minZoomReached:m,maxZoomReached:y,ariaLabelConfig:x}=rB(iU,rI),{zoomIn:b,zoomOut:_,fitView:E}=oy();return(0,v.jsxs)(rU,{className:w(["react-flow__controls","horizontal"===h?"horizontal":"vertical",u]),position:c,style:e,"data-testid":"rf__controls","aria-label":f??x["controls.ariaLabel"],children:[t&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(iW,{onClick:()=>{b(),i?.()},className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:(0,v.jsx)(iX,{})}),(0,v.jsx)(iW,{onClick:()=>{_(),a?.()},className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:m,children:(0,v.jsx)(iY,{})})]}),n&&(0,v.jsx)(iW,{className:"react-flow__controls-fitview",onClick:()=>{E(o),s?.()},title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:(0,v.jsx)(iK,{})}),r&&(0,v.jsx)(iW,{className:"react-flow__controls-interactive",onClick:()=>{g.setState({nodesDraggable:!p,nodesConnectable:!p,elementsSelectable:!p}),l?.(!p)},title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:p?(0,v.jsx)(iq,{}):(0,v.jsx)(iZ,{})}),d]})}iG.displayName="Controls",(0,x.memo)(iG);let iQ=(0,x.memo)(function({id:e,x:t,y:n,width:r,height:o,style:i,color:a,strokeColor:s,strokeWidth:l,className:u,borderRadius:d,shapeRendering:c,selected:h,onClick:f}){let{background:g,backgroundColor:p}=i||{};return(0,v.jsx)("rect",{className:w(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:o,style:{fill:a||g||p,stroke:s,strokeWidth:l},shapeRendering:c,onClick:f?t=>f(t,e):void 0})}),iJ=e=>e.nodes.map(e=>e.id),i0=e=>e instanceof Function?e:()=>e,i1=(0,x.memo)(function({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:s,onClick:l}){let{node:u,x:d,y:c,width:h,height:f}=rB(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:o,y:i}=n.internals.positionAbsolute,{width:a,height:s}=nP(r);return{node:r,x:o,y:i,width:a,height:s}},rI);return u&&!u.hidden&&n$(u)?(0,v.jsx)(s,{x:d,y:c,width:h,height:f,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:o,strokeColor:n(u),strokeWidth:i,shapeRendering:a,onClick:l,id:u.id}):null});var i2=(0,x.memo)(function({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=iQ,onClick:a}){let s=rB(iJ,rI),l=i0(t),u=i0(e),d=i0(n),c="u"<typeof window||window.chrome?"crispEdges":"geometricPrecision";return(0,v.jsx)(v.Fragment,{children:s.map(e=>(0,v.jsx)(i1,{id:e,nodeColorFunc:l,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:a,shapeRendering:c},e))})});let i5=e=>!e.hidden,i3=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?nw(na(e.nodeLookup,{filter:i5}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}};function i4({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:s,bgColor:l,maskColor:u,maskStrokeColor:d,maskStrokeWidth:c,position:h="bottom-right",onClick:f,onNodeClick:g,pannable:p=!1,zoomable:m=!1,ariaLabel:y,inversePan:b,zoomStep:_=1,offsetScale:E=5}){let k=rH(),S=(0,x.useRef)(null),{boundingRect:N,viewBB:M,rfId:C,panZoom:j,translateExtent:A,flowWidth:O,flowHeight:z,ariaLabelConfig:P}=rB(i3,rI),$=e?.width??200,I=e?.height??150,R=Math.max(N.width/$,N.height/I),L=R*$,D=R*I,T=E*R,B=N.x-(L-N.width)/2-T,H=N.y-(D-N.height)/2-T,V=L+2*T,F=D+2*T,X=`react-flow__minimap-desc-${C}`,Y=(0,x.useRef)(0),K=(0,x.useRef)();Y.current=R,(0,x.useEffect)(()=>{if(S.current&&j)return K.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let o=ef(e);return{update:function({translateExtent:e,width:i,height:a,zoomStep:s=1,pannable:l=!0,zoomable:u=!0,inversePan:d=!1}){let c=[0,0],h=t4().on("start",e=>{("mousedown"===e.sourceEvent.type||"touchstart"===e.sourceEvent.type)&&(c=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?o=>{let s=n();if("mousemove"!==o.sourceEvent.type&&"touchmove"!==o.sourceEvent.type||!t)return;let l=[o.sourceEvent.clientX??o.sourceEvent.touches[0].clientX,o.sourceEvent.clientY??o.sourceEvent.touches[0].clientY],u=[l[0]-c[0],l[1]-c[1]];c=l;let h=r()*Math.max(s[2],Math.log(s[2]))*(d?-1:1),f={x:s[0]-u[0]*h,y:s[1]-u[1]*h};t.setViewportConstrained({x:f.x,y:f.y,zoom:s[2]},[[0,0],[i,a]],e)}:null).on("zoom.wheel",u?e=>{if("wheel"!==e.sourceEvent.type||!t)return;let r=n(),o=e.sourceEvent.ctrlKey&&nO()?10:1,i=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*s,a=r[2]*Math.pow(2,i*o);t.scaleTo(a)}:null);o.call(h,{})},destroy:function(){o.on("zoom",null)},pointer:eg}}({domNode:S.current,panZoom:j,getTransform:()=>k.getState().transform,getViewScale:()=>Y.current}),()=>{K.current?.destroy()}},[j]),(0,x.useEffect)(()=>{K.current?.update({translateExtent:A,width:O,height:z,inversePan:b,pannable:p,zoomStep:_,zoomable:m})},[p,m,b,_,A,O,z]);let Z=f?e=>{let[t,n]=K.current?.pointer(e)||[0,0];f(e,{x:t,y:n})}:void 0,q=g?(0,x.useCallback)((e,t)=>{g(e,k.getState().nodeLookup.get(t).internals.userNode)},[]):void 0,W=y??P["minimap.ariaLabel"];return(0,v.jsx)(rU,{position:h,style:{...e,"--xy-minimap-background-color-props":"string"==typeof l?l:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof u?u:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof c?c*R:void 0,"--xy-minimap-node-background-color-props":"string"==typeof r?r:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof n?n:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof a?a:void 0},className:w(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:(0,v.jsxs)("svg",{width:$,height:I,viewBox:`${B} ${H} ${V} ${F}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":X,ref:S,onClick:Z,children:[W&&(0,v.jsx)("title",{id:X,children:W}),(0,v.jsx)(i2,{onClick:q,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:a,nodeComponent:s}),(0,v.jsx)("path",{className:"react-flow__minimap-mask",d:`M${B-T},${H-T}h${V+2*T}v${F+2*T}h${-V-2*T}z
|
|
2
|
-
M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}i4.displayName="MiniMap",(0,x.memo)(i4);let i6={[m.Line]:"right",[m.Handle]:"bottom-right"};(0,x.memo)(function({nodeId:e,position:t,variant:n=m.Handle,className:r,style:o,children:i,color:a,minWidth:s=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:h,autoScale:f=!0,shouldResize:g,onResizeStart:p,onResize:y,onResizeEnd:b}){let _,E=oP(),k="string"==typeof e?e:E,S=rH(),N=(0,x.useRef)(null),M=n===m.Handle,C=rB((0,x.useCallback)((_=M&&f,e=>_?`${Math.max(1/e.transform[2],1)}`:void 0),[M,f]),rI),j=(0,x.useRef)(null),A=t??i6[n];(0,x.useEffect)(()=>{if(N.current&&k)return j.current||(j.current=function({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){let i=ef(e),a={controlDirection:rw("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:s,keepAspectRatio:l,resizeDirection:u,onResizeStart:d,onResize:c,onResizeEnd:h,shouldResize:f}){let g,p,m,y,v={...rS},x={...rN};a={boundaries:s,resizeDirection:u,keepAspectRatio:l,controlDirection:rw(e)};let b=null,w=[],_=!1,E=eM().on("start",e=>{let{nodeLookup:r,transform:o,snapGrid:i,snapToGrid:a,nodeOrigin:s,paneDomNode:l}=n();if(!(g=r.get(t)))return;b=l?.getBoundingClientRect()??null;let{xSnapped:u,ySnapped:c}=nL(e.sourceEvent,{transform:o,snapGrid:i,snapToGrid:a,containerBounds:b});if(x={...v={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},pointerX:u,pointerY:c,aspectRatio:v.width/v.height},p=void 0,g.parentId&&("parent"===g.extent||g.expandParent)){var h;m=(p=r.get(g.parentId))&&"parent"===g.extent?[[0,0],[(h=p).measured.width,h.measured.height]]:void 0}for(let[e,n]of(w=[],y=void 0,r))if(n.parentId===t&&(w.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){let e=function(e,t,n){let r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,s=n[0]*i,l=n[1]*a;return[[r-s,o-l],[r+i-s,o+a-l]]}(n,g,n.origin??s);y=y?[[Math.min(e[0][0],y[0][0]),Math.min(e[0][1],y[0][1])],[Math.max(e[1][0],y[1][0]),Math.max(e[1][1],y[1][1])]]:e}d?.(e,{...v})}).on("drag",e=>{let{transform:t,snapGrid:o,snapToGrid:i,nodeOrigin:s}=n(),l=nL(e.sourceEvent,{transform:t,snapGrid:o,snapToGrid:i,containerBounds:b}),u=[];if(!g)return;let{x:d,y:h,width:E,height:k}=v,S={},N=g.origin??s,{width:M,height:C,x:j,y:A}=function(e,t,n,r,o,i,a,s){var l,u,d,c;let{affectsX:h,affectsY:f}=t,{isHorizontal:g,isVertical:p}=t,m=g&&p,{xSnapped:y,ySnapped:v}=n,{minWidth:x,maxWidth:b,minHeight:w,maxHeight:_}=r,{x:E,y:k,width:S,height:N,aspectRatio:M}=e,C=Math.floor(g?y-e.pointerX:0),j=Math.floor(p?v-e.pointerY:0),A=S+(h?-C:C),O=N+(f?-j:j),z=-i[0]*S,P=-i[1]*N,$=rk(A,x,b),I=rk(O,w,_);if(a){let e=0,t=0;h&&C<0?e=r_(E+C+z,a[0][0]):!h&&C>0&&(e=rE(E+A+z,a[1][0])),f&&j<0?t=r_(k+j+P,a[0][1]):!f&&j>0&&(t=rE(k+O+P,a[1][1])),$=Math.max($,e),I=Math.max(I,t)}if(s){let e=0,t=0;h&&C>0?e=rE(E+C,s[0][0]):!h&&C<0&&(e=r_(E+A,s[1][0])),f&&j>0?t=rE(k+j,s[0][1]):!f&&j<0&&(t=r_(k+O,s[1][1])),$=Math.max($,e),I=Math.max(I,t)}if(o){if(g){($=Math.max($,rk(A/M,w,_)*M),a)&&($=Math.max($,(h||f)&&(!h||f||!m)?r_(k+P+(h?C:-C)/M,a[0][1])*M:rE(k+P+A/M,a[1][1])*M));s&&($=Math.max($,(h||f)&&(!h||f||!m)?rE(k+(h?C:-C)/M,s[0][1])*M:r_(k+A/M,s[1][1])*M))}if(p){(I=Math.max(I,rk(O*M,x,b)/M),a)&&(I=Math.max(I,(h||f)&&(!f||h||!m)?r_(E+(f?j:-j)*M+z,a[0][0])/M:rE(E+O*M+z,a[1][0])/M));s&&(I=Math.max(I,(h||f)&&(!f||h||!m)?rE(E+(f?j:-j)*M,s[0][0])/M:r_(E+O*M,s[1][0])/M))}}j+=j<0?I:-I,C+=C<0?$:-$,o&&(m?A>O*M?j=((l=h,u=f,l?!u:u)?-C:C)/M:C=((d=h,c=f,d?!c:c)?-j:j)*M:g?(j=C/M,f=h):(C=j*M,h=f));let R=h?E+C:E,L=f?k+j:k;return{width:S+(h?-C:C),height:N+(f?-j:j),x:i[0]*C*(h?-1:1)+R,y:i[1]*j*(f?-1:1)+L}}(x,a.controlDirection,l,a.boundaries,a.keepAspectRatio,N,m,y),O=M!==E,z=C!==k,P=j!==d&&O,$=A!==h&&z;if(!P&&!$&&!O&&!z)return;if((P||$||1===N[0]||1===N[1])&&(S.x=P?j:v.x,S.y=$?A:v.y,v.x=S.x,v.y=S.y,w.length>0)){let e=j-d,t=A-h;for(let n of w)n.position={x:n.position.x-e+N[0]*(M-E),y:n.position.y-t+N[1]*(C-k)},u.push(n)}if((O||z)&&(S.width=O&&(!a.resizeDirection||"horizontal"===a.resizeDirection)?M:v.width,S.height=z&&(!a.resizeDirection||"vertical"===a.resizeDirection)?C:v.height,v.width=S.width,v.height=S.height),p&&g.expandParent){let e=N[0]*(S.width??0);S.x&&S.x<e&&(v.x=e,x.x=x.x-(S.x-e));let t=N[1]*(S.height??0);S.y&&S.y<t&&(v.y=t,x.y=x.y-(S.y-t))}let I=function({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){let a=e-t,s=n-r,l=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&o&&(l[0]=-1*l[0]),s&&i&&(l[1]=-1*l[1]),l}({width:v.width,prevWidth:E,height:v.height,prevHeight:k,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),R={...v,direction:I};!1!==f?.(e,R)&&(_=!0,c?.(e,R),r(S,u))}).on("end",e=>{_&&(h?.(e,{...v}),o?.({...v}),_=!1)});i.call(E)},destroy:function(){i.on(".drag",null)}}}({domNode:N.current,nodeId:k,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:o,domNode:i}=S.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:o,paneDomNode:i}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:o,nodeOrigin:i}=S.getState(),a=[],s={x:e.x,y:e.y},l=r.get(k);if(l&&l.expandParent&&l.parentId){let t=l.origin??i,n=e.width??l.measured.width??0,u=e.height??l.measured.height??0,d=rr([{id:l.id,parentId:l.parentId,rect:{width:n,height:u,...nI({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:u},l.parentId,r,t)}}],r,o,i);a.push(...d),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*u,e.y):void 0}if(void 0!==s.x&&void 0!==s.y){let e={id:k,type:"position",position:{...s}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){let t={id:k,type:"dimensions",resizing:!0,setAttributes:!h||("horizontal"===h?"width":"height"),dimensions:{width:e.width,height:e.height}};a.push(t)}for(let e of t){let t={...e,type:"position"};a.push(t)}n(a)},onEnd:({width:e,height:t})=>{S.getState().triggerNodeChanges([{id:k,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}}])}})),j.current.update({controlPosition:A,boundaries:{minWidth:s,minHeight:l,maxWidth:u,maxHeight:d},keepAspectRatio:c,resizeDirection:h,onResizeStart:p,onResize:y,onResizeEnd:b,shouldResize:g}),()=>{j.current?.destroy()}},[A,s,l,u,d,c,p,y,b,g]);let O=A.split("-");return(0,v.jsx)("div",{className:w(["react-flow__resize-control","nodrag",...O,n,r]),ref:N,style:{...o,scale:C,...a&&{[M?"backgroundColor":"borderColor"]:a}},children:i})});var i8=e.i(406963);let i9=(0,i8.default)("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),i7=(0,i8.default)("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),ae=(0,i8.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),at=(0,i8.default)("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"}]]);var an=e.i(371522),ar=e.i(949035),ao=e.i(355578),ai=e.i(500324),aa=e.i(996718),as=e.i(252304),al=e.i(186339),au=e.i(329686),ad=e.i(844010),ac=e.i(222862),ah=e.i(880932),af=e.i(636557),ag=e.i(613349);let ap="!opacity-0 !size-3 !bg-muted-foreground/40 !rounded-full group-hover:!opacity-100 hover:!bg-primary hover:!scale-125 !transition-all !border-none",am=(0,x.memo)(function({data:e,selected:t,dragging:n}){let{agent:r,runtimes:o,activeTaskCount:i,index:a}=e,s=o.find(e=>e.id===r.runtime_id),l=s?.status==="online",[u,d]=(0,x.useState)(!1);return(0,v.jsxs)("div",{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),className:(0,ag.cn)("bg-background rounded-xl ring-1 ring-foreground/8 shadow-sm transition-[box-shadow,ring-color,opacity,transform] duration-200 py-3 px-3.5 group",t&&"ring-2 ring-primary/30 shadow-md",!t&&"hover:ring-foreground/15 hover:shadow-md",n&&"shadow-lg scale-[1.02] cursor-grabbing"),style:{animationDelay:`${60*a}ms`},children:[(0,v.jsx)(oI,{type:"source",id:"right",position:p.Right,className:ap}),(0,v.jsx)(oI,{type:"source",id:"left",position:p.Left,className:ap}),(0,v.jsx)(oI,{type:"source",id:"top",position:p.Top,className:ap}),(0,v.jsx)(oI,{type:"source",id:"bottom",position:p.Bottom,className:ap}),(0,v.jsx)(oI,{type:"target",id:"target-right",position:p.Right,className:ap}),(0,v.jsx)(oI,{type:"target",id:"target-left",position:p.Left,className:ap}),(0,v.jsx)(oI,{type:"target",id:"target-top",position:p.Top,className:ap}),(0,v.jsx)(oI,{type:"target",id:"target-bottom",position:p.Bottom,className:ap}),(0,v.jsx)(ad.AgentPreviewCard,{agent:r,isOnline:l,activeTaskCount:i,variant:"compact",isHovered:u})]})}),ay=(0,x.memo)(function({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:i,targetPosition:a,selected:s,data:l}){let{instruction:u,onEdgeClick:d}=l??{},[c,h]=(0,x.useState)(!1),[f,g,p]=n0({sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:i,targetPosition:a,borderRadius:16}),m=(0,x.useCallback)(t=>{t.stopPropagation(),d?.(e)},[d,e]);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("path",{d:f,fill:"none",stroke:s?"var(--color-primary)":c?"var(--color-muted-foreground)":"var(--color-border)",strokeWidth:s||c?2:1.5,style:{transition:"stroke 150ms, stroke-width 150ms"},onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1)}),(0,v.jsx)(iL,{children:(0,v.jsx)("button",{type:"button",style:{position:"absolute",transform:`translate(-50%, -50%) translate(${g}px,${p}px)`,pointerEvents:"auto"},className:`text-[11px] leading-tight bg-background/90 px-2 py-0.5 rounded-md truncate cursor-pointer transition-colors italic ${c?"text-muted-foreground":"text-muted-foreground/40"}`,onClick:m,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:u&&""!==u&&"<p></p>"!==u?"edit relationship":"define relationship"})})]})});var av=e.i(332680),ax=e.i(740513),ab=e.i(676214);e.i(400175);var aw=e.i(126366),a_=e.i(393153);function aE({open:e,onOpenChange:t,link:n,agents:r,onSave:o,onDelete:i}){let[a,s]=(0,x.useState)(""),[l,u]=(0,x.useState)(!1),d=(0,x.useRef)(a);(0,x.useEffect)(()=>{d.current=a},[a]);let c=(0,x.useRef)(""),h=(0,x.useRef)(null),f=(0,x.useRef)(n);(0,x.useEffect)(()=>{f.current=n},[n]);let g=r.find(e=>e.id===n?.source_agent_id),p=r.find(e=>e.id===n?.target_agent_id);(0,x.useEffect)(()=>{n&&(s(n.instruction),c.current=n.instruction)},[n]);let m=(0,x.useCallback)(()=>{let e=d.current,t=f.current;t&&e!==c.current&&(c.current=e,o(t.id,e))},[o]),y=(0,x.useCallback)(()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(m,500)},[m]),b=(0,x.useCallback)(e=>{s(e),y()},[y]);(0,x.useEffect)(()=>()=>{h.current&&clearTimeout(h.current),m()},[m]);let w=(0,x.useCallback)(e=>{e||(h.current&&clearTimeout(h.current),m()),t(e)},[t,m]),_=(0,x.useCallback)(()=>{h.current&&clearTimeout(h.current),n&&i(n.id),u(!1)},[n,i]),E=e=>{if(!e)return null;let t=(0,aw.parseAvatarUrl)(e.avatar_url);return t?(0,v.jsx)(aw.AvatarRenderer,{config:t,size:32,className:"shrink-0 rounded-xl"}):(0,v.jsx)("div",{className:"flex items-center justify-center size-8 rounded-xl bg-secondary text-secondary-foreground text-xs font-medium shrink-0",children:e.name.charAt(0).toUpperCase()})};return(0,v.jsxs)(av.Sheet,{open:e,onOpenChange:w,children:[(0,v.jsxs)(av.SheetContent,{side:"right",showCloseButton:!1,className:"data-[side=right]:sm:inset-y-2 data-[side=right]:sm:right-2 data-[side=right]:sm:h-auto data-[side=right]:sm:rounded-xl data-[side=right]:sm:border data-[side=right]:sm:max-w-md",children:[(0,v.jsxs)(av.SheetTitle,{className:"sr-only",children:["Edit relationship between ",g?.name," and ",p?.name]}),(0,v.jsxs)(av.SheetHeader,{className:"border-b px-5 py-4",children:[(0,v.jsxs)("div",{className:"flex items-center justify-between",children:[(0,v.jsx)("div",{className:"flex items-center gap-2",children:(0,v.jsxs)("div",{className:"flex items-center",children:[E(g),(0,v.jsx)("div",{className:"-ml-2 ring-2 ring-background rounded-xl",children:E(p)})]})}),(0,v.jsxs)(au.Tooltip,{children:[(0,v.jsx)(au.TooltipTrigger,{render:(0,v.jsx)(al.Button,{variant:"ghost",size:"icon-sm",className:"text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>u(!0)}),children:(0,v.jsx)(ab.Trash2,{className:"size-4"})}),(0,v.jsx)(au.TooltipContent,{children:"Remove connection"})]})]}),(0,v.jsxs)("p",{className:"text-sm font-medium",children:[g?.name??"Agent"," and ",p?.name??"Agent"]}),(0,v.jsx)("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-2",children:"use @ to mention agent"})]}),(0,v.jsx)("div",{className:"flex-1 overflow-y-auto thin-scrollbar px-5 py-4",children:(0,v.jsx)(ax.MarkdownEditor,{variant:"seamless",contentType:"markdown",placeholder:"Describe how these agents should collaborate. This instruction is shared with both agents when they receive tasks.",value:a,onChange:b,minHeight:"12rem",agents:r})})]}),(0,v.jsx)(a_.ConfirmDialog,{open:l,onOpenChange:u,title:"Remove connection",description:`This will remove the connection between "${g?.name??"Agent"}" and "${p?.name??"Agent"}".`,onConfirm:_})]})}var ak=e.i(789994),aS=e.i(937091),aN=e.i(450463);function aM({name:e,avatarUrl:t,size:n=20}){let r=(0,aw.parseAvatarUrl)(t);return r?(0,v.jsx)(aw.AvatarRenderer,{config:r,size:n,className:"rounded-full shrink-0"}):(0,v.jsx)("span",{className:"flex items-center justify-center rounded-full bg-secondary text-[7px] font-medium shrink-0",style:{width:n,height:n},children:(e??"?").charAt(0).toUpperCase()})}function aC({task:e,slug:t,onOpenChat:n}){let r="running"===e.status,o=`/w/${t}/agents/${e.agent_id}?task=${e.id}&conv=${e.conversation_id}`,i=(0,x.useCallback)(t=>{t.metaKey||t.ctrlKey||t.shiftKey||0!==t.button||(t.preventDefault(),n(e.agent_id,{conversationId:e.conversation_id,taskId:e.id}))},[e.agent_id,e.conversation_id,e.id,n]);return(0,v.jsxs)("a",{href:o,onClick:i,className:"flex items-center gap-2.5 px-3 py-2 hover:bg-accent/50 transition-colors cursor-pointer rounded-md",children:[(0,v.jsxs)("div",{className:"relative shrink-0",children:[(0,v.jsx)(aM,{name:e.agent?.name,avatarUrl:e.agent?.avatarUrl,size:24}),(0,v.jsx)("span",{className:`absolute -bottom-0.5 -right-0.5 size-2 rounded-full ring-2 ring-background ${r?"bg-primary animate-pulse":"bg-muted-foreground/40"}`})]}),(0,v.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,v.jsxs)("div",{className:"flex items-center gap-1.5 leading-tight",children:[(0,v.jsx)("span",{className:"text-sm font-medium truncate",children:e.agent?.name??"Unknown"}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:["#",e.channel]})]}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground truncate leading-tight",children:e.prompt})]}),(0,v.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap shrink-0",children:(0,aN.relativeTime)(e.created_at)})]})}function aj(){let{activeTaskDetails:e}=(0,ao.useAgentContext)(),{slug:t}=(0,ai.useWorkspace)(),n=(0,aa.useIsMobile)(),{openAgentChat:r}=(0,as.useAgentChatSheet)(),[o,i]=(0,x.useState)(!1),a=(0,x.useRef)(new Set),s=e.length;return((0,x.useEffect)(()=>{if(0===s){a.current=new Set;return}let t=new Set(e.map(e=>e.id));e.some(e=>!a.current.has(e.id))&&!o&&i(!0),a.current=t},[e,s,o]),n||0===s)?null:o?(0,v.jsxs)("div",{role:"region","aria-label":"Active tasks",className:"w-80 rounded-lg ring-1 ring-foreground/8 shadow-sm bg-background/90 backdrop-blur-sm animate-[fade-up_300ms_ease-out_both]",children:[(0,v.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border/50",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium","aria-live":"polite",children:[(0,v.jsx)("span",{className:"size-1.5 rounded-full bg-primary animate-pulse"}),(0,v.jsxs)("span",{children:[s," task",1!==s?"s":""," active"]})]}),(0,v.jsx)("button",{type:"button","aria-label":"Collapse tasks panel",className:"size-6 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>i(!1),children:(0,v.jsx)(aS.X,{className:"size-3.5"})})]}),(0,v.jsxs)("div",{className:"max-h-75 overflow-y-auto thin-scrollbar py-1",children:[e.slice(0,8).map(e=>(0,v.jsx)(aC,{task:e,slug:t,onOpenChat:r},e.id)),s>8&&(0,v.jsxs)(ak.default,{href:`/w/${t}/threads?status=active`,className:"block text-xs text-muted-foreground hover:text-foreground text-center py-1.5 transition-colors",children:["View all ",s," tasks"]})]})]}):(0,v.jsxs)("button",{type:"button",onClick:()=>i(!0),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-background/90 backdrop-blur-sm ring-1 ring-foreground/8 shadow-sm text-xs font-medium text-muted-foreground hover:text-foreground transition-colors animate-[fade-up_300ms_ease-out_both]",children:[(0,v.jsx)("span",{className:"size-1.5 rounded-full bg-primary animate-pulse"}),s," active"]})}var aA=e.i(265481);function aO({name:e,avatarUrl:t,size:n=20}){let r=(0,aw.parseAvatarUrl)(t);return r?(0,v.jsx)(aw.AvatarRenderer,{config:r,size:n,className:"rounded-full shrink-0"}):(0,v.jsx)("span",{className:"flex items-center justify-center rounded-full bg-secondary text-[7px] font-medium shrink-0",style:{width:n,height:n},children:(e??"?").charAt(0).toUpperCase()})}function az(){let{agents:e}=(0,ao.useAgentContext)(),{slug:t,workspaceId:n}=(0,ai.useWorkspace)(),r=(0,aa.useIsMobile)(),[o,i]=(0,x.useState)([]),[a,s]=(0,x.useState)(!1),l=new Map(e.map(e=>[e.id,e])),u=(0,x.useCallback)(async()=>{if(!n)return;let e=new Date,t=new Date(e);t.setHours(23,59,59,999);try{let r=(await (0,ac.listCalendarEvents)(n,{from:e.toISOString(),to:t.toISOString()})).filter(t=>new Date(t.occurrence_at)>=e);i(r)}catch{}},[n]);(0,x.useEffect)(()=>{u();let e=setInterval(u,6e4);return()=>clearInterval(e)},[u]);let d=o.reduce((e,t)=>e+(t.collapsed_count??1),0);if(r||0===d)return null;let c=[],h=new Map;for(let e of o)h.set(e.agent_id,(h.get(e.agent_id)??0)+(e.collapsed_count??1));for(let[e,t]of h){let n=l.get(e);c.push({agentId:e,agentName:n?.name??"Unknown",avatarUrl:n?.avatar_url??null,count:t})}return(c.sort((e,t)=>t.count-e.count),a)?(0,v.jsxs)("div",{role:"region","aria-label":"Upcoming events",className:"w-72 rounded-lg ring-1 ring-foreground/8 shadow-sm bg-background/90 backdrop-blur-sm animate-[fade-up_300ms_ease-out_both]",children:[(0,v.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border/50",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,v.jsx)(aA.CalendarDays,{className:"size-3.5 text-muted-foreground"}),(0,v.jsxs)("span",{children:[d," events today"]})]}),(0,v.jsx)("button",{type:"button","aria-label":"Collapse events panel",className:"size-6 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>s(!1),children:(0,v.jsx)(aS.X,{className:"size-3.5"})})]}),(0,v.jsx)("div",{className:"max-h-52 overflow-y-auto thin-scrollbar py-1",children:c.map(e=>(0,v.jsxs)(ak.default,{href:`/w/${t}/calendar`,className:"flex items-center gap-2.5 px-3 py-2 hover:bg-accent/50 transition-colors cursor-pointer rounded-md",children:[(0,v.jsx)(aO,{name:e.agentName,avatarUrl:e.avatarUrl,size:22}),(0,v.jsx)("span",{className:"flex-1 text-sm truncate",children:e.agentName}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:[e.count," event",1!==e.count?"s":""]})]},e.agentId))})]}):(0,v.jsxs)("button",{type:"button",onClick:()=>s(!0),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-background/90 backdrop-blur-sm ring-1 ring-foreground/8 shadow-sm text-xs font-medium text-muted-foreground hover:text-foreground transition-colors animate-[fade-up_300ms_ease-out_both]",children:[(0,v.jsx)(aA.CalendarDays,{className:"size-3"}),d," upcoming"]})}var aP=Object.defineProperty,a$={},aI={Graph:()=>aT,alg:()=>aq,json:()=>aY,version:()=>aX};for(var aR in aI)aP(a$,aR,{get:aI[aR],enumerable:!0});var aL=Object.defineProperty,aD=(e,t)=>{for(var n in t)aL(e,n,{get:t[n],enumerable:!0})},aT=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=!("directed"in e)||e.directed,this._isMultigraph="multigraph"in e&&e.multigraph,this._isCompound="compound"in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return"function"!=typeof e?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>0===Object.keys(this._in[e]).length)}sinks(){return this.nodes().filter(e=>0===Object.keys(this._out[e]).length)}setNodes(e,t){return e.forEach(e=>{void 0!==t?this.setNode(e,t):this.setNode(e)}),this}setNode(e,t){return e in this._nodes?arguments.length>1&&(this._nodes[e]=t):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount),this}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(void 0===t)t="\0";else{t+="";for(let n=t;void 0!==n;n=this.parent(n))if(n===e)throw Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();this.hasNode(e)}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let t of this.successors(e))n.add(t);return Array.from(n.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let o=this.parent(e);return!o||t.hasNode(o)?(n[e]=null!=o?o:void 0,null!=o?o:void 0):o in n?n[o]:r(o)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return"function"!=typeof e?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(void 0!==t?this.setEdge(e,n,t):this.setEdge(e,n),n)),this}setEdge(e,t,n,r){let o,i,a,s,l=!1;"object"==typeof e&&null!==e&&"v"in e?(o=e.v,i=e.w,a=e.name,2==arguments.length&&(s=t,l=!0)):(o=e,i=t,a=r,arguments.length>2&&(s=n,l=!0)),o=""+o,i=""+i,void 0!==a&&(a=""+a);let u=aV(this._isDirected,o,i,a);if(u in this._edgeLabels)return l&&(this._edgeLabels[u]=s),this;if(void 0!==a&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(i),this._edgeLabels[u]=l?s:this._defaultEdgeLabelFn(o,i,a);let d=function(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let e=o;o=i,i=e}let a={v:o,w:i};return r&&(a.name=r),a}(this._isDirected,o,i,a);return o=d.v,i=d.w,Object.freeze(d),this._edgeObjs[u]=d,aB(this._preds[i],o),aB(this._sucs[o],i),this._in[i][u]=d,this._out[o][u]=d,this._edgeCount++,this}edge(e,t,n){let r=1==arguments.length?aF(this._isDirected,e):aV(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=1==arguments.length?this.edge(e):this.edge(e,t,n);return"object"!=typeof r?{label:r}:r}hasEdge(e,t,n){return(1==arguments.length?aF(this._isDirected,e):aV(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=1==arguments.length?aF(this._isDirected,e):aV(this._isDirected,e,t,n),o=this._edgeObjs[r];if(o){let e=o.v,t=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],aH(this._preds[t],e),aH(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function aB(e,t){e[t]?e[t]++:e[t]=1}function aH(e,t){void 0===e[t]||--e[t]||delete e[t]}function aV(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let e=o;o=i,i=e}return o+"\x01"+i+"\x01"+(void 0===r?"\0":r)}function aF(e,t){return aV(e,t.v,t.w,t.name)}var aX="4.0.1",aY={};function aK(e){var t,n;let r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e).nodes().map(e=>{let n=t.node(e),r=t.parent(e),o={v:e};return void 0!==n&&(o.value=n),void 0!==r&&(o.parent=r),o}),edges:(n=e).edges().map(e=>{let t=n.edge(e),r={v:e.v,w:e.w};return void 0!==e.name&&(r.name=e.name),void 0!==t&&(r.value=t),r})},o=e.graph();return void 0!==o&&(r.value=structuredClone(o)),r}function aZ(e){let t=new aT(e.options);return void 0!==e.value&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}aD(aY,{read:()=>aZ,write:()=>aK});var aq={};aD(aq,{CycleException:()=>a6,bellmanFord:()=>aU,components:()=>aG,dijkstra:()=>a0,dijkstraAll:()=>a1,findCycles:()=>a5,floydWarshall:()=>a4,isAcyclic:()=>a9,postorder:()=>se,preorder:()=>st,prim:()=>sn,shortestPaths:()=>sr,tarjan:()=>a2,topsort:()=>a8});var aW=()=>1;function aU(e,t,n,r){return function(e,t,n,r){let o={},i,a=0,s=e.nodes(),l=function(e){let t=n(e);o[e.v].distance+t<o[e.w].distance&&(o[e.w]={distance:o[e.v].distance+t,predecessor:e.v},i=!0)},u=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;l({v:n,w:r})})})};s.forEach(function(e){o[e]={distance:e===t?0:1/0,predecessor:""}});let d=s.length;for(let e=1;e<d&&(i=!1,a++,u(),i);e++);if(a===d-1&&(i=!1,u(),i))throw Error("The graph contains a negative weight cycle");return o}(e,String(t),n||aW,r||function(t){return e.outEdges(t)})}function aG(e){let t={},n=[],r;return e.nodes().forEach(function(o){r=[],function n(o){o in t||(t[o]=!0,r.push(o),e.successors(o).forEach(n),e.predecessors(o).forEach(n))}(o),r.length&&n.push(r)}),n}var aQ=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,o=e.length;return n[r]=o,e.push({key:r,priority:t}),this._decrease(o),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(void 0===n)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,o=e;n<t.length&&(o=t[n].priority<t[o].priority?n:o,r<t.length&&(o=t[r].priority<t[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;0!==e&&!(t[r=e>>1].priority<n);)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,o=n[e],i=n[t];n[e]=i,n[t]=o,r[i.key]=e,r[o.key]=t}},aJ=()=>1;function a0(e,t,n,r){return function(e,t,n,r){let o={},i=new aQ,a,s,l=function(e){let t=e.v!==a?e.v:e.w,r=o[t],l=n(e),u=s.distance+l;if(l<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+l);u<r.distance&&(r.distance=u,r.predecessor=a,i.decrease(t,u))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;o[e]={distance:n,predecessor:""},i.add(e,n)});i.size()>0&&(s=o[a=i.removeMin()]).distance!==1/0;)r(a).forEach(l);return o}(e,String(t),n||aJ,r||function(t){return e.outEdges(t)})}function a1(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=a0(e,o,t,n),r},{})}function a2(e){let t=0,n=[],r={},o=[];return e.nodes().forEach(function(i){i in r||function i(a){let s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(e){e in r?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(i(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){let e=[],t;do r[t=n.pop()].onStack=!1,e.push(t);while(a!==t)o.push(e)}}(i)}),o}function a5(e){return a2(e).filter(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}var a3=()=>1;function a4(e,t,n){var r,o,i;let a,s;return r=e,o=t||a3,i=n||function(t){return e.outEdges(t)},a={},(s=r.nodes()).forEach(function(e){a[e]={},a[e][e]={distance:0,predecessor:""},s.forEach(function(t){e!==t&&(a[e][t]={distance:1/0,predecessor:""})}),i(e).forEach(function(t){let n=t.v===e?t.w:t.v,r=o(t);a[e][n]={distance:r,predecessor:e}})}),s.forEach(function(e){let t=a[e];s.forEach(function(n){let r=a[n];s.forEach(function(n){let o=r[e],i=t[n],a=r[n],s=o.distance+i.distance;s<a.distance&&(a.distance=s,a.predecessor=i.predecessor)})})}),a}var a6=class extends Error{constructor(...e){super(...e)}};function a8(e){let t={},n={},r=[];if(e.sinks().forEach(function o(i){if(i in n)throw new a6;i in t||(n[i]=!0,t[i]=!0,e.predecessors(i).forEach(o),delete n[i],r.push(i))}),Object.keys(t).length!==e.nodeCount())throw new a6;return r}function a9(e){try{a8(e)}catch(e){if(e instanceof a6)return!1;throw e}return!0}function a7(e,t,n){var r,o,i;let a,s;return r=t,o=function(e,t){return e.push(t),e},i=[],Array.isArray(r)||(r=[r]),a=t=>{var n;return null!=(n=e.isDirected()?e.successors(t):e.neighbors(t))?n:[]},s={},r.forEach(function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);i=function e(t,n,r,o,i,a,s){return n in o||(o[n]=!0,r||(s=a(s,n)),i(n).forEach(function(n){s=e(t,n,r,o,i,a,s)}),r&&(s=a(s,n))),s}(e,t,"post"===n,s,a,o,i)}),i}function se(e,t){return a7(e,t,"post")}function st(e,t){return a7(e,t,"pre")}function sn(e,t){let n=new aT,r={},o=new aQ,i;function a(e){let n=e.v===i?e.w:e.v,a=o.priority(n);if(void 0!==a){let s=t(e);s<a&&(r[n]=i,o.decrease(n,s))}}if(0===e.nodeCount())return n;e.nodes().forEach(function(e){o.add(e,1/0),n.setNode(e)}),o.decrease(e.nodes()[0],0);let s=!1;for(;o.size()>0;){if((i=o.removeMin())in r)n.setEdge(i,r[i]);else{if(s)throw Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(i).forEach(a)}return n}function sr(e,t,n,r){return function(e,t,n,r){if(void 0===n)return a0(e,t,n,r);let o=!1,i=e.nodes();for(let a=0;a<i.length;a++){let s=r(i[a]);for(let e=0;e<s.length;e++){let t=s[e],r=t.v===i[a]?t.v:t.w,l=r===t.v?t.w:t.v;0>n({v:r,w:l})&&(o=!0)}if(o)return aU(e,t,n,r)}return a0(e,t,n,r)}(e,t,n,null!=r?r:t=>{let n=e.outEdges(t);return null!=n?n:[]})}function so(e,t,n,r){let o=r;for(;e.hasNode(o);)o=r+""+ ++sf;return n.dummy=t,e.setNode(o,n),o}function si(e){let t=new aT({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function sa(e,t){let n,r,o=e.x,i=e.y,a=t.x-o,s=t.y-i,l=e.width/2,u=e.height/2;if(!a&&!s)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*l>Math.abs(a)*u?(s<0&&(u=-u),n=u*a/s,r=u):(a<0&&(l=-l),n=l,r=l*s/a),{x:o+n,y:i+r}}function ss(e){let t=sg(sd(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;void 0!==o&&(t[o]||(t[o]=[]),t[o][r.order]=n)}),t}function sl(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),so(e,"border",o,t)}function su(e,t){return t.length>65535?e(...(function(e,t=65535){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n})(t).map(t=>e(...t))):e(...t)}function sd(e){return su(Math.max,e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?5e-324:n}))}function sc(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function sh(e,t){return t()}var sf=0;function sg(e,t,n=1){null==t&&(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let o=[];for(let t=e;r(t);t+=n)o.push(t);return o}function sp(e,t){let n={};for(let r of t)void 0!==e[r]&&(n[r]=e[r]);return n}function sm(e,t){let n;return n="string"==typeof t?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}var sy=class{constructor(){((e,t,n)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?aP(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n})(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return sv(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&sv(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,sx)),n=n._prev;return"["+e.join(", ")+"]"}};function sv(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function sx(e,t){if("_next"!==e&&"_prev"!==e)return t}var sb=()=>1;function sw(e,t,n,r,o){let i=[],a=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let a=e.edge(r),s=e.node(r.v);o&&i.push({v:r.v,w:r.w}),s.out-=a,s_(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,s_(t,n,a)}),e.removeNode(r.v),a}function s_(e,t,n){var r,o,i;n.out?n.in?null==(i=e[n.out-n.in+t])||i.enqueue(n):null==(o=e[e.length-1])||o.enqueue(n):null==(r=e[0])||r.enqueue(n)}function sE(e){let t={};e.sources().forEach(function n(r){let o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r),a=su(Math.min,i?i.map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen):[]);return a===1/0&&(a=0),o.rank=a})}function sk(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var sS=function(e){var t,n,r,o;let i,a,s=new aT({directed:!1}),l=e.nodes();if(0===l.length)throw Error("Graph must have at least one node");let u=l[0],d=e.nodeCount();for(s.setNode(u,{});t=s,n=e,t.nodes().forEach(function e(r){let o=n.nodeEdges(r);o&&o.forEach(o=>{let i=o.v,a=r===i?o.w:i;t.hasNode(a)||sk(n,o)||(t.setNode(a,{}),t.setEdge(r,a,{}),e(a))})}),t.nodeCount()<d&&(r=s,i=(o=e).edges().reduce((e,t)=>{let n=1/0;return r.hasNode(t.v)!==r.hasNode(t.w)&&(n=sk(o,t)),n<e[0]?[n,t]:e},[1/0,null])[1]);)a=s.hasNode(i.v)?sk(e,i):-sk(e,i),function(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}(s,e,a);return s},{preorder:sN,postorder:sM}=aq;function sC(e){var t;let n,r,o;t=e,o=new aT().setGraph(t.graph()),t.nodes().forEach(e=>o.setNode(e,t.node(e))),t.edges().forEach(e=>{let n=o.edge(e.v,e.w)||{weight:0,minlen:1},r=t.edge(e);o.setEdge(e.v,e.w,{weight:n.weight+r.weight,minlen:Math.max(n.minlen,r.minlen)})}),sE(e=o);let i=sS(e);for(sO(i),sj(i,e);n=sz(i);)r=sP(i,e,n),s$(i,e,n,r)}function sj(e,t){let n=sM(e,e.nodes());(n=n.slice(0,n.length-1)).forEach(n=>{var r,o,i;let a;return r=e,o=t,i=n,a=r.node(i).parent,void(r.edge(i,a).cutvalue=sA(r,o,i))})}function sA(e,t,n){let r=e.node(n).parent,o=!0,i=t.edge(n,r),a=0;i||(o=!1,i=t.edge(r,n)),a=i.weight;let s=t.nodeEdges(n);return s&&s.forEach(i=>{let s=i.v===n,l=s?i.w:i.v;if(l!==r){var u,d,c;let r=s===o,h=t.edge(i).weight;if(a+=r?h:-h,u=e,d=n,c=l,u.hasEdge(d,c)){let t=e.edge(n,l).cutvalue;a+=r?-t:t}}}),a}function sO(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,n,r,o,i){let a=r,s=t.node(o);n[o]=!0;let l=t.neighbors(o);return l&&l.forEach(i=>{Object.hasOwn(n,i)||(r=e(t,n,r,i,o))}),s.low=a,s.lim=r++,i?s.parent=i:delete s.parent,r}(e,{},1,t)}function sz(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function sP(e,t,n){let r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);let i=e.node(r),a=e.node(o),s=i,l=!1;return i.lim>a.lim&&(s=a,l=!0),t.edges().filter(t=>l===sI(e,e.node(t.v),s)&&l!==sI(e,e.node(t.w),s)).reduce((e,n)=>sk(t,n)<sk(t,e)?n:e)}function s$(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),sO(e),sj(e,t),function(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=sN(e,[n]);(r=r.slice(1)).forEach(n=>{let r=e.node(n).parent,o=t.edge(n,r),i=!1;o||(o=t.edge(r,n),i=!0),t.node(n).rank=t.node(r).rank+(i?o.minlen:-o.minlen)})}(e,t)}function sI(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}sC.initLowLimValues=sO,sC.initCutValues=sj,sC.calcCutValue=sA,sC.leaveEdge=sz,sC.enterEdge=sP,sC.exchangeEdges=s$;function sR(e,t,n,r,o,i){let a=o[t][i-1],s=so(e,"border",{width:0,height:0,rank:i,borderType:t},n);o[t][i]=s,e.setParent(s,r),a&&e.setEdge(a,s,{weight:1})}function sL(e){e.nodes().forEach(t=>sD(e.node(t))),e.edges().forEach(t=>sD(e.edge(t)))}function sD(e){let t=e.width;e.width=e.height,e.height=t}function sT(e){e.y=-e.y}function sB(e){let t=e.x;e.x=e.y,e.y=t}function sH(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function sV(e,t,n){let r=new Map,o=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if("number"==typeof n.rank&&o(n.rank,t),"number"==typeof n.minRank&&"number"==typeof n.maxRank)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&o(e,t)}return t.map(function(t){var o;let i,a;return o=r.get(t)||[],i=function(e){let t;for(;e.hasNode(t="_root"+ ++sf););return t}(e),a=new aT({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t)),o.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let l=e[n](r);l&&l.forEach(t=>{let n=t.v===r?t.w:t.v,o=a.edge(n,r),i=void 0!==o?o.weight:0;a.setEdge(n,r,{weight:e.edge(t).weight+i})}),Object.hasOwn(o,"minRank")&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a})}function sF(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function sX(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}var sY=["nodesep","edgesep","ranksep","marginx","marginy"],sK={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},sZ=["acyclicer","ranker","rankdir","align","rankalign"],sq=["width","height","rank"],sW={width:0,height:0},sU=["minlen","weight","width","height","labeloffset"],sG={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},sQ=["labelpos"];function sJ(e,t){return sm(sp(e,t),Number)}function s0(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n}),t}var s1=function(e,t={}){let n=t.debugTiming?sc:sh;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>{var t;let n,r;return t=e,n=new aT({multigraph:!0,compound:!0}),r=s0(t.graph()),n.setGraph(Object.assign({},sK,sJ(r,sY),sp(r,sZ))),t.nodes().forEach(e=>{let r=sJ(s0(t.node(e)),sq);Object.keys(sW).forEach(e=>{void 0===r[e]&&(r[e]=sW[e])}),n.setNode(e,r);let o=t.parent(e);void 0!==o&&n.setParent(e,o)}),t.edges().forEach(e=>{let r=s0(t.edge(e));n.setEdge(e,Object.assign({},sG,sJ(r,sU),sp(r,sQ)))}),n});return n(" runLayout",()=>{var e,o,i;return e=r,o=n,i=t,void(o(" makeSpaceForEdgeLabels",()=>{var t;let n;return n=(t=e).graph(),void(n.ranksep/=2,t.edges().forEach(e=>{let r=t.edge(e);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}),o(" removeSelfEdges",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w){let n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),o(" acyclic",()=>{var t,n;let r,o,i;("greedy"===e.graph().acyclicer?function(e,t){var n,r;let o,i,a,s,l;if(1>=e.nodeCount())return[];let u=(n=e,r=t||sb,o=new aT,i=0,a=0,n.nodes().forEach(e=>{o.setNode(e,{v:e,in:0,out:0})}),n.edges().forEach(e=>{let t=o.edge(e.v,e.w)||0,n=r(e);o.setEdge(e.v,e.w,t+n);let s=o.node(e.v),l=o.node(e.w);a=Math.max(a,s.out+=n),i=Math.max(i,l.in+=n)}),s=(function(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t})(a+i+3).map(()=>new sy),l=i+1,o.nodes().forEach(e=>{s_(s,l,o.node(e))}),{graph:o,buckets:s,zeroIdx:l});return(function(e,t,n){var r;let o=[],i=t[t.length-1],a=t[0],s;for(;e.nodeCount();){for(;s=a.dequeue();)sw(e,t,n,s);for(;s=i.dequeue();)sw(e,t,n,s);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(s=null==(r=t[i])?void 0:r.dequeue()){o=o.concat(sw(e,t,n,s,!0)||[]);break}}}return o})(u.graph,u.buckets,u.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}(e,(t=e,e=>t.edge(e).weight)):(r=[],o={},i={},(n=e).nodes().forEach(function e(t){Object.hasOwn(i,t)||(i[t]=!0,o[t]=!0,n.outEdges(t).forEach(t=>{Object.hasOwn(o,t.w)?r.push(t):e(t.w)}),delete o[t])}),r)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,"rev"+ ++sf)})}),o(" nestingGraph.run",()=>{var t,n;let r,o,i,a,s,l;return r=so(e,"root",{},"_root"),a=2*(i=su(Math.max,Object.values((l={},(t=e).children("\0").forEach(e=>(function e(n,r){let o=t.children(n);o&&o.length&&o.forEach(t=>e(t,r+1)),l[n]=r})(e,1)),o=l)))-1)+1,e.graph().nestingRoot=r,e.edges().forEach(t=>e.edge(t).minlen*=a),s=(n=e).edges().reduce((e,t)=>e+n.edge(t).weight,0)+1,void(e.children("\0").forEach(t=>(function e(t,n,r,o,i,a,s){var l;let u=t.children(s);if(!u.length){s!==n&&t.setEdge(n,s,{weight:0,minlen:r});return}let d=sl(t,"_bt"),c=sl(t,"_bb"),h=t.node(s);t.setParent(d,s),h.borderTop=d,t.setParent(c,s),h.borderBottom=c,u.forEach(l=>{var u;e(t,n,r,o,i,a,l);let h=t.node(l),f=h.borderTop?h.borderTop:l,g=h.borderBottom?h.borderBottom:l,p=h.borderTop?o:2*o,m=f!==g?1:i-(null!=(u=a[s])?u:0)+1;t.setEdge(d,f,{weight:p,minlen:m,nestingEdge:!0}),t.setEdge(g,c,{weight:p,minlen:m,nestingEdge:!0})}),t.parent(s)||t.setEdge(n,d,{weight:0,minlen:i+(null!=(l=a[s])?l:0)})})(e,r,a,s,i,o,t)),e.graph().nodeRankFactor=a)}),o(" rank",()=>(function(e){let t=e.graph().ranker;if("function"==typeof t)return t(e);switch(t){case"network-simplex":default:sC(e);break;case"tight-tree":var n;sE(n=e),sS(n);break;case"longest-path":sE(e);case"none":}})(si(e))),o(" injectEdgeLabelProxies",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let n=t.node(e.v),r={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};so(t,"edge-proxy",r,"_ep")}})}),o(" removeEmptyRanks",()=>{let t,n,r,o;return t=su(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),n=[],e.nodes().forEach(r=>{let o=e.node(r).rank-t;n[o]||(n[o]=[]),n[o].push(r)}),r=0,o=e.graph().nodeRankFactor,void Array.from(n).forEach((t,n)=>{void 0===t&&n%o!=0?--r:void 0!==t&&r&&t.forEach(t=>e.node(t).rank+=r)})}),o(" nestingGraph.cleanup",()=>{let t;return t=e.graph(),void(e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)}))}),o(" normalizeRanks",()=>{let t;return t=su(Math.min,e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?Number.MAX_VALUE:n})),void e.nodes().forEach(n=>{let r=e.node(n);Object.hasOwn(r,"rank")&&(r.rank-=t)})}),o(" assignRankMinMax",()=>{var t;let n;return n=0,void((t=e).nodes().forEach(e=>{let r=t.node(e);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,n=Math.max(n,r.maxRank))}),t.graph().maxRank=n)}),o(" removeEdgeLabelProxies",()=>{var t;(t=e).nodes().forEach(e=>{let n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}),o(" normalize.run",()=>{e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,r,o,i=t.v,a=e.node(i).rank,s=t.w,l=e.node(s).rank,u=t.name,d=e.edge(t),c=d.labelRank;if(l!==a+1){for(e.removeEdge(t),o=0,++a;a<l;++o,++a)d.points=[],n=so(e,"edge",r={width:0,height:0,edgeLabel:d,edgeObj:t,rank:a},"_d"),a===c&&(r.width=d.width,r.height=d.height,r.dummy="edge-label",r.labelpos=d.labelpos),e.setEdge(i,n,{weight:d.weight},u),0===o&&e.graph().dummyChains.push(n),i=n;e.setEdge(i,s,{weight:d.weight},u)}})(e,t))}),o(" parentDummyChains",()=>{var t,n;let r,o,i;return i=(r={},o=0,(n=t=e).children("\0").forEach(function e(t){let i=o;n.children(t).forEach(e),r[t]={low:i,lim:o++}}),r),void t.graph().dummyChains.forEach(e=>{let n=t.node(e),r=n.edgeObj,o=function(e,t,n,r){let o=[],i=[],a=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),l;l=n;do o.push(l=e.parent(l));while(l&&(t[l].low>a||s>t[l].lim))let u=l,d=r;for(;(d=e.parent(d))!==u;)i.push(d);return{path:o.concat(i.reverse()),lca:u}}(t,i,r.v,r.w),a=o.path,s=o.lca,l=0,u=a[0],d=!0;for(;e!==r.w;){if(n=t.node(e),d){for(;(u=a[l])!==s&&t.node(u).maxRank<n.rank;)l++;u===s&&(d=!1)}if(!d){for(;l<a.length-1&&t.node(a[l+1]).minRank<=n.rank;)l++;u=a[l]}void 0!==u&&t.setParent(e,u),e=t.successors(e)[0]}})}),o(" addBorderSegments",()=>{var t;(t=e).children("\0").forEach(function e(n){let r=t.children(n),o=t.node(n);if(r.length&&r.forEach(e),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let e=o.minRank,r=o.maxRank+1;e<r;++e)sR(t,"borderLeft","_bl",n,o,e),sR(t,"borderRight","_br",n,o,e)}})}),o(" order",()=>(function e(t,n={}){let r,o,i;if("function"==typeof n.customOrder)return void n.customOrder(t,e);let a=sd(t),s=sV(t,sg(1,a+1),"inEdges"),l=sV(t,sg(a-1,-1,-1),"outEdges"),u=(r={},i=sg(su(Math.max,(o=t.nodes().filter(e=>!t.children(e).length)).map(e=>t.node(e).rank))+1).map(()=>[]),o.sort((e,n)=>t.node(e).rank-t.node(n).rank).forEach(function e(n){if(r[n])return;r[n]=!0,i[t.node(n).rank].push(n);let o=t.successors(n);o&&o.forEach(e)}),i);if(sF(t,u),n.disableOptimalOrderHeuristic)return;let d=1/0,c,h=n.constraints||[];for(let e=0,n=0;n<4;++e,++n){(function(e,t,n){let r=new aT;e.forEach(function(e){var o;let i,a;n.forEach(e=>r.setEdge(e.left,e.right));let s=e.graph().root,l=function e(t,n,r,o){var i;let a,s,l,u,d,c,h,f,g,p,m=t.children(n),y=t.node(n),v=y?y.borderLeft:void 0,x=y?y.borderRight:void 0,b={};v&&(m=m.filter(e=>e!==v&&e!==x));let w=function(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),o=e.node(n.v);return{sum:t.sum+r.weight*o.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}(t,m);w.forEach(n=>{if(t.children(n.v).length){var i,a;let s=e(t,n.v,r,o);b[n.v]=s,Object.hasOwn(s,"barycenter")&&(i=n,a=s,void 0!==i.barycenter?(i.barycenter=(i.barycenter*i.weight+a.barycenter*a.weight)/(i.weight+a.weight),i.weight+=a.weight):(i.barycenter=a.barycenter,i.weight=a.weight))}});let _=(a={},w.forEach((e,t)=>{let n={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(n.barycenter=e.barycenter,n.weight=e.weight),a[e.v]=n}),r.edges().forEach(e=>{let t=a[e.v],n=a[e.w];void 0!==t&&void 0!==n&&(n.indegree++,t.out.push(n))}),function(e){let t=[];for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(function(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(n)),n.out.forEach(function(t){return n=>{n.in.push(t),0==--n.indegree&&e.push(n)}}(n))}return t.filter(e=>!e.merged).map(e=>sp(e,["vs","i","barycenter","weight"]))}(Object.values(a).filter(e=>!e.indegree)));!function(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}(_,b);let E=(u=(i=e=>Object.hasOwn(e,"barycenter"),s={lhs:[],rhs:[]},_.forEach(e=>{i(e)?s.lhs.push(e):s.rhs.push(e)}),l=s).lhs,d=l.rhs.sort((e,t)=>t.i-e.i),c=[],h=0,f=0,g=0,u.sort(function(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}(!!o)),g=sH(c,d,g),u.forEach(e=>{g+=e.vs.length,c.push(e.vs),h+=e.barycenter*e.weight,f+=e.weight,g=sH(c,d,g)}),p={vs:c.flat(1)},f&&(p.barycenter=h/f,p.weight=f),p);if(v&&x){E.vs=[v,E.vs,x].flat(1);let e=t.predecessors(v);if(e&&e.length){let n=t.node(e[0]),r=t.predecessors(x),o=t.node(r[0]);Object.hasOwn(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+n.order+o.order)/(E.weight+2),E.weight+=2}}return E}(e,s,r,t);l.vs.forEach((t,n)=>e.node(t).order=n),o=l.vs,i={},o.forEach(t=>{let n=e.parent(t),o,s;for(;n;){if((o=e.parent(n))?(s=i[o],i[o]=n):(s=a,a=n),s&&s!==n)return void r.setEdge(s,n);n=o}})})})(e%2?s:l,e%4>=2,h),u=ss(t);let r=function(e,t){let n=0;for(let r=1;r<t.length;++r)n+=function(e,t,n){var r;let o=(r=n.map((e,t)=>t),n.reduce((e,t,n)=>(e[t]=r[n],e),{})),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:o[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let s=2*a-1;a-=1;let l=Array(s).fill(0),u=0;return i.forEach(e=>{let t=e.pos+a;l[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=l[t+1]),t=t-1>>1,l[t]+=e.weight;u+=e.weight*n}),u}(e,t[r-1],t[r]);return n}(t,u);r<d?(n=0,c=Object.assign({},u),d=r):r===d&&(c=structuredClone(u))}sF(t,c)})(e,i)),o(" insertSelfEdges",()=>{var t;ss(t=e).forEach(e=>{let n=0;e.forEach((e,r)=>{let o=t.node(e);o.order=r+n,(o.selfEdges||[]).forEach(e=>{so(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete o.selfEdges})})}),o(" adjustCoordinateSystem",()=>{var t;let n;("lr"===(n=null==(t=e.graph().rankdir)?void 0:t.toLowerCase())||"rl"===n)&&sL(e)}),o(" position",()=>{var t,n,r,o;let i,a,s,l,u,d,c,h,f,g,p,m,y,v,x;p=ss(o=t=si(t=e)),y=(m=o.graph()).ranksep,v=m.rankalign,x=0,p.forEach(e=>{let t=e.reduce((e,t)=>{var n;let r=null!=(n=o.node(t).height)?n:0;return e>r?e:r},0);e.forEach(e=>{let n=o.node(e);"top"===v?n.y=x+n.height/2:"bottom"===v?n.y=x+t-n.height/2:n.y=x+t/2}),x+=t+y}),Object.entries((a=ss(n=t),s=Object.assign((i={},a.length&&a.reduce(function(e,t){let r=0,o=0,a=e.length,s=t[t.length-1];return t.forEach((e,l)=>{let u=function(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}(n,e),d=u?n.node(u).order:a;(u||e===s)&&(t.slice(o,l+1).forEach(e=>{let t=n.predecessors(e);t&&t.forEach(t=>{let o=n.node(t),a=o.order;(a<r||d<a)&&!(o.dummy&&n.node(e).dummy)&&sX(i,t,e)})}),o=l+1,r=d)}),t}),i),function(e,t){let n={};function r(t,r,o,i,a){sg(r,o).forEach(r=>{let o=t[r];if(void 0!==o&&e.node(o).dummy){let t=e.predecessors(o);t&&t.forEach(t=>{if(void 0===t)return;let r=e.node(t);r.dummy&&(r.order<i||r.order>a)&&sX(n,t,o)})}})}return t.length&&t.reduce(function(t,n){let o=-1,i=-1,a=0;return n.forEach((s,l)=>{if("border"===e.node(s).dummy){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(void 0===s)return;i=e.node(s).order,r(n,a,l,o,i),a=l,o=i}}r(n,a,n.length,i,t.length)}),n}),n}(n,a)),l={},["u","d"].forEach(e=>{u="u"===e?a:Object.values(a).reverse(),["l","r"].forEach(t=>{var r,o;let i,a,d;"r"===t&&(u=u.map(e=>Object.values(e).reverse()));let c=(r=u,o=t=>("u"===e?n.predecessors(t):n.successors(t))||[],i={},a={},d={},r.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,d[e]=t})}),r.forEach(e=>{let t=-1;e.forEach(e=>{let n=o(e);if(n&&n.length){let r=n.sort((e,t)=>{let n=d[e],r=d[t];return(void 0!==n?n:0)-(void 0!==r?r:0)}),o=(r.length-1)/2;for(let n=Math.floor(o),l=Math.ceil(o);n<=l;++n){let o=r[n];if(void 0===o)continue;let l=d[o];if(void 0!==l&&a[e]===e&&t<l&&!function(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return void 0!==r&&Object.hasOwn(r,n)}(s,e,o)){let n=i[o];void 0!==n&&(a[o]=e,a[e]=i[e]=n,t=l)}}}})}),{root:i,align:a}),h=function(e,t,n,r,o=!1){var i,a,s,l,u,d,c;let h,f,g,p={},m=(i=e,a=t,s=n,l=o,h=new aT,g=(u=(f=i.graph()).nodesep,d=f.edgesep,c=l,(e,t,n)=>{let r=e.node(t),o=e.node(n),i,a;if(i=0+r.width/2,Object.hasOwn(r,"labelpos"))switch(r.labelpos.toLowerCase()){case"l":a=-r.width/2;break;case"r":a=r.width/2}if(a&&(i+=c?a:-a),a=void 0,i+=(r.dummy?d:u)/2,i+=(o.dummy?d:u)/2,i+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":a=o.width/2;break;case"r":a=-o.width/2}return a&&(i+=c?a:-a),i}),a.forEach(e=>{let t;e.forEach(e=>{let n=s[e];if(void 0!==n){if(h.setNode(n),void 0!==t){let r=s[t];if(void 0!==r){let o=h.edge(r,n);h.setEdge(r,n,Math.max(g(i,e,t),o||0))}}t=e}})}),h),y=o?"borderLeft":"borderRight";function v(e,t){let n=m.nodes().slice(),r={},o=n.pop();for(;o;){if(r[o])e(o);else for(let e of(r[o]=!0,n.push(o),t(o)))n.push(e);o=n.pop()}}return v(function(e){let t=m.inEdges(e);t?p[e]=t.reduce((e,t)=>{var n;let r=null!=(n=p[t.v])?n:0,o=m.edge(t);return Math.max(e,r+(void 0!==o?o:0))},0):p[e]=0},function(e){return m.predecessors(e)||[]}),v(function(t){let n=m.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=p[t.w],r=m.edge(t);return Math.min(e,(void 0!==n?n:0)-(void 0!==r?r:0))},1/0));let o=e.node(t);r!==1/0&&o.borderType!==y&&(p[t]=Math.max(void 0!==p[t]?p[t]:0,r))},function(e){return m.successors(e)||[]}),Object.keys(r).forEach(e=>{var t;let r=n[e];void 0!==r&&(p[e]=null!=(t=p[r])?t:0)}),p}(n,u,c.root,c.align,"r"===t);"r"===t&&(h=sm(h,e=>-e)),l[e+t]=h})}),d=Object.values(l).reduce((e,t)=>{let r=-1/0,o=1/0;Object.entries(t).forEach(([e,t])=>{var i,a;let s=(i=n,a=e,i.node(a).width/2);r=Math.max(t+s,r),o=Math.min(t-s,o)});let i=r-o;return i<e[0]&&(e=[i,t]),e},[1/0,null])[1],h=su(Math.min,c=Object.values(d)),f=su(Math.max,c),["u","d"].forEach(e=>{["l","r"].forEach(t=>{let n=e+t,r=l[n];if(!r||r===d)return;let o=Object.values(r),i=h-su(Math.min,o);"l"!==t&&(i=f-su(Math.max,o)),i&&(l[n]=sm(r,e=>e+i))})}),r=n.graph().align,(g=l.ul)?sm(g,(e,t)=>{var n,o;if(r){let e=l[r.toLowerCase()];if(e&&void 0!==e[t])return e[t]}let i=Object.values(l).map(e=>{let n=e[t];return void 0!==n?n:0}).sort((e,t)=>e-t);return((null!=(n=i[1])?n:0)+(null!=(o=i[2])?o:0))/2}):{})).forEach(([e,n])=>t.node(e).x=n)}),o(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{let n=t.node(e);if("selfedge"===n.dummy){let r=t.node(n.e.v),o=r.x+r.width/2,i=r.y,a=n.x-o,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:o+2*a/3,y:i-s},{x:o+5*a/6,y:i-s},{x:o+a,y:i},{x:o+5*a/6,y:i+s},{x:o+2*a/3,y:i+s}],n.label.x=n.x,n.label.y=n.y}})}),o(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),o=t.node(n.borderBottom),i=t.node(n.borderLeft[n.borderLeft.length-1]),a=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),o(" normalize.undo",()=>{e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=o,n=e.node(t)})}),o(" fixupEdgeLabelCoords",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch(("l"===n.labelpos||"r"===n.labelpos)&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}),o(" undoCoordinateSystem",()=>{var t,n,r;let o;("bt"===(o=null==(t=e.graph().rankdir)?void 0:t.toLowerCase())||"rl"===o)&&((n=e).nodes().forEach(e=>sT(n.node(e))),n.edges().forEach(e=>{var t;let r=n.edge(e);null==(t=r.points)||t.forEach(sT),Object.hasOwn(r,"y")&&sT(r)})),("lr"===o||"rl"===o)&&((r=e).nodes().forEach(e=>sB(r.node(e))),r.edges().forEach(e=>{var t;let n=r.edge(e);null==(t=n.points)||t.forEach(sB),Object.hasOwn(n,"x")&&sB(n)}),sL(e))}),o(" translateGraph",()=>(function(e){let t=1/0,n=0,r=1/0,o=0,i=e.graph(),a=i.marginx||0,s=i.marginy||0;function l(e){let i=e.x,a=e.y,s=e.width,l=e.height;t=Math.min(t,i-s/2),n=Math.max(n,i+s/2),r=Math.min(r,a-l/2),o=Math.max(o,a+l/2)}e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,"x")&&l(n)}),t-=a,r-=s,e.nodes().forEach(n=>{let o=e.node(n);o.x-=t,o.y-=r}),e.edges().forEach(n=>{let o=e.edge(n);o.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(o,"x")&&(o.x-=t),Object.hasOwn(o,"y")&&(o.y-=r)}),i.width=n-t+a,i.height=o-r+s})(e)),o(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e),r=t.node(e.v),o=t.node(e.w),i,a;n.points?(i=n.points[0],a=n.points[n.points.length-1]):(n.points=[],i=o,a=r),n.points.unshift(sa(r,i)),n.points.push(sa(o,a))})}),o(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}),o(" acyclic.undo",()=>{e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}))}),n(" updateInputGraph",()=>{var t,n;return t=e,n=r,void(t.nodes().forEach(e=>{let r=t.node(e),o=n.node(e);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,n.children(e).length&&(r.width=o.width,r.height=o.height))}),t.edges().forEach(e=>{let r=t.edge(e),o=n.edge(e);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),t.graph().width=n.graph().width,t.graph().height=n.graph().height)}),r})};function s2(e,t,n="LR"){let r=new a$.Graph;for(let t of(r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:n,nodesep:80,ranksep:180,marginx:40,marginy:40}),e))r.setNode(t.id,{width:280,height:100});for(let e of t)r.setEdge(e.source,e.target);return s1(r),e.map(e=>{let t=r.node(e.id);return{...e,position:{x:t.x-140,y:t.y-50}}})}let s5={agent:am},s3={link:ay};function s4(e){return`alook-canvas-positions-${e}`}function s6({onAgentClick:e}){let t=(0,b.useRouter)(),{agents:n,runtimes:r,loading:o,activeTaskCounts:i,agentLinks:a}=(0,ao.useAgentContext)(),{slug:s,workspaceId:l}=(0,ai.useWorkspace)(),{zoomIn:u,zoomOut:d,fitView:c}=oy(),[h,f]=(0,x.useState)([]),[g,p]=(0,x.useState)([]),[m,w]=(0,x.useState)([]),_=!o,[E,k]=(0,x.useState)(null),[S,N]=(0,x.useState)(!1),[M,C]=(0,x.useState)(!1),j=(0,x.useRef)(!1),A=(0,x.useRef)({});(0,x.useEffect)(()=>{o||w(a)},[a,o]),(0,x.useEffect)(()=>{if(!_)return;let e=new Map(h.map(e=>[e.id,e.position])),t=m.map(t=>{let n=A.current[t.id],r=n?.sourceHandle,o=n?.targetHandle;if(!r||!o){let n=e.get(t.source_agent_id),i=e.get(t.target_agent_id);if(n&&i){let e=i.x-n.x,t=i.y-n.y;Math.abs(e)>=Math.abs(t)?(r=e>=0?"right":"left",o=e>=0?"target-left":"target-right"):(r=t>=0?"bottom":"top",o=t>=0?"target-top":"target-bottom")}else r="right",o="target-left"}return{id:t.id,source:t.source_agent_id,target:t.target_agent_id,sourceHandle:r,targetHandle:o,type:"link",data:{instruction:t.instruction,onEdgeClick:e=>{let t=m.find(t=>t.id===e);t&&(k(t),N(!0))}},selected:E?.id===t.id&&S}});p(t),C(0===t.length)},[m,_,E,S,h]),(0,x.useEffect)(()=>{if(o||0===n.length)return;let e=function(e){try{let t=localStorage.getItem(s4(e));return t?JSON.parse(t):{}}catch{return{}}}(l),t=new Set(n.map(e=>e.id)),a={};for(let[n,r]of Object.entries(e))t.has(n)&&(a[n]=r);let u=n.map((e,t)=>({id:e.id,type:"agent",position:a[e.id]??{x:0,y:0},data:{agent:e,runtimes:r,activeTaskCount:i[e.id]??0,slug:s,index:t}})),d=Object.keys(a).length>0,h=n.filter(e=>!a[e.id]).map(e=>e.id);if(d||_){if(d&&h.length>0&&!_&&(u=u.filter(e=>a[e.id])),d){if(h.length>0&&_){let e=s2([...u.filter(e=>a[e.id]),...u.filter(e=>!a[e.id])],m.map(e=>({id:e.id,source:e.source_agent_id,target:e.target_agent_id})));u=u.map(t=>{if(a[t.id])return t;let n=e.find(e=>e.id===t.id);return n?{...t,position:n.position}:t})}}else _&&(u=s2(u,m.map(e=>({id:e.id,source:e.source_agent_id,target:e.target_agent_id}))),j.current||(j.current=!0,setTimeout(()=>c({padding:.4,duration:400}),50)));f(u)}},[n,r,i,s,o,l,_,m,c]);let O=(0,x.useCallback)(e=>{f(t=>oa(e,t))},[]),z=(0,x.useCallback)(e=>{p(t=>oa(e,t))},[]),P=(0,x.useCallback)(()=>{f(e=>{let t={};for(let n of e)t[n.id]=n.position;try{localStorage.setItem(s4(l),JSON.stringify(t))}catch{}return e})},[l]),$=(0,x.useCallback)(async e=>{if(e.source&&e.target)try{let t=await (0,ac.createAgentLink)({source_agent_id:e.source,target_agent_id:e.target},l);(e.sourceHandle||e.targetHandle)&&(A.current[t.id]={sourceHandle:e.sourceHandle??"right",targetHandle:e.targetHandle??"target-left"}),w(e=>[...e,t]),C(!1)}catch(e){e instanceof af.ApiError?409===e.status?ah.toast.error("Link already exists"):400===e.status?ah.toast.error("Can't link an agent to itself"):ah.toast.error("Failed to create link"):ah.toast.error("Failed to create link")}},[l]),I=(0,x.useCallback)(async(e,t)=>{try{let n=await (0,ac.updateAgentLink)(e,{instruction:t},l);w(t=>t.map(t=>t.id===e?n:t))}catch{ah.toast.error("Failed to update link")}},[l]),R=(0,x.useCallback)(async e=>{try{await (0,ac.deleteAgentLink)(e,l),w(t=>t.filter(t=>t.id!==e)),N(!1)}catch{ah.toast.error("Failed to delete link")}},[l]),L=(0,x.useCallback)(()=>{try{localStorage.removeItem(s4(l))}catch{}let e=m.map(e=>({id:e.id,source:e.source_agent_id,target:e.target_agent_id}));f(t=>{let n=s2(t,e).map(e=>({...e,style:{...e.style,transition:"transform 300ms ease-out"}}));return setTimeout(()=>{f(e=>e.map(e=>({...e,style:{...e.style,transition:void 0}}))),c({padding:.4,duration:400})},350),n})},[m,l,c]),D=(0,x.useCallback)((n,r)=>{let o=r.data;N(!1),e?e(o.agent):t.push(`/w/${s}/agents/${o.agent.id}`)},[t,s,e]),T=(0,x.useMemo)(()=>({stroke:"var(--color-primary)",strokeWidth:1.5,strokeDasharray:"6 4",opacity:.5}),[]);return(0,v.jsxs)("div",{className:"flex-1 relative",children:[(0,v.jsx)(iI,{nodes:h,edges:g,nodeTypes:s5,edgeTypes:s3,onNodesChange:O,onEdgesChange:z,onConnect:$,onNodeClick:D,onNodeDragStop:P,connectionLineStyle:T,fitView:!0,fitViewOptions:{padding:.4,maxZoom:1},minZoom:.25,maxZoom:2.5,zoomOnScroll:!0,panOnScroll:!1,proOptions:{hideAttribution:!0},children:(0,v.jsx)(iF,{variant:y.Dots,gap:24,size:1.5,color:"var(--color-border)"})}),(0,v.jsxs)("div",{className:"absolute bottom-4 left-4 bg-background/80 backdrop-blur-sm rounded-lg ring-1 ring-foreground/5 p-1 flex gap-0.5 animate-[fade-up_300ms_ease-out_both]",style:{animationDelay:"200ms"},children:[(0,v.jsx)("button",{type:"button",className:"size-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>u(),children:(0,v.jsx)(i9,{className:"size-4"})}),(0,v.jsx)("button",{type:"button",className:"size-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>d(),children:(0,v.jsx)(i7,{className:"size-4"})}),(0,v.jsx)("button",{type:"button",className:"size-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>c({padding:.4,duration:400}),children:(0,v.jsx)(ae,{className:"size-4"})}),(0,v.jsx)("button",{type:"button",className:"size-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:L,children:(0,v.jsx)(at,{className:"size-4"})})]}),M&&(0,v.jsx)("div",{className:"absolute bottom-14 left-4 text-xs text-muted-foreground bg-background/80 backdrop-blur-sm rounded-md px-3 py-1.5 ring-1 ring-foreground/5",children:"Drag between agent handles to create relationships."}),(0,v.jsx)(aE,{open:S,onOpenChange:N,link:E,agents:n,onSave:I,onDelete:R}),(0,v.jsxs)("div",{className:"absolute bottom-4 right-4 z-10 flex flex-wrap justify-end items-end gap-2",children:[(0,v.jsx)(az,{}),(0,v.jsx)(aj,{})]}),(0,v.jsxs)(au.Tooltip,{children:[(0,v.jsx)(au.TooltipTrigger,{render:(0,v.jsx)("button",{type:"button",className:"absolute top-4 right-4 size-8 rounded-lg bg-background/80 backdrop-blur-sm ring-1 ring-foreground/5 flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors animate-[fade-up_300ms_ease-out_both]",style:{animationDelay:"200ms"},onClick:()=>t.push(`/w/${s}/agents/new`)}),children:(0,v.jsx)(ar.Plus,{className:"size-4"})}),(0,v.jsx)(au.TooltipContent,{children:"Create new agent"})]})]})}function s8({onAgentClick:e}){let t=(0,b.useRouter)(),{agents:n,runtimes:r,loading:o,activeTaskCounts:i}=(0,ao.useAgentContext)(),{slug:a}=(0,ai.useWorkspace)();if(o)return(0,v.jsx)("div",{className:"flex flex-col gap-1 p-4",children:[void 0,void 0,void 0,void 0].map((e,t)=>(0,v.jsx)("div",{className:"animate-pulse rounded-xl bg-muted h-15"},t))});let s=n=>{e?e(n):t.push(`/w/${a}/agents/${n.id}`)};return(0,v.jsxs)("div",{className:"relative flex-1 flex flex-col",children:[(0,v.jsx)("div",{className:"flex flex-col gap-1 p-4 overflow-y-auto thin-scrollbar",children:n.map(e=>{let t=r.find(t=>t.id===e.runtime_id),n=t?.status==="online";return(0,v.jsx)("div",{role:"button",tabIndex:0,className:"flex items-center w-full rounded-xl px-3 py-2.5 hover:bg-accent/50 active:bg-accent/70 transition-colors cursor-pointer text-left",onClick:()=>s(e),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),s(e))},children:(0,v.jsx)(ad.AgentPreviewCard,{agent:e,isOnline:n,activeTaskCount:i[e.id]??0})},e.id)})}),(0,v.jsxs)(au.Tooltip,{children:[(0,v.jsx)(au.TooltipTrigger,{render:(0,v.jsx)("button",{type:"button",className:"absolute top-4 right-4 size-8 rounded-lg bg-background/80 backdrop-blur-sm ring-1 ring-foreground/5 flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>t.push(`/w/${a}/agents/new`)}),children:(0,v.jsx)(ar.Plus,{className:"size-4"})}),(0,v.jsx)(au.TooltipContent,{children:"Create new agent"})]})]})}e.s(["default",0,function(){let e=(0,b.useRouter)(),{agents:t,loading:n}=(0,ao.useAgentContext)(),{workspaceId:r}=(0,ai.useWorkspace)(),o=(0,aa.useIsMobile)(),{openAgentChat:i}=(0,as.useAgentChatSheet)(),a=(0,x.useCallback)(e=>{i(e.id)},[i]);return n?(0,v.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,v.jsx)(an.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}):0===t.length?(0,v.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,v.jsxs)("div",{className:"text-center animate-[fade-up_400ms_ease-out_both]",children:[(0,v.jsx)("p",{className:"text-muted-foreground text-sm",children:"Build your AI company"}),(0,v.jsx)(al.Button,{size:"sm",className:"mt-4 glow-border",onClick:()=>e.push(`/studio/new?workspace_id=${r}`),children:"Get Started"})]})}):o?(0,v.jsx)(s8,{onAgentClick:a}):(0,v.jsx)(iz,{children:(0,v.jsx)(s6,{onAgentClick:a})})}],614191)}]);
|
|
2
|
+
M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}i4.displayName="MiniMap",(0,x.memo)(i4);let i6={[m.Line]:"right",[m.Handle]:"bottom-right"};(0,x.memo)(function({nodeId:e,position:t,variant:n=m.Handle,className:r,style:o,children:i,color:a,minWidth:s=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:h,autoScale:f=!0,shouldResize:g,onResizeStart:p,onResize:y,onResizeEnd:b}){let _,E=oP(),k="string"==typeof e?e:E,S=rH(),N=(0,x.useRef)(null),M=n===m.Handle,C=rB((0,x.useCallback)((_=M&&f,e=>_?`${Math.max(1/e.transform[2],1)}`:void 0),[M,f]),rI),j=(0,x.useRef)(null),A=t??i6[n];(0,x.useEffect)(()=>{if(N.current&&k)return j.current||(j.current=function({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){let i=ef(e),a={controlDirection:rw("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:s,keepAspectRatio:l,resizeDirection:u,onResizeStart:d,onResize:c,onResizeEnd:h,shouldResize:f}){let g,p,m,y,v={...rS},x={...rN};a={boundaries:s,resizeDirection:u,keepAspectRatio:l,controlDirection:rw(e)};let b=null,w=[],_=!1,E=eM().on("start",e=>{let{nodeLookup:r,transform:o,snapGrid:i,snapToGrid:a,nodeOrigin:s,paneDomNode:l}=n();if(!(g=r.get(t)))return;b=l?.getBoundingClientRect()??null;let{xSnapped:u,ySnapped:c}=nL(e.sourceEvent,{transform:o,snapGrid:i,snapToGrid:a,containerBounds:b});if(x={...v={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},pointerX:u,pointerY:c,aspectRatio:v.width/v.height},p=void 0,g.parentId&&("parent"===g.extent||g.expandParent)){var h;m=(p=r.get(g.parentId))&&"parent"===g.extent?[[0,0],[(h=p).measured.width,h.measured.height]]:void 0}for(let[e,n]of(w=[],y=void 0,r))if(n.parentId===t&&(w.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){let e=function(e,t,n){let r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,s=n[0]*i,l=n[1]*a;return[[r-s,o-l],[r+i-s,o+a-l]]}(n,g,n.origin??s);y=y?[[Math.min(e[0][0],y[0][0]),Math.min(e[0][1],y[0][1])],[Math.max(e[1][0],y[1][0]),Math.max(e[1][1],y[1][1])]]:e}d?.(e,{...v})}).on("drag",e=>{let{transform:t,snapGrid:o,snapToGrid:i,nodeOrigin:s}=n(),l=nL(e.sourceEvent,{transform:t,snapGrid:o,snapToGrid:i,containerBounds:b}),u=[];if(!g)return;let{x:d,y:h,width:E,height:k}=v,S={},N=g.origin??s,{width:M,height:C,x:j,y:A}=function(e,t,n,r,o,i,a,s){var l,u,d,c;let{affectsX:h,affectsY:f}=t,{isHorizontal:g,isVertical:p}=t,m=g&&p,{xSnapped:y,ySnapped:v}=n,{minWidth:x,maxWidth:b,minHeight:w,maxHeight:_}=r,{x:E,y:k,width:S,height:N,aspectRatio:M}=e,C=Math.floor(g?y-e.pointerX:0),j=Math.floor(p?v-e.pointerY:0),A=S+(h?-C:C),O=N+(f?-j:j),z=-i[0]*S,P=-i[1]*N,$=rk(A,x,b),I=rk(O,w,_);if(a){let e=0,t=0;h&&C<0?e=r_(E+C+z,a[0][0]):!h&&C>0&&(e=rE(E+A+z,a[1][0])),f&&j<0?t=r_(k+j+P,a[0][1]):!f&&j>0&&(t=rE(k+O+P,a[1][1])),$=Math.max($,e),I=Math.max(I,t)}if(s){let e=0,t=0;h&&C>0?e=rE(E+C,s[0][0]):!h&&C<0&&(e=r_(E+A,s[1][0])),f&&j>0?t=rE(k+j,s[0][1]):!f&&j<0&&(t=r_(k+O,s[1][1])),$=Math.max($,e),I=Math.max(I,t)}if(o){if(g){($=Math.max($,rk(A/M,w,_)*M),a)&&($=Math.max($,(h||f)&&(!h||f||!m)?r_(k+P+(h?C:-C)/M,a[0][1])*M:rE(k+P+A/M,a[1][1])*M));s&&($=Math.max($,(h||f)&&(!h||f||!m)?rE(k+(h?C:-C)/M,s[0][1])*M:r_(k+A/M,s[1][1])*M))}if(p){(I=Math.max(I,rk(O*M,x,b)/M),a)&&(I=Math.max(I,(h||f)&&(!f||h||!m)?r_(E+(f?j:-j)*M+z,a[0][0])/M:rE(E+O*M+z,a[1][0])/M));s&&(I=Math.max(I,(h||f)&&(!f||h||!m)?rE(E+(f?j:-j)*M,s[0][0])/M:r_(E+O*M,s[1][0])/M))}}j+=j<0?I:-I,C+=C<0?$:-$,o&&(m?A>O*M?j=((l=h,u=f,l?!u:u)?-C:C)/M:C=((d=h,c=f,d?!c:c)?-j:j)*M:g?(j=C/M,f=h):(C=j*M,h=f));let R=h?E+C:E,L=f?k+j:k;return{width:S+(h?-C:C),height:N+(f?-j:j),x:i[0]*C*(h?-1:1)+R,y:i[1]*j*(f?-1:1)+L}}(x,a.controlDirection,l,a.boundaries,a.keepAspectRatio,N,m,y),O=M!==E,z=C!==k,P=j!==d&&O,$=A!==h&&z;if(!P&&!$&&!O&&!z)return;if((P||$||1===N[0]||1===N[1])&&(S.x=P?j:v.x,S.y=$?A:v.y,v.x=S.x,v.y=S.y,w.length>0)){let e=j-d,t=A-h;for(let n of w)n.position={x:n.position.x-e+N[0]*(M-E),y:n.position.y-t+N[1]*(C-k)},u.push(n)}if((O||z)&&(S.width=O&&(!a.resizeDirection||"horizontal"===a.resizeDirection)?M:v.width,S.height=z&&(!a.resizeDirection||"vertical"===a.resizeDirection)?C:v.height,v.width=S.width,v.height=S.height),p&&g.expandParent){let e=N[0]*(S.width??0);S.x&&S.x<e&&(v.x=e,x.x=x.x-(S.x-e));let t=N[1]*(S.height??0);S.y&&S.y<t&&(v.y=t,x.y=x.y-(S.y-t))}let I=function({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){let a=e-t,s=n-r,l=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&o&&(l[0]=-1*l[0]),s&&i&&(l[1]=-1*l[1]),l}({width:v.width,prevWidth:E,height:v.height,prevHeight:k,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),R={...v,direction:I};!1!==f?.(e,R)&&(_=!0,c?.(e,R),r(S,u))}).on("end",e=>{_&&(h?.(e,{...v}),o?.({...v}),_=!1)});i.call(E)},destroy:function(){i.on(".drag",null)}}}({domNode:N.current,nodeId:k,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:o,domNode:i}=S.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:o,paneDomNode:i}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:o,nodeOrigin:i}=S.getState(),a=[],s={x:e.x,y:e.y},l=r.get(k);if(l&&l.expandParent&&l.parentId){let t=l.origin??i,n=e.width??l.measured.width??0,u=e.height??l.measured.height??0,d=rr([{id:l.id,parentId:l.parentId,rect:{width:n,height:u,...nI({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:u},l.parentId,r,t)}}],r,o,i);a.push(...d),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*u,e.y):void 0}if(void 0!==s.x&&void 0!==s.y){let e={id:k,type:"position",position:{...s}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){let t={id:k,type:"dimensions",resizing:!0,setAttributes:!h||("horizontal"===h?"width":"height"),dimensions:{width:e.width,height:e.height}};a.push(t)}for(let e of t){let t={...e,type:"position"};a.push(t)}n(a)},onEnd:({width:e,height:t})=>{S.getState().triggerNodeChanges([{id:k,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}}])}})),j.current.update({controlPosition:A,boundaries:{minWidth:s,minHeight:l,maxWidth:u,maxHeight:d},keepAspectRatio:c,resizeDirection:h,onResizeStart:p,onResize:y,onResizeEnd:b,shouldResize:g}),()=>{j.current?.destroy()}},[A,s,l,u,d,c,p,y,b,g]);let O=A.split("-");return(0,v.jsx)("div",{className:w(["react-flow__resize-control","nodrag",...O,n,r]),ref:N,style:{...o,scale:C,...a&&{[M?"backgroundColor":"borderColor"]:a}},children:i})});var i8=e.i(406963);let i9=(0,i8.default)("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),i7=(0,i8.default)("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),ae=(0,i8.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),at=(0,i8.default)("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"}]]);var an=e.i(371522),ar=e.i(949035),ao=e.i(355578),ai=e.i(500324),aa=e.i(996718),as=e.i(252304),al=e.i(186339),au=e.i(329686),ad=e.i(844010);e.i(400175);var ac=e.i(819748),ah=e.i(126366),af=e.i(222862),ag=e.i(880932),ap=e.i(636557),am=e.i(613349);let ay="!opacity-0 !size-3 !bg-muted-foreground/40 !rounded-full group-hover:!opacity-100 hover:!bg-primary hover:!scale-125 !transition-all !border-none",av=(0,x.memo)(function({data:e,selected:t,dragging:n}){let{agent:r,runtimes:o,activeTaskCount:i,index:a}=e,s=o.find(e=>e.id===r.runtime_id),l=s?.status==="online",[u,d]=(0,x.useState)(!1);return(0,v.jsxs)("div",{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),className:(0,am.cn)("bg-background rounded-xl ring-1 ring-foreground/8 shadow-sm transition-[box-shadow,ring-color,opacity,transform] duration-200 py-3 px-3.5 group",t&&"ring-2 ring-primary/30 shadow-md",!t&&"hover:ring-foreground/15 hover:shadow-md",n&&"shadow-lg scale-[1.02] cursor-grabbing"),style:{animationDelay:`${60*a}ms`},children:[(0,v.jsx)(oI,{type:"source",id:"right",position:p.Right,className:ay}),(0,v.jsx)(oI,{type:"source",id:"left",position:p.Left,className:ay}),(0,v.jsx)(oI,{type:"source",id:"top",position:p.Top,className:ay}),(0,v.jsx)(oI,{type:"source",id:"bottom",position:p.Bottom,className:ay}),(0,v.jsx)(oI,{type:"target",id:"target-right",position:p.Right,className:ay}),(0,v.jsx)(oI,{type:"target",id:"target-left",position:p.Left,className:ay}),(0,v.jsx)(oI,{type:"target",id:"target-top",position:p.Top,className:ay}),(0,v.jsx)(oI,{type:"target",id:"target-bottom",position:p.Bottom,className:ay}),(0,v.jsx)(ad.AgentPreviewCard,{agent:r,isOnline:l,activeTaskCount:i,variant:"compact",isHovered:u})]})}),ax=(0,x.memo)(function({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:i,targetPosition:a,selected:s,data:l}){let{instruction:u,onEdgeClick:d}=l??{},[c,h]=(0,x.useState)(!1),[f,g,p]=n0({sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:i,targetPosition:a,borderRadius:16}),m=(0,x.useCallback)(t=>{t.stopPropagation(),d?.(e)},[d,e]);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("path",{d:f,fill:"none",stroke:s?"var(--color-primary)":c?"var(--color-muted-foreground)":"var(--color-border)",strokeWidth:s||c?2:1.5,style:{transition:"stroke 150ms, stroke-width 150ms"},onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1)}),(0,v.jsx)(iL,{children:(0,v.jsx)("button",{type:"button",style:{position:"absolute",transform:`translate(-50%, -50%) translate(${g}px,${p}px)`,pointerEvents:"auto"},className:`text-[11px] leading-tight bg-background/90 px-2 py-0.5 rounded-md truncate cursor-pointer transition-colors italic ${c?"text-muted-foreground":"text-muted-foreground/40"}`,onClick:m,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:u&&""!==u&&"<p></p>"!==u?"edit relationship":"define relationship"})})]})});var ab=e.i(332680),aw=e.i(740513),a_=e.i(676214),aE=e.i(393153);function ak({open:e,onOpenChange:t,link:n,agents:r,onSave:o,onDelete:i}){let[a,s]=(0,x.useState)(""),[l,u]=(0,x.useState)(!1),d=(0,x.useRef)(a);(0,x.useEffect)(()=>{d.current=a},[a]);let c=(0,x.useRef)(""),h=(0,x.useRef)(null),f=(0,x.useRef)(n);(0,x.useEffect)(()=>{f.current=n},[n]);let g=r.find(e=>e.id===n?.source_agent_id),p=r.find(e=>e.id===n?.target_agent_id);(0,x.useEffect)(()=>{n&&(s(n.instruction),c.current=n.instruction)},[n]);let m=(0,x.useCallback)(()=>{let e=d.current,t=f.current;t&&e!==c.current&&(c.current=e,o(t.id,e))},[o]),y=(0,x.useCallback)(()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(m,500)},[m]),b=(0,x.useCallback)(e=>{s(e),y()},[y]);(0,x.useEffect)(()=>()=>{h.current&&clearTimeout(h.current),m()},[m]);let w=(0,x.useCallback)(e=>{e||(h.current&&clearTimeout(h.current),m()),t(e)},[t,m]),_=(0,x.useCallback)(()=>{h.current&&clearTimeout(h.current),n&&i(n.id),u(!1)},[n,i]),E=e=>{if(!e)return null;let t=(0,ah.parseAvatarUrl)(e.avatar_url);return t?(0,v.jsx)(ah.AvatarRenderer,{config:t,size:32,className:"shrink-0 rounded-xl"}):(0,v.jsx)("div",{className:"flex items-center justify-center size-8 rounded-xl bg-secondary text-secondary-foreground text-xs font-medium shrink-0",children:e.name.charAt(0).toUpperCase()})};return(0,v.jsxs)(ab.Sheet,{open:e,onOpenChange:w,children:[(0,v.jsxs)(ab.SheetContent,{side:"right",showCloseButton:!1,className:"data-[side=right]:sm:inset-y-2 data-[side=right]:sm:right-2 data-[side=right]:sm:h-auto data-[side=right]:sm:rounded-xl data-[side=right]:sm:border data-[side=right]:sm:max-w-md",children:[(0,v.jsxs)(ab.SheetTitle,{className:"sr-only",children:["Edit relationship between ",g?.name," and ",p?.name]}),(0,v.jsxs)(ab.SheetHeader,{className:"border-b px-5 py-4",children:[(0,v.jsxs)("div",{className:"flex items-center justify-between",children:[(0,v.jsx)("div",{className:"flex items-center gap-2",children:(0,v.jsxs)("div",{className:"flex items-center",children:[E(g),(0,v.jsx)("div",{className:"-ml-2 ring-2 ring-background rounded-xl",children:E(p)})]})}),(0,v.jsxs)(au.Tooltip,{children:[(0,v.jsx)(au.TooltipTrigger,{render:(0,v.jsx)(al.Button,{variant:"ghost",size:"icon-sm",className:"text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>u(!0)}),children:(0,v.jsx)(a_.Trash2,{className:"size-4"})}),(0,v.jsx)(au.TooltipContent,{children:"Remove connection"})]})]}),(0,v.jsxs)("p",{className:"text-sm font-medium",children:[g?.name??"Agent"," and ",p?.name??"Agent"]}),(0,v.jsx)("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-2",children:"use @ to mention agent"})]}),(0,v.jsx)("div",{className:"flex-1 overflow-y-auto thin-scrollbar px-5 py-4",children:(0,v.jsx)(aw.MarkdownEditor,{variant:"seamless",contentType:"markdown",placeholder:"Describe how these agents should collaborate. This instruction is shared with both agents when they receive tasks.",value:a,onChange:b,minHeight:"12rem",agents:r})})]}),(0,v.jsx)(aE.ConfirmDialog,{open:l,onOpenChange:u,title:"Remove connection",description:`This will remove the connection between "${g?.name??"Agent"}" and "${p?.name??"Agent"}".`,onConfirm:_})]})}var aS=e.i(789994),aN=e.i(937091),aM=e.i(450463);function aC({name:e,avatarUrl:t,size:n=20}){let r=(0,ah.parseAvatarUrl)(t);return r?(0,v.jsx)(ah.AvatarRenderer,{config:r,size:n,className:"rounded-full shrink-0"}):(0,v.jsx)("span",{className:"flex items-center justify-center rounded-full bg-secondary text-[7px] font-medium shrink-0",style:{width:n,height:n},children:(e??"?").charAt(0).toUpperCase()})}function aj({task:e,slug:t,onOpenChat:n}){let r="running"===e.status,o=`/w/${t}/agents/${e.agent_id}?task=${e.id}&conv=${e.conversation_id}`,i=(0,x.useCallback)(t=>{t.metaKey||t.ctrlKey||t.shiftKey||0!==t.button||(t.preventDefault(),n(e.agent_id,{conversationId:e.conversation_id,taskId:e.id}))},[e.agent_id,e.conversation_id,e.id,n]);return(0,v.jsxs)("a",{href:o,onClick:i,className:"flex items-center gap-2.5 px-3 py-2 hover:bg-accent/50 transition-colors cursor-pointer rounded-md",children:[(0,v.jsxs)("div",{className:"relative shrink-0",children:[(0,v.jsx)(aC,{name:e.agent?.name,avatarUrl:e.agent?.avatarUrl,size:24}),(0,v.jsx)("span",{className:`absolute -bottom-0.5 -right-0.5 size-2 rounded-full ring-2 ring-background ${r?"bg-primary animate-pulse":"bg-muted-foreground/40"}`})]}),(0,v.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,v.jsxs)("div",{className:"flex items-center gap-1.5 leading-tight",children:[(0,v.jsx)("span",{className:"text-sm font-medium truncate",children:e.agent?.name??"Unknown"}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:["#",e.channel]})]}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground truncate leading-tight",children:e.prompt})]}),(0,v.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap shrink-0",children:(0,aM.relativeTime)(e.created_at)})]})}function aA(){let{activeTaskDetails:e}=(0,ao.useAgentContext)(),{slug:t}=(0,ai.useWorkspace)(),n=(0,aa.useIsMobile)(),{openAgentChat:r}=(0,as.useAgentChatSheet)(),[o,i]=(0,x.useState)(!1),a=(0,x.useRef)(new Set),s=e.length;return((0,x.useEffect)(()=>{if(0===s){a.current=new Set;return}let t=new Set(e.map(e=>e.id));e.some(e=>!a.current.has(e.id))&&!o&&i(!0),a.current=t},[e,s,o]),n||0===s)?null:o?(0,v.jsxs)("div",{role:"region","aria-label":"Active tasks",className:"w-80 rounded-lg ring-1 ring-foreground/8 shadow-sm bg-background/90 backdrop-blur-sm animate-[fade-up_300ms_ease-out_both]",children:[(0,v.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border/50",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium","aria-live":"polite",children:[(0,v.jsx)("span",{className:"size-1.5 rounded-full bg-primary animate-pulse"}),(0,v.jsxs)("span",{children:[s," task",1!==s?"s":""," active"]})]}),(0,v.jsx)("button",{type:"button","aria-label":"Collapse tasks panel",className:"size-6 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>i(!1),children:(0,v.jsx)(aN.X,{className:"size-3.5"})})]}),(0,v.jsxs)("div",{className:"max-h-75 overflow-y-auto thin-scrollbar py-1",children:[e.slice(0,8).map(e=>(0,v.jsx)(aj,{task:e,slug:t,onOpenChat:r},e.id)),s>8&&(0,v.jsxs)(aS.default,{href:`/w/${t}/threads?status=active`,className:"block text-xs text-muted-foreground hover:text-foreground text-center py-1.5 transition-colors",children:["View all ",s," tasks"]})]})]}):(0,v.jsxs)("button",{type:"button",onClick:()=>i(!0),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-background/90 backdrop-blur-sm ring-1 ring-foreground/8 shadow-sm text-xs font-medium text-muted-foreground hover:text-foreground transition-colors animate-[fade-up_300ms_ease-out_both]",children:[(0,v.jsx)("span",{className:"size-1.5 rounded-full bg-primary animate-pulse"}),s," active"]})}var aO=e.i(265481);function az({name:e,avatarUrl:t,size:n=20}){let r=(0,ah.parseAvatarUrl)(t);return r?(0,v.jsx)(ah.AvatarRenderer,{config:r,size:n,className:"rounded-full shrink-0"}):(0,v.jsx)("span",{className:"flex items-center justify-center rounded-full bg-secondary text-[7px] font-medium shrink-0",style:{width:n,height:n},children:(e??"?").charAt(0).toUpperCase()})}function aP(){let{agents:e}=(0,ao.useAgentContext)(),{slug:t,workspaceId:n}=(0,ai.useWorkspace)(),r=(0,aa.useIsMobile)(),[o,i]=(0,x.useState)([]),[a,s]=(0,x.useState)(!1),l=new Map(e.map(e=>[e.id,e])),u=(0,x.useCallback)(async()=>{if(!n)return;let e=new Date,t=new Date(e);t.setHours(23,59,59,999);try{let r=(await (0,af.listCalendarEvents)(n,{from:e.toISOString(),to:t.toISOString()})).filter(t=>new Date(t.occurrence_at)>=e);i(r)}catch{}},[n]);(0,x.useEffect)(()=>{u();let e=setInterval(u,6e4);return()=>clearInterval(e)},[u]);let d=o.reduce((e,t)=>e+(t.collapsed_count??1),0);if(r||0===d)return null;let c=[],h=new Map;for(let e of o)h.set(e.agent_id,(h.get(e.agent_id)??0)+(e.collapsed_count??1));for(let[e,t]of h){let n=l.get(e);c.push({agentId:e,agentName:n?.name??"Unknown",avatarUrl:n?.avatar_url??null,count:t})}return(c.sort((e,t)=>t.count-e.count),a)?(0,v.jsxs)("div",{role:"region","aria-label":"Upcoming events",className:"w-72 rounded-lg ring-1 ring-foreground/8 shadow-sm bg-background/90 backdrop-blur-sm animate-[fade-up_300ms_ease-out_both]",children:[(0,v.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border/50",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,v.jsx)(aO.CalendarDays,{className:"size-3.5 text-muted-foreground"}),(0,v.jsxs)("span",{children:[d," events today"]})]}),(0,v.jsx)("button",{type:"button","aria-label":"Collapse events panel",className:"size-6 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>s(!1),children:(0,v.jsx)(aN.X,{className:"size-3.5"})})]}),(0,v.jsx)("div",{className:"max-h-52 overflow-y-auto thin-scrollbar py-1",children:c.map(e=>(0,v.jsxs)(aS.default,{href:`/w/${t}/calendar`,className:"flex items-center gap-2.5 px-3 py-2 hover:bg-accent/50 transition-colors cursor-pointer rounded-md",children:[(0,v.jsx)(az,{name:e.agentName,avatarUrl:e.avatarUrl,size:22}),(0,v.jsx)("span",{className:"flex-1 text-sm truncate",children:e.agentName}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:[e.count," event",1!==e.count?"s":""]})]},e.agentId))})]}):(0,v.jsxs)("button",{type:"button",onClick:()=>s(!0),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-background/90 backdrop-blur-sm ring-1 ring-foreground/8 shadow-sm text-xs font-medium text-muted-foreground hover:text-foreground transition-colors animate-[fade-up_300ms_ease-out_both]",children:[(0,v.jsx)(aO.CalendarDays,{className:"size-3"}),d," upcoming"]})}var a$=Object.defineProperty,aI={},aR={Graph:()=>aB,alg:()=>aW,json:()=>aK,version:()=>aY};for(var aL in aR)a$(aI,aL,{get:aR[aL],enumerable:!0});var aD=Object.defineProperty,aT=(e,t)=>{for(var n in t)aD(e,n,{get:t[n],enumerable:!0})},aB=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=!("directed"in e)||e.directed,this._isMultigraph="multigraph"in e&&e.multigraph,this._isCompound="compound"in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return"function"!=typeof e?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>0===Object.keys(this._in[e]).length)}sinks(){return this.nodes().filter(e=>0===Object.keys(this._out[e]).length)}setNodes(e,t){return e.forEach(e=>{void 0!==t?this.setNode(e,t):this.setNode(e)}),this}setNode(e,t){return e in this._nodes?arguments.length>1&&(this._nodes[e]=t):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount),this}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(void 0===t)t="\0";else{t+="";for(let n=t;void 0!==n;n=this.parent(n))if(n===e)throw Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();this.hasNode(e)}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let t of this.successors(e))n.add(t);return Array.from(n.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let o=this.parent(e);return!o||t.hasNode(o)?(n[e]=null!=o?o:void 0,null!=o?o:void 0):o in n?n[o]:r(o)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return"function"!=typeof e?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(void 0!==t?this.setEdge(e,n,t):this.setEdge(e,n),n)),this}setEdge(e,t,n,r){let o,i,a,s,l=!1;"object"==typeof e&&null!==e&&"v"in e?(o=e.v,i=e.w,a=e.name,2==arguments.length&&(s=t,l=!0)):(o=e,i=t,a=r,arguments.length>2&&(s=n,l=!0)),o=""+o,i=""+i,void 0!==a&&(a=""+a);let u=aF(this._isDirected,o,i,a);if(u in this._edgeLabels)return l&&(this._edgeLabels[u]=s),this;if(void 0!==a&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(i),this._edgeLabels[u]=l?s:this._defaultEdgeLabelFn(o,i,a);let d=function(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let e=o;o=i,i=e}let a={v:o,w:i};return r&&(a.name=r),a}(this._isDirected,o,i,a);return o=d.v,i=d.w,Object.freeze(d),this._edgeObjs[u]=d,aH(this._preds[i],o),aH(this._sucs[o],i),this._in[i][u]=d,this._out[o][u]=d,this._edgeCount++,this}edge(e,t,n){let r=1==arguments.length?aX(this._isDirected,e):aF(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=1==arguments.length?this.edge(e):this.edge(e,t,n);return"object"!=typeof r?{label:r}:r}hasEdge(e,t,n){return(1==arguments.length?aX(this._isDirected,e):aF(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=1==arguments.length?aX(this._isDirected,e):aF(this._isDirected,e,t,n),o=this._edgeObjs[r];if(o){let e=o.v,t=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],aV(this._preds[t],e),aV(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function aH(e,t){e[t]?e[t]++:e[t]=1}function aV(e,t){void 0===e[t]||--e[t]||delete e[t]}function aF(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let e=o;o=i,i=e}return o+"\x01"+i+"\x01"+(void 0===r?"\0":r)}function aX(e,t){return aF(e,t.v,t.w,t.name)}var aY="4.0.1",aK={};function aZ(e){var t,n;let r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e).nodes().map(e=>{let n=t.node(e),r=t.parent(e),o={v:e};return void 0!==n&&(o.value=n),void 0!==r&&(o.parent=r),o}),edges:(n=e).edges().map(e=>{let t=n.edge(e),r={v:e.v,w:e.w};return void 0!==e.name&&(r.name=e.name),void 0!==t&&(r.value=t),r})},o=e.graph();return void 0!==o&&(r.value=structuredClone(o)),r}function aq(e){let t=new aB(e.options);return void 0!==e.value&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}aT(aK,{read:()=>aq,write:()=>aZ});var aW={};aT(aW,{CycleException:()=>a8,bellmanFord:()=>aG,components:()=>aQ,dijkstra:()=>a1,dijkstraAll:()=>a2,findCycles:()=>a3,floydWarshall:()=>a6,isAcyclic:()=>a7,postorder:()=>st,preorder:()=>sn,prim:()=>sr,shortestPaths:()=>so,tarjan:()=>a5,topsort:()=>a9});var aU=()=>1;function aG(e,t,n,r){return function(e,t,n,r){let o={},i,a=0,s=e.nodes(),l=function(e){let t=n(e);o[e.v].distance+t<o[e.w].distance&&(o[e.w]={distance:o[e.v].distance+t,predecessor:e.v},i=!0)},u=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;l({v:n,w:r})})})};s.forEach(function(e){o[e]={distance:e===t?0:1/0,predecessor:""}});let d=s.length;for(let e=1;e<d&&(i=!1,a++,u(),i);e++);if(a===d-1&&(i=!1,u(),i))throw Error("The graph contains a negative weight cycle");return o}(e,String(t),n||aU,r||function(t){return e.outEdges(t)})}function aQ(e){let t={},n=[],r;return e.nodes().forEach(function(o){r=[],function n(o){o in t||(t[o]=!0,r.push(o),e.successors(o).forEach(n),e.predecessors(o).forEach(n))}(o),r.length&&n.push(r)}),n}var aJ=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,o=e.length;return n[r]=o,e.push({key:r,priority:t}),this._decrease(o),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(void 0===n)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,o=e;n<t.length&&(o=t[n].priority<t[o].priority?n:o,r<t.length&&(o=t[r].priority<t[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;0!==e&&!(t[r=e>>1].priority<n);)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,o=n[e],i=n[t];n[e]=i,n[t]=o,r[i.key]=e,r[o.key]=t}},a0=()=>1;function a1(e,t,n,r){return function(e,t,n,r){let o={},i=new aJ,a,s,l=function(e){let t=e.v!==a?e.v:e.w,r=o[t],l=n(e),u=s.distance+l;if(l<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+l);u<r.distance&&(r.distance=u,r.predecessor=a,i.decrease(t,u))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;o[e]={distance:n,predecessor:""},i.add(e,n)});i.size()>0&&(s=o[a=i.removeMin()]).distance!==1/0;)r(a).forEach(l);return o}(e,String(t),n||a0,r||function(t){return e.outEdges(t)})}function a2(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=a1(e,o,t,n),r},{})}function a5(e){let t=0,n=[],r={},o=[];return e.nodes().forEach(function(i){i in r||function i(a){let s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(e){e in r?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(i(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){let e=[],t;do r[t=n.pop()].onStack=!1,e.push(t);while(a!==t)o.push(e)}}(i)}),o}function a3(e){return a5(e).filter(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}var a4=()=>1;function a6(e,t,n){var r,o,i;let a,s;return r=e,o=t||a4,i=n||function(t){return e.outEdges(t)},a={},(s=r.nodes()).forEach(function(e){a[e]={},a[e][e]={distance:0,predecessor:""},s.forEach(function(t){e!==t&&(a[e][t]={distance:1/0,predecessor:""})}),i(e).forEach(function(t){let n=t.v===e?t.w:t.v,r=o(t);a[e][n]={distance:r,predecessor:e}})}),s.forEach(function(e){let t=a[e];s.forEach(function(n){let r=a[n];s.forEach(function(n){let o=r[e],i=t[n],a=r[n],s=o.distance+i.distance;s<a.distance&&(a.distance=s,a.predecessor=i.predecessor)})})}),a}var a8=class extends Error{constructor(...e){super(...e)}};function a9(e){let t={},n={},r=[];if(e.sinks().forEach(function o(i){if(i in n)throw new a8;i in t||(n[i]=!0,t[i]=!0,e.predecessors(i).forEach(o),delete n[i],r.push(i))}),Object.keys(t).length!==e.nodeCount())throw new a8;return r}function a7(e){try{a9(e)}catch(e){if(e instanceof a8)return!1;throw e}return!0}function se(e,t,n){var r,o,i;let a,s;return r=t,o=function(e,t){return e.push(t),e},i=[],Array.isArray(r)||(r=[r]),a=t=>{var n;return null!=(n=e.isDirected()?e.successors(t):e.neighbors(t))?n:[]},s={},r.forEach(function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);i=function e(t,n,r,o,i,a,s){return n in o||(o[n]=!0,r||(s=a(s,n)),i(n).forEach(function(n){s=e(t,n,r,o,i,a,s)}),r&&(s=a(s,n))),s}(e,t,"post"===n,s,a,o,i)}),i}function st(e,t){return se(e,t,"post")}function sn(e,t){return se(e,t,"pre")}function sr(e,t){let n=new aB,r={},o=new aJ,i;function a(e){let n=e.v===i?e.w:e.v,a=o.priority(n);if(void 0!==a){let s=t(e);s<a&&(r[n]=i,o.decrease(n,s))}}if(0===e.nodeCount())return n;e.nodes().forEach(function(e){o.add(e,1/0),n.setNode(e)}),o.decrease(e.nodes()[0],0);let s=!1;for(;o.size()>0;){if((i=o.removeMin())in r)n.setEdge(i,r[i]);else{if(s)throw Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(i).forEach(a)}return n}function so(e,t,n,r){return function(e,t,n,r){if(void 0===n)return a1(e,t,n,r);let o=!1,i=e.nodes();for(let a=0;a<i.length;a++){let s=r(i[a]);for(let e=0;e<s.length;e++){let t=s[e],r=t.v===i[a]?t.v:t.w,l=r===t.v?t.w:t.v;0>n({v:r,w:l})&&(o=!0)}if(o)return aG(e,t,n,r)}return a1(e,t,n,r)}(e,t,n,null!=r?r:t=>{let n=e.outEdges(t);return null!=n?n:[]})}function si(e,t,n,r){let o=r;for(;e.hasNode(o);)o=r+""+ ++sg;return n.dummy=t,e.setNode(o,n),o}function sa(e){let t=new aB({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function ss(e,t){let n,r,o=e.x,i=e.y,a=t.x-o,s=t.y-i,l=e.width/2,u=e.height/2;if(!a&&!s)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*l>Math.abs(a)*u?(s<0&&(u=-u),n=u*a/s,r=u):(a<0&&(l=-l),n=l,r=l*s/a),{x:o+n,y:i+r}}function sl(e){let t=sp(sc(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;void 0!==o&&(t[o]||(t[o]=[]),t[o][r.order]=n)}),t}function su(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),si(e,"border",o,t)}function sd(e,t){return t.length>65535?e(...(function(e,t=65535){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n})(t).map(t=>e(...t))):e(...t)}function sc(e){return sd(Math.max,e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?5e-324:n}))}function sh(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function sf(e,t){return t()}var sg=0;function sp(e,t,n=1){null==t&&(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let o=[];for(let t=e;r(t);t+=n)o.push(t);return o}function sm(e,t){let n={};for(let r of t)void 0!==e[r]&&(n[r]=e[r]);return n}function sy(e,t){let n;return n="string"==typeof t?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}var sv=class{constructor(){((e,t,n)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?a$(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n})(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return sx(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&sx(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,sb)),n=n._prev;return"["+e.join(", ")+"]"}};function sx(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function sb(e,t){if("_next"!==e&&"_prev"!==e)return t}var sw=()=>1;function s_(e,t,n,r,o){let i=[],a=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let a=e.edge(r),s=e.node(r.v);o&&i.push({v:r.v,w:r.w}),s.out-=a,sE(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,sE(t,n,a)}),e.removeNode(r.v),a}function sE(e,t,n){var r,o,i;n.out?n.in?null==(i=e[n.out-n.in+t])||i.enqueue(n):null==(o=e[e.length-1])||o.enqueue(n):null==(r=e[0])||r.enqueue(n)}function sk(e){let t={};e.sources().forEach(function n(r){let o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r),a=sd(Math.min,i?i.map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen):[]);return a===1/0&&(a=0),o.rank=a})}function sS(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var sN=function(e){var t,n,r,o;let i,a,s=new aB({directed:!1}),l=e.nodes();if(0===l.length)throw Error("Graph must have at least one node");let u=l[0],d=e.nodeCount();for(s.setNode(u,{});t=s,n=e,t.nodes().forEach(function e(r){let o=n.nodeEdges(r);o&&o.forEach(o=>{let i=o.v,a=r===i?o.w:i;t.hasNode(a)||sS(n,o)||(t.setNode(a,{}),t.setEdge(r,a,{}),e(a))})}),t.nodeCount()<d&&(r=s,i=(o=e).edges().reduce((e,t)=>{let n=1/0;return r.hasNode(t.v)!==r.hasNode(t.w)&&(n=sS(o,t)),n<e[0]?[n,t]:e},[1/0,null])[1]);)a=s.hasNode(i.v)?sS(e,i):-sS(e,i),function(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}(s,e,a);return s},{preorder:sM,postorder:sC}=aW;function sj(e){var t;let n,r,o;t=e,o=new aB().setGraph(t.graph()),t.nodes().forEach(e=>o.setNode(e,t.node(e))),t.edges().forEach(e=>{let n=o.edge(e.v,e.w)||{weight:0,minlen:1},r=t.edge(e);o.setEdge(e.v,e.w,{weight:n.weight+r.weight,minlen:Math.max(n.minlen,r.minlen)})}),sk(e=o);let i=sN(e);for(sz(i),sA(i,e);n=sP(i);)r=s$(i,e,n),sI(i,e,n,r)}function sA(e,t){let n=sC(e,e.nodes());(n=n.slice(0,n.length-1)).forEach(n=>{var r,o,i;let a;return r=e,o=t,i=n,a=r.node(i).parent,void(r.edge(i,a).cutvalue=sO(r,o,i))})}function sO(e,t,n){let r=e.node(n).parent,o=!0,i=t.edge(n,r),a=0;i||(o=!1,i=t.edge(r,n)),a=i.weight;let s=t.nodeEdges(n);return s&&s.forEach(i=>{let s=i.v===n,l=s?i.w:i.v;if(l!==r){var u,d,c;let r=s===o,h=t.edge(i).weight;if(a+=r?h:-h,u=e,d=n,c=l,u.hasEdge(d,c)){let t=e.edge(n,l).cutvalue;a+=r?-t:t}}}),a}function sz(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,n,r,o,i){let a=r,s=t.node(o);n[o]=!0;let l=t.neighbors(o);return l&&l.forEach(i=>{Object.hasOwn(n,i)||(r=e(t,n,r,i,o))}),s.low=a,s.lim=r++,i?s.parent=i:delete s.parent,r}(e,{},1,t)}function sP(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function s$(e,t,n){let r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);let i=e.node(r),a=e.node(o),s=i,l=!1;return i.lim>a.lim&&(s=a,l=!0),t.edges().filter(t=>l===sR(e,e.node(t.v),s)&&l!==sR(e,e.node(t.w),s)).reduce((e,n)=>sS(t,n)<sS(t,e)?n:e)}function sI(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),sz(e),sA(e,t),function(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=sM(e,[n]);(r=r.slice(1)).forEach(n=>{let r=e.node(n).parent,o=t.edge(n,r),i=!1;o||(o=t.edge(r,n),i=!0),t.node(n).rank=t.node(r).rank+(i?o.minlen:-o.minlen)})}(e,t)}function sR(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}sj.initLowLimValues=sz,sj.initCutValues=sA,sj.calcCutValue=sO,sj.leaveEdge=sP,sj.enterEdge=s$,sj.exchangeEdges=sI;function sL(e,t,n,r,o,i){let a=o[t][i-1],s=si(e,"border",{width:0,height:0,rank:i,borderType:t},n);o[t][i]=s,e.setParent(s,r),a&&e.setEdge(a,s,{weight:1})}function sD(e){e.nodes().forEach(t=>sT(e.node(t))),e.edges().forEach(t=>sT(e.edge(t)))}function sT(e){let t=e.width;e.width=e.height,e.height=t}function sB(e){e.y=-e.y}function sH(e){let t=e.x;e.x=e.y,e.y=t}function sV(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function sF(e,t,n){let r=new Map,o=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if("number"==typeof n.rank&&o(n.rank,t),"number"==typeof n.minRank&&"number"==typeof n.maxRank)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&o(e,t)}return t.map(function(t){var o;let i,a;return o=r.get(t)||[],i=function(e){let t;for(;e.hasNode(t="_root"+ ++sg););return t}(e),a=new aB({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t)),o.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let l=e[n](r);l&&l.forEach(t=>{let n=t.v===r?t.w:t.v,o=a.edge(n,r),i=void 0!==o?o.weight:0;a.setEdge(n,r,{weight:e.edge(t).weight+i})}),Object.hasOwn(o,"minRank")&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a})}function sX(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function sY(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}var sK=["nodesep","edgesep","ranksep","marginx","marginy"],sZ={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},sq=["acyclicer","ranker","rankdir","align","rankalign"],sW=["width","height","rank"],sU={width:0,height:0},sG=["minlen","weight","width","height","labeloffset"],sQ={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},sJ=["labelpos"];function s0(e,t){return sy(sm(e,t),Number)}function s1(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n}),t}var s2=function(e,t={}){let n=t.debugTiming?sh:sf;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>{var t;let n,r;return t=e,n=new aB({multigraph:!0,compound:!0}),r=s1(t.graph()),n.setGraph(Object.assign({},sZ,s0(r,sK),sm(r,sq))),t.nodes().forEach(e=>{let r=s0(s1(t.node(e)),sW);Object.keys(sU).forEach(e=>{void 0===r[e]&&(r[e]=sU[e])}),n.setNode(e,r);let o=t.parent(e);void 0!==o&&n.setParent(e,o)}),t.edges().forEach(e=>{let r=s1(t.edge(e));n.setEdge(e,Object.assign({},sQ,s0(r,sG),sm(r,sJ)))}),n});return n(" runLayout",()=>{var e,o,i;return e=r,o=n,i=t,void(o(" makeSpaceForEdgeLabels",()=>{var t;let n;return n=(t=e).graph(),void(n.ranksep/=2,t.edges().forEach(e=>{let r=t.edge(e);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}),o(" removeSelfEdges",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w){let n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),o(" acyclic",()=>{var t,n;let r,o,i;("greedy"===e.graph().acyclicer?function(e,t){var n,r;let o,i,a,s,l;if(1>=e.nodeCount())return[];let u=(n=e,r=t||sw,o=new aB,i=0,a=0,n.nodes().forEach(e=>{o.setNode(e,{v:e,in:0,out:0})}),n.edges().forEach(e=>{let t=o.edge(e.v,e.w)||0,n=r(e);o.setEdge(e.v,e.w,t+n);let s=o.node(e.v),l=o.node(e.w);a=Math.max(a,s.out+=n),i=Math.max(i,l.in+=n)}),s=(function(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t})(a+i+3).map(()=>new sv),l=i+1,o.nodes().forEach(e=>{sE(s,l,o.node(e))}),{graph:o,buckets:s,zeroIdx:l});return(function(e,t,n){var r;let o=[],i=t[t.length-1],a=t[0],s;for(;e.nodeCount();){for(;s=a.dequeue();)s_(e,t,n,s);for(;s=i.dequeue();)s_(e,t,n,s);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(s=null==(r=t[i])?void 0:r.dequeue()){o=o.concat(s_(e,t,n,s,!0)||[]);break}}}return o})(u.graph,u.buckets,u.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}(e,(t=e,e=>t.edge(e).weight)):(r=[],o={},i={},(n=e).nodes().forEach(function e(t){Object.hasOwn(i,t)||(i[t]=!0,o[t]=!0,n.outEdges(t).forEach(t=>{Object.hasOwn(o,t.w)?r.push(t):e(t.w)}),delete o[t])}),r)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,"rev"+ ++sg)})}),o(" nestingGraph.run",()=>{var t,n;let r,o,i,a,s,l;return r=si(e,"root",{},"_root"),a=2*(i=sd(Math.max,Object.values((l={},(t=e).children("\0").forEach(e=>(function e(n,r){let o=t.children(n);o&&o.length&&o.forEach(t=>e(t,r+1)),l[n]=r})(e,1)),o=l)))-1)+1,e.graph().nestingRoot=r,e.edges().forEach(t=>e.edge(t).minlen*=a),s=(n=e).edges().reduce((e,t)=>e+n.edge(t).weight,0)+1,void(e.children("\0").forEach(t=>(function e(t,n,r,o,i,a,s){var l;let u=t.children(s);if(!u.length){s!==n&&t.setEdge(n,s,{weight:0,minlen:r});return}let d=su(t,"_bt"),c=su(t,"_bb"),h=t.node(s);t.setParent(d,s),h.borderTop=d,t.setParent(c,s),h.borderBottom=c,u.forEach(l=>{var u;e(t,n,r,o,i,a,l);let h=t.node(l),f=h.borderTop?h.borderTop:l,g=h.borderBottom?h.borderBottom:l,p=h.borderTop?o:2*o,m=f!==g?1:i-(null!=(u=a[s])?u:0)+1;t.setEdge(d,f,{weight:p,minlen:m,nestingEdge:!0}),t.setEdge(g,c,{weight:p,minlen:m,nestingEdge:!0})}),t.parent(s)||t.setEdge(n,d,{weight:0,minlen:i+(null!=(l=a[s])?l:0)})})(e,r,a,s,i,o,t)),e.graph().nodeRankFactor=a)}),o(" rank",()=>(function(e){let t=e.graph().ranker;if("function"==typeof t)return t(e);switch(t){case"network-simplex":default:sj(e);break;case"tight-tree":var n;sk(n=e),sN(n);break;case"longest-path":sk(e);case"none":}})(sa(e))),o(" injectEdgeLabelProxies",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let n=t.node(e.v),r={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};si(t,"edge-proxy",r,"_ep")}})}),o(" removeEmptyRanks",()=>{let t,n,r,o;return t=sd(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),n=[],e.nodes().forEach(r=>{let o=e.node(r).rank-t;n[o]||(n[o]=[]),n[o].push(r)}),r=0,o=e.graph().nodeRankFactor,void Array.from(n).forEach((t,n)=>{void 0===t&&n%o!=0?--r:void 0!==t&&r&&t.forEach(t=>e.node(t).rank+=r)})}),o(" nestingGraph.cleanup",()=>{let t;return t=e.graph(),void(e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)}))}),o(" normalizeRanks",()=>{let t;return t=sd(Math.min,e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?Number.MAX_VALUE:n})),void e.nodes().forEach(n=>{let r=e.node(n);Object.hasOwn(r,"rank")&&(r.rank-=t)})}),o(" assignRankMinMax",()=>{var t;let n;return n=0,void((t=e).nodes().forEach(e=>{let r=t.node(e);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,n=Math.max(n,r.maxRank))}),t.graph().maxRank=n)}),o(" removeEdgeLabelProxies",()=>{var t;(t=e).nodes().forEach(e=>{let n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}),o(" normalize.run",()=>{e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,r,o,i=t.v,a=e.node(i).rank,s=t.w,l=e.node(s).rank,u=t.name,d=e.edge(t),c=d.labelRank;if(l!==a+1){for(e.removeEdge(t),o=0,++a;a<l;++o,++a)d.points=[],n=si(e,"edge",r={width:0,height:0,edgeLabel:d,edgeObj:t,rank:a},"_d"),a===c&&(r.width=d.width,r.height=d.height,r.dummy="edge-label",r.labelpos=d.labelpos),e.setEdge(i,n,{weight:d.weight},u),0===o&&e.graph().dummyChains.push(n),i=n;e.setEdge(i,s,{weight:d.weight},u)}})(e,t))}),o(" parentDummyChains",()=>{var t,n;let r,o,i;return i=(r={},o=0,(n=t=e).children("\0").forEach(function e(t){let i=o;n.children(t).forEach(e),r[t]={low:i,lim:o++}}),r),void t.graph().dummyChains.forEach(e=>{let n=t.node(e),r=n.edgeObj,o=function(e,t,n,r){let o=[],i=[],a=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),l;l=n;do o.push(l=e.parent(l));while(l&&(t[l].low>a||s>t[l].lim))let u=l,d=r;for(;(d=e.parent(d))!==u;)i.push(d);return{path:o.concat(i.reverse()),lca:u}}(t,i,r.v,r.w),a=o.path,s=o.lca,l=0,u=a[0],d=!0;for(;e!==r.w;){if(n=t.node(e),d){for(;(u=a[l])!==s&&t.node(u).maxRank<n.rank;)l++;u===s&&(d=!1)}if(!d){for(;l<a.length-1&&t.node(a[l+1]).minRank<=n.rank;)l++;u=a[l]}void 0!==u&&t.setParent(e,u),e=t.successors(e)[0]}})}),o(" addBorderSegments",()=>{var t;(t=e).children("\0").forEach(function e(n){let r=t.children(n),o=t.node(n);if(r.length&&r.forEach(e),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let e=o.minRank,r=o.maxRank+1;e<r;++e)sL(t,"borderLeft","_bl",n,o,e),sL(t,"borderRight","_br",n,o,e)}})}),o(" order",()=>(function e(t,n={}){let r,o,i;if("function"==typeof n.customOrder)return void n.customOrder(t,e);let a=sc(t),s=sF(t,sp(1,a+1),"inEdges"),l=sF(t,sp(a-1,-1,-1),"outEdges"),u=(r={},i=sp(sd(Math.max,(o=t.nodes().filter(e=>!t.children(e).length)).map(e=>t.node(e).rank))+1).map(()=>[]),o.sort((e,n)=>t.node(e).rank-t.node(n).rank).forEach(function e(n){if(r[n])return;r[n]=!0,i[t.node(n).rank].push(n);let o=t.successors(n);o&&o.forEach(e)}),i);if(sX(t,u),n.disableOptimalOrderHeuristic)return;let d=1/0,c,h=n.constraints||[];for(let e=0,n=0;n<4;++e,++n){(function(e,t,n){let r=new aB;e.forEach(function(e){var o;let i,a;n.forEach(e=>r.setEdge(e.left,e.right));let s=e.graph().root,l=function e(t,n,r,o){var i;let a,s,l,u,d,c,h,f,g,p,m=t.children(n),y=t.node(n),v=y?y.borderLeft:void 0,x=y?y.borderRight:void 0,b={};v&&(m=m.filter(e=>e!==v&&e!==x));let w=function(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),o=e.node(n.v);return{sum:t.sum+r.weight*o.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}(t,m);w.forEach(n=>{if(t.children(n.v).length){var i,a;let s=e(t,n.v,r,o);b[n.v]=s,Object.hasOwn(s,"barycenter")&&(i=n,a=s,void 0!==i.barycenter?(i.barycenter=(i.barycenter*i.weight+a.barycenter*a.weight)/(i.weight+a.weight),i.weight+=a.weight):(i.barycenter=a.barycenter,i.weight=a.weight))}});let _=(a={},w.forEach((e,t)=>{let n={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(n.barycenter=e.barycenter,n.weight=e.weight),a[e.v]=n}),r.edges().forEach(e=>{let t=a[e.v],n=a[e.w];void 0!==t&&void 0!==n&&(n.indegree++,t.out.push(n))}),function(e){let t=[];for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(function(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(n)),n.out.forEach(function(t){return n=>{n.in.push(t),0==--n.indegree&&e.push(n)}}(n))}return t.filter(e=>!e.merged).map(e=>sm(e,["vs","i","barycenter","weight"]))}(Object.values(a).filter(e=>!e.indegree)));!function(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}(_,b);let E=(u=(i=e=>Object.hasOwn(e,"barycenter"),s={lhs:[],rhs:[]},_.forEach(e=>{i(e)?s.lhs.push(e):s.rhs.push(e)}),l=s).lhs,d=l.rhs.sort((e,t)=>t.i-e.i),c=[],h=0,f=0,g=0,u.sort(function(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}(!!o)),g=sV(c,d,g),u.forEach(e=>{g+=e.vs.length,c.push(e.vs),h+=e.barycenter*e.weight,f+=e.weight,g=sV(c,d,g)}),p={vs:c.flat(1)},f&&(p.barycenter=h/f,p.weight=f),p);if(v&&x){E.vs=[v,E.vs,x].flat(1);let e=t.predecessors(v);if(e&&e.length){let n=t.node(e[0]),r=t.predecessors(x),o=t.node(r[0]);Object.hasOwn(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+n.order+o.order)/(E.weight+2),E.weight+=2}}return E}(e,s,r,t);l.vs.forEach((t,n)=>e.node(t).order=n),o=l.vs,i={},o.forEach(t=>{let n=e.parent(t),o,s;for(;n;){if((o=e.parent(n))?(s=i[o],i[o]=n):(s=a,a=n),s&&s!==n)return void r.setEdge(s,n);n=o}})})})(e%2?s:l,e%4>=2,h),u=sl(t);let r=function(e,t){let n=0;for(let r=1;r<t.length;++r)n+=function(e,t,n){var r;let o=(r=n.map((e,t)=>t),n.reduce((e,t,n)=>(e[t]=r[n],e),{})),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:o[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let s=2*a-1;a-=1;let l=Array(s).fill(0),u=0;return i.forEach(e=>{let t=e.pos+a;l[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=l[t+1]),t=t-1>>1,l[t]+=e.weight;u+=e.weight*n}),u}(e,t[r-1],t[r]);return n}(t,u);r<d?(n=0,c=Object.assign({},u),d=r):r===d&&(c=structuredClone(u))}sX(t,c)})(e,i)),o(" insertSelfEdges",()=>{var t;sl(t=e).forEach(e=>{let n=0;e.forEach((e,r)=>{let o=t.node(e);o.order=r+n,(o.selfEdges||[]).forEach(e=>{si(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete o.selfEdges})})}),o(" adjustCoordinateSystem",()=>{var t;let n;("lr"===(n=null==(t=e.graph().rankdir)?void 0:t.toLowerCase())||"rl"===n)&&sD(e)}),o(" position",()=>{var t,n,r,o;let i,a,s,l,u,d,c,h,f,g,p,m,y,v,x;p=sl(o=t=sa(t=e)),y=(m=o.graph()).ranksep,v=m.rankalign,x=0,p.forEach(e=>{let t=e.reduce((e,t)=>{var n;let r=null!=(n=o.node(t).height)?n:0;return e>r?e:r},0);e.forEach(e=>{let n=o.node(e);"top"===v?n.y=x+n.height/2:"bottom"===v?n.y=x+t-n.height/2:n.y=x+t/2}),x+=t+y}),Object.entries((a=sl(n=t),s=Object.assign((i={},a.length&&a.reduce(function(e,t){let r=0,o=0,a=e.length,s=t[t.length-1];return t.forEach((e,l)=>{let u=function(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}(n,e),d=u?n.node(u).order:a;(u||e===s)&&(t.slice(o,l+1).forEach(e=>{let t=n.predecessors(e);t&&t.forEach(t=>{let o=n.node(t),a=o.order;(a<r||d<a)&&!(o.dummy&&n.node(e).dummy)&&sY(i,t,e)})}),o=l+1,r=d)}),t}),i),function(e,t){let n={};function r(t,r,o,i,a){sp(r,o).forEach(r=>{let o=t[r];if(void 0!==o&&e.node(o).dummy){let t=e.predecessors(o);t&&t.forEach(t=>{if(void 0===t)return;let r=e.node(t);r.dummy&&(r.order<i||r.order>a)&&sY(n,t,o)})}})}return t.length&&t.reduce(function(t,n){let o=-1,i=-1,a=0;return n.forEach((s,l)=>{if("border"===e.node(s).dummy){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(void 0===s)return;i=e.node(s).order,r(n,a,l,o,i),a=l,o=i}}r(n,a,n.length,i,t.length)}),n}),n}(n,a)),l={},["u","d"].forEach(e=>{u="u"===e?a:Object.values(a).reverse(),["l","r"].forEach(t=>{var r,o;let i,a,d;"r"===t&&(u=u.map(e=>Object.values(e).reverse()));let c=(r=u,o=t=>("u"===e?n.predecessors(t):n.successors(t))||[],i={},a={},d={},r.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,d[e]=t})}),r.forEach(e=>{let t=-1;e.forEach(e=>{let n=o(e);if(n&&n.length){let r=n.sort((e,t)=>{let n=d[e],r=d[t];return(void 0!==n?n:0)-(void 0!==r?r:0)}),o=(r.length-1)/2;for(let n=Math.floor(o),l=Math.ceil(o);n<=l;++n){let o=r[n];if(void 0===o)continue;let l=d[o];if(void 0!==l&&a[e]===e&&t<l&&!function(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return void 0!==r&&Object.hasOwn(r,n)}(s,e,o)){let n=i[o];void 0!==n&&(a[o]=e,a[e]=i[e]=n,t=l)}}}})}),{root:i,align:a}),h=function(e,t,n,r,o=!1){var i,a,s,l,u,d,c;let h,f,g,p={},m=(i=e,a=t,s=n,l=o,h=new aB,g=(u=(f=i.graph()).nodesep,d=f.edgesep,c=l,(e,t,n)=>{let r=e.node(t),o=e.node(n),i,a;if(i=0+r.width/2,Object.hasOwn(r,"labelpos"))switch(r.labelpos.toLowerCase()){case"l":a=-r.width/2;break;case"r":a=r.width/2}if(a&&(i+=c?a:-a),a=void 0,i+=(r.dummy?d:u)/2,i+=(o.dummy?d:u)/2,i+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":a=o.width/2;break;case"r":a=-o.width/2}return a&&(i+=c?a:-a),i}),a.forEach(e=>{let t;e.forEach(e=>{let n=s[e];if(void 0!==n){if(h.setNode(n),void 0!==t){let r=s[t];if(void 0!==r){let o=h.edge(r,n);h.setEdge(r,n,Math.max(g(i,e,t),o||0))}}t=e}})}),h),y=o?"borderLeft":"borderRight";function v(e,t){let n=m.nodes().slice(),r={},o=n.pop();for(;o;){if(r[o])e(o);else for(let e of(r[o]=!0,n.push(o),t(o)))n.push(e);o=n.pop()}}return v(function(e){let t=m.inEdges(e);t?p[e]=t.reduce((e,t)=>{var n;let r=null!=(n=p[t.v])?n:0,o=m.edge(t);return Math.max(e,r+(void 0!==o?o:0))},0):p[e]=0},function(e){return m.predecessors(e)||[]}),v(function(t){let n=m.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=p[t.w],r=m.edge(t);return Math.min(e,(void 0!==n?n:0)-(void 0!==r?r:0))},1/0));let o=e.node(t);r!==1/0&&o.borderType!==y&&(p[t]=Math.max(void 0!==p[t]?p[t]:0,r))},function(e){return m.successors(e)||[]}),Object.keys(r).forEach(e=>{var t;let r=n[e];void 0!==r&&(p[e]=null!=(t=p[r])?t:0)}),p}(n,u,c.root,c.align,"r"===t);"r"===t&&(h=sy(h,e=>-e)),l[e+t]=h})}),d=Object.values(l).reduce((e,t)=>{let r=-1/0,o=1/0;Object.entries(t).forEach(([e,t])=>{var i,a;let s=(i=n,a=e,i.node(a).width/2);r=Math.max(t+s,r),o=Math.min(t-s,o)});let i=r-o;return i<e[0]&&(e=[i,t]),e},[1/0,null])[1],h=sd(Math.min,c=Object.values(d)),f=sd(Math.max,c),["u","d"].forEach(e=>{["l","r"].forEach(t=>{let n=e+t,r=l[n];if(!r||r===d)return;let o=Object.values(r),i=h-sd(Math.min,o);"l"!==t&&(i=f-sd(Math.max,o)),i&&(l[n]=sy(r,e=>e+i))})}),r=n.graph().align,(g=l.ul)?sy(g,(e,t)=>{var n,o;if(r){let e=l[r.toLowerCase()];if(e&&void 0!==e[t])return e[t]}let i=Object.values(l).map(e=>{let n=e[t];return void 0!==n?n:0}).sort((e,t)=>e-t);return((null!=(n=i[1])?n:0)+(null!=(o=i[2])?o:0))/2}):{})).forEach(([e,n])=>t.node(e).x=n)}),o(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{let n=t.node(e);if("selfedge"===n.dummy){let r=t.node(n.e.v),o=r.x+r.width/2,i=r.y,a=n.x-o,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:o+2*a/3,y:i-s},{x:o+5*a/6,y:i-s},{x:o+a,y:i},{x:o+5*a/6,y:i+s},{x:o+2*a/3,y:i+s}],n.label.x=n.x,n.label.y=n.y}})}),o(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),o=t.node(n.borderBottom),i=t.node(n.borderLeft[n.borderLeft.length-1]),a=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),o(" normalize.undo",()=>{e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=o,n=e.node(t)})}),o(" fixupEdgeLabelCoords",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch(("l"===n.labelpos||"r"===n.labelpos)&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}),o(" undoCoordinateSystem",()=>{var t,n,r;let o;("bt"===(o=null==(t=e.graph().rankdir)?void 0:t.toLowerCase())||"rl"===o)&&((n=e).nodes().forEach(e=>sB(n.node(e))),n.edges().forEach(e=>{var t;let r=n.edge(e);null==(t=r.points)||t.forEach(sB),Object.hasOwn(r,"y")&&sB(r)})),("lr"===o||"rl"===o)&&((r=e).nodes().forEach(e=>sH(r.node(e))),r.edges().forEach(e=>{var t;let n=r.edge(e);null==(t=n.points)||t.forEach(sH),Object.hasOwn(n,"x")&&sH(n)}),sD(e))}),o(" translateGraph",()=>(function(e){let t=1/0,n=0,r=1/0,o=0,i=e.graph(),a=i.marginx||0,s=i.marginy||0;function l(e){let i=e.x,a=e.y,s=e.width,l=e.height;t=Math.min(t,i-s/2),n=Math.max(n,i+s/2),r=Math.min(r,a-l/2),o=Math.max(o,a+l/2)}e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,"x")&&l(n)}),t-=a,r-=s,e.nodes().forEach(n=>{let o=e.node(n);o.x-=t,o.y-=r}),e.edges().forEach(n=>{let o=e.edge(n);o.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(o,"x")&&(o.x-=t),Object.hasOwn(o,"y")&&(o.y-=r)}),i.width=n-t+a,i.height=o-r+s})(e)),o(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e),r=t.node(e.v),o=t.node(e.w),i,a;n.points?(i=n.points[0],a=n.points[n.points.length-1]):(n.points=[],i=o,a=r),n.points.unshift(ss(r,i)),n.points.push(ss(o,a))})}),o(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}),o(" acyclic.undo",()=>{e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}))}),n(" updateInputGraph",()=>{var t,n;return t=e,n=r,void(t.nodes().forEach(e=>{let r=t.node(e),o=n.node(e);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,n.children(e).length&&(r.width=o.width,r.height=o.height))}),t.edges().forEach(e=>{let r=t.edge(e),o=n.edge(e);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),t.graph().width=n.graph().width,t.graph().height=n.graph().height)}),r})};function s5(e,t,n="LR"){let r=new aI.Graph;for(let t of(r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:n,nodesep:80,ranksep:180,marginx:40,marginy:40}),e))r.setNode(t.id,{width:280,height:100});for(let e of t)r.setEdge(e.source,e.target);return s2(r),e.map(e=>{let t=r.node(e.id);return{...e,position:{x:t.x-140,y:t.y-50}}})}let s3={agent:av},s4={link:ax};function s6(e){return`alook-canvas-positions-${e}`}function s8({onAgentClick:e}){let t=(0,b.useRouter)(),{agents:n,runtimes:r,loading:o,activeTaskCounts:i,agentLinks:a}=(0,ao.useAgentContext)(),{slug:s,workspaceId:l}=(0,ai.useWorkspace)(),{zoomIn:u,zoomOut:d,fitView:c}=oy(),[h,f]=(0,x.useState)([]),[g,p]=(0,x.useState)([]),[m,w]=(0,x.useState)([]),_=!o,[E,k]=(0,x.useState)(null),[S,N]=(0,x.useState)(!1),[M,C]=(0,x.useState)(!1),j=(0,x.useRef)(!1),A=(0,x.useRef)({});(0,x.useEffect)(()=>{o||w(a)},[a,o]),(0,x.useEffect)(()=>{if(!_)return;let e=new Map(h.map(e=>[e.id,e.position])),t=m.map(t=>{let n=A.current[t.id],r=n?.sourceHandle,o=n?.targetHandle;if(!r||!o){let n=e.get(t.source_agent_id),i=e.get(t.target_agent_id);if(n&&i){let e=i.x-n.x,t=i.y-n.y;Math.abs(e)>=Math.abs(t)?(r=e>=0?"right":"left",o=e>=0?"target-left":"target-right"):(r=t>=0?"bottom":"top",o=t>=0?"target-top":"target-bottom")}else r="right",o="target-left"}return{id:t.id,source:t.source_agent_id,target:t.target_agent_id,sourceHandle:r,targetHandle:o,type:"link",data:{instruction:t.instruction,onEdgeClick:e=>{let t=m.find(t=>t.id===e);t&&(k(t),N(!0))}},selected:E?.id===t.id&&S}});p(t),C(0===t.length)},[m,_,E,S,h]),(0,x.useEffect)(()=>{if(o||0===n.length)return;let e=function(e){try{let t=localStorage.getItem(s6(e));return t?JSON.parse(t):{}}catch{return{}}}(l),t=new Set(n.map(e=>e.id)),a={};for(let[n,r]of Object.entries(e))t.has(n)&&(a[n]=r);let u=n.map((e,t)=>({id:e.id,type:"agent",position:a[e.id]??{x:0,y:0},data:{agent:e,runtimes:r,activeTaskCount:i[e.id]??0,slug:s,index:t}})),d=Object.keys(a).length>0,h=n.filter(e=>!a[e.id]).map(e=>e.id);if(d||_){if(d&&h.length>0&&!_&&(u=u.filter(e=>a[e.id])),d){if(h.length>0&&_){let e=s5([...u.filter(e=>a[e.id]),...u.filter(e=>!a[e.id])],m.map(e=>({id:e.id,source:e.source_agent_id,target:e.target_agent_id})));u=u.map(t=>{if(a[t.id])return t;let n=e.find(e=>e.id===t.id);return n?{...t,position:n.position}:t})}}else _&&(u=s5(u,m.map(e=>({id:e.id,source:e.source_agent_id,target:e.target_agent_id}))),j.current||(j.current=!0,setTimeout(()=>c({padding:.4,duration:400}),50)));f(u)}},[n,r,i,s,o,l,_,m,c]);let O=(0,x.useCallback)(e=>{f(t=>oa(e,t))},[]),z=(0,x.useCallback)(e=>{p(t=>oa(e,t))},[]),P=(0,x.useCallback)(()=>{f(e=>{let t={};for(let n of e)t[n.id]=n.position;try{localStorage.setItem(s6(l),JSON.stringify(t))}catch{}return e})},[l]),$=(0,x.useCallback)(async e=>{if(e.source&&e.target)try{let t=await (0,af.createAgentLink)({source_agent_id:e.source,target_agent_id:e.target},l);(e.sourceHandle||e.targetHandle)&&(A.current[t.id]={sourceHandle:e.sourceHandle??"right",targetHandle:e.targetHandle??"target-left"}),w(e=>[...e,t]),C(!1)}catch(e){e instanceof ap.ApiError?409===e.status?ag.toast.error("Link already exists"):400===e.status?ag.toast.error("Can't link an agent to itself"):ag.toast.error("Failed to create link"):ag.toast.error("Failed to create link")}},[l]),I=(0,x.useCallback)(async(e,t)=>{try{let n=await (0,af.updateAgentLink)(e,{instruction:t},l);w(t=>t.map(t=>t.id===e?n:t))}catch{ag.toast.error("Failed to update link")}},[l]),R=(0,x.useCallback)(async e=>{try{await (0,af.deleteAgentLink)(e,l),w(t=>t.filter(t=>t.id!==e)),N(!1)}catch{ag.toast.error("Failed to delete link")}},[l]),L=(0,x.useCallback)(()=>{try{localStorage.removeItem(s6(l))}catch{}let e=m.map(e=>({id:e.id,source:e.source_agent_id,target:e.target_agent_id}));f(t=>{let n=s5(t,e).map(e=>({...e,style:{...e.style,transition:"transform 300ms ease-out"}}));return setTimeout(()=>{f(e=>e.map(e=>({...e,style:{...e.style,transition:void 0}}))),c({padding:.4,duration:400})},350),n})},[m,l,c]),D=(0,x.useCallback)((n,r)=>{let o=r.data;N(!1),e?e(o.agent):t.push(`/w/${s}/agents/${o.agent.id}`)},[t,s,e]),T=(0,x.useMemo)(()=>({stroke:"var(--color-primary)",strokeWidth:1.5,strokeDasharray:"6 4",opacity:.5}),[]);return(0,v.jsxs)("div",{className:"flex-1 relative",children:[(0,v.jsx)(iI,{nodes:h,edges:g,nodeTypes:s3,edgeTypes:s4,onNodesChange:O,onEdgesChange:z,onConnect:$,onNodeClick:D,onNodeDragStop:P,connectionLineStyle:T,fitView:!0,fitViewOptions:{padding:.4,maxZoom:1},minZoom:.25,maxZoom:2.5,zoomOnScroll:!0,panOnScroll:!1,proOptions:{hideAttribution:!0},children:(0,v.jsx)(iF,{variant:y.Dots,gap:24,size:1.5,color:"var(--color-border)"})}),(0,v.jsxs)("div",{className:"absolute bottom-4 left-4 bg-background/80 backdrop-blur-sm rounded-lg ring-1 ring-foreground/5 p-1 flex gap-0.5 animate-[fade-up_300ms_ease-out_both]",style:{animationDelay:"200ms"},children:[(0,v.jsx)("button",{type:"button",className:"size-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>u(),children:(0,v.jsx)(i9,{className:"size-4"})}),(0,v.jsx)("button",{type:"button",className:"size-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>d(),children:(0,v.jsx)(i7,{className:"size-4"})}),(0,v.jsx)("button",{type:"button",className:"size-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>c({padding:.4,duration:400}),children:(0,v.jsx)(ae,{className:"size-4"})}),(0,v.jsx)("button",{type:"button",className:"size-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:L,children:(0,v.jsx)(at,{className:"size-4"})})]}),M&&(0,v.jsx)("div",{className:"absolute bottom-14 left-4 text-xs text-muted-foreground bg-background/80 backdrop-blur-sm rounded-md px-3 py-1.5 ring-1 ring-foreground/5",children:"Drag between agent handles to create relationships."}),(0,v.jsx)(ak,{open:S,onOpenChange:N,link:E,agents:n,onSave:I,onDelete:R}),(0,v.jsxs)("div",{className:"absolute bottom-4 right-4 z-10 flex flex-wrap justify-end items-end gap-2",children:[(0,v.jsx)(aP,{}),(0,v.jsx)(aA,{})]}),(0,v.jsxs)(au.Tooltip,{children:[(0,v.jsx)(au.TooltipTrigger,{render:(0,v.jsx)("button",{type:"button",className:"absolute top-4 right-4 size-8 rounded-lg bg-background/80 backdrop-blur-sm ring-1 ring-foreground/5 flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors animate-[fade-up_300ms_ease-out_both]",style:{animationDelay:"200ms"},onClick:()=>t.push(`/w/${s}/agents/new`)}),children:(0,v.jsx)(ar.Plus,{className:"size-4"})}),(0,v.jsx)(au.TooltipContent,{children:"Create new agent"})]})]})}function s9({onAgentClick:e}){let t=(0,b.useRouter)(),{agents:n,runtimes:r,loading:o,activeTaskCounts:i}=(0,ao.useAgentContext)(),{slug:a}=(0,ai.useWorkspace)();if(o)return(0,v.jsx)("div",{className:"flex flex-col gap-1 p-4",children:[void 0,void 0,void 0,void 0].map((e,t)=>(0,v.jsx)("div",{className:"animate-pulse rounded-xl bg-muted h-15"},t))});let s=n=>{e?e(n):t.push(`/w/${a}/agents/${n.id}`)};return(0,v.jsxs)("div",{className:"relative flex-1 flex flex-col",children:[(0,v.jsx)("div",{className:"flex flex-col gap-1 p-4 overflow-y-auto thin-scrollbar",children:n.map(e=>{let t,n=r.find(t=>t.id===e.runtime_id),o=n?.status==="online";return(0,v.jsxs)("div",{role:"button",tabIndex:0,className:"flex items-center gap-3 w-full rounded-xl px-3 py-2.5 hover:bg-accent/50 active:bg-accent/70 transition-colors cursor-pointer text-left",onClick:()=>s(e),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),s(e))},children:[(t=(0,ah.parseAvatarUrl)(e.avatar_url))?(0,v.jsx)(ac.AnimatedAvatar,{config:t,size:36,className:"shrink-0 rounded-xl",isHovered:!1,isWorking:o&&(i[e.id]??0)>0}):(0,v.jsx)("div",{className:"flex items-center justify-center size-9 rounded-xl bg-secondary text-secondary-foreground text-sm font-medium shrink-0",children:e.name.charAt(0).toUpperCase()}),(0,v.jsx)("div",{className:"min-w-0 flex-1",children:(0,v.jsx)(ad.AgentPreviewCard,{agent:e,isOnline:o,activeTaskCount:i[e.id]??0})})]},e.id)})}),(0,v.jsxs)(au.Tooltip,{children:[(0,v.jsx)(au.TooltipTrigger,{render:(0,v.jsx)("button",{type:"button",className:"absolute top-4 right-4 size-8 rounded-lg bg-background/80 backdrop-blur-sm ring-1 ring-foreground/5 flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",onClick:()=>t.push(`/w/${a}/agents/new`)}),children:(0,v.jsx)(ar.Plus,{className:"size-4"})}),(0,v.jsx)(au.TooltipContent,{children:"Create new agent"})]})]})}e.s(["default",0,function(){let e=(0,b.useRouter)(),{agents:t,loading:n}=(0,ao.useAgentContext)(),{workspaceId:r}=(0,ai.useWorkspace)(),o=(0,aa.useIsMobile)(),{openAgentChat:i}=(0,as.useAgentChatSheet)(),a=(0,x.useCallback)(e=>{i(e.id)},[i]);return n?(0,v.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,v.jsx)(an.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}):0===t.length?(0,v.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,v.jsxs)("div",{className:"text-center animate-[fade-up_400ms_ease-out_both]",children:[(0,v.jsx)("p",{className:"text-muted-foreground text-sm",children:"Build your AI company"}),(0,v.jsx)(al.Button,{size:"sm",className:"mt-4 glow-border",onClick:()=>e.push(`/studio/new?workspace_id=${r}`),children:"Get Started"})]})}):o?(0,v.jsx)(s9,{onAgentClick:a}):(0,v.jsx)(iz,{children:(0,v.jsx)(s8,{onAgentClick:a})})}],614191)}]);
|