nebulosity 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +11 -11
- package/.next/diagnostics/route-bundle-stats.json +10 -10
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/prerender-manifest.json +5 -5
- package/.next/server/app/_global-error/page/build-manifest.json +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page/build-manifest.json +3 -3
- package/.next/server/app/_not-found/page/next-font-manifest.json +2 -3
- package/.next/server/app/_not-found/page.js +3 -2
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +27 -20
- package/.next/server/app/_not-found.segments/_full.segment.rsc +27 -20
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +34 -26
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +29 -23
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +33 -24
- package/.next/server/app/index.segments/_full.segment.rsc +29 -23
- package/.next/server/app/index.segments/_tree.segment.rsc +4 -5
- package/.next/server/app/page/build-manifest.json +3 -3
- package/.next/server/app/page/next-font-manifest.json +2 -3
- package/.next/server/app/page.js +4 -4
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__06blyow8irfw3._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0bmqko-d8fd5k._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0cmmlmvta4i0g._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0jgr1dt1j95ku._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0m0n163465-zb._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0p7epsgp2b5m3._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__1i5e5sqg45ens._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__1vjt0neva-819._.js +3 -3
- package/.next/server/chunks/_0uqus0ehnijt-._.js +1 -1
- package/.next/server/chunks/lib_background_start_ts_11u_1uu8b9yuy._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0_3l5tdzqy-td._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__10ockmlli-lun._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__0dyligeswbb47._.js → [root-of-the-server]__16-gclvix9mjd._.js} +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1auodc3c0rppy._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1cf6qt9agg_9-._.js +3 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__1i9r59yk4i69p._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1l3qp8u9yc_ig._.js +3 -0
- package/.next/server/chunks/ssr/_1p-0wsx9qfm68._.js +13 -0
- package/.next/server/chunks/ssr/app_map_18iu6j19jsqmu._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_1r3iqtbm45lqp._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0q-w892nagajq.js +3 -0
- package/.next/server/middleware-build-manifest.js +11 -11
- package/.next/server/next-font-manifest.js +1 -1
- package/.next/server/next-font-manifest.json +4 -6
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{1rljem7o1jtdo.js → 18kfexnrqek07.js} +1 -1
- package/.next/static/chunks/1hwbgd4nvvhg8.js +1 -0
- package/.next/static/chunks/25r4lkkf1shfo.css +3 -0
- package/.next/static/chunks/35ubvk2ivdjgs.js +1 -0
- package/.next/static/chunks/3ieqvmcg3hofj.js +31 -0
- package/.next/static/chunks/3w00e1w2125pp.js +11 -0
- package/.next/static/media/733da6bd8dac84c8-s.3hlisc-pwq13z.woff2 +0 -0
- package/.next/static/media/784318cea1dfcfa4-s.0-oo9_1x_xmvg.woff2 +0 -0
- package/.next/static/media/7e114457660b62ed-s.36fqqi66-3tjb.woff2 +0 -0
- package/.next/static/media/85e86a88f68a624a-s.357dd_6abeqge.woff2 +0 -0
- package/.next/static/media/9a321a2c78eff0b5-s.p.1bkzbscqrt8rl.woff2 +0 -0
- package/.next/static/media/9fecbd3e5ea9bccb-s.3_z45zcoc-xoz.woff2 +0 -0
- package/.next/static/media/c64053b510252f55-s.1kd-r_s9smv5m.woff2 +0 -0
- package/.next/static/media/c6a5c2fdc12da45c-s.p.17-aodiw50953.woff2 +0 -0
- package/.next/static/media/f263782c6a4bddee-s.1gyfqm5yhhzs7.woff2 +0 -0
- package/.next/trace +1 -1
- package/.next/trace-build +1 -1
- package/README.md +13 -4
- package/app/globals.css +91 -54
- package/app/layout.tsx +20 -11
- package/app/map/BackButton.tsx +5 -5
- package/app/map/BoxActions.tsx +20 -12
- package/app/map/Breadcrumb.tsx +132 -46
- package/app/map/DetailPanel.tsx +408 -297
- package/app/map/Explorer.tsx +268 -0
- package/app/map/Header.tsx +105 -0
- package/app/map/HelpDialog.tsx +37 -34
- package/app/map/Legend.tsx +19 -75
- package/app/map/LineCard.tsx +187 -0
- package/app/map/MapBox.tsx +73 -38
- package/app/map/MapCanvas.tsx +344 -115
- package/app/map/MapToolbar.tsx +377 -0
- package/app/map/MapView.tsx +217 -213
- package/app/map/RepoMenu.tsx +13 -12
- package/app/map/RoutedEdge.tsx +48 -16
- package/app/map/SearchPalette.tsx +6 -6
- package/app/map/SourceViewer.tsx +19 -17
- package/app/map/StatusBar.tsx +166 -0
- package/app/map/embed.ts +22 -2
- package/app/map/emphasis.ts +94 -8
- package/app/map/explorerRows.ts +85 -0
- package/app/map/flowNodes.ts +12 -7
- package/app/map/format.ts +2 -2
- package/app/map/history.ts +4 -3
- package/app/map/inspector.ts +113 -0
- package/app/map/labels.ts +66 -7
- package/app/map/narrow.ts +165 -85
- package/app/map/opening.ts +16 -0
- package/app/map/portals.ts +2 -2
- package/app/map/routes.ts +1060 -55
- package/app/map/runs.ts +108 -0
- package/app/map/shell.ts +91 -0
- package/app/map/shortcuts.ts +2 -1
- package/app/map/summaries.ts +41 -5
- package/app/map/text.ts +9 -1
- package/app/map/theme.ts +197 -0
- package/app/map/useDismiss.ts +20 -6
- package/app/map/useEditorBridge.ts +12 -1
- package/app/map/useThemeKind.ts +28 -0
- package/app/map/useWindowSize.ts +37 -0
- package/app/map/viewport.ts +134 -16
- package/app/map/weights.ts +80 -0
- package/app/page.tsx +3 -5
- package/lib/background/child.ts +2 -0
- package/lib/background/service.ts +26 -10
- package/lib/contracts.ts +25 -2
- package/lib/db/migrations/0011_plain_summaries_prompt_version.sql +1 -0
- package/lib/db/migrations/meta/0011_snapshot.json +1498 -0
- package/lib/db/migrations/meta/_journal.json +7 -0
- package/lib/db/schema.ts +2 -1
- package/lib/db/store/map.ts +6 -0
- package/lib/db/store/summaries.ts +14 -8
- package/lib/engine/describe.ts +2 -0
- package/lib/index/summarize/budget.ts +5 -2
- package/lib/index/summarize/claude.ts +19 -4
- package/lib/index/summarize/compare.ts +2 -2
- package/lib/index/summarize/plan.ts +73 -13
- package/lib/index/summarize/preview.ts +12 -9
- package/lib/index/summarize/prompts.ts +122 -25
- package/lib/index/summarize/run.ts +48 -18
- package/lib/index/summarize/snapshot.ts +7 -2
- package/lib/index/summarize/status.ts +3 -2
- package/lib/tools/text.ts +3 -2
- package/mcp/server.ts +1 -1
- package/package.json +4 -2
- package/scripts/commands/summarize-command.ts +27 -9
- package/.next/server/chunks/ssr/[root-of-the-server]__0ekw8p2ramybv._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0fwbsqt9e2tr-._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__17_rqmx62cz59._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__1zfp6sltse4hf._.js +0 -3
- package/.next/server/chunks/ssr/_1d2woi6toj_0_._.js +0 -3
- package/.next/server/chunks/ssr/_1wfc1zz26g5ji._.js +0 -9
- package/.next/server/chunks/ssr/app_0gw6epmxyea3q._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_@swc_helpers_cjs__interop_require_default_cjs_1ztp13a5szri_._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_next_dist_1c5t_vsn6u8fr._.js +0 -3
- package/.next/static/chunks/02x9pxyl2d8om.css +0 -3
- package/.next/static/chunks/0p-0bv2dzer18.js +0 -7
- package/.next/static/chunks/10u7p2gj02qay.js +0 -1
- package/.next/static/chunks/31qp8jfkw0x2h.js +0 -31
- package/.next/static/media/123d516c9baeb953-s.1qc6dx89jd2qv.woff2 +0 -0
- package/.next/static/media/41ba59f553543ecf-s.3cb5lpr2l6xud.woff2 +0 -0
- package/.next/static/media/44ed10da57ebfb0e-s.2y65deuc30pmy.woff2 +0 -0
- package/.next/static/media/48eea41d8317494f-s.p.0wiir8udbzjvx.woff2 +0 -0
- package/.next/static/media/49b1d53681a91a99-s.1yd4_i3e35931.woff2 +0 -0
- package/.next/static/media/67bba87670b402d1-s.1u30mmyq6lnsd.woff2 +0 -0
- package/.next/static/media/6fca7e74603dd412-s.02z5rrbg5nt92.woff2 +0 -0
- package/.next/static/media/73263b2957b73100-s.2qt3tdwt-y9x_.woff2 +0 -0
- package/.next/static/media/7ac0b1cd3e695dd0-s.1i-sca43-qwng.woff2 +0 -0
- package/.next/static/media/916cd8a3bde3edf8-s.p.0oace-s_gkfks.woff2 +0 -0
- package/.next/static/media/a45aa1001bf9176f-s.2vemzm0itqzfy.woff2 +0 -0
- package/.next/static/media/a74d2542cc4c775f-s.29yke99gs9qpn.woff2 +0 -0
- package/.next/static/media/ab664c0e419cc841-s.3cvcemwuzoywn.woff2 +0 -0
- package/.next/static/media/c1b11b726b36a5e5-s.2rixgazldzomk.woff2 +0 -0
- package/.next/static/media/d6c1ff7e86974212-s.p.40sczeszzbjw1.woff2 +0 -0
- package/.next/static/media/faab88e4be272d29-s.0rgnxg2b64rzs.woff2 +0 -0
- package/app/map/ActivityBar.tsx +0 -81
- package/app/map/StatusPill.tsx +0 -93
- package/app/map/TopBar.tsx +0 -84
- /package/.next/static/{prDi039MhjlFqDOOwZ4aR → of6twfEZ3j95xtfQB_NSL}/_buildManifest.js +0 -0
- /package/.next/static/{prDi039MhjlFqDOOwZ4aR → of6twfEZ3j95xtfQB_NSL}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{prDi039MhjlFqDOOwZ4aR → of6twfEZ3j95xtfQB_NSL}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,75772,e=>{var t,n,r,o,i,a,l,s,d,u,c,h,f,p,g,m,x,y=e.i(43476),v=e.i(71645);function b(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=b(e[n]))&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var w={value:()=>{}};function k(){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 E(r)}function E(e){this._=e}function M(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=w,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}function j(){}function _(e){return null==e?j:function(){return this.querySelector(e)}}function S(){return[]}function N(e){return null==e?S:function(){return this.querySelectorAll(e)}}function C(e){return function(){return this.matches(e)}}function $(e){return function(t){return t.matches(e)}}E.prototype=k.prototype={constructor:E,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]=M(r[n],e.name,t);else if(null==t)for(n in r)r[n]=M(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 E(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 O=Array.prototype.find;function A(){return this.firstElementChild}var P=Array.prototype.filter;function z(){return Array.from(this.children)}function L(e){return Array(e.length)}function R(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function I(e,t,n,r,o,i){for(var a,l=0,s=t.length,d=i.length;l<d;++l)(a=t[l])?(a.__data__=i[l],r[l]=a):n[l]=new R(e,i[l]);for(;l<s;++l)(a=t[l])&&(o[l]=a)}function D(e,t,n,r,o,i,a){var l,s,d,u=new Map,c=t.length,h=i.length,f=Array(c);for(l=0;l<c;++l)(s=t[l])&&(f[l]=d=a.call(s,s.__data__,l,t)+"",u.has(d)?o[l]=s:u.set(d,s));for(l=0;l<h;++l)d=a.call(e,i[l],l,i)+"",(s=u.get(d))?(r[l]=s,s.__data__=i[l],u.delete(d)):n[l]=new R(e,i[l]);for(l=0;l<c;++l)(s=t[l])&&u.get(f[l])===s&&(o[l]=s)}function B(e){return e.__data__}function T(e,t){return e<t?-1:e>t?1:e>=t?0:0/0}R.prototype={constructor:R,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 F="http://www.w3.org/1999/xhtml";let H={svg:"http://www.w3.org/2000/svg",xhtml:F,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function V(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),H.hasOwnProperty(t)?{space:H[t],local:e}:e}function q(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function W(e,t){return e.style.getPropertyValue(t)||q(e).getComputedStyle(e,null).getPropertyValue(t)}function X(e){return e.trim().split(/^|\s+/)}function Y(e){return e.classList||new K(e)}function K(e){this._node=e,this._names=X(e.getAttribute("class")||"")}function U(e,t){for(var n=Y(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Z(e,t){for(var n=Y(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function G(){this.textContent=""}function Q(){this.innerHTML=""}function J(){this.nextSibling&&this.parentNode.appendChild(this)}function ee(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function et(e){var t=V(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===F&&t.documentElement.namespaceURI===F?t.createElement(e):t.createElementNS(n,e)}})(t)}function en(){return null}function er(){var e=this.parentNode;e&&e.removeChild(this)}function eo(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ei(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ea(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,l=o.length;a<l;++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 es(e,t,n){var r=q(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)}K.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 eu(e,t){this._groups=e,this._parents=t}function ec(){return new eu([[document.documentElement]],ed)}function eh(e){return"string"==typeof e?new eu([[document.querySelector(e)]],[document.documentElement]):new eu([[e]],ed)}function ef(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]}eu.prototype=ec.prototype={constructor:eu,select:function(e){"function"!=typeof e&&(e=_(e));for(var t=this._groups,n=t.length,r=Array(n),o=0;o<n;++o)for(var i,a,l=t[o],s=l.length,d=r[o]=Array(s),u=0;u<s;++u)(i=l[u])&&(a=e.call(i,i.__data__,u,l))&&("__data__"in i&&(a.__data__=i.__data__),d[u]=a);return new eu(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=N(e);for(var n=this._groups,r=n.length,o=[],i=[],a=0;a<r;++a)for(var l,s=n[a],d=s.length,u=0;u<d;++u)(l=s[u])&&(o.push(e.call(l,l.__data__,u,s)),i.push(l));return new eu(o,i)},selectChild:function(e){var t;return this.select(null==e?A:(t="function"==typeof e?e:$(e),function(){return O.call(this.children,t)}))},selectChildren:function(e){var t;return this.selectAll(null==e?z:(t="function"==typeof e?e:$(e),function(){return P.call(this.children,t)}))},filter:function(e){"function"!=typeof e&&(e=C(e));for(var t=this._groups,n=t.length,r=Array(n),o=0;o<n;++o)for(var i,a=t[o],l=a.length,s=r[o]=[],d=0;d<l;++d)(i=a[d])&&e.call(i,i.__data__,d,a)&&s.push(i);return new eu(r,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,B);var n=t?D:I,r=this._parents,o=this._groups;"function"!=typeof e&&(y=e,e=function(){return y});for(var i=o.length,a=Array(i),l=Array(i),s=Array(i),d=0;d<i;++d){var u=r[d],c=o[d],h=c.length,f="object"==typeof(x=e.call(u,u&&u.__data__,d,r))&&"length"in x?x:Array.from(x),p=f.length,g=l[d]=Array(p),m=a[d]=Array(p);n(u,c,g,m,s[d]=Array(h),f,t);for(var x,y,v,b,w=0,k=0;w<p;++w)if(v=g[w]){for(w>=k&&(k=w+1);!(b=m[k])&&++k<p;);v._next=b||null}}return(a=new eu(a,r))._enter=l,a._exit=s,a},enter:function(){return new eu(this._enter||this._groups.map(L),this._parents)},exit:function(){return new eu(this._exit||this._groups.map(L),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),l=Array(o),s=0;s<a;++s)for(var d,u=n[s],c=r[s],h=u.length,f=l[s]=Array(h),p=0;p<h;++p)(d=u[p]||c[p])&&(f[p]=d);for(;s<o;++s)l[s]=n[s];return new eu(l,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=T);for(var n=this._groups,r=n.length,o=Array(r),i=0;i<r;++i){for(var a,l=n[i],s=l.length,d=o[i]=Array(s),u=0;u<s;++u)(a=l[u])&&(d[u]=a);d.sort(t)}return new eu(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,l=i.length;a<l;++a)(o=i[a])&&e.call(o,o.__data__,a,i);return this},attr:function(e,t){var n=V(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)):W(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=X(e+"");if(arguments.length<2){for(var r=Y(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:Z)(this,e)}}:t?function(e){return function(){U(this,e)}}:function(e){return function(){Z(this,e)}})(n,t))},text:function(e){return arguments.length?this.each(null==e?G:("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?Q:("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(J)},lower:function(){return this.each(ee)},append:function(e){var t="function"==typeof e?e:et(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:et(e),r=null==t?en:"function"==typeof t?t:_(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(er)},clone:function(e){return this.select(e?ei:eo)},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 l=this.node().__on;if(l){for(var s,d=0,u=l.length;d<u;++d)for(r=0,s=l[d];r<a;++r)if((o=i[r]).type===s.type&&o.name===s.name)return s.value}return}for(l=t?el:ea,r=0;r<a;++r)this.each(l(i[r],t,n));return this},dispatch:function(e,t){return this.each(("function"==typeof t?function(e,t){return function(){return es(this,e,t.apply(this,arguments))}}:function(e,t){return function(){return es(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},eg={capture:!0,passive:!1};function em(e){e.stopImmediatePropagation()}function ex(e){e.preventDefault(),e.stopImmediatePropagation()}function ey(e){var t=e.document.documentElement,n=eh(e).on("dragstart.drag",ex,eg);"onselectstart"in t?n.on("selectstart.drag",ex,eg):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ev(e,t){var n=e.document.documentElement,r=eh(e).on("dragstart.drag",null);t&&(r.on("click.drag",ex,eg),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 eb=e=>()=>e;function ew(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:a,y:l,dx:s,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}function ek(e){return!e.ctrlKey&&!e.button}function eE(){return this.parentNode}function eM(e,t){return null==t?{x:e.x,y:e.y}:t}function ej(){return navigator.maxTouchPoints||"ontouchstart"in this}function e_(){var e,t,n,r,o=ek,i=eE,a=eM,l=ej,s={},d=k("start","drag","end"),u=0,c=0;function h(e){e.on("mousedown.drag",f).filter(l).on("touchstart.drag",m).on("touchmove.drag",x,ep).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,l){if(!r&&o.call(this,a,l)){var s=v(this,i.call(this,a,l),a,l,"mouse");s&&(eh(a.view).on("mousemove.drag",p,eg).on("mouseup.drag",g,eg),ey(a.view),em(a),n=!1,e=a.clientX,t=a.clientY,s("start",a))}}function p(r){if(ex(r),!n){var o=r.clientX-e,i=r.clientY-t;n=o*o+i*i>c}s.mouse("drag",r)}function g(e){eh(e.view).on("mousemove.drag mouseup.drag",null),ev(e.view,n),ex(e),s.mouse("end",e)}function m(e,t){if(o.call(this,e,t)){var n,r,a=e.changedTouches,l=i.call(this,e,t),s=a.length;for(n=0;n<s;++n)(r=v(this,l,e,t,a[n].identifier,a[n]))&&(em(e),r("start",e,a[n]))}}function x(e){var t,n,r=e.changedTouches,o=r.length;for(t=0;t<o;++t)(n=s[r[t].identifier])&&(ex(e),n("drag",e,r[t]))}function y(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=s[o[t].identifier])&&(em(e),n("end",e,o[t]))}function v(e,t,n,r,o,i){var l,c,f,p=d.copy(),g=ef(i||n,t);if(null!=(f=a.call(e,new ew("beforestart",{sourceEvent:n,target:h,identifier:o,active:u,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),r)))return l=f.x-g[0]||0,c=f.y-g[1]||0,function n(i,a,d){var m,x=g;switch(i){case"start":s[o]=n,m=u++;break;case"end":delete s[o],--u;case"drag":g=ef(d||a,t),m=u}p.call(i,e,new ew(i,{sourceEvent:a,subject:f,target:h,identifier:o,active:m,x:g[0]+l,y:g[1]+c,dx:g[0]-x[0],dy:g[1]-x[1],dispatch:p}),r)}}return h.filter=function(e){return arguments.length?(o="function"==typeof e?e:eb(!!e),h):o},h.container=function(e){return arguments.length?(i="function"==typeof e?e:eb(e),h):i},h.subject=function(e){return arguments.length?(a="function"==typeof e?e:eb(e),h):a},h.touchable=function(e){return arguments.length?(l="function"==typeof e?e:eb(!!e),h):l},h.on=function(){var e=d.on.apply(d,arguments);return e===d?h:e},h.clickDistance=function(e){return arguments.length?(c=(e*=1)*e,h):Math.sqrt(c)},h}function eS(e){return((e=Math.exp(e))+1/e)/2}ew.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};let eN=function e(t,n,r){function o(e,o){var i,a,l=e[0],s=e[1],d=e[2],u=o[0],c=o[1],h=o[2],f=u-l,p=c-s,g=f*f+p*p;if(g<1e-12)a=Math.log(h/d)/t,i=function(e){return[l+e*f,s+e*p,d*Math.exp(t*e*a)]};else{var m=Math.sqrt(g),x=(h*h-d*d+r*g)/(2*d*n*m),y=(h*h-d*d-r*g)/(2*h*n*m),v=Math.log(Math.sqrt(x*x+1)-x);a=(Math.log(Math.sqrt(y*y+1)-y)-v)/t,i=function(e){var r,o,i=e*a,u=eS(v),c=d/(n*m)*(u*(((r=Math.exp(2*(r=t*i+v)))-1)/(r+1))-((o=Math.exp(o=v))-1/o)/2);return[l+c*f,s+c*p,d*u/eS(t*i+v)]}}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 eC,e$,eO=0,eA=0,eP=0,ez=0,eL=0,eR=0,eI="object"==typeof performance&&performance.now?performance:Date,eD="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function eB(){return eL||(eD(eT),eL=eI.now()+eR)}function eT(){eL=0}function eF(){this._call=this._time=this._next=null}function eH(e,t,n){var r=new eF;return r.restart(e,t,n),r}function eV(){eL=(ez=eI.now())+eR,eO=eA=0;try{eB(),++eO;for(var e,t=eC;t;)(e=eL-t._time)>=0&&t._call.call(void 0,e),t=t._next;--eO}finally{eO=0,function(){for(var e,t,n=eC,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:eC=t);e$=e,eW(r)}(),eL=0}}function eq(){var e=eI.now(),t=e-ez;t>1e3&&(eR-=t,ez=e)}function eW(e){!eO&&(eA&&(eA=clearTimeout(eA)),e-eL>24?(e<1/0&&(eA=setTimeout(eV,e-eI.now()-eR)),eP&&(eP=clearInterval(eP))):(eP||(ez=eI.now(),eP=setInterval(eq,1e3)),eO=1,eD(eV)))}function eX(e,t,n){var r=new eF;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}eF.prototype=eH.prototype={constructor:eF,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||e$===this||(e$?e$._next=this:eC=this,e$=this),this._call=e,this._time=n,eW()},stop:function(){this._call&&(this._call=null,this._time=1/0,eW())}};var eY=k("start","end","cancel","interrupt"),eK=[];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(s){var d,u,c,h;if(1!==n.state)return l();for(d in o)if((h=o[d]).name===n.name){if(3===h.state)return eX(i);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[d]):+d<t&&(h.state=6,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[d])}if(eX(function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(s))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,r=Array(c=n.tween.length),d=0,u=-1;d<c;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=h);r.length=u+1}}function a(t){for(var o=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),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),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete o[t],o)return;delete e.__transition}o[t]=n,n.timer=eH(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:eY,tween:eK,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function eZ(e,t){var n=eQ(e,t);if(n.state>0)throw Error("too late; already scheduled");return n}function eG(e,t){var n=eQ(e,t);if(n.state>3)throw Error("too late; already running");return n}function eQ(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error("transition not found");return n}function eJ(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 e0(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}var e1=180/Math.PI,e2={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function e3(e,t,n,r,o,i){var a,l,s;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(s=e*n+t*r)&&(n-=e*s,r-=t*s),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,s/=l),e*r<t*n&&(e=-e,t=-t,s=-s,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*e1,skewX:Math.atan(s)*e1,scaleX:a,scaleY:l}}function e5(e,t,n,r){function o(e){return e.length?e.pop()+" ":""}return function(i,a){var l,s,d,u,c=[],h=[];return i=e(i),a=e(a),!function(e,r,o,i,a,l){if(e!==o||r!==i){var s=a.push("translate(",null,t,null,n);l.push({i:s-4,x:e0(e,o)},{i:s-2,x:e0(r,i)})}else(o||i)&&a.push("translate("+o+t+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,c,h),l=i.rotate,s=a.rotate,l!==s?(l-s>180?s+=360:s-l>180&&(l+=360),h.push({i:c.push(o(c)+"rotate(",null,r)-2,x:e0(l,s)})):s&&c.push(o(c)+"rotate("+s+r),d=i.skewX,u=a.skewX,d!==u?h.push({i:c.push(o(c)+"skewX(",null,r)-2,x:e0(d,u)}):u&&c.push(o(c)+"skewX("+u+r),!function(e,t,n,r,i,a){if(e!==n||t!==r){var l=i.push(o(i)+"scale(",null,",",null,")");a.push({i:l-4,x:e0(e,n)},{i:l-2,x:e0(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 e4=e5(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?e2:e3(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),e6=e5(function(e){return null==e?e2:(d||(d=document.createElementNS("http://www.w3.org/2000/svg","g")),d.setAttribute("transform",e),e=d.transform.baseVal.consolidate())?e3((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):e2},", ",")",")");function e8(e,t,n){var r=e._id;return e.each(function(){var e=eG(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return eQ(e,r).value[t]}}function e7(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function e9(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function te(){}var tt=1/.7,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}\\)$`),tl=RegExp(`^rgb\\(${to},${to},${to}\\)$`),ts=RegExp(`^rgba\\(${tn},${tn},${tn},${tr}\\)$`),td=RegExp(`^rgba\\(${to},${to},${to},${tr}\\)$`),tu=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 tp(){return this.rgb().formatRgb()}function tg(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 tv(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?tx(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?tx(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 tv(t[1],t[2],t[3],1):(t=tl.exec(e))?new tv(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=ts.exec(e))?tx(t[1],t[2],t[3],t[4]):(t=td.exec(e))?tx(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=tu.exec(e))?tj(t[1],t[2]/100,t[3]/100,1):(t=tc.exec(e))?tj(t[1],t[2]/100,t[3]/100,t[4]):th.hasOwnProperty(e)?tm(th[e]):"transparent"===e?new tv(0/0,0/0,0/0,0):null}function tm(e){return new tv(e>>16&255,e>>8&255,255&e,1)}function tx(e,t,n,r){return r<=0&&(e=t=n=0/0),new tv(e,t,n,r)}function ty(e,t,n,r){var o;return 1==arguments.length?((o=e)instanceof te||(o=tg(o)),o)?new tv((o=o.rgb()).r,o.g,o.b,o.opacity):new tv:new tv(e,t,n,null==r?1:r)}function tv(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function tb(){return`#${tM(this.r)}${tM(this.g)}${tM(this.b)}`}function tw(){let e=tk(this.opacity);return`${1===e?"rgb(":"rgba("}${tE(this.r)}, ${tE(this.g)}, ${tE(this.b)}${1===e?")":`, ${e})`}`}function tk(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 tM(e){return((e=tE(e))<16?"0":"")+e.toString(16)}function tj(e,t,n,r){return r<=0?e=t=n=0/0:n<=0||n>=1?e=t=0/0:t<=0&&(e=0/0),new tS(e,t,n,r)}function t_(e){if(e instanceof tS)return new tS(e.h,e.s,e.l,e.opacity);if(e instanceof te||(e=tg(e)),!e)return new tS;if(e instanceof tS)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=0/0,l=i-o,s=(i+o)/2;return l?(a=t===i?(n-r)/l+(n<r)*6:n===i?(r-t)/l+2:(t-n)/l+4,l/=s<.5?i+o:2-i-o,a*=60):l=s>0&&s<1?0:a,new tS(a,l,s,e.opacity)}function tS(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function tN(e){return(e=(e||0)%360)<0?e+360:e}function tC(e){return Math.max(0,Math.min(1,e||0))}function t$(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(te,tg,{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 t_(this).formatHsl()},formatRgb:tp,toString:tp}),e7(tv,ty,e9(te,{brighter(e){return e=null==e?tt:Math.pow(tt,e),new tv(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new tv(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new tv(tE(this.r),tE(this.g),tE(this.b),tk(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`#${tM(this.r)}${tM(this.g)}${tM(this.b)}${tM((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:tw,toString:tw})),e7(tS,function(e,t,n,r){return 1==arguments.length?t_(e):new tS(e,t,n,null==r?1:r)},e9(te,{brighter(e){return e=null==e?tt:Math.pow(tt,e),new tS(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new tS(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 tv(t$(e>=240?e-240:e+120,o,r),t$(e,o,r),t$(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new tS(tN(this.h),tC(this.s),tC(this.l),tk(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=tk(this.opacity);return`${1===e?"hsl(":"hsla("}${tN(this.h)}, ${100*tC(this.s)}%, ${100*tC(this.l)}%${1===e?")":`, ${e})`}`}}));let tA=e=>()=>e;function tP(e,t){var n=t-e;return n?function(t){return e+t*n}:tA(isNaN(e)?t:e)}let tz=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)}):tA(isNaN(e)?t:e)};function o(e,t){var n=r((e=ty(e)).r,(t=ty(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 tL(e){return function(t){var n,r,o=t.length,i=Array(o),a=Array(o),l=Array(o);for(n=0;n<o;++n)r=ty(t[n]),i[n]=r.r||0,a[n]=r.g||0,l[n]=r.b||0;return i=e(i),a=e(a),l=e(l),r.opacity=1,function(e){return r.r=i(e),r.g=a(e),r.b=l(e),r+""}}}tL(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,l=r<t-1?e[r+2]:2*i-o;return tO((n-r/t)*t,a,o,i,l)}}),tL(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],l=e[(r+2)%t];return tO((n-r/t)*t,o,i,a,l)}});var tR=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tI=RegExp(tR.source,"g");function tD(e,t){var n,r,o,i,a,l=tR.lastIndex=tI.lastIndex=0,s=-1,d=[],u=[];for(e+="",t+="";(o=tR.exec(e))&&(i=tI.exec(t));)(a=i.index)>l&&(a=t.slice(l,a),d[s]?d[s]+=a:d[++s]=a),(o=o[0])===(i=i[0])?d[s]?d[s]+=i:d[++s]=i:(d[++s]=null,u.push({i:s,x:e0(o,i)})),l=tI.lastIndex;return l<t.length&&(a=t.slice(l),d[s]?d[s]+=a:d[++s]=a),d.length<2?u[0]?(n=u[0].x,function(e){return n(e)+""}):(r=t,function(){return r}):(t=u.length,function(e){for(var n,r=0;r<t;++r)d[(n=u[r]).i]=n.x(e);return d.join("")})}function tB(e,t){var n;return("number"==typeof t?e0:t instanceof tg?tz:(n=tg(t))?(t=n,tz):tD)(e,t)}var tT=ec.prototype.constructor;function tF(e){return function(){this.style.removeProperty(e)}}var tH=0;function tV(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}var tq=ec.prototype;tV.prototype=(function(e){return ec().transition(e)}).prototype={constructor:tV,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=_(e));for(var r=this._groups,o=r.length,i=Array(o),a=0;a<o;++a)for(var l,s,d=r[a],u=d.length,c=i[a]=Array(u),h=0;h<u;++h)(l=d[h])&&(s=e.call(l,l.__data__,h,d))&&("__data__"in l&&(s.__data__=l.__data__),c[h]=s,eU(c[h],t,n,h,c,eQ(l,n)));return new tV(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=N(e));for(var r=this._groups,o=r.length,i=[],a=[],l=0;l<o;++l)for(var s,d=r[l],u=d.length,c=0;c<u;++c)if(s=d[c]){for(var h,f=e.call(s,s.__data__,c,d),p=eQ(s,n),g=0,m=f.length;g<m;++g)(h=f[g])&&eU(h,t,n,g,f,p);i.push(f),a.push(s)}return new tV(i,a,t,n)},selectChild:tq.selectChild,selectChildren:tq.selectChildren,filter:function(e){"function"!=typeof e&&(e=C(e));for(var t=this._groups,n=t.length,r=Array(n),o=0;o<n;++o)for(var i,a=t[o],l=a.length,s=r[o]=[],d=0;d<l;++d)(i=a[d])&&e.call(i,i.__data__,d,a)&&s.push(i);return new tV(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),l=0;l<i;++l)for(var s,d=t[l],u=n[l],c=d.length,h=a[l]=Array(c),f=0;f<c;++f)(s=d[f]||u[f])&&(h[f]=s);for(;l<r;++l)a[l]=t[l];return new tV(a,this._parents,this._name,this._id)},selection:function(){return new tT(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=++tH,r=this._groups,o=r.length,i=0;i<o;++i)for(var a,l=r[i],s=l.length,d=0;d<s;++d)if(a=l[d]){var u=eQ(a,t);eU(a,e,n,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new tV(r,this._parents,e,n)},call:tq.call,nodes:tq.nodes,node:tq.node,size:tq.size,empty:tq.empty,each:tq.each,on:function(e,t){var n,r,o,i,a,l,s=this._id;return arguments.length<2?eQ(this.node(),s).on.on(e):this.each((n=s,r=e,o=t,l=(r+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})?eZ:eG,function(){var e=l(this,n),t=e.on;t!==i&&(a=(i=t).copy()).on(r,o),e.on=a}))},attr:function(e,t){var n=V(e),r="transform"===n?e6:tB;return this.attrTween(e,"function"==typeof t?(n.local?function(e,t,n){var r,o,i;return function(){var a,l,s=n(this);return null==s?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local))===(l=s+"")?null:a===r&&l===o?i:(o=l,i=t(r=a,s))}}:function(e,t,n){var r,o,i;return function(){var a,l,s=n(this);return null==s?void this.removeAttribute(e):(a=this.getAttribute(e))===(l=s+"")?null:a===r&&l===o?i:(o=l,i=t(r=a,s))}})(n,r,e8(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=V(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,l,s,d,u,c,h,f,p,g,m,x,y,v,b,w,k,E,M="transform"==(e+="")?e4:tB;return null==t?this.styleTween(e,(r=e,function(){var e=W(this,r),t=(this.style.removeProperty(r),W(this,r));return e===t?null:e===o&&t===i?a:a=M(o=e,i=t)})).on("end.style."+e,tF(e)):"function"==typeof t?this.styleTween(e,(l=e,s=e8(this,"style."+e,t),function(){var e=W(this,l),t=s(this),n=t+"";return null==t&&(this.style.removeProperty(l),n=t=W(this,l)),e===n?null:e===d&&n===u?c:(u=n,c=M(d=e,t))})).each((h=this._id,v="end."+(y="style."+(f=e)),function(){var e=eG(this,h),t=e.on,n=null==e.value[y]?x||(x=tF(f)):void 0;(t!==p||m!==n)&&(g=(p=t).copy()).on(v,m=n),e.on=g})):this.styleTween(e,(b=e,E=t+"",function(){var e=W(this,b);return e===E?null:e===w?k:k=M(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=e8(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=eQ(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=eG(this,e),i=o.tween;if(i!==n){r=n=i;for(var a=0,l=r.length;a<l;++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=eG(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var l={name:t,value:n},s=0,d=o.length;s<d;++s)if(o[s].name===t){o[s]=l;break}s===d&&o.push(l)}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(){eZ(this,e).delay=+t.apply(this,arguments)}}:function(e,t){return t*=1,function(){eZ(this,e).delay=t}})(t,e)):eQ(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?function(e,t){return function(){eG(this,e).duration=+t.apply(this,arguments)}}:function(e,t){return t*=1,function(){eG(this,e).duration=t}})(t,e)):eQ(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(){eG(this,e).ease=t}}(t,e)):eQ(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();eG(this,t).ease=n}))},end:function(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,a){var l={value:a},s={value:function(){0==--o&&i()}};n.each(function(){var n=eG(this,r),o=n.on;o!==e&&((t=(e=o).copy())._.cancel.push(l),t._.interrupt.push(l),t._.end.push(s)),n.on=t}),0===o&&i()})},[Symbol.iterator]:tq[Symbol.iterator]};var tW={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};ec.prototype.interrupt=function(e){return this.each(function(){eJ(this,e)})},ec.prototype.transition=function(e){var t,n;e instanceof tV?(t=e._id,e=e._name):(t=++tH,(n=tW).time=eB(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,l=r[i],s=l.length,d=0;d<s;++d)(a=l[d])&&eU(a,e,t,d,l,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 tV(r,this._parents,e,t)};let tX=e=>()=>e;function tY(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 tK(e,t,n){this.k=e,this.x=t,this.y=n}tK.prototype={constructor:tK,scale:function(e){return 1===e?this:new tK(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new tK(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 tU=new tK(1,0,0);function tZ(e){for(;!e.__zoom;)if(!(e=e.parentNode))return tU;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||tU}function t2(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function t3(){return navigator.maxTouchPoints||"ontouchstart"in this}function t5(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=t5,a=t2,l=t3,s=[0,1/0],d=[[-1/0,-1/0],[1/0,1/0]],u=250,c=eN,h=k("start","zoom","end"),f=0,p=10;function g(e){e.property("__zoom",t1).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",j).filter(l).on("touchstart.zoom",_).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,t){return(t=Math.max(s[0],Math.min(s[1],t)))===e.k?e:new tK(t,e.x,e.y)}function x(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 tK(e.k,r,o)}function y(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function v(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),l=null==n?y(a):"function"==typeof n?n.apply(this,e):n,s=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),d=this.__zoom,u="function"==typeof t?t.apply(this,e):t,h=c(d.invert(l).concat(s/d.k),u.invert(l).concat(s/u.k));return function(e){if(1===e)e=u;else{var t=h(e),n=s/t[2];e=new tK(n,l[0]-t[0]*n,l[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(e,...t){if(r.apply(this,arguments)){var n=b(this,t).event(e),o=this.__zoom,l=Math.max(s[0],Math.min(s[1],o.k*Math.pow(2,a.apply(this,arguments)))),u=ef(e);if(n.wheel)(n.mouse[0][0]!==u[0]||n.mouse[0][1]!==u[1])&&(n.mouse[1]=o.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(o.k===l)return;n.mouse=[u,o.invert(u)],eJ(this),n.start()}tQ(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(x(m(o,l),n.mouse[0],n.mouse[1]),n.extent,d))}}function M(e,...t){if(!n&&r.apply(this,arguments)){var o=e.currentTarget,a=b(this,t,!0).event(e),l=eh(e.view).on("mousemove.zoom",function(e){if(tQ(e),!a.moved){var t=e.clientX-u,n=e.clientY-c;a.moved=t*t+n*n>f}a.event(e).zoom("mouse",i(x(a.that.__zoom,a.mouse[0]=ef(e,o),a.mouse[1]),a.extent,d))},!0).on("mouseup.zoom",function(e){l.on("mousemove.zoom mouseup.zoom",null),ev(e.view,a.moved),tQ(e),a.event(e).end()},!0),s=ef(e,o),u=e.clientX,c=e.clientY;ey(e.view),tG(e),a.mouse=[s,this.__zoom.invert(s)],eJ(this),a.start()}}function j(e,...t){if(r.apply(this,arguments)){var n=this.__zoom,a=ef(e.changedTouches?e.changedTouches[0]:e,this),l=n.invert(a),s=n.k*(e.shiftKey?.5:2),c=i(x(m(n,s),a,l),o.apply(this,t),d);tQ(e),u>0?eh(this).transition().duration(u).call(v,c,a,e):eh(this).call(g.transform,c,a,e)}}function _(n,...o){if(r.apply(this,arguments)){var i,a,l,s,d=n.touches,u=d.length,c=b(this,o,n.changedTouches.length===u).event(n);for(tG(n),a=0;a<u;++a)s=[s=ef(l=d[a],this),this.__zoom.invert(s),l.identifier],c.touch0?c.touch1||c.touch0[2]===s[2]||(c.touch1=s,c.taps=0):(c.touch0=s,i=!0,c.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(c.taps<2&&(t=s[0],e=setTimeout(function(){e=null},500)),eJ(this),c.start())}}function S(e,...t){if(this.__zooming){var n,r,o,a,l=b(this,t).event(e),s=e.changedTouches,u=s.length;for(tQ(e),n=0;n<u;++n)o=ef(r=s[n],this),l.touch0&&l.touch0[2]===r.identifier?l.touch0[0]=o:l.touch1&&l.touch1[2]===r.identifier&&(l.touch1[0]=o);if(r=l.that.__zoom,l.touch1){var c=l.touch0[0],h=l.touch0[1],f=l.touch1[0],p=l.touch1[1],g=(g=f[0]-c[0])*g+(g=f[1]-c[1])*g,y=(y=p[0]-h[0])*y+(y=p[1]-h[1])*y;r=m(r,Math.sqrt(g/y)),o=[(c[0]+f[0])/2,(c[1]+f[1])/2],a=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!l.touch0)return;o=l.touch0[0],a=l.touch0[1]}l.zoom("touch",i(x(r,o,a),l.extent,d))}}function N(e,...r){if(this.__zooming){var o,i,a=b(this,r).event(e),l=e.changedTouches,s=l.length;for(tG(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),o=0;o<s;++o)i=l[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=ef(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var d=eh(this).on("dblclick.zoom");d&&d.apply(this,arguments)}}}return g.transform=function(e,t,n,r){var o=e.selection?e.selection():e;o.property("__zoom",t1),e!==o?v(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()})},g.scaleBy=function(e,t,n,r){g.scaleTo(e,function(){var e=this.__zoom.k,n="function"==typeof t?t.apply(this,arguments):t;return e*n},n,r)},g.scaleTo=function(e,t,n,r){g.transform(e,function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==n?y(e):"function"==typeof n?n.apply(this,arguments):n,l=r.invert(a),s="function"==typeof t?t.apply(this,arguments):t;return i(x(m(r,s),a,l),e,d)},n,r)},g.translateBy=function(e,t,n,r){g.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),d)},null,r)},g.translateTo=function(e,t,n,r,a){g.transform(e,function(){var e=o.apply(this,arguments),a=this.__zoom,l=null==r?y(e):"function"==typeof r?r.apply(this,arguments):r;return i(tU.translate(l[0],l[1]).scale(a.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,d)},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=eh(this.that).datum();h.call(e,this.that,new tY(e,{sourceEvent:this.sourceEvent,target:g,type:e,transform:this.that.__zoom,dispatch:h}),t)}},g.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:tX(+e),g):a},g.filter=function(e){return arguments.length?(r="function"==typeof e?e:tX(!!e),g):r},g.touchable=function(e){return arguments.length?(l="function"==typeof e?e:tX(!!e),g):l},g.extent=function(e){return arguments.length?(o="function"==typeof e?e:tX([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),g):o},g.scaleExtent=function(e){return arguments.length?(s[0]=+e[0],s[1]=+e[1],g):[s[0],s[1]]},g.translateExtent=function(e){return arguments.length?(d[0][0]=+e[0][0],d[1][0]=+e[1][0],d[0][1]=+e[0][1],d[1][1]=+e[1][1],g):[[d[0][0],d[0][1]],[d[1][0],d[1][1]]]},g.constrain=function(e){return arguments.length?(i=e,g):i},g.duration=function(e){return arguments.length?(u=+e,g):u},g.interpolate=function(e){return arguments.length?(c=e,g):c},g.on=function(){var e=h.on.apply(h,arguments);return e===h?g:e},g.clickDistance=function(e){return arguments.length?(f=(e*=1)*e,g):Math.sqrt(f)},g.tapDistance=function(e){return arguments.length?(p=+e,g):p},g}function t6(e,t){var n,r,o=typeof t;return null==t||"boolean"===o?tA(t):("number"===o?e0:"string"===o?(r=tg(t))?(t=r,tz):tD:t instanceof tg?tz: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}}:e0: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)}tZ.prototype=tK.prototype;let t8=[[-1/0,-1/0],[1/0,1/0]],t7=["Enter"," ","Escape"],t9={"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=u||(u={})).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=p||(p={})).Arrow="arrow",i.ArrowClosed="arrowclosed",(a=g||(g={})).Left="left",a.Top="top",a.Right="right",a.Bottom="bottom";let nt={[g.Left]:g.Right,[g.Right]:g.Left,[g.Top]:g.Bottom,[g.Bottom]:g.Top};function nn(e){return null===e?null:e?"valid":"invalid"}let nr=e=>!!e&&"object"==typeof e&&"id"in e&&"source"in e&&"target"in e,no=e=>!!e&&"object"==typeof e&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ni=(e,t=[0,0])=>{let{width:n,height:r}=nz(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?ny(n):{x:0,y:0,width:0,height:0}},nl=(e,t,[n,r,o]=[0,0,1],i=!1,a=!1)=>{let l=(t.x-n)/o,s=(t.y-r)/o,d=t.width/o,u=t.height/o,c=[];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??0,h=e.height??t.height??t.initialHeight??0,{x:f,y:p}=t.internals.positionAbsolute,g=nk(l,s,d,u,f,p,o,h),m=o*h,x=i&&g>0;(!t.internals.handleBounds||x||g>=m||t.dragging)&&c.push(t)}return c};async function ns({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},a){let l,s;if(0===e.size)return!0;let d=nO(na((l=new Map,s=a?.nodes?new Set(a.nodes.map(e=>e.id)):null,e.forEach(e=>{let t;if(a?.includeHiddenNodes){let{width:n,height:r}=nz(e);t=n>0&&r>0}else t=!!(e.measured.width&&e.measured.height&&!e.hidden);t&&(!s||s.has(e.id))&&l.set(e.id,e)}),l)),t,n,a?.minZoom??o,a?.maxZoom??i,a?.padding??.1);return await r.setViewport(d,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),!0}function nd({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){let a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:s,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},u=a.origin??r,c=a.extent||o;if("parent"!==a.extent||a.expandParent)l&&nP(a.extent)&&(c=[[a.extent[0][0]+s,a.extent[0][1]+d],[a.extent[1][0]+s,a.extent[1][1]+d]]);else if(l){let e=l.measured.width,t=l.measured.height;e&&t&&(c=[[s,d],[s+e,d+t]])}else i?.("005","Only child nodes can use a parent extent.");let h=nP(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-s+(a.measured.width??0)*u[0],y:h.y-d+(a.measured.height??0)*u[1]},positionAbsolute:h}}async function nu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){let i,a=new Set(e.map(e=>e.id)),l=[];for(let e of n){if(!1===e.deletable)continue;let t=a.has(e.id),n=!t&&e.parentId&&l.find(t=>t.id===e.parentId);(t||n)&&l.push(e)}let s=new Set(t.map(e=>e.id)),d=r.filter(e=>!1!==e.deletable),u=(i=new Set,l.forEach(e=>{i.add(e.id)}),d.filter(e=>i.has(e.source)||i.has(e.target)));for(let e of d)s.has(e.id)&&!u.find(t=>t.id===e.id)&&u.push(e);if(!o)return{edges:u,nodes:l};let c=await o({nodes:l,edges:u});return"boolean"==typeof c?c?{edges:u,nodes:l}:{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}=nz(n),{x:i,y:a}=n.internals.positionAbsolute;return nh(e,[[i,a],[i+r,a+o]],t)}let np=(e,t,n)=>e<t?nc(Math.abs(e-t),1,t)/t:e>n?-nc(Math.abs(e-n),1,t)/t:0,ng=(e,t,n=15,r=40)=>[np(e.x,r,t.width-r)*n,np(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)}),nx=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),ny=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),nv=(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)=>ny(nm(nx(e),nx(t))),nk=(e,t,n,r,o,i,a,l)=>Math.ceil(Math.max(0,Math.min(e+n,o+a)-Math.max(e,o))*Math.max(0,Math.min(t+r,i+l)-Math.max(t,i))),nE=(e,t)=>nk(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),nM=e=>nj(e.width)&&nj(e.height)&&nj(e.x)&&nj(e.y),nj=e=>!isNaN(e)&&isFinite(e),n_=(e,t)=>(e,t)=>{},nS=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),nN=({x:e,y:t},[n,r,o],i=!1,a=[1,1])=>{let l={x:(e-n)/o,y:(t-r)/o};return i?nS(l,a):l},nC=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function n$(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(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}let nO=(e,t,n,r,o,i)=>{let a=function(e,t,n){if("string"==typeof e||"number"==typeof e){let r=n$(e,n),o=n$(e,t);return{top:r,right:o,bottom:r,left:o,x:2*o,y:2*r}}if("object"==typeof e){let r=n$(e.top??e.y??0,n),o=n$(e.bottom??e.y??0,n),i=n$(e.left??e.x??0,t),a=n$(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),l=nc(Math.min((t-a.x)/e.width,(n-a.y)/e.height),r,o),s=e.x+e.width/2,d=e.y+e.height/2,u=t/2-s*l,c=n/2-d*l,h=function(e,t,n,r,o,i){let{x:a,y:l}=nC(e,[t,n,r]),{x:s,y:d}=nC({x:e.x+e.width,y:e.y+e.height},[t,n,r]);return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(o-s),bottom:Math.floor(i-d)}}(e,u,c,l,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:u-f.left+f.right,y:c-f.top+f.bottom,zoom:l}},nA=()=>"u">typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function nP(e){return null!=e&&"parent"!==e}function nz(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function nL(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function nR(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 nI(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function nD(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){let{x:i,y:a}=nV(e),l=nN({x:i-(o?.left??0),y:a-(o?.top??0)},r),{x:s,y:d}=n?nS(l,t):l;return{xSnapped:s,ySnapped:d,...l}}let nB=e=>({width:e.offsetWidth,height:e.offsetHeight}),nT=e=>e?.getRootNode?.()||window?.document,nF=["INPUT","SELECT","TEXTAREA"];function nH(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1&&(nF.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)}},nq=(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,...nB(t)}}):null};function nW({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:a,targetControlY:l}){let s=.125*e+.375*o+.375*a+.125*n,d=.125*t+.375*i+.375*l+.125*r,u=Math.abs(s-e),c=Math.abs(d-t);return[s,d,u,c]}function nX(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function nY({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case g.Left:return[t-nX(t-r,i),n];case g.Right:return[t+nX(r-t,i),n];case g.Top:return[t,n-nX(n-o,i)];case g.Bottom:return[t,n+nX(o-n,i)]}}function nK({sourceX:e,sourceY:t,sourcePosition:n=g.Bottom,targetX:r,targetY:o,targetPosition:i=g.Top,curvature:a=.25}){let[l,s]=nY({pos:n,x1:e,y1:t,x2:r,y2:o,c:a}),[d,u]=nY({pos:i,x1:r,y1:o,x2:e,y2:t,c:a}),[c,h,f,p]=nW({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:s,targetControlX:d,targetControlY:u});return[`M${e},${t} C${l},${s} ${d},${u} ${r},${o}`,c,h,f,p]}function nU({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 nZ=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`;function nG({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[o,i,a,l]=nU({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,a,l]}let nQ={[g.Left]:{x:-1,y:0},[g.Right]:{x:1,y:0},[g.Top]:{x:0,y:-1},[g.Bottom]:{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=g.Bottom,targetX:r,targetY:o,targetPosition:i=g.Top,borderRadius:a=5,centerX:l,centerY:s,offset:d=20,stepPosition:u=.5}){let[c,h,f,p,m]=function({source:e,sourcePosition:t=g.Bottom,target:n,targetPosition:r=g.Top,center:o,offset:i,stepPosition:a}){let l,s,d=nQ[t],u=nQ[r],c={x:e.x+d.x*i,y:e.y+d.y*i},h={x:n.x+u.x*i,y:n.y+u.y*i},f=(({source:e,sourcePosition:t=g.Bottom,target:n})=>t===g.Left||t===g.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})({source:c,sourcePosition:t,target:h}),p=0!==f.x?"x":"y",m=f[p],x=[],y={x:0,y:0},v={x:0,y:0},[,,b,w]=nU({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(d[p]*u[p]==-1){"x"===p?(l=o.x??c.x+(h.x-c.x)*a,s=o.y??(c.y+h.y)/2):(l=o.x??(c.x+h.x)/2,s=o.y??c.y+(h.y-c.y)*a);let e=[{x:l,y:c.y},{x:l,y:h.y}],t=[{x:c.x,y:s},{x:h.x,y:s}];x=d[p]===m?"x"===p?e:t:"x"===p?t:e}else{let o=[{x:c.x,y:h.y}],a=[{x:h.x,y:c.y}];if(x="x"===p?d.x===m?a:o:d.y===m?o:a,t===r){let t=Math.abs(e[p]-n[p]);if(t<=i){let r=Math.min(i-1,i-t);d[p]===m?y[p]=(c[p]>e[p]?-1:1)*r:v[p]=(h[p]>n[p]?-1:1)*r}}if(t!==r){let e="x"===p?"y":"x",t=d[p]===u[e],n=c[e]>h[e],r=c[e]<h[e];(1===d[p]&&(!t&&n||t&&r)||1!==d[p]&&(!t&&r||t&&n))&&(x="x"===p?o:a)}let f={x:c.x+y.x,y:c.y+y.y},g={x:h.x+v.x,y:h.y+v.y};Math.max(Math.abs(f.x-x[0].x),Math.abs(g.x-x[0].x))>=Math.max(Math.abs(f.y-x[0].y),Math.abs(g.y-x[0].y))?(l=(f.x+g.x)/2,s=x[0].y):(l=x[0].x,s=(f.y+g.y)/2)}let k={x:c.x+y.x,y:c.y+y.y},E={x:h.x+v.x,y:h.y+v.y};return[[e,...k.x!==x[0].x||k.y!==x[0].y?[k]:[],...x,...E.x!==x[x.length-1].x||E.y!==x[x.length-1].y?[E]:[],n],l,s,b,w]}({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:l,y:s},offset:d,stepPosition:u}),x=`M${c[0].x} ${c[0].y}`;for(let e=1;e<c.length-1;e++)x+=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 l=e.x<n.x?1:-1,s=e.y<n.y?-1:1;return`L ${i},${a+o*s}Q ${i},${a} ${i+o*l},${a}`}(c[e-1],c[e],c[e+1],a);return[x+=`L${c[c.length-1].x} ${c[c.length-1].y}`,h,f,p,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 n3(e,t,n=g.Left,r=!1){let o=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??nz(e);if(r)return{x:o+a/2,y:i+l/2};switch(t?.position??n){case g.Top:return{x:o+a/2,y:i};case g.Right:return{x:o+a,y:i+l/2};case g.Bottom:return{x:o+a/2,y:i+l};case g.Left:return{x:o,y:i+l/2}}}function n5(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 n7(e,t){let n={...e};for(let e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function n9(e){return"manual"===e}function re(e,t,n,r={}){let o=n7(n8,r),i={i:0},a=new Map(t),l=o?.elevateNodesOnSelect&&!n9(o.zIndexMode)?1e3:0,s=e.length>0,d=!1;for(let u of(t.clear(),n.clear(),e)){let e=a.get(u.id);if(o.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=nh(ni(u,o.nodeOrigin),nP(u.extent)?u.extent:o.nodeExtent,nz(u));e={...o.defaults,...u,measured:{width:u.measured?.width,height:u.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}}(u,e),z:rn(u,l,o.zIndexMode),userNode:u}},t.set(u.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(s=!1),u.parentId&&rt(e,t,n,r,i),d||=u.selected??!1}return{nodesInitialized:s,hasSelectedNodes:d}}function rt(e,t,n,r,o){let{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:s}=n7(n6,r),d=e.parentId,u=t.get(d);if(!u)return void console.warn(`Parent node ${d} 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&&!u.parentId&&void 0===u.internals.rootParentIndex&&"auto"===s&&(u.internals.rootParentIndex=++o.i,u.internals.z=u.internals.z+10*o.i),o&&void 0!==u.internals.rootParentIndex&&(o.i=u.internals.rootParentIndex);let{x:c,y:h,z:f}=function(e,t,n,r,o,i){let{x:a,y:l}=t.internals.positionAbsolute,s=nz(e),d=ni(e,n),u=nP(e.extent)?nh(d,e.extent,s):d,c=nh({x:a+u.x,y:l+u.y},r,s);"parent"===e.extent&&(c=nf(c,s,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,u,a,l,i&&!n9(s)?1e3:0,s),{positionAbsolute:p}=e.internals,g=c!==p.x||h!==p.y;(g||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:g?{x:c,y:h}:p,z:f}})}function rn(e,t,n){let r=nj(e.zIndex)?e.zIndex:0;return n9(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??nv(e),n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},a)=>{let l=i.internals.positionAbsolute,s=nz(i),d=i.origin??r,u=t.x<l.x?Math.round(Math.abs(l.x-t.x)):0,c=t.y<l.y?Math.round(Math.abs(l.y-t.y)):0,h=Math.max(s.width,Math.round(t.width)),f=Math.max(s.height,Math.round(t.height)),p=(h-s.width)*d[0],g=(f-s.height)*d[1];(u>0||c>0||p||g)&&(o.push({id:a,type:"position",position:{x:i.position.x-u+p,y:i.position.y-c+g}}),n.get(a)?.forEach(t=>{e.some(e=>e.id===t.id)||o.push({id:t.id,type:"position",position:{x:t.position.x+u,y:t.position.y+c}})})),(s.width<t.width||s.height<t.height||u||c)&&o.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:h+(u?d[0]*u-p:0),height:f+(c?d[1]*c-g:0)}})}),o}async function ro({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!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!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function ri(e,t,n,r,o,i){let a=o,l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${o}-${e}`;let s=r.get(a)||new Map;if(r.set(a,s.set(n,t)),i){a=`${o}-${e}-${i}`;let l=r.get(a)||new Map;r.set(a,l.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,l={edgeId:r.id,source:n,target:o,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${o}-${a}`;ri("source",l,`${o}-${a}--${n}-${i}`,e,n,i),ri("target",l,s,e,o,a),t.set(r.id,r)}}function rl(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 rs({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 rd(e,t,n,r,o,i=!1){let a=r.get(e);if(!a)return null;let l="strict"===o?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],s=(n?l?.find(e=>e.id===n):l?.[0])??null;return s&&i?{...s,...n3(a,s,s.position,!0)}:s}function ru(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:l,flowId:s,isValidConnection:d=rc,nodeLookup:c}){let h="target"===i,f=t?a.querySelector(`.${l}-flow__handle[data-id="${s}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:g}=nV(e),m=a.elementFromPoint(p,g),x=m?.classList.contains(`${l}-flow__handle`)?m:f,y={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){let e=ru(void 0,x),t=x.getAttribute("data-nodeid"),i=x.getAttribute("data-handleid"),a=x.classList.contains("connectable"),l=x.classList.contains("connectableend");if(!t||!e)return y;let s={source:h?t:r,sourceHandle:h?i:o,target:h?r:t,targetHandle:h?o:i};y.connection=s,y.isValid=a&&l&&(n===u.Strict?h&&"source"===e||!h&&"target"===e:t!==r||i!==o)&&d(s),y.toHandle=rd(t,e,i,c,n,!0)}return y}let rf=function(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:s,lib:d,autoPanOnConnect:u,flowId:c,panBy:h,cancelConnection:f,onConnectStart:p,onConnect:m,onConnectEnd:x,isValidConnection:y=rc,onReconnectEnd:v,updateConnection:b,getTransform:w,getFromHandle:k,autoPanSpeed:E,dragThreshold:M=1,handleDomNode:j}){let _,S=nT(e.target),N=0,{x:C,y:$}=nV(e),O=ru(i,j),A=l?.getBoundingClientRect(),P=!1;if(!A||!O)return;let z=rd(o,O,r,s,t);if(!z)return;let L=nV(e,A),R=!1,I=null,D=!1,B=null,T={...z,nodeId:o,type:O,position:z.position},F=s.get(o),H={inProgress:!0,isValid:null,from:n3(F,T,g.Left,!0),fromHandle:T,fromPosition:T.position,fromNode:F,to:L,toHandle:null,toPosition:nt[T.position],toNode:null,pointer:L};function V(){P=!0,b(H),p?.(e,{nodeId:o,handleId:r,handleType:O})}function q(e){var i,l;let f;if(!P){let{x:t,y:n}=nV(e),r=t-C,o=n-$;if(!(r*r+o*o>M*M))return;V()}if(!k()||!T)return void W(e);let p=w();_=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())nE(o,nv(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:l,y:s}=n3(a,n,n.position,!0),d=Math.sqrt(Math.pow(l-e.x,2)+Math.pow(s-e.y,2));d>t||(d<i?(o=[{...n,x:l,y:s}],i=d):d===i&&o.push({...n,x:l,y:s}))}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]}(nN(L=nV(e,A),p,!1,[1,1]),n,s,T),R||(!function e(){if(!u||!A)return;let[t,n]=ng(L,A,E);h({x:t,y:n}),N=requestAnimationFrame(e)}(),R=!0);let m=rh(e,{handle:_,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:S,lib:d,flowId:c,nodeLookup:s});B=m.handleDomNode,I=m.connection,i=!!_,l=m.isValid,f=null,l?f=!0:i&&!l&&(f=!1),D=f;let x=s.get(o),v=x?n3(x,T,g.Left,!0):H.from,j={...H,from:v,isValid:D,to:m.toHandle&&D?nC({x:m.toHandle.x,y:m.toHandle.y},p):L,toHandle:m.toHandle,toPosition:D&&m.toHandle?m.toHandle.position:nt[T.position],toNode:m.toHandle?s.get(m.toHandle.nodeId):null,pointer:L};b(j),H=j}function W(e){if(!("touches"in e)||!(e.touches.length>0)){if(P){(_||B)&&I&&D&&m?.(I);let{inProgress:t,...n}=H,r={...n,toPosition:H.toHandle?H.toPosition:null};x?.(e,r),i&&v?.(e,r)}f(),cancelAnimationFrame(N),R=!1,D=!1,I=null,B=null,S.removeEventListener("mousemove",q),S.removeEventListener("mouseup",W),S.removeEventListener("touchmove",q),S.removeEventListener("touchend",W)}}0===M&&V(),S.addEventListener("mousemove",q),S.addEventListener("mouseup",W),S.addEventListener("touchmove",q),S.addEventListener("touchend",W)},rp=e=>({x:e.x,y:e.y,zoom:e.k}),rg=({x:e,y:t,zoom:n})=>tU.translate(e,t).scale(n),rm=(e,t)=>e.target.closest(`.${t}`),rx=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),ry=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,rv=(e,t=0,n=ry,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&&nA()?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 rk(e,t){return Math.max(0,t-e)}function rE(e,t){return Math.max(0,e-t)}function rM(e,t,n){return Math.max(0,t-e,e-n)}(l=m||(m={})).Line="line",l.Handle="handle";let rj={width:0,height:0,x:0,y:0},r_={...rj,pointerX:0,pointerY:0,aspectRatio:1};var rS=e.i(30224);let rN=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:()=>{n.clear()}},a=t=e(r,o,i);return i},{useDebugValue:rC}=v.default,{useSyncExternalStoreWithSelector:r$}=rS.default,rO=e=>e;function rA(e,t=rO,n){let r=r$(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return rC(r),r}let rP=(e,t)=>{let n=e?rN(e):rN,r=(e,r=t)=>rA(n,e,r);return Object.assign(r,n),r};function rz(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 rL=e.i(74080);let rR=(0,v.createContext)(null),rI=rR.Provider,rD=((e="react")=>`Seems like you have not used ${"svelte"===e?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`)("react");function rB(e,t){let n=(0,v.useContext)(rR);if(null===n)throw Error(rD);return rA(n,e,t)}function rT(){let e=(0,v.useContext)(rR);if(null===e)throw Error(rD);return(0,v.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}let rF={display:"none"},rH={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},rV="react-flow__node-desc",rq="react-flow__edge-desc",rW=e=>e.ariaLiveMessage,rX=e=>e.ariaLabelConfig;function rY({rfId:e}){let t=rB(rW);return(0,y.jsx)("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:rH,children:t})}function rK({rfId:e,disableKeyboardA11y:t}){let n=rB(rX);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{id:`${rV}-${e}`,style:rF,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,y.jsx)("div",{id:`${rq}-${e}`,style:rF,children:n["edge.a11yDescription.default"]}),!t&&(0,y.jsx)(rY,{rfId:e})]})}let rU=(0,v.forwardRef)(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{let a=`${e}`.split("-");return(0,y.jsx)("div",{className:b(["react-flow__panel",n,...a]),style:r,ref:i,...o,children:t})});rU.displayName="Panel";let rZ="https://reactflow.dev?utm_source=attribution";function rG({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,y.jsx)(rU,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${rZ}`,children:(0,y.jsx)("a",{href:rZ,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}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 rz(e.selectedNodes.map(rJ),t.selectedNodes.map(rJ))&&rz(e.selectedEdges.map(rJ),t.selectedEdges.map(rJ))}function r1({onSelectionChange:e}){let t=rT(),{selectedNodes:n,selectedEdges:r}=rB(rQ,r0);return(0,v.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 r3({onSelectionChange:e}){let t=rB(r2);return e||t?(0,y.jsx)(r1,{onSelectionChange:e}):null}let r5=[0,0],r4={x:0,y:0,zoom:1},r6=["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"],r8=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:r5,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function r9(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:s}=rB(r8,rz),d=rT();(0,v.useEffect)(()=>(s(e.defaultNodes,e.defaultEdges),()=>{u.current=r7,l()}),[]);let u=(0,v.useRef)(r7);return(0,v.useEffect)(()=>{for(let l of r6){let s=e[l];if(s!==u.current[l]&&void 0!==e[l])if("nodes"===l)t(s);else if("edges"===l)n(s);else if("minZoom"===l)r(s);else if("maxZoom"===l)o(s);else if("translateExtent"===l)i(s);else if("nodeExtent"===l)a(s);else if("ariaLabelConfig"===l)d.setState({ariaLabelConfig:{...t9,...s||{}}});else"fitView"===l?d.setState({fitViewQueued:s}):"fitViewOptions"===l?d.setState({fitViewOptions:s}):d.setState({[l]:s})}u.current=e},r6.map(t=>e[t])),null}function oe(){return"u"<typeof window||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}let ot="u">typeof document?document:null;function on(e=null,t={target:ot,actInsideInputWithModifier:!0}){let[n,r]=(0,v.useState)(!1),o=(0,v.useRef)(!1),i=(0,v.useRef)(new Set([])),[a,l]=(0,v.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,v.useEffect)(()=>{let n=t?.target??ot,s=t?.actInsideInputWithModifier??!0;if(null!==e){let e=e=>{if(o.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!o.current||o.current&&!s)&&nH(e))return!1;let n=oo(e.code,l);if(i.current.add(e[n]),or(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)}},d=e=>{let t=oo(e.code,l);or(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(e[t]),"Meta"===e.key&&i.current.clear(),o.current=!1},u=()=>{i.current.clear(),r(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",d),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",d),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[e,r]),n}function or(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function oo(e,t){return t.includes(e)?"code":"key"}function oi(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 oa(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(oa(i.id,e)))}return r}function os({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 ou=n_("React Flow","https://reactflow.dev/"),oc=e=>!!e&&"object"==typeof e&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e);function oh(e){return(0,v.forwardRef)(e)}let of="u">typeof window?v.useLayoutEffect:v.useEffect;function op(e){let[t,n]=(0,v.useState)(BigInt(0)),[r]=(0,v.useState)(()=>{var e;let t;return e=()=>n(e=>e+BigInt(1)),t=[],{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}});return of(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}let og=(0,v.createContext)(null);function om({children:e}){let t=rT(),n=op((0,v.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:o,onNodesChange:i,nodeLookup:a,fitViewQueued:l,onNodesChangeMiddlewareMap:s}=t.getState(),d=n;for(let t of e)d="function"==typeof t?t(d):t;let u=os({items:d,lookup:a});for(let e of s.values())u=e(u);o&&r(d),u.length>0?i?.(u):l&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=op((0,v.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:o,onEdgesChange:i,edgeLookup:a}=t.getState(),l=n;for(let t of e)l="function"==typeof t?t(l):t;o?r(l):i&&i(os({items:l,lookup:a}))},[])),o=(0,v.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,y.jsx)(og.Provider,{value:o,children:e})}let ox=e=>!!e.panZoom;function oy(){let e,t=(e=rT(),(0,v.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return!!n&&n.scaleBy(1.2,t)},zoomOut:async t=>{let{panZoom:n}=e.getState();return!!n&&n.scaleBy(1/1.2,t)},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return!!r&&r.scaleTo(t,n)},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),!0)},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:l}=e.getState(),s=nO(t,r,o,i,a,n?.padding??.1);return!!l&&(await l.setViewport(s,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0)},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:o,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;let{x:l,y:s}=a.getBoundingClientRect(),d={x:t.x-l,y:t.y-s},u=n.snapGrid??o;return nN(d,r,n.snapToGrid??i,u)},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=rT(),r=function(){let e=(0,v.useContext)(og);if(!e)throw Error("useBatchContext must be used within a BatchProvider");return e}(),o=rB(ox),i=(0,v.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?nR(o.position,o.measured,o.parentId,t,r):o.position;return nv({...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}))},l=(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:l,triggerEdgeChanges:s,onDelete:d,onBeforeDelete:u}=n.getState(),{nodes:c,edges:h}=await nu({nodesToRemove:e,edgesToRemove:t,nodes:r,edges:o,onBeforeDelete:u}),f=h.length>0,p=c.length>0;if(f){let e=h.map(od);a?.(h),s(e)}if(p){let e=c.map(od);i?.(c),l(e)}return(p||f)&&d?.({nodes:c,edges:h}),{deletedNodes:c,deletedEdges:h}},getIntersectingNodes:(e,t=!0,r)=>{let o=nM(e),a=o?e:i(e),l=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 s=nv(l?r:i),d=nE(s,a);return t&&d>0||d>=s.width*s.height||d>=a.width*a.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=nM(e)?e:i(e);if(!r)return!1;let o=nE(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:l,updateEdgeData:(e,t,n={replace:!1})=>{l(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}:ny(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,v.useMemo)(()=>({...i,...t,viewportInitialized:o}),[o])}let ov=e=>e.selected,ob="u">typeof window?window:void 0,ow={position:"absolute",width:"100%",height:"100%",top:0,left:0},ok=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function oE({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=c.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:s,translateExtent:d,minZoom:u,maxZoom:h,zoomActivationKeyCode:f,preventScrolling:p=!0,children:g,noWheelClassName:m,noPanClassName:x,onViewportChange:b,isControlledViewport:w,paneClickDistance:k,selectionOnDrag:E}){let M,j=rT(),_=(0,v.useRef)(null),{userSelectionActive:S,lib:N,connectionInProgress:C}=rB(ok,rz),$=on(f),O=(0,v.useRef)();M=rT(),(0,v.useEffect)(()=>{let e=()=>{if(!_.current||!(_.current.checkVisibility?.()??!0))return!1;let e=nB(_.current);(0===e.height||0===e.width)&&M.getState().onError?.("004","The parent container needs a width and a height to render the graph."),M.setState({width:e.width||500,height:e.height||500})};if(_.current){e(),window.addEventListener("resize",e);let t=new ResizeObserver(()=>e());return t.observe(_.current),()=>{window.removeEventListener("resize",e),t&&_.current&&t.unobserve(_.current)}}},[]);let A=(0,v.useCallback)(e=>{b?.({x:e[0],y:e[1],zoom:e[2]}),w||j.setState({transform:e})},[b,w]);return(0,v.useEffect)(()=>{if(_.current){O.current=function({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:s}){let d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),h=[[0,0],[u.width,u.height]],f="u">typeof ResizeObserver?new ResizeObserver(e=>{let t=e[0];t&&(h=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null;f?.observe(e);let p=t4().extent(()=>h).scaleExtent([t,n]).translateExtent(r),g=eh(e).call(p);b({x:o.x,y:o.y,zoom:nc(o.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=g.on("wheel.zoom"),x=g.on("dblclick.zoom");async function y(e,t){return!!g&&new Promise(n=>{p?.interpolate(t?.interpolate==="linear"?t6:eN).transform(rv(g,t?.duration,t?.ease,()=>n(!0)),e)})}function v(){p.on("zoom",null)}async function b(e,t,n){let r=rg(e),o=p?.constrain()(r,t,n);return o&&await y(o),o}return p.wheelDelta(rb),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:o,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:f,preventScrolling:y,zoomOnPinch:b,zoomOnScroll:w,zoomOnDoubleClick:k,zoomActivationKeyPressed:E,lib:M,onTransformChange:j,connectionInProgress:_,paneClickDistance:S,selectionOnDrag:N}){r&&!d.isZoomingOrPanning&&v();let C=o&&!E&&!r;p.clickDistance(N?1/0:!nj(S)||S<0?0:S);let $=C?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:s,onPanZoomEnd:d}){return u=>{if(rm(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let h=n.property("__zoom").k||1;if(u.ctrlKey&&a){let e=ef(u),t=h*Math.pow(2,rb(u));r.scaleTo(n,t,e,u);return}let f=1===u.deltaMode?20:1,p=o===c.Vertical?0:u.deltaX*f,g=o===c.Horizontal?0:u.deltaY*f;!nA()&&u.shiftKey&&o!==c.Vertical&&(p=u.deltaY*f,g=0),r.translateBy(n,-(p/h)*i,-(g/h)*i,{internal:!0});let m=rp(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?s?.(u,m):(e.isPanScrolling=!0,l?.(u,m)),e.panScrollTimeout=setTimeout(()=>{d?.(u,m),e.isPanScrolling=!1},150)}}({zoomPanValues:d,noWheelClassName:e,d3Selection:g,d3Zoom:p,panOnScrollMode:h,panOnScrollSpeed:f,zoomOnPinch:b,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){let i="wheel"===r.type,a=!t&&i&&!r.ctrlKey,l=rm(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,o)}}({noWheelClassName:e,preventScrolling:y,d3ZoomHandler:m});g.on("wheel.zoom",$,{passive:!1});let O=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let o=rp(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:d,onDraggingChange:s,onPanZoomStart:a});p.on("start",O);let A=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{e.usedRightMouseButton=!!(n&&rx(t,e.mouseButton??0)),i.sourceEvent?.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!i.sourceEvent?.internal&&o?.(i.sourceEvent,rp(i.transform))}}({zoomPanValues:d,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:i,onTransformChange:j});p.on("zoom",A);let P=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&rx(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){let t=rp(a.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(a.sourceEvent,t)},150*!!n)}}}({zoomPanValues:d,panOnDrag:u,panOnScroll:o,onPaneContextMenu:n,onPanZoomEnd:l,onDraggingChange:s});p.on("end",P);let z=function({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:s,lib:d,connectionInProgress:u}){return c=>{let h=e||t,f=n&&c.ctrlKey,p="wheel"===c.type;if(1===c.button&&"mousedown"===c.type&&(rm(c,`${d}-flow__node`)||rm(c,`${d}-flow__edge`)))return!0;if(!r&&!h&&!o&&!i&&!n||a||u&&!p||rm(c,l)&&p||rm(c,s)&&(!p||o&&p&&!e)||!n&&c.ctrlKey&&p)return!1;if(!n&&"touchstart"===c.type&&c.touches?.length>1)return c.preventDefault(),!1;if(!h&&!o&&!f&&p||!r&&("mousedown"===c.type||"touchstart"===c.type)||Array.isArray(r)&&!r.includes(c.button)&&"mousedown"===c.type)return!1;let g=Array.isArray(r)&&r.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||p)&&g}}({zoomActivationKeyPressed:E,panOnDrag:u,zoomOnScroll:w,panOnScroll:o,zoomOnDoubleClick:k,zoomOnPinch:b,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:M,connectionInProgress:_});p.filter(z),k?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)},destroy:v,setViewport:async function e(e,t){let n=rg(e);return await y(n,t),n},setViewportConstrained:b,getViewport:function(){let e=g?tZ(g.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:async function e(e,t){return!!g&&new Promise(n=>{p?.interpolate(t?.interpolate==="linear"?t6:eN).scaleTo(rv(g,t?.duration,t?.ease,()=>n(!0)),e)})},scaleBy:async function e(e,t){return!!g&&new Promise(n=>{p?.interpolate(t?.interpolate==="linear"?t6:eN).scaleBy(rv(g,t?.duration,t?.ease,()=>n(!0)),e)})},setScaleExtent:function(e){p?.scaleExtent(e)},setTranslateExtent:function(e){p?.translateExtent(e)},syncViewport:function(e){if(g){let t=rg(e),n=g.property("__zoom");(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&p?.transform(g,t,null,{sync:!0})}},setClickDistance:function(e){let t=!nj(e)||e<0?0:e;p?.clickDistance(t)}}}({domNode:_.current,minZoom:u,maxZoom:h,translateExtent:d,viewport:s,onDraggingChange:e=>j.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=j.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=j.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=j.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return j.setState({panZoom:O.current,transform:[e,t,n],domNode:_.current.closest(".react-flow")}),()=>{O.current?.destroy()}}},[]),(0,v.useEffect)(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:$,preventScrolling:p,noPanClassName:x,userSelectionActive:S,noWheelClassName:m,lib:N,onTransformChange:A,connectionInProgress:C,selectionOnDrag:E,paneClickDistance:k})},[e,t,n,r,o,i,a,l,$,p,x,S,m,N,A,C,E,k]),(0,y.jsx)("div",{className:"react-flow__renderer",ref:_,style:ow,children:g})}let oM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function oj(){let{userSelectionActive:e,userSelectionRect:t}=rB(oM,rz);return e&&t?(0,y.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 o_=(e,t)=>n=>{n.target===t.current&&e?.(n)},oS=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function oN({isSelecting:e,selectionKeyPressed:t,selectionMode:n=h.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:s,onPaneClick:d,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:g,children:m}){let x=(0,v.useRef)(0),w=rT(),{userSelectionActive:k,elementsSelectable:E,dragging:M,panBy:j,autoPanSpeed:_}=rB(oS,rz),S=E&&(e||k),N=(0,v.useRef)(null),C=(0,v.useRef)(),$=(0,v.useRef)(new Set),O=(0,v.useRef)(new Set),A=(0,v.useRef)(!1),P=(0,v.useRef)(!1),z=(0,v.useRef)({x:0,y:0}),L=(0,v.useRef)(!1),R=e=>{if(P.current||A.current||w.getState().connection.inProgress){P.current=!1,A.current=!1;return}d?.(e),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})};function I(e,t){let{userSelectionRect:r}=w.getState();if(!r)return;let{transform:o,nodeLookup:i,edgeLookup:a,connectionLookup:l,triggerNodeChanges:s,triggerEdgeChanges:d,defaultEdgeOptions:u}=w.getState(),c={x:r.startX,y:r.startY},{x:f,y:p}=nC(c,o),g={startX:c.x,startY:c.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},m=$.current,x=O.current;$.current=new Set(nl(i,g,o,n===h.Partial,!0).map(e=>e.id)),O.current=new Set;let y=u?.selectable??!0;for(let e of $.current){let t=l.get(e);if(t)for(let{edgeId:e}of t.values()){let t=a.get(e);t&&(t.selectable??y)&&O.current.add(e)}}nI(m,$.current)||s(ol(i,$.current,!0)),nI(x,O.current)||d(ol(a,O.current)),w.setState({userSelectionRect:g,userSelectionActive:!0,nodesSelectionActive:!1})}let D=()=>{cancelAnimationFrame(x.current),x.current=0,L.current=!1};(0,v.useEffect)(()=>()=>D(),[]);let B=!0===r||Array.isArray(r)&&r.includes(0);return(0,y.jsxs)("div",{className:b(["react-flow__pane",{draggable:B,dragging:M,selection:e}]),onClick:S?void 0:o_(R,N),onContextMenu:o_(e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():u?.(e)},N),onWheel:o_(c?e=>c(e):void 0,N),onPointerEnter:S?void 0:f,onPointerMove:S?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:a}=w.getState();if(!C.current||!n)return;let{x:s,y:d}=nV(e.nativeEvent,C.current);z.current={x:s,y:d};let u=nC({x:n.startX,y:n.startY},r);if(!P.current){if(Math.hypot(s-u.x,d-u.y)<=(t?0:i))return;a(),l?.(e)}P.current=!0,L.current||(!function e(){if(!o||!C.current)return;let[t,n]=ng(z.current,C.current,_);j({x:t,y:n}).then(t=>{if(!P.current||!t){x.current=requestAnimationFrame(e);return}let{x:n,y:r}=z.current;I(n,r),x.current=requestAnimationFrame(e)})}(),L.current=!0),I(s,d)}:p,onPointerUp:e=>{if(!S){e.target===N.current&&w.getState().connection.inProgress&&(A.current=!0);return}0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!k&&e.target===N.current&&w.getState().userSelectionRect&&R?.(e),w.setState({userSelectionActive:!1,userSelectionRect:null}),P.current&&(s?.(e),w.setState({nodesSelectionActive:$.current.size>0})),D())},onPointerCancel:S?e=>{e.target?.releasePointerCapture?.(e.pointerId),D()}:void 0,onPointerDownCapture:S?n=>{let{domNode:r,transform:o}=w.getState();if(C.current=r?.getBoundingClientRect(),!C.current)return;let i=n.target===N.current;if(!i&&n.target.closest(".nokey")||!e||!(a&&i||t)||0!==n.button||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),P.current=!1;let{x:l,y:s}=nV(n.nativeEvent,C.current),d=nN({x:l,y:s},o);w.setState({userSelectionRect:{width:0,height:0,startX:d.x,startY:d.y,x:l,y:s}}),i||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:S?e=>{P.current&&(e.stopPropagation(),P.current=!1)}:void 0,onPointerLeave:g,ref:N,style:ow,children:[m,(0,y.jsx)(oj,{})]})}function oC({id:e,store:t,unselect:n=!1,nodeRef:r}){let o,{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:l,nodeLookup:s,onError:d}=t.getState(),u=s.get(e);u?(t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&l)&&(a({nodes:[u],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):d?.("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 o$({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:a}){let l=rT(),[s,d]=(0,v.useState)(!1),u=(0,v.useRef)();return(0,v.useEffect)(()=>{if(!t)return u.current=function({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},a=0,l=new Map,s=!1,d={x:0,y:0},u=null,c=!1,h=null,f=!1,p=!1,g=null;return{update:function({noDragClassName:m,handleSelector:x,domNode:y,isSelectable:v,nodeId:b,nodeClickDistance:w=0}){function k({x:e,y:n}){let{nodeLookup:o,nodeExtent:a,snapGrid:s,snapToGrid:d,nodeOrigin:u,onNodeDrag:c,onSelectionDrag:h,onError:f,updateNodePositions:m}=t();i={x:e,y:n};let x=!1,y=l.size>1,v=y&&a?nx(na(l)):null,w=y&&d?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=nS(i,t);return{x:a.x-i.x,y:a.y-i.y}}({dragItems:l,snapGrid:s,x:e,y:n}):null;for(let[t,r]of l){if(!o.has(t))continue;let i={x:e-r.distance.x,y:n-r.distance.y};d&&(i=w?{x:Math.round(i.x+w.x),y:Math.round(i.y+w.y)}:nS(i,s));let l=null;if(y&&a&&!r.extent&&v){let{positionAbsolute:e}=r.internals,t=e.x-v.x+a[0][0],n=e.x+r.measured.width-v.x2+a[1][0];l=[[t,e.y-v.y+a[0][1]],[n,e.y+r.measured.height-v.y2+a[1][1]]]}let{position:c,positionAbsolute:h}=nd({nodeId:t,nextPosition:i,nodeLookup:o,nodeExtent:l||a,nodeOrigin:u,onError:f});x=x||r.position.x!==c.x||r.position.y!==c.y,r.position=c,r.internals.positionAbsolute=h}if(p=p||x,x&&(m(l,!0),g&&(r||c||!b&&h))){let[e,t]=rs({nodeId:b,dragItems:l,nodeLookup:o});r?.(g,l,e,t),c?.(g,e,t),b||h?.(g,t)}}async function E(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:o}=t();if(!o){s=!1,cancelAnimationFrame(a);return}let[l,c]=ng(d,u,r);(0!==l||0!==c)&&(i.x=(i.x??0)-l/e[2],i.y=(i.y??0)-c/e[2],await n({x:l,y:c})&&k(i)),a=requestAnimationFrame(E)}function M(r){let{nodeLookup:o,multiSelectionActive:a,nodesDraggable:s,transform:d,snapGrid:h,snapToGrid:f,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:m,unselectNodesAndEdges:x}=t();c=!0,p&&v||a||!b||o.get(b)?.selected||x(),v&&p&&b&&e?.(b);let y=nD(r.sourceEvent,{transform:d,snapGrid:h,snapToGrid:f,containerBounds:u});if(i=y,(l=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,s,y,b)).size>0&&(n||g||!b&&m)){let[e,t]=rs({nodeId:b,dragItems:l,nodeLookup:o});n?.(r.sourceEvent,l,e,t),g?.(r.sourceEvent,e,t),b||m?.(r.sourceEvent,t)}}h=eh(y);let j=e_().clickDistance(w).on("start",e=>{let{domNode:n,nodeDragThreshold:r,transform:o,snapGrid:a,snapToGrid:l}=t();u=n?.getBoundingClientRect()||null,f=!1,p=!1,g=e.sourceEvent,0===r&&M(e),i=nD(e.sourceEvent,{transform:o,snapGrid:a,snapToGrid:l,containerBounds:u}),d=nV(e.sourceEvent,u)}).on("drag",e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:o,snapToGrid:a,nodeDragThreshold:h,nodeLookup:p}=t(),m=nD(e.sourceEvent,{transform:r,snapGrid:o,snapToGrid:a,containerBounds:u});if(g=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||b&&!p.has(b))&&(f=!0),!f){if(!s&&n&&c&&(s=!0,E()),!c){let t=nV(e.sourceEvent,u),n=t.x-d.x,r=t.y-d.y;Math.sqrt(n*n+r*r)>h&&M(e)}(i.x!==m.xSnapped||i.y!==m.ySnapped)&&l&&c&&(d=nV(e.sourceEvent,u),k(m))}}).on("end",e=>{if(!c||f){f&&l.size>0&&t().updateNodePositions(l,!1);return}if(s=!1,c=!1,cancelAnimationFrame(a),l.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:i,onSelectionDragStop:a}=t();if(p&&(r(l,!1),p=!1),o||i||!b&&a){let[t,r]=rs({nodeId:b,dragItems:l,nodeLookup:n,dragging:!1});o?.(e.sourceEvent,l,t,r),i?.(e.sourceEvent,t,r),b||a?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!m||!rl(t,`.${m}`,y))&&(!x||rl(t,x,y))});h.call(j)},destroy:function(){h?.on(".drag",null)}}}({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{oC({id:t,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,l,e]),(0,v.useEffect)(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:a})},[n,r,t,i,e,o,a]),s}function oO(){let e=rT();return(0,v.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:o,nodesDraggable:i,onError:a,updateNodePositions:l,nodeLookup:s,nodeOrigin:d}=e.getState(),u=new Map,c=e=>e.selected&&(e.draggable||i&&void 0===e.draggable),h=r?o[0]:5,f=r?o[1]:5,p=t.direction.x*h*t.factor,g=t.direction.y*f*t.factor;for(let[,e]of s){if(!c(e))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+g};r&&(t=nS(t,o));let{position:i,positionAbsolute:l}=nd({nodeId:e.id,nextPosition:t,nodeLookup:s,nodeExtent:n,nodeOrigin:d,onError:a});e.position=i,e.internals.positionAbsolute=l,u.set(e.id,e)}l(u)},[])}let oA=(0,v.createContext)(null),oP=oA.Provider;oA.Consumer;let oz=()=>(0,v.useContext)(oA),oL=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),oR=(0,v.createContext)(null);function oI({children:e}){let t=rB(oL,rz);return(0,y.jsx)(oR.Provider,{value:t,children:e})}let oD={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},oB=(0,v.memo)(oh(function({type:e="source",position:t=g.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:s,className:d,onMouseDown:c,onTouchStart:h,...f},p){let m=a||null,x="target"===e,w=rT(),k=oz(),{connectOnClick:E,noPanClassName:M,rfId:j}=function(){let e=(0,v.useContext)(oR);if(!e)throw Error("useHandleConfig must be used within a HandleConfigProvider");return e}(),{connectingFrom:_,connectingTo:S,clickConnecting:N,isPossibleEndHandle:C,connectionInProcess:$,clickConnectionInProcess:O,valid:A}=rB(t=>{let{connectionClickStartHandle:n,connectionMode:r,connection:o}=t,{fromHandle:i,toHandle:a,isValid:l}=o;if(!i&&!n)return oD;let s=a?.nodeId===k&&a?.id===m&&a?.type===e;return{connectingFrom:i?.nodeId===k&&i?.id===m&&i?.type===e,connectingTo:s,clickConnecting:n?.nodeId===k&&n?.id===m&&n?.type===e,isPossibleEndHandle:r===u.Strict?i?.type!==e:k!==i?.nodeId||m!==i?.id,connectionInProcess:!!i,clickConnectionInProcess:!!n,valid:s&&l}},rz);k||w.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");let P=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=w.getState(),o={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=w.getState();t(function(e,t,n={}){return((e,t,n={})=>{let r,o;if(!e.source||!e.target)return n.onError?.("006","Can't create edge. An edge needs a source and a target."),t;let i=n.getEdgeId||nZ;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))})(e,t,{...n,onError:n.onError??ou})}(o,e,{onError:n}))}n?.(o),l?.(o)},z=e=>{if(!k)return;let t="clientX"in e.nativeEvent;if(o&&(t&&0===e.button||!t)){let t=w.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:x,handleId:m,nodeId:k,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>w.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:P,isValidConnection:n||((...e)=>w.getState().isValidConnection?.(...e)??!0),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?c?.(e):h?.(e)};return(0,y.jsx)("div",{"data-handleid":m,"data-nodeid":k,"data-handlepos":t,"data-id":`${j}-${k}-${m}-${e}`,className:b(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",M,d,{source:!x,target:x,connectable:r,connectablestart:o,connectableend:i,clickconnecting:N,connectingfrom:_,connectingto:S,valid:A,connectionindicator:r&&(!$||C)&&($||O?i:o)}]),onMouseDown:z,onTouchStart:z,onClick:E?t=>{let{onClickConnectStart:r,onClickConnectEnd:i,connectionClickStartHandle:a,connectionMode:l,isValidConnection:s,lib:d,rfId:u,nodeLookup:c,connection:h}=w.getState();if(!k||!a&&!o)return;if(!a){r?.(t.nativeEvent,{nodeId:k,handleId:m,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:k,type:e,id:m}});return}let f=nT(t.target),p=n||s,{connection:g,isValid:x}=rh(t.nativeEvent,{handle:{nodeId:k,id:m,type:e},connectionMode:l,fromNodeId:a.nodeId,fromHandleId:a.id||null,fromType:a.type,isValidConnection:p,flowId:u,doc:f,lib:d,nodeLookup:c});x&&g&&P(g);let y=structuredClone(h);delete y.inProgress,y.toPosition=y.toHandle?y.toHandle.position:null,i?.(t,y),w.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:s})})),oT={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},oF={input:function({data:e,isConnectable:t,sourcePosition:n=g.Bottom}){return(0,y.jsxs)(y.Fragment,{children:[e?.label,(0,y.jsx)(oB,{type:"source",position:n,isConnectable:t})]})},default:function({data:e,isConnectable:t,targetPosition:n=g.Top,sourcePosition:r=g.Bottom}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(oB,{type:"target",position:n,isConnectable:t}),e?.label,(0,y.jsx)(oB,{type:"source",position:r,isConnectable:t})]})},output:function({data:e,isConnectable:t,targetPosition:n=g.Top}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(oB,{type:"target",position:n,isConnectable:t}),e?.label]})},group:function(){return null}},oH=e=>{let{width:t,height:n,x:r,y:o}=na(e.nodeLookup,{filter:e=>!!e.selected});return{width:nj(t)?t:null,height:nj(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 oV({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=rT(),{width:o,height:i,transformString:a,userSelectionActive:l}=rB(oH,rz),s=oO(),d=(0,v.useRef)(null);(0,v.useEffect)(()=>{n||d.current?.focus({preventScroll:!0})},[n]);let u=!l&&null!==o&&null!==i;if(o$({nodeRef:d,disabled:!u}),!u)return null;let c=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,y.jsx)("div",{className:b(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:(0,y.jsx)("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(oT,e.key)&&(e.preventDefault(),s({direction:oT[e.key],factor:e.shiftKey?4:1}))},style:{width:o,height:i}})})}let oq="u">typeof window?window:void 0,oW=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function oX({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:s,selectionKeyCode:d,selectionOnDrag:u,selectionMode:c,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:p,panActivationKeyCode:g,zoomActivationKeyCode:m,elementsSelectable:x,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:k,panOnScrollSpeed:E,panOnScrollMode:M,zoomOnDoubleClick:j,panOnDrag:_,autoPanOnSelection:S,defaultViewport:N,translateExtent:C,minZoom:$,maxZoom:O,preventScrolling:A,onSelectionContextMenu:P,noWheelClassName:z,noPanClassName:L,disableKeyboardA11y:R,onViewportChange:I,isControlledViewport:D}){let{nodesSelectionActive:B,userSelectionActive:T}=rB(oW,rz),F=on(d,{target:oq}),H=on(g,{target:oq}),V=H||_,q=H||k,W=u&&!0!==V,X=F||T||W;return!function({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=rT(),{deleteElements:r}=oy(),o=on(e,{actInsideInputWithModifier:!1}),i=on(t,{target:ob});(0,v.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,v.useEffect)(()=>{n.setState({multiSelectionActive:i})},[i])}({deleteKeyCode:s,multiSelectionKeyCode:p}),(0,y.jsx)(oE,{onPaneContextMenu:i,elementsSelectable:x,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:q,panOnScrollSpeed:E,panOnScrollMode:M,zoomOnDoubleClick:j,panOnDrag:!F&&V,defaultViewport:N,translateExtent:C,minZoom:$,maxZoom:O,zoomActivationKeyCode:m,preventScrolling:A,noWheelClassName:z,noPanClassName:L,onViewportChange:I,isControlledViewport:D,paneClickDistance:l,selectionOnDrag:W,children:(0,y.jsxs)(oN,{onSelectionStart:h,onSelectionEnd:f,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:V,autoPanOnSelection:S,isSelecting:!!X,selectionMode:c,selectionKeyPressed:F,paneClickDistance:l,selectionOnDrag:W,children:[e,B&&(0,y.jsx)(oV,{onSelectionContextMenu:P,noPanClassName:L,disableKeyboardA11y:R})]})})}oX.displayName="FlowRenderer";let oY=(0,v.memo)(oX),oK=e=>e.updateNodeInternals;var oU=(0,v.memo)(function({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:s,nodesConnectable:d,nodesFocusable:u,resizeObserver:c,noDragClassName:h,noPanClassName:f,disableKeyboardA11y:p,rfId:g,nodeTypes:m,nodeClickDistance:x,onError:w}){let k,{node:E,internals:M,isParent:j}=rB(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},rz),_=E.type||"default",S=m?.[_]||oF[_];void 0===S&&(w?.("003",(k=_,`Node type "${k}" not found. Using fallback type "default".`)),_="default",S=m?.default||oF.default);let N=!!(E.draggable||l&&void 0===E.draggable),C=!!(E.selectable||s&&void 0===E.selectable),$=!!(E.connectable||d&&void 0===E.connectable),O=!!(E.focusable||u&&void 0===E.focusable),A=rT(),P=nL(E),z=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let o=rT(),i=(0,v.useRef)(null),a=(0,v.useRef)(null),l=(0,v.useRef)(e.sourcePosition),s=(0,v.useRef)(e.targetPosition),d=(0,v.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,v.useEffect)(()=>{!i.current||e.hidden||u&&a.current===i.current||(a.current&&r?.unobserve(a.current),r?.observe(i.current),a.current=i.current)},[u,e.hidden]),(0,v.useEffect)(()=>()=>{a.current&&(r?.unobserve(a.current),a.current=null)},[]),(0,v.useEffect)(()=>{if(i.current){let n=d.current!==t,r=l.current!==e.sourcePosition,a=s.current!==e.targetPosition;(n||r||a)&&(d.current=t,l.current=e.sourcePosition,s.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:_,hasDimensions:P,resizeObserver:c}),L=o$({nodeRef:z,disabled:E.hidden||!N,noDragClassName:h,handleSelector:E.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:x}),R=oO();if(E.hidden)return null;let I=nz(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},B=C||N||t||n||r||o,T=n?e=>n(e,{...M.userNode}):void 0,F=r?e=>r(e,{...M.userNode}):void 0,H=o?e=>o(e,{...M.userNode}):void 0,V=i?e=>i(e,{...M.userNode}):void 0,q=a?e=>a(e,{...M.userNode}):void 0;return(0,y.jsx)("div",{className:b(["react-flow__node",`react-flow__node-${_}`,{[f]:N},E.className,{selected:E.selected,selectable:C,parent:j,draggable:N,dragging:L}]),ref:z,style:{zIndex:M.z,transform:`translate(${M.positionAbsolute.x}px,${M.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:P?"visible":"hidden",...E.style,...D},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:T,onMouseMove:F,onMouseLeave:H,onContextMenu:V,onClick:n=>{let{selectNodesOnDrag:r,nodeDragThreshold:o}=A.getState();C&&(!r||!N||o>0)&&oC({id:e,store:A,nodeRef:z}),t&&t(n,{...M.userNode})},onDoubleClick:q,onKeyDown:O?t=>{if(!nH(t.nativeEvent)&&!p){if(t7.includes(t.key)&&C)oC({id:e,store:A,unselect:"Escape"===t.key,nodeRef:z});else if(N&&E.selected&&Object.prototype.hasOwnProperty.call(oT,t.key)){t.preventDefault();let{ariaLabelConfig:e}=A.getState();A.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~M.positionAbsolute.x,y:~~M.positionAbsolute.y})}),R({direction:oT[t.key],factor:t.shiftKey?4:1})}}}:void 0,tabIndex:O?0:void 0,onFocus:O?()=>{if(p||!z.current?.matches(":focus-visible"))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:o,setCenter:i}=A.getState();!o||nl(new Map([[e,E]]),{x:0,y:0,width:n,height:r},t,!0).length>0||i(E.position.x+I.width/2,E.position.y+I.height/2,{zoom:t[2]})}:void 0,role:E.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${rV}-${g}`,"aria-label":E.ariaLabel,...E.domAttributes,children:(0,y.jsx)(oP,{value:e,children:(0,y.jsx)(S,{id:e,data:E.data,type:_,positionAbsoluteX:M.positionAbsolute.x,positionAbsoluteY:M.positionAbsolute.y,selected:E.selected??!1,selectable:C,draggable:N,deletable:E.deletable??!0,isConnectable:$,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:L,dragHandle:E.dragHandle,zIndex:M.z,parentId:E.parentId,...I})})})});let oZ=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function oG(e){var t;let{nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=rB(oZ,rz),a=(t=e.onlyRenderVisibleElements,rB((0,v.useCallback)(e=>t?nl(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]),rz)),l=function(){let e=rB(oK),[t]=(0,v.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,v.useEffect)(()=>()=>{t?.disconnect()},[t]),t}();return(0,y.jsx)("div",{className:"react-flow__nodes",style:ow,children:a.map(t=>(0,y.jsx)(oU,{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:e.nodesDraggable??!0,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},t))})}oG.displayName="NodeRenderer";let oQ=(0,v.memo)(oG),oJ={[p.Arrow]:({color:e="none",strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,y.jsx)("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[p.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,y.jsx)("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},o0=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{let s,d=(s=rT(),(0,v.useMemo)(()=>{let e;return Object.prototype.hasOwnProperty.call(oJ,t)?oJ[t]:(s.getState().onError?.("009",(e=t,`Marker type "${e}" doesn't exist.`)),null)},[t]));return d?(0,y.jsx)("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:(0,y.jsx)(d,{color:n,strokeWidth:a})}):null},o1=({defaultColor:e,rfId:t})=>{let n=rB(e=>e.edges),r=rB(e=>e.defaultEdgeOptions),o=(0,v.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,y.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,y.jsx)("defs",{children:o.map(e=>(0,y.jsx)(o0,{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};o1.displayName="MarkerDefinitions";var o2=(0,v.memo)(o1);function o3({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:s,className:d,...u}){let[c,h]=(0,v.useState)({x:1,y:0,width:0,height:0}),f=b(["react-flow__edge-textwrapper",d]),p=(0,v.useRef)(null);return((0,v.useEffect)(()=>{if(p.current){let e=p.current.getBBox();h({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n)?(0,y.jsxs)("g",{transform:`translate(${e-c.width/2} ${t-c.height/2})`,className:f,visibility:c.width?"visible":"hidden",...u,children:[o&&(0,y.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:l,ry:l}),(0,y.jsx)("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:p,style:r,children:n}),s]}):null}o3.displayName="EdgeText";let o5=(0,v.memo)(o3);function o4({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:s,interactionWidth:d=20,...u}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{...u,d:e,fill:"none",className:b(["react-flow__edge-path",u.className])}),d?(0,y.jsx)("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&nj(t)&&nj(n)?(0,y.jsx)(o5,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:s}):null]})}function o6({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===g.Left||e===g.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function o8({sourceX:e,sourceY:t,sourcePosition:n=g.Bottom,targetX:r,targetY:o,targetPosition:i=g.Top}){let[a,l]=o6({pos:n,x1:e,y1:t,x2:r,y2:o}),[s,d]=o6({pos:i,x1:r,y1:o,x2:e,y2:t}),[u,c,h,f]=nW({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:l,targetControlX:s,targetControlY:d});return[`M${e},${t} C${a},${l} ${s},${d} ${r},${o}`,u,c,h,f]}function o7(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a,targetPosition:l,label:s,labelStyle:d,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:m,interactionWidth:x})=>{let[v,b,w]=o8({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l}),k=e.isInternal?void 0:t;return(0,y.jsx)(o4,{id:k,path:v,labelX:b,labelY:w,label:s,labelStyle:d,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:m,interactionWidth:x})})}let o9=o7({isInternal:!1}),ie=o7({isInternal:!0});function it(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:s,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:c,style:h,sourcePosition:f=g.Bottom,targetPosition:p=g.Top,markerEnd:m,markerStart:x,pathOptions:v,interactionWidth:b})=>{let[w,k,E]=n0({sourceX:n,sourceY:r,sourcePosition:f,targetX:o,targetY:i,targetPosition:p,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),M=e.isInternal?void 0:t;return(0,y.jsx)(o4,{id:M,path:w,labelX:k,labelY:E,label:a,labelStyle:l,labelShowBg:s,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:c,style:h,markerEnd:m,markerStart:x,interactionWidth:b})})}o9.displayName="SimpleBezierEdge",ie.displayName="SimpleBezierEdgeInternal";let ir=it({isInternal:!1}),io=it({isInternal:!0});function ii(e){return(0,v.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,y.jsx)(ir,{...n,id:r,pathOptions:(0,v.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}ir.displayName="SmoothStepEdge",io.displayName="SmoothStepEdgeInternal";let ia=ii({isInternal:!1}),il=ii({isInternal:!0});function is(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:s,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:c,style:h,markerEnd:f,markerStart:p,interactionWidth:g})=>{let[m,x,v]=nG({sourceX:n,sourceY:r,targetX:o,targetY:i}),b=e.isInternal?void 0:t;return(0,y.jsx)(o4,{id:b,path:m,labelX:x,labelY:v,label:a,labelStyle:l,labelShowBg:s,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:c,style:h,markerEnd:f,markerStart:p,interactionWidth:g})})}ia.displayName="StepEdge",il.displayName="StepEdgeInternal";let id=is({isInternal:!1}),iu=is({isInternal:!0});function ic(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a=g.Bottom,targetPosition:l=g.Top,label:s,labelStyle:d,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:x,pathOptions:v,interactionWidth:b})=>{let[w,k,E]=nK({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l,curvature:v?.curvature}),M=e.isInternal?void 0:t;return(0,y.jsx)(o4,{id:M,path:w,labelX:k,labelY:E,label:s,labelStyle:d,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:x,interactionWidth:b})})}id.displayName="StraightEdge",iu.displayName="StraightEdgeInternal";let ih=ic({isInternal:!1}),ip=ic({isInternal:!0});ih.displayName="BezierEdge",ip.displayName="BezierEdgeInternal";let ig={default:ip,straight:iu,step:il,smoothstep:io,simplebezier:ie},im={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},ix="react-flow__edgeupdater";function iy({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:a,type:l}){return(0,y.jsx)("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:a,className:b([ix,`${ix}-${l}`]),cx:e===g.Left?t-r:e===g.Right?t+r:t,cy:e===g.Top?n-r:e===g.Bottom?n+r:n,r:r,stroke:"transparent",fill:"transparent"})}function iv({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:a,sourcePosition:l,targetPosition:s,onReconnect:d,onReconnectStart:u,onReconnectEnd:c,setReconnecting:h,setUpdateHover:f}){let p=rT(),g=(e,t)=>{if(0!==e.button)return;let{autoPanOnConnect:r,domNode:o,connectionMode:i,connectionRadius:a,lib:l,onConnectStart:s,cancelConnection:f,nodeLookup:g,rfId:m,panBy:x,updateConnection:y}=p.getState(),v="target"===t.type;rf(e.nativeEvent,{autoPanOnConnect:r,connectionMode:i,connectionRadius:a,domNode:o,handleId:t.id,nodeId:t.nodeId,nodeLookup:g,isTarget:v,edgeUpdaterType:t.type,lib:l,flowId:m,cancelConnection:f,panBy:x,isValidConnection:(...e)=>p.getState().isValidConnection?.(...e)??!0,onConnect:e=>d?.(n,e),onConnectStart:(r,o)=>{h(!0),u?.(e,n,t.type),s?.(r,o)},onConnectEnd:(...e)=>p.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{h(!1),c?.(e,n,t.type,r)},updateConnection:y,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},m=()=>f(!0),x=()=>f(!1);return(0,y.jsxs)(y.Fragment,{children:[(!0===e||"source"===e)&&(0,y.jsx)(iy,{position:l,centerX:r,centerY:o,radius:t,onMouseDown:e=>g(e,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),onMouseEnter:m,onMouseOut:x,type:"source"}),(!0===e||"target"===e)&&(0,y.jsx)(iy,{position:s,centerX:i,centerY:a,radius:t,onMouseDown:e=>g(e,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),onMouseEnter:m,onMouseOut:x,type:"target"})]})}var ib=(0,v.memo)(function({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:s,onMouseLeave:d,reconnectRadius:c,onReconnect:h,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:x,noPanClassName:w,onError:k,disableKeyboardA11y:E}){let M,j=rB(t=>t.edgeLookup.get(e)),_=rB(e=>e.defaultEdgeOptions),S=(j=_?{..._,...j}:j).type||"default",N=x?.[S]||ig[S];void 0===N&&(k?.("011",(M=S,`Edge type "${M}" not found. Using fallback type "default".`)),S="default",N=x?.default||ig.default);let C=!!(j.focusable||t&&void 0===j.focusable),$=void 0!==h&&(j.reconnectable||n&&void 0===j.reconnectable),O=!!(j.selectable||r&&void 0===j.selectable),A=(0,v.useRef)(null),[P,z]=(0,v.useState)(!1),[L,R]=(0,v.useState)(!1),I=rT(),{zIndex:D=j.zIndex,sourceX:B,sourceY:T,targetX:F,targetY:H,sourcePosition:V,targetPosition:q}=rB((0,v.useCallback)(t=>{let n=t.nodeLookup.get(j.source),r=t.nodeLookup.get(j.target);if(!n||!r)return im;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=n5(r?.source??[],e.sourceHandle),a=n5(e.connectionMode===u.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 l=i?.position||g.Bottom,s=a?.position||g.Top,d=n3(t,i,l),c=n3(n,a,s);return{sourceX:d.x,sourceY:d.y,targetX:c.x,targetY:c.y,sourcePosition:l,targetPosition:s}}({id:e,sourceNode:n,targetNode:r,sourceHandle:j.sourceHandle||null,targetHandle:j.targetHandle||null,connectionMode:t.connectionMode,onError:k}),i=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:j.selected,zIndex:j.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...o||im,zIndex:i}},[j.source,j.target,j.sourceHandle,j.targetHandle,j.selected,j.zIndex]),rz),W=(0,v.useMemo)(()=>j.markerStart?`url('#${n4(j.markerStart,m)}')`:void 0,[j.markerStart,m]),X=(0,v.useMemo)(()=>j.markerEnd?`url('#${n4(j.markerEnd,m)}')`:void 0,[j.markerEnd,m]);if(j.hidden||null===B||null===T||null===F||null===H)return null;let Y=i?e=>{i(e,{...j})}:void 0,K=a?e=>{a(e,{...j})}:void 0,U=l?e=>{l(e,{...j})}:void 0,Z=s?e=>{s(e,{...j})}:void 0,G=d?e=>{d(e,{...j})}:void 0;return(0,y.jsx)("svg",{style:{zIndex:D},children:(0,y.jsxs)("g",{className:b(["react-flow__edge",`react-flow__edge-${S}`,j.className,w,{selected:j.selected,animated:j.animated,inactive:!O&&!o,updating:P,selectable:O}]),onClick:t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:i}=I.getState();O&&(I.setState({nodesSelectionActive:!1}),j.selected&&i?(r({nodes:[],edges:[j]}),A.current?.blur()):n([e])),o&&o(t,j)},onDoubleClick:Y,onContextMenu:K,onMouseEnter:U,onMouseMove:Z,onMouseLeave:G,onKeyDown:C?t=>{if(!E&&t7.includes(t.key)&&O){let{unselectNodesAndEdges:n,addSelectedEdges:r}=I.getState();"Escape"===t.key?(A.current?.blur(),n({edges:[j]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:j.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===j.ariaLabel?void 0:j.ariaLabel||`Edge from ${j.source} to ${j.target}`,"aria-describedby":C?`${rq}-${m}`:void 0,ref:A,...j.domAttributes,children:[!L&&(0,y.jsx)(N,{id:e,source:j.source,target:j.target,type:j.type,selected:j.selected,animated:j.animated,selectable:O,deletable:j.deletable??!0,label:j.label,labelStyle:j.labelStyle,labelShowBg:j.labelShowBg,labelBgStyle:j.labelBgStyle,labelBgPadding:j.labelBgPadding,labelBgBorderRadius:j.labelBgBorderRadius,sourceX:B,sourceY:T,targetX:F,targetY:H,sourcePosition:V,targetPosition:q,data:j.data,style:j.style,sourceHandleId:j.sourceHandle,targetHandleId:j.targetHandle,markerStart:W,markerEnd:X,pathOptions:"pathOptions"in j?j.pathOptions:void 0,interactionWidth:j.interactionWidth}),$&&(0,y.jsx)(iv,{edge:j,isReconnectable:$,reconnectRadius:c,onReconnect:h,onReconnectStart:f,onReconnectEnd:p,sourceX:B,sourceY:T,targetX:F,targetY:H,sourcePosition:V,targetPosition:q,setUpdateHover:z,setReconnecting:R})]})})});let iw=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ik({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:s,onEdgeMouseLeave:d,onEdgeClick:u,reconnectRadius:c,onEdgeDoubleClick:h,onReconnectStart:f,onReconnectEnd:p,disableKeyboardA11y:g}){let{edgesFocusable:m,edgesReconnectable:x,elementsSelectable:b,onError:w}=rB(iw,rz),k=rB((0,v.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),nE({x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]},ny(i))>0}({sourceNode:r,targetNode:o,width:e.width,height:e.height,transform:e.transform})&&n.push(t.id)}return n},[t]),rz);return(0,y.jsxs)("div",{className:"react-flow__edges",children:[(0,y.jsx)(o2,{defaultColor:e,rfId:n}),k.map(e=>(0,y.jsx)(ib,{id:e,edgesFocusable:m,edgesReconnectable:x,elementsSelectable:b,noPanClassName:o,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:s,onMouseLeave:d,onClick:u,reconnectRadius:c,onDoubleClick:h,onReconnectStart:f,onReconnectEnd:p,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:g},e))]})}ik.displayName="EdgeRenderer";let iE=(0,v.memo)(ik),iM=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function ij({children:e}){let t=rT(),n=(0,v.useRef)(null),[r]=(0,v.useState)(()=>t.getState().transform);return of(()=>{let e=null,r=()=>{let r=t.getState().transform;(!e||r[0]!==e[0]||r[1]!==e[1]||r[2]!==e[2])&&(e=r,n.current&&(n.current.style.transform=iM(r)))};return r(),t.subscribe(r)},[t]),(0,y.jsx)("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:iM(r)},children:e})}let i_=e=>e.panZoom?.syncViewport;function iS(e){return e.connection.inProgress?{...e.connection,to:nN(e.connection.to,e.transform)}:{...e.connection}}let iN=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function iC({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:o,width:i,height:a,isValid:l,inProgress:s}=rB(iN,rz);return i&&o&&s?(0,y.jsx)("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:(0,y.jsx)("g",{className:b(["react-flow__connection",nn(l)]),children:(0,y.jsx)(i$,{style:t,type:n,CustomComponent:r,isValid:l})})}):null}let i$=({style:e,type:t=f.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:o,from:i,fromNode:a,fromHandle:l,fromPosition:s,to:d,toNode:u,toHandle:c,toPosition:h,pointer:p}=rB(iS,rz);if(!o)return;if(n)return(0,y.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:s,toPosition:h,connectionStatus:nn(r),toNode:u,toHandle:c,pointer:p});let g="",m={sourceX:i.x,sourceY:i.y,sourcePosition:s,targetX:d.x,targetY:d.y,targetPosition:h};switch(t){case f.Bezier:[g]=nK(m);break;case f.SimpleBezier:[g]=o8(m);break;case f.Step:[g]=n0({...m,borderRadius:0});break;case f.SmoothStep:[g]=n0(m);break;default:[g]=nG(m)}return(0,y.jsx)("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};i$.displayName="ConnectionLine";let iO={};function iA(e=iO){(0,v.useRef)(e),rT(),(0,v.useEffect)(()=>{},[e])}function iP({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:s,onNodeMouseLeave:d,onNodeContextMenu:u,onSelectionContextMenu:c,onSelectionStart:h,onSelectionEnd:f,connectionLineType:p,connectionLineStyle:g,connectionLineComponent:m,connectionLineContainerStyle:x,selectionKeyCode:b,selectionOnDrag:w,selectionMode:k,multiSelectionKeyCode:E,panActivationKeyCode:M,zoomActivationKeyCode:j,deleteKeyCode:_,onlyRenderVisibleElements:S,elementsSelectable:N,defaultViewport:C,translateExtent:$,minZoom:O,maxZoom:A,preventScrolling:P,defaultMarkerColor:z,zoomOnScroll:L,zoomOnPinch:R,panOnScroll:I,panOnScrollSpeed:D,panOnScrollMode:B,zoomOnDoubleClick:T,panOnDrag:F,autoPanOnSelection:H,onPaneClick:V,onPaneMouseEnter:q,onPaneMouseMove:W,onPaneMouseLeave:X,onPaneScroll:Y,onPaneContextMenu:K,paneClickDistance:U,nodeClickDistance:Z,onEdgeContextMenu:G,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:et,onReconnect:en,onReconnectStart:er,onReconnectEnd:eo,noDragClassName:ei,noWheelClassName:ea,noPanClassName:el,disableKeyboardA11y:es,nodeExtent:ed,rfId:eu,viewport:ec,onViewportChange:eh,nodesDraggable:ef}){let ep,eg,em,ex;return iA(e),iA(t),rT(),(0,v.useRef)(!1),(0,v.useEffect)(()=>{},[]),ep=oy(),eg=(0,v.useRef)(!1),(0,v.useEffect)(()=>{!eg.current&&ep.viewportInitialized&&n&&(setTimeout(()=>n(ep),1),eg.current=!0)},[n,ep.viewportInitialized]),em=rB(i_),ex=rT(),(0,v.useEffect)(()=>{ec&&(em?.(ec),ex.setState({transform:[ec.x,ec.y,ec.zoom]}))},[ec,em]),(0,y.jsx)(oY,{onPaneClick:V,onPaneMouseEnter:q,onPaneMouseMove:W,onPaneMouseLeave:X,onPaneContextMenu:K,onPaneScroll:Y,paneClickDistance:U,deleteKeyCode:_,selectionKeyCode:b,selectionOnDrag:w,selectionMode:k,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:E,panActivationKeyCode:M,zoomActivationKeyCode:j,elementsSelectable:N,zoomOnScroll:L,zoomOnPinch:R,zoomOnDoubleClick:T,panOnScroll:I,panOnScrollSpeed:D,panOnScrollMode:B,panOnDrag:F,autoPanOnSelection:H,defaultViewport:C,translateExtent:$,minZoom:O,maxZoom:A,onSelectionContextMenu:c,preventScrolling:P,noDragClassName:ei,noWheelClassName:ea,noPanClassName:el,disableKeyboardA11y:es,onViewportChange:eh,isControlledViewport:!!ec,children:(0,y.jsxs)(ij,{children:[(0,y.jsx)(iE,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:a,onReconnect:en,onReconnectStart:er,onReconnectEnd:eo,onlyRenderVisibleElements:S,onEdgeContextMenu:G,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:et,defaultMarkerColor:z,noPanClassName:el,disableKeyboardA11y:es,rfId:eu}),(0,y.jsx)(iC,{style:g,type:p,component:m,containerStyle:x}),(0,y.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,y.jsx)(oQ,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:s,onNodeMouseLeave:d,onNodeContextMenu:u,nodeClickDistance:Z,onlyRenderVisibleElements:S,noPanClassName:el,noDragClassName:ei,disableKeyboardA11y:es,nodeExtent:ed,rfId:eu,nodesDraggable:ef}),(0,y.jsx)("div",{className:"react-flow__viewport-portal"})]})})}iP.displayName="GraphView";let iz=(0,v.memo)(iP),iL=n_("React Flow","https://reactflow.dev/"),iR=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:s=.5,maxZoom:d=2,nodeOrigin:c,nodeExtent:h,zIndexMode:f="basic"}={})=>{let p=new Map,g=new Map,m=new Map,x=new Map,y=r??t??[],v=n??e??[],b=c??[0,0],w=h??t8;ra(m,x,y);let{nodesInitialized:k}=re(v,p,g,{nodeOrigin:b,nodeExtent:w,zIndexMode:f}),E=[0,0,1];if(a&&o&&i){let{x:e,y:t,zoom:n}=nO(na(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),o,i,s,d,l?.padding??.1);E=[e,t,n]}return{rfId:"1",width:o??0,height:i??0,transform:E,nodes:v,nodesInitialized:k,nodeLookup:p,parentLookup:g,edges:y,edgeLookup:x,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==r,panZoom:null,minZoom:s,maxZoom:d,translateExtent:t8,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:u.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:l,fitViewResolver:null,connection:{...ne},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:iL,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:t9,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}};function iI({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:s,fitView:d,nodeOrigin:u,nodeExtent:c,zIndexMode:h,children:f}){let[p]=(0,v.useState)(()=>(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:s,maxZoom:d,nodeOrigin:u,nodeExtent:c,zIndexMode:h})=>{let f,p;return f=(f,p)=>{async function m(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:o,height:i,minZoom:a,maxZoom:l}=p();t&&(await ns({nodes:e,width:o,height:i,panZoom:t,minZoom:a,maxZoom:l},n),r?.resolve(!0),f({fitViewResolver:null}))}return{...iR({nodes:e,edges:t,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:s,maxZoom:d,nodeOrigin:u,nodeExtent:c,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:o,fitViewQueued:i,zIndexMode:a,nodesSelectionActive:l}=p(),{nodesInitialized:s,hasSelectedNodes:d}=re(e,t,n,{nodeOrigin:r,nodeExtent:c,elevateNodesOnSelect:o,checkEquality:!0,zIndexMode:a}),u=l&&d;i&&s?(m(),f({nodes:e,nodesInitialized:s,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):f({nodes:e,nodesInitialized:s,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=p();ra(t,n,e),f({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=p();t(e),f({hasDefaultNodes:!0})}if(t){let{setEdges:e}=p();e(t),f({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:o,nodeOrigin:i,nodeExtent:a,debug:l,fitViewQueued:s,zIndexMode:d}=p(),{changes:u,updatedInternals:c}=function(e,t,n,r,o,i,a){let l=r?.querySelector(".xyflow__viewport"),s=!1;if(!l)return{changes:[],updatedInternals:s};let d=[],u=window.getComputedStyle(l),{m22:c}=new window.DOMMatrixReadOnly(u.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}}),s=!0;continue}let l=nB(r.nodeElement),u=e.measured.width!==l.width||e.measured.height!==l.height;if(l.width&&l.height&&(u||!e.internals.handleBounds||r.force)){let f=r.nodeElement.getBoundingClientRect(),p=nP(e.extent)?e.extent:i,{positionAbsolute:g}=e.internals;if(e.parentId&&"parent"===e.extent){let n=t.get(e.parentId);n&&(g=nf(g,l,n))}else p&&(g=nh(g,p,l));let m={...e,measured:l,internals:{...e.internals,positionAbsolute:g,handleBounds:{source:nq("source",r.nodeElement,f,c,e.id),target:nq("target",r.nodeElement,f,c,e.id)}}};t.set(e.id,m),e.parentId&&rt(m,t,n,{nodeOrigin:o,zIndexMode:a}),s=!0,u&&(d.push({id:e.id,type:"dimensions",dimensions:l}),e.expandParent&&e.parentId&&h.push({id:e.id,parentId:e.parentId,rect:nv(m,o)}))}}if(h.length>0){let e=rr(h,t,n,o);d.push(...e)}return{changes:d,updatedInternals:s}}(e,n,r,o,i,a,d);c&&(!function(e,t,n){let r=n7(n6,n);for(let n of e.values())if(n.parentId)rt(n,e,t,r);else{let e=nh(ni(n,r.nodeOrigin),nP(n.extent)?n.extent:r.nodeExtent,nz(n));n.internals.positionAbsolute=e}}(n,r,{nodeOrigin:i,nodeExtent:a,zIndexMode:d}),s?(m(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),u?.length>0&&(l&&console.log("React Flow: trigger node changes",u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:o,triggerNodeChanges:i,connection:a,updateConnection:l,onNodesChangeMiddlewareMap:s}=p();for(let[i,s]of e){let e=o.get(i),d=!!(e?.expandParent&&e?.parentId&&s?.position),u={id:i,type:"position",position:d?{x:Math.max(0,s.position.x),y:Math.max(0,s.position.y)}:s.position,dragging:t};if(e&&a.inProgress&&a.fromNode.id===e.id){let t=n3(e,a.fromHandle,g.Left,!0);l({...a,from:t})}d&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...s.internals.positionAbsolute,width:s.measured.width??0,height:s.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=p(),i=rr(n,o,e,t);r.push(...i)}for(let e of s.values())r=e(r);i(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:o,debug:i}=p();e?.length&&(o&&n(oi(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}=p();e?.length&&(o&&n(oi(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}=p();t?o(e.map(e=>oa(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}=p();t?i(e.map(e=>oa(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}=p(),l=[];for(let t of e||r){if(!t.selected)continue;let e=o.get(t.id);e&&(e.selected=!1),l.push(oa(t.id,!1))}let s=[];for(let e of t||n)e.selected&&s.push(oa(e.id,!1));i(l),a(s)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=p();t?.setScaleExtent([e,n]),f({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=p();t?.setScaleExtent([n,e]),f({maxZoom:e})},setTranslateExtent:e=>{p().panZoom?.setTranslateExtent(e),f({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:o}=p();if(!o)return;let i=t.reduce((e,t)=>t.selected?[...e,oa(t.id,!1)]:e,[]),a=e.reduce((e,t)=>t.selected?[...e,oa(t.id,!1)]:e,[]);n(i),r(a)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:o,elevateNodesOnSelect:i,nodeExtent:a,zIndexMode:l}=p();(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:l}),f({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:o,translateExtent:i}=p();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}=p();if(!a)return!1;let l=void 0!==n?.zoom?n.zoom:i;return await a.setViewport({x:r/2-e*l,y:o/2-t*l,zoom:l},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{f({connection:{...ne}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...iR()})}},p=Object.is,f?rP(f,p):rP})({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:d,minZoom:a,maxZoom:l,fitViewOptions:s,nodeOrigin:u,nodeExtent:c,zIndexMode:h}));return(0,y.jsx)(rI,{value:p,children:(0,y.jsx)(om,{children:(0,y.jsx)(oI,{children:f})})})}function iD({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:a,fitView:l,fitViewOptions:s,minZoom:d,maxZoom:u,nodeOrigin:c,nodeExtent:h,zIndexMode:f}){return(0,v.useContext)(rR)?(0,y.jsx)(y.Fragment,{children:e}):(0,y.jsx)(iI,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:s,initialMinZoom:d,initialMaxZoom:u,nodeOrigin:c,nodeExtent:h,zIndexMode:f,children:e})}let iB={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var iT=oh(function({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:s,onInit:d,onMove:u,onMoveStart:p,onMoveEnd:g,onConnect:m,onConnectStart:x,onConnectEnd:w,onClickConnectStart:k,onClickConnectEnd:E,onNodeMouseEnter:M,onNodeMouseMove:j,onNodeMouseLeave:_,onNodeContextMenu:S,onNodeDoubleClick:N,onNodeDragStart:C,onNodeDrag:$,onNodeDragStop:O,onNodesDelete:A,onEdgesDelete:P,onDelete:z,onSelectionChange:L,onSelectionDragStart:R,onSelectionDrag:I,onSelectionDragStop:D,onSelectionContextMenu:B,onSelectionStart:T,onSelectionEnd:F,onBeforeDelete:H,connectionMode:V,connectionLineType:q=f.Bezier,connectionLineStyle:W,connectionLineComponent:X,connectionLineContainerStyle:Y,deleteKeyCode:K="Backspace",selectionKeyCode:U="Shift",selectionOnDrag:Z=!1,selectionMode:G=h.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:J=nA()?"Meta":"Control",zoomActivationKeyCode:ee=nA()?"Meta":"Control",snapToGrid:et,snapGrid:en,onlyRenderVisibleElements:er=!1,selectNodesOnDrag:eo,nodesDraggable:ei,autoPanOnNodeFocus:ea,nodesConnectable:el,nodesFocusable:es,nodeOrigin:ed=r5,edgesFocusable:eu,edgesReconnectable:ec,elementsSelectable:eh=!0,defaultViewport:ef=r4,minZoom:ep=.5,maxZoom:eg=2,translateExtent:em=t8,preventScrolling:ex=!0,nodeExtent:ey,defaultMarkerColor:ev="#b1b1b7",zoomOnScroll:eb=!0,zoomOnPinch:ew=!0,panOnScroll:ek=!1,panOnScrollSpeed:eE=.5,panOnScrollMode:eM=c.Free,zoomOnDoubleClick:ej=!0,panOnDrag:e_=!0,onPaneClick:eS,onPaneMouseEnter:eN,onPaneMouseMove:eC,onPaneMouseLeave:e$,onPaneScroll:eO,onPaneContextMenu:eA,paneClickDistance:eP=1,nodeClickDistance:ez=0,children:eL,onReconnect:eR,onReconnectStart:eI,onReconnectEnd:eD,onEdgeContextMenu:eB,onEdgeDoubleClick:eT,onEdgeMouseEnter:eF,onEdgeMouseMove:eH,onEdgeMouseLeave:eV,reconnectRadius:eq=10,onNodesChange:eW,onEdgesChange:eX,noDragClassName:eY="nodrag",noWheelClassName:eK="nowheel",noPanClassName:eU="nopan",fitView:eZ,fitViewOptions:eG,connectOnClick:eQ,attributionPosition:eJ,proOptions:e0,defaultEdgeOptions:e1,elevateNodesOnSelect:e2=!0,elevateEdgesOnSelect:e3=!1,disableKeyboardA11y:e5=!1,autoPanOnConnect:e4,autoPanOnNodeDrag:e6,autoPanOnSelection:e8=!0,autoPanSpeed:e7,connectionRadius:e9,isValidConnection:te,onError:tt,style:tn,id:tr,nodeDragThreshold:to,connectionDragThreshold:ti,viewport:ta,onViewportChange:tl,width:ts,height:td,colorMode:tu="light",debug:tc,onScroll:th,ariaLabelConfig:tf,zIndexMode:tp="basic",...tg},tm){let tx=tr||"1",ty=function(e){let[t,n]=(0,v.useState)("system"===e?null:e);return(0,v.useEffect)(()=>{if("system"!==e)return void n(e);let t=oe(),r=()=>n(t?.matches?"dark":"light");return r(),t?.addEventListener("change",r),()=>{t?.removeEventListener("change",r)}},[e]),null!==t?t:oe()?.matches?"dark":"light"}(tu),tv=(0,v.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),th?.(e)},[th]);return(0,y.jsx)("div",{"data-testid":"rf__wrapper",...tg,onScroll:tv,style:{...tn,...iB},ref:tm,className:b(["react-flow",o,ty]),id:tr,role:"application",children:(0,y.jsxs)(iD,{nodes:e,edges:t,width:ts,height:td,fitView:eZ,fitViewOptions:eG,minZoom:ep,maxZoom:eg,nodeOrigin:ed,nodeExtent:ey,zIndexMode:tp,children:[(0,y.jsx)(r9,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:x,onConnectEnd:w,onClickConnectStart:k,onClickConnectEnd:E,nodesDraggable:ei,autoPanOnNodeFocus:ea,nodesConnectable:el,nodesFocusable:es,edgesFocusable:eu,edgesReconnectable:ec,elementsSelectable:eh,elevateNodesOnSelect:e2,elevateEdgesOnSelect:e3,minZoom:ep,maxZoom:eg,nodeExtent:ey,onNodesChange:eW,onEdgesChange:eX,snapToGrid:et,snapGrid:en,connectionMode:V,translateExtent:em,connectOnClick:eQ,defaultEdgeOptions:e1,fitView:eZ,fitViewOptions:eG,onNodesDelete:A,onEdgesDelete:P,onDelete:z,onNodeDragStart:C,onNodeDrag:$,onNodeDragStop:O,onSelectionDrag:I,onSelectionDragStart:R,onSelectionDragStop:D,onMove:u,onMoveStart:p,onMoveEnd:g,noPanClassName:eU,nodeOrigin:ed,rfId:tx,autoPanOnConnect:e4,autoPanOnNodeDrag:e6,autoPanSpeed:e7,onError:tt,connectionRadius:e9,isValidConnection:te,selectNodesOnDrag:eo,nodeDragThreshold:to,connectionDragThreshold:ti,onBeforeDelete:H,debug:tc,ariaLabelConfig:tf,zIndexMode:tp}),(0,y.jsx)(iz,{onInit:d,onNodeClick:l,onEdgeClick:s,onNodeMouseEnter:M,onNodeMouseMove:j,onNodeMouseLeave:_,onNodeContextMenu:S,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:a,connectionLineType:q,connectionLineStyle:W,connectionLineComponent:X,connectionLineContainerStyle:Y,selectionKeyCode:U,selectionOnDrag:Z,selectionMode:G,deleteKeyCode:K,multiSelectionKeyCode:J,panActivationKeyCode:Q,zoomActivationKeyCode:ee,onlyRenderVisibleElements:er,defaultViewport:ef,translateExtent:em,minZoom:ep,maxZoom:eg,preventScrolling:ex,zoomOnScroll:eb,zoomOnPinch:ew,zoomOnDoubleClick:ej,panOnScroll:ek,panOnScrollSpeed:eE,panOnScrollMode:eM,panOnDrag:e_,autoPanOnSelection:e8,onPaneClick:eS,onPaneMouseEnter:eN,onPaneMouseMove:eC,onPaneMouseLeave:e$,onPaneScroll:eO,onPaneContextMenu:eA,paneClickDistance:eP,nodeClickDistance:ez,onSelectionContextMenu:B,onSelectionStart:T,onSelectionEnd:F,onReconnect:eR,onReconnectStart:eI,onReconnectEnd:eD,onEdgeContextMenu:eB,onEdgeDoubleClick:eT,onEdgeMouseEnter:eF,onEdgeMouseMove:eH,onEdgeMouseLeave:eV,reconnectRadius:eq,defaultMarkerColor:ev,noDragClassName:eY,noWheelClassName:eK,noPanClassName:eU,rfId:tx,disableKeyboardA11y:e5,nodeExtent:ey,viewport:ta,onViewportChange:tl,nodesDraggable:ei}),(0,y.jsx)(r3,{onSelectionChange:L}),eL,(0,y.jsx)(rG,{proOptions:e0,position:eJ}),(0,y.jsx)(rK,{rfId:tx,disableKeyboardA11y:e5})]})})});let iF=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function iH({children:e}){let t=rB(iF);return t?(0,rL.createPortal)(e,t):null}let iV=e=>e.domNode?.querySelector(".react-flow__viewport-portal");function iq({children:e}){let t=rB(iV);return t?(0,rL.createPortal)(e,t):null}function iW({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,y.jsx)("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:b(["react-flow__background-pattern",n,r])})}function iX({radius:e,className:t}){return(0,y.jsx)("circle",{cx:e,cy:e,r:e,className:b(["react-flow__background-pattern","dots",t])})}(s=x||(x={})).Lines="lines",s.Dots="dots",s.Cross="cross";let iY={[x.Dots]:1,[x.Lines]:1,[x.Cross]:6},iK=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function iU({id:e,variant:t=x.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:a,bgColor:l,style:s,className:d,patternClassName:u}){let c=(0,v.useRef)(null),{transform:h,patternId:f}=rB(iK,rz),p=r||iY[t],g=t===x.Dots,m=t===x.Cross,w=Array.isArray(n)?n:[n,n],k=[w[0]*h[2]||1,w[1]*h[2]||1],E=p*h[2],M=Array.isArray(i)?i:[i,i],j=m?[E,E]:k,_=[M[0]*h[2]||1+j[0]/2,M[1]*h[2]||1+j[1]/2],S=`${f}${e||""}`;return(0,y.jsxs)("svg",{className:b(["react-flow__background",d]),style:{...s,...ow,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:c,"data-testid":"rf__background",children:[(0,y.jsx)("pattern",{id:S,x:h[0]%k[0],y:h[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:g?(0,y.jsx)(iX,{radius:E/2,className:u}):(0,y.jsx)(iW,{dimensions:j,lineWidth:o,variant:t,className:u})}),(0,y.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${S})`})]})}function iZ(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:(0,y.jsx)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function iG(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:(0,y.jsx)("path",{d:"M0 0h32v4.2H0z"})})}function iQ(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:(0,y.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 iJ(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,y.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 i0(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,y.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 i1({children:e,className:t,...n}){return(0,y.jsx)("button",{type:"button",className:b(["react-flow__controls-button",t]),...n,children:e})}iU.displayName="Background",(0,v.memo)(iU);let i2=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function i3({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:s,className:d,children:u,position:c="bottom-left",orientation:h="vertical","aria-label":f}){let p=rT(),{isInteractive:g,minZoomReached:m,maxZoomReached:x,ariaLabelConfig:v}=rB(i2,rz),{zoomIn:w,zoomOut:k,fitView:E}=oy();return(0,y.jsxs)(rU,{className:b(["react-flow__controls","horizontal"===h?"horizontal":"vertical",d]),position:c,style:e,"data-testid":"rf__controls","aria-label":f??v["controls.ariaLabel"],children:[t&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(i1,{onClick:()=>{w(),i?.()},className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:x,children:(0,y.jsx)(iZ,{})}),(0,y.jsx)(i1,{onClick:()=>{k(),a?.()},className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:m,children:(0,y.jsx)(iG,{})})]}),n&&(0,y.jsx)(i1,{className:"react-flow__controls-fitview",onClick:()=>{E(o),l?.()},title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:(0,y.jsx)(iQ,{})}),r&&(0,y.jsx)(i1,{className:"react-flow__controls-interactive",onClick:()=>{p.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),s?.(!g)},title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:g?(0,y.jsx)(i0,{}):(0,y.jsx)(iJ,{})}),u]})}i3.displayName="Controls",(0,v.memo)(i3);let i5=(0,v.memo)(function({id:e,x:t,y:n,width:r,height:o,style:i,color:a,strokeColor:l,strokeWidth:s,className:d,borderRadius:u,shapeRendering:c,selected:h,onClick:f}){let{background:p,backgroundColor:g}=i||{};return(0,y.jsx)("rect",{className:b(["react-flow__minimap-node",{selected:h},d]),x:t,y:n,rx:u,ry:u,width:r,height:o,style:{fill:a||p||g,stroke:l,strokeWidth:s},shapeRendering:c,onClick:f?t=>f(t,e):void 0})}),i4=e=>e.nodes.map(e=>e.id),i6=e=>e instanceof Function?e:()=>e,i8=(0,v.memo)(function({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:s}){let{node:d,x:u,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:l}=nz(r);return{node:r,x:o,y:i,width:a,height:l}},rz);return d&&!d.hidden&&nL(d)?(0,y.jsx)(l,{x:u,y:c,width:h,height:f,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:o,strokeColor:n(d),strokeWidth:i,shapeRendering:a,onClick:s,id:d.id}):null});var i7=(0,v.memo)(function({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=i5,onClick:a}){let l=rB(i4,rz),s=i6(t),d=i6(e),u=i6(n),c="u"<typeof window||window.chrome?"crispEdges":"geometricPrecision";return(0,y.jsx)(y.Fragment,{children:l.map(e=>(0,y.jsx)(i8,{id:e,nodeColorFunc:s,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:a,shapeRendering:c},e))})});let i9=e=>!e.hidden,ae=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:i9}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},at=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,an=(e,t)=>at(e.viewBB,t.viewBB)&&at(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig;function ar({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:s,maskColor:d,maskStrokeColor:u,maskStrokeWidth:c,position:h="bottom-right",onClick:f,onNodeClick:p,pannable:g=!1,zoomable:m=!1,ariaLabel:x,inversePan:w,zoomStep:k=1,offsetScale:E=5}){let M=rT(),j=(0,v.useRef)(null),{boundingRect:_,viewBB:S,rfId:N,panZoom:C,translateExtent:$,flowWidth:O,flowHeight:A,ariaLabelConfig:P}=rB(ae,an),z=e?.width??200,L=e?.height??150,R=Math.max(_.width/z,_.height/L),I=R*z,D=R*L,B=E*R,T=_.x-(I-_.width)/2-B,F=_.y-(D-_.height)/2-B,H=I+2*B,V=D+2*B,q=`react-flow__minimap-desc-${N}`,W=(0,v.useRef)(0),X=(0,v.useRef)();W.current=R,(0,v.useEffect)(()=>{if(j.current&&C)return X.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let o=eh(e);return{update:function({translateExtent:e,width:i,height:a,zoomStep:l=1,pannable:s=!0,zoomable:d=!0,inversePan:u=!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",s?o=>{let l=n();if("mousemove"!==o.sourceEvent.type&&"touchmove"!==o.sourceEvent.type||!t)return;let s=[o.sourceEvent.clientX??o.sourceEvent.touches[0].clientX,o.sourceEvent.clientY??o.sourceEvent.touches[0].clientY],d=[s[0]-c[0],s[1]-c[1]];c=s;let h=r()*Math.max(l[2],Math.log(l[2]))*(u?-1:1),f={x:l[0]-d[0]*h,y:l[1]-d[1]*h};t.setViewportConstrained({x:f.x,y:f.y,zoom:l[2]},[[0,0],[i,a]],e)}:null).on("zoom.wheel",d?e=>{if("wheel"!==e.sourceEvent.type||!t)return;let r=n(),o=e.sourceEvent.ctrlKey&&nA()?10:1,i=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*l,a=r[2]*Math.pow(2,i*o);t.scaleTo(a)}:null);o.call(h,{})},destroy:function(){o.on("zoom",null)},pointer:ef}}({domNode:j.current,panZoom:C,getTransform:()=>M.getState().transform,getViewScale:()=>W.current}),()=>{X.current?.destroy()}},[C]),(0,v.useEffect)(()=>{X.current?.update({translateExtent:$,width:O,height:A,inversePan:w,pannable:g,zoomStep:k,zoomable:m})},[g,m,w,k,$,O,A]);let Y=f?e=>{let[t,n]=X.current?.pointer(e)||[0,0];f(e,{x:t,y:n})}:void 0,K=p?(0,v.useCallback)((e,t)=>{p(e,M.getState().nodeLookup.get(t).internals.userNode)},[]):void 0,U=x??P["minimap.ariaLabel"];return(0,y.jsx)(rU,{position:h,style:{...e,"--xy-minimap-background-color-props":"string"==typeof s?s:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof u?u: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:b(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:(0,y.jsxs)("svg",{width:z,height:L,viewBox:`${T} ${F} ${H} ${V}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":q,ref:j,onClick:Y,children:[U&&(0,y.jsx)("title",{id:q,children:U}),(0,y.jsx)(i7,{onClick:K,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:a,nodeComponent:l}),(0,y.jsx)("path",{className:"react-flow__minimap-mask",d:`M${T-B},${F-B}h${H+2*B}v${V+2*B}h${-H-2*B}z
|
|
2
|
+
M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ar.displayName="MiniMap",(0,v.memo)(ar);let ao={[m.Line]:"right",[m.Handle]:"bottom-right"};(0,v.memo)(function({nodeId:e,position:t,variant:n=m.Handle,className:r,style:o,children:i,color:a,minWidth:l=10,minHeight:s=10,maxWidth:d=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:h,autoScale:f=!0,shouldResize:p,onResizeStart:g,onResize:x,onResizeEnd:w}){let k,E=oz(),M="string"==typeof e?e:E,j=rT(),_=(0,v.useRef)(null),S=n===m.Handle,N=rB((0,v.useCallback)((k=S&&f,e=>k?`${Math.max(1/e.transform[2],1)}`:void 0),[S,f]),rz),C=(0,v.useRef)(null),$=t??ao[n];(0,v.useEffect)(()=>{if(_.current&&M)return C.current||(C.current=function({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){let i=eh(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:l,keepAspectRatio:s,resizeDirection:d,onResizeStart:u,onResize:c,onResizeEnd:h,shouldResize:f}){let p,g,m,x,y={...rj},v={...r_};a={boundaries:l,resizeDirection:d,keepAspectRatio:s,controlDirection:rw(e)};let b=null,w=[],k=!1,E=e_().on("start",e=>{let{nodeLookup:r,transform:o,snapGrid:i,snapToGrid:a,nodeOrigin:l,paneDomNode:s}=n();if(!(p=r.get(t)))return;b=s?.getBoundingClientRect()??null;let{xSnapped:d,ySnapped:c}=nD(e.sourceEvent,{transform:o,snapGrid:i,snapToGrid:a,containerBounds:b});for(let[e,n]of(v={...y={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},pointerX:d,pointerY:c,aspectRatio:y.width/y.height},g=void 0,m=nP(p.extent)?p.extent:void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(g=r.get(p.parentId)),g&&"parent"===p.extent&&(m=[[0,0],[g.measured.width,g.measured.height]]),w=[],x=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,l=n[0]*i,s=n[1]*a;return[[r-l,o-s],[r+i-l,o+a-s]]}(n,p,n.origin??l);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...y})}).on("drag",e=>{let{transform:t,snapGrid:o,snapToGrid:i,nodeOrigin:l}=n(),s=nD(e.sourceEvent,{transform:t,snapGrid:o,snapToGrid:i,containerBounds:b}),d=[];if(!p)return;let{x:u,y:h,width:E,height:M}=y,j={},_=p.origin??l,{width:S,height:N,x:C,y:$}=function(e,t,n,r,o,i,a,l){var s,d,u,c;let{affectsX:h,affectsY:f}=t,{isHorizontal:p,isVertical:g}=t,m=p&&g,{xSnapped:x,ySnapped:y}=n,{minWidth:v,maxWidth:b,minHeight:w,maxHeight:k}=r,{x:E,y:M,width:j,height:_,aspectRatio:S}=e,N=Math.floor(p?x-e.pointerX:0),C=Math.floor(g?y-e.pointerY:0),$=j+(h?-N:N),O=_+(f?-C:C),A=-i[0]*j,P=-i[1]*_,z=rM($,v,b),L=rM(O,w,k);if(a){let e=0,t=0;h&&N<0?e=rk(E+N+A,a[0][0]):!h&&N>0&&(e=rE(E+$+A,a[1][0])),f&&C<0?t=rk(M+C+P,a[0][1]):!f&&C>0&&(t=rE(M+O+P,a[1][1])),z=Math.max(z,e),L=Math.max(L,t)}if(l){let e=0,t=0;h&&N>0?e=rE(E+N,l[0][0]):!h&&N<0&&(e=rk(E+$,l[1][0])),f&&C>0?t=rE(M+C,l[0][1]):!f&&C<0&&(t=rk(M+O,l[1][1])),z=Math.max(z,e),L=Math.max(L,t)}if(o){if(p){(z=Math.max(z,rM($/S,w,k)*S),a)&&(z=Math.max(z,(h||f)&&(!h||f||!m)?rk(M+P+(h?N:-N)/S,a[0][1])*S:rE(M+P+$/S,a[1][1])*S));l&&(z=Math.max(z,(h||f)&&(!h||f||!m)?rE(M+(h?N:-N)/S,l[0][1])*S:rk(M+$/S,l[1][1])*S))}if(g){(L=Math.max(L,rM(O*S,v,b)/S),a)&&(L=Math.max(L,(h||f)&&(!f||h||!m)?rk(E+(f?C:-C)*S+A,a[0][0])/S:rE(E+O*S+A,a[1][0])/S));l&&(L=Math.max(L,(h||f)&&(!f||h||!m)?rE(E+(f?C:-C)*S,l[0][0])/S:rk(E+O*S,l[1][0])/S))}}C+=C<0?L:-L,N+=N<0?z:-z,o&&(m?$>O*S?C=((s=h,d=f,s?!d:d)?-N:N)/S:N=((u=h,c=f,u?!c:c)?-C:C)*S:p?(C=N/S,f=h):(N=C*S,h=f));let R=h?E+N:E,I=f?M+C:M;return{width:j+(h?-N:N),height:_+(f?-C:C),x:i[0]*N*(h?-1:1)+R,y:i[1]*C*(f?-1:1)+I}}(v,a.controlDirection,s,a.boundaries,a.keepAspectRatio,_,m,x),O=S!==E,A=N!==M,P=C!==u&&O,z=$!==h&&A;if(!P&&!z&&!O&&!A)return;if((P||z||1===_[0]||1===_[1])&&(j.x=P?C:y.x,j.y=z?$:y.y,y.x=j.x,y.y=j.y,w.length>0)){let e=C-u,t=$-h;for(let n of w)n.position={x:n.position.x-e+_[0]*(S-E),y:n.position.y-t+_[1]*(N-M)},d.push(n)}if((O||A)&&(j.width=O&&(!a.resizeDirection||"horizontal"===a.resizeDirection)?S:y.width,j.height=A&&(!a.resizeDirection||"vertical"===a.resizeDirection)?N:y.height,y.width=j.width,y.height=j.height),g&&p.expandParent){let e=_[0]*(j.width??0);j.x&&j.x<e&&(y.x=e,v.x=v.x-(j.x-e));let t=_[1]*(j.height??0);j.y&&j.y<t&&(y.y=t,v.y=v.y-(j.y-t))}let L=function({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){let a=e-t,l=n-r,s=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&o&&(s[0]=-1*s[0]),l&&i&&(s[1]=-1*s[1]),s}({width:y.width,prevWidth:E,height:y.height,prevHeight:M,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),R={...y,direction:L};!1!==f?.(e,R)&&(k=!0,c?.(e,R),r(j,d))}).on("end",e=>{k&&(h?.(e,{...y}),o?.({...y}),k=!1)});i.call(E)},destroy:function(){i.on(".drag",null)}}}({domNode:_.current,nodeId:M,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:o,domNode:i}=j.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}=j.getState(),a=[],l={x:e.x,y:e.y},s=r.get(M);if(s&&s.expandParent&&s.parentId){let t=s.origin??i,n=e.width??s.measured.width??0,d=e.height??s.measured.height??0,u=rr([{id:s.id,parentId:s.parentId,rect:{width:n,height:d,...nR({x:e.x??s.position.x,y:e.y??s.position.y},{width:n,height:d},s.parentId,r,t)}}],r,o,i);a.push(...u),l.x=e.x?Math.max(t[0]*n,e.x):void 0,l.y=e.y?Math.max(t[1]*d,e.y):void 0}if(void 0!==l.x&&void 0!==l.y){let e={id:M,type:"position",position:{...l}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){let t={id:M,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})=>{j.getState().triggerNodeChanges([{id:M,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}}])}})),C.current.update({controlPosition:$,boundaries:{minWidth:l,minHeight:s,maxWidth:d,maxHeight:u},keepAspectRatio:c,resizeDirection:h,onResizeStart:g,onResize:x,onResizeEnd:w,shouldResize:p}),()=>{C.current?.destroy()}},[$,l,s,d,u,c,g,x,w,p]);let O=$.split("-");return(0,y.jsx)("div",{className:b(["react-flow__resize-control","nodrag",...O,n,r]),ref:_,style:{...o,scale:N,...a&&{[S?"backgroundColor":"borderColor"]:a}},children:i})});class ai extends Error{status;code;constructor(e,t,n){super(n),this.status=e,this.code=t,this.name="ApiError"}}async function aa(e){let t=await e.json().catch(()=>null);return new ai(e.status,t?.error.code??"INTERNAL",t?.error.message??`HTTP ${e.status}`)}async function al(e,t){try{return await fetch(e,t)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw e;throw new ai(0,"NETWORK","The Nebulosity server didn't answer. Is nebulosity map (or npm run dev) still running?")}}async function as(e,t){let n=await al(e,t);if(!n.ok)throw await aa(n);return await n.json()}async function ad(e,t){let n=e.getReader(),r=new TextDecoder,o="";for(;;){let{value:e,done:i}=await n.read();if(i)return;let a=function(e){let t=e.replace(/\r\n/g,"\n").split("\n\n"),n=t.pop()??"",r=[];for(let e of t){let t="message",n=[];for(let r of e.split("\n"))!r.startsWith(":")&&(r.startsWith("event:")?t=r.slice(6).trim():r.startsWith("data:")&&n.push(r.slice(5).replace(/^ /,"")));n.length>0&&r.push({event:t,data:n.join("\n")})}return{frames:r,rest:n}}(o+=r.decode(e,{stream:!0}));for(let e of(o=a.rest,a.frames))t(e)}}let au={level:(e,t=0,n,r)=>as(((e,t=0,n)=>`/api/level?path=${encodeURIComponent(e)}${t>0?`&page=${t}`:""}${void 0!==n?`&focus=${encodeURIComponent(n)}`:""}`)(e,t,r),{signal:n}),describe:(e,t)=>as(`/api/describe?path=${encodeURIComponent(e)}`,{signal:t}),search:(e,t,n)=>as(`/api/search?q=${encodeURIComponent(e)}&limit=${t}`,{signal:n}),status:e=>as("/api/status",{signal:e}),source:(e,t)=>as(`/api/source?path=${encodeURIComponent(e)}`,{signal:t}),summarize:e=>as(`/api/summarize?path=${encodeURIComponent(e)}`,{method:"POST"}),repos:()=>as("/api/repos"),setActiveRepo:e=>as("/api/repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:e})}),async reindex(e){let t=await al("/api/index",{method:"POST"});if(!t.ok||!t.body)throw await aa(t);let n={done:null,error:null};if(await ad(t.body,t=>{"progress"===t.event?e(JSON.parse(t.data)):"done"===t.event?n.done=JSON.parse(t.data):"error"===t.event&&(n.error=JSON.parse(t.data))}),n.error)throw new ai(500,n.error.code,n.error.message);if(!n.done)throw new ai(500,"INTERNAL","The re-index ended without a result.");return n.done}},ac=(e,t)=>e.left<t.left+t.width&&t.left<e.left+e.width&&e.top<t.top+t.height&&t.top<e.top+e.height;function ah(e,t,n){return{left:Math.max(8,Math.min(e.left,n.width-8-t.width)),top:Math.max(8,Math.min(e.top,n.height-8-t.height))}}var af=e.i(11676);function ap(e,t,n){let r,o,i=e.closest("header")?.parentElement??document.documentElement,a=i.getBoundingClientRect(),l=i.querySelector(":scope > footer")?.getBoundingClientRect().top??a.bottom,s=e.getBoundingClientRect(),d=(r=Math.min(t,a.right-a.left-32),{shift:Math.min(Math.max(o="start"===n?s.left:s.right-r,a.left+16),a.right-16-r)-o,width:r}),u=l-s.top-36-8;return"start"===n?{left:d.shift,width:d.width,maxHeight:u}:{right:-d.shift,width:d.width,maxHeight:u}}function ag(e,t){(0,v.useEffect)(()=>{if(e)return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[e,t])}function am(e,t){let n=(0,v.useRef)(null),r=(0,v.useRef)(t);return(0,v.useEffect)(()=>{r.current=t},[t]),(0,v.useEffect)(()=>{var t;if(!e)return;let o=e=>{n.current&&e.target instanceof Node&&!n.current.contains(e.target)&&r.current()},i=(t=()=>r.current(),e=>{"Escape"===e.key&&(e.stopPropagation(),t())});return document.addEventListener("pointerdown",o),document.addEventListener("keydown",i),()=>{document.removeEventListener("pointerdown",o),document.removeEventListener("keydown",i)}},[e]),n}function ax({repo:e,repoRoot:t,trail:n,onOpen:r,compact:o}){let i=n.slice(1),a=(0,v.useRef)(null),l=(0,v.useRef)(null),s=(0,v.useRef)(null),[d,u]=(0,v.useState)({trail:n,count:0,owner:!0}),c=o&&i.length>0,h=c?i.length-1:d.trail===n?d.count:0,f=d.trail!==n||d.owner,p=c?["",...i.slice(0,h)]:i.slice(0,h);(0,v.useLayoutEffect)(()=>{let e=a.current,t=s.current,r=l.current;if(!e||!t||!r)return;let o=e.closest("header")?.querySelector('[data-testid="search-button"]')??null,i=()=>{let i=[...t.children].map(e=>e.getBoundingClientRect().width),a=i.pop()??0,l=[...r.querySelectorAll(".truncate")].reduce((e,t)=>e+Math.max(0,t.scrollWidth-t.clientWidth),0),s=e.getBoundingClientRect().width+(()=>{if(null===o)return 0;let e=getComputedStyle(o);return"0"===e.flexShrink?0:Math.max(0,o.getBoundingClientRect().width-(parseFloat(e.minWidth)||0))})()-r.getBoundingClientRect().width-l-4,d=e=>0===i.length?0:function(e,t,n){let r=e.length-1;if(r<=0)return 0;let o=e.reduce((e,t)=>e+t,0)+4*r;if(o<=t)return 0;o+=n+4;for(let n=1;n<r;n++)if((o-=e[n-1]+4)<=t)return n;return r}(i,e,a),c=d(s),h=(0===i.length?e.querySelector("[data-crumb-root]")?.getBoundingClientRect().width??0:i.slice(c).reduce((e,t)=>e+t+4,c>0?a+4:0)-4)<=s,f=r.querySelector("[data-repo-owner]")?.scrollWidth??0,p=h?c:d(s+f);u(e=>e.trail===n&&e.count===p&&e.owner===h?e:{trail:n,count:p,owner:h})};i();let d=new ResizeObserver(i);for(let n of(d.observe(e),d.observe(r),null!==o&&d.observe(o),t.children))d.observe(n);return()=>d.disconnect()},[n]);let g=0===i.length?"root":(0,af.d)(i[i.length-1],t);return(0,y.jsxs)("nav",{ref:a,"aria-label":"Where you are","data-owner":f?void 0:"hidden",className:"group/crumb relative flex min-w-0 flex-1 items-center gap-1 font-mono text-[12.5px] text-text-2",children:[(0,y.jsx)("span",{ref:l,className:`${c?"hidden":"flex"} min-w-[30px] shrink-[1000] items-center has-[[data-testid=repo-menu]]:min-w-[50px]`,children:e}),p.length>0&&(0,y.jsxs)(y.Fragment,{children:[!c&&(0,y.jsx)("span",{"aria-hidden":!0,className:"shrink-0",children:"/"}),(0,y.jsx)(ay,{steps:p,repoRoot:t,onOpen:r})]}),i.map((e,n)=>n<h?null:(0,y.jsxs)("span",{className:`flex items-center gap-1 ${n===i.length-1?"min-w-0":"shrink-0"}`,children:[(0,y.jsx)("span",{"aria-hidden":!0,children:"/"}),n===i.length-1?(0,y.jsx)("span",{"aria-current":"page",title:e,className:"truncate text-text",children:(0,af.d)(e,t)}):(0,y.jsx)("button",{type:"button",onClick:()=>r(e),title:e,className:"truncate rounded-[4px] px-0.5 hover:bg-node hover:text-text",children:(0,af.d)(e,t)})]},e)),0===i.length&&!o&&(0,y.jsxs)("span",{"data-crumb-root":!0,className:"flex shrink-0 items-center gap-1",children:[(0,y.jsx)("span",{"aria-hidden":!0,children:"/"}),(0,y.jsx)("span",{"aria-current":"page",className:"text-text-2",children:g})]}),(0,y.jsxs)("div",{ref:s,"aria-hidden":!0,className:"pointer-events-none invisible absolute inset-x-0 top-0 flex h-0 gap-1 overflow-hidden whitespace-nowrap",children:[i.map(e=>(0,y.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,y.jsx)("span",{children:"/"}),(0,y.jsx)("span",{className:"px-0.5",children:(0,af.d)(e,t)})]},e)),(0,y.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,y.jsx)("span",{children:"/"}),(0,y.jsx)("span",{className:"px-1.5",children:"…"})]})]})]})}function ay({steps:e,repoRoot:t,onOpen:n}){let[r,o]=(0,v.useState)(!1),[i,a]=(0,v.useState)({left:0,width:260}),l=am(r,()=>o(!1)),s=(0,v.useCallback)(()=>{l.current&&a(ap(l.current,260,"start"))},[l]);return ag(r,s),(0,y.jsxs)("span",{ref:l,className:"relative shrink-0",children:[(0,y.jsx)("button",{type:"button","data-testid":"breadcrumb-folded","aria-expanded":r,"aria-label":`${e.length} more ${1===e.length?"folder":"folders"} on the way here`,title:e.map(e=>(0,af.d)(e,t)).join(" / "),onClick:()=>{r||s(),o(e=>!e)},className:"rounded-[4px] border border-border px-1.5 leading-[18px] hover:bg-node hover:text-text",children:"…"}),r&&(0,y.jsx)("ul",{"data-testid":"breadcrumb-menu","data-covers":!0,style:i,className:"absolute top-7 z-30 overflow-y-auto rounded-md border border-border bg-panel py-1 font-sans text-[13px]",children:e.map(e=>(0,y.jsx)("li",{children:(0,y.jsx)("button",{type:"button",onClick:()=>{o(!1),n(e)},title:e,className:"block w-full truncate px-3 py-1.5 text-left font-mono text-[12.5px] text-text hover:bg-node",children:(0,af.d)(e,t)})},e))})]})}var av={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};let ab=(e,t,n,r)=>{let o=(0,v.forwardRef)(({color:n="currentColor",size:o=24,stroke:i=2,title:a,className:l,children:s,...d},u)=>(0,v.createElement)("svg",{ref:u,...av[e],width:o,height:o,className:["tabler-icon",`tabler-icon-${t}`,l].filter(Boolean).join(" "),..."filled"===e?{fill:n}:{strokeWidth:i,stroke:n},...d},[a&&(0,v.createElement)("title",{key:"svg-title"},a),...r.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(s)?s:[s]]));return o.displayName=`${n}`,o},aw=ab("outline","arrow-left","ArrowLeft",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M5 12l6 6",key:"svg-1"}],["path",{d:"M5 12l6 -6",key:"svg-2"}]]),ak=ab("outline","arrow-right","ArrowRight",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M13 18l6 -6",key:"svg-1"}],["path",{d:"M13 6l6 6",key:"svg-2"}]]),aE=ab("outline","file","File",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2",key:"svg-1"}]]),aM=ab("outline","folder","Folder",[["path",{d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2",key:"svg-0"}]]),aj=ab("outline","x","X",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);function a_(e,t,n=new Set){let r=.02*Math.max(0,...e.map(e=>e.count));return e.filter(e=>e.source!==e.target&&e.count<r&&(null===t||e.source!==t&&e.target!==t)&&!n.has(e.source)&&!n.has(e.target)).length}let aS={uses:{line:"var(--edge-strong)",fill:"bg-edge-strong",underline:"after:bg-edge-strong"},usedBy:{line:"var(--used-by-edge)",fill:"bg-used-by-edge",underline:"after:bg-used-by-edge"}},aN=e=>`${e.source}->${e.target}`,aC=(e,t,n)=>"uses"===n?e.source===t:"usedBy"===n?e.target===t:e.source===t||e.target===t;function a$(e,t,n="all"){let r=new Set;if(null===t)return r;for(let o of e)aC(o,t,n)&&(o.source===t?r.add(o.target):o.target===t&&r.add(o.source));return r}function aO(e,t,n,r,o={}){let i=new Set(e),a=null!==n&&i.has(n)?n:null,l=null!==r&&i.has(r)&&r!==a?r:null,s=o.direction??"all",d=a$(t,a,s),u=a$(t,l),c=new Map;for(let t of e)t===a?c.set(t,"selected"):d.has(t)?c.set(t,"linked"):t===l||u.has(t)?c.set(t,"preview"):c.set(t,null===a?"normal":"faded");let h=.02*Math.max(0,...t.map(e=>e.count)),f=o.pinned??new Set,p=new Map;for(let e of t){let t=t=>null!==t&&(e.source===t||e.target===t),n=f.has(e.source)||f.has(e.target);null!==a&&aC(e,a,s)?p.set(aN(e),"selected"):t(a)?p.set(aN(e),t(l)?"preview":"faded"):t(l)?p.set(aN(e),"preview"):o.quietLines&&!n||o.strongOnly&&e.count<h&&!n?p.set(aN(e),"hidden"):p.set(aN(e),null===a?"normal":"faded")}return{boxes:c,edges:p}}function aA(e){return e.toLocaleString("en-US")}let aP=[["K",1e3],["M",1e6],["B",1e9]];function az(e){return e<5e3?"just now":e<6e4?`${Math.floor(e/1e3)} s ago`:e<36e5?`${Math.floor(e/6e4)} min ago`:`${Math.floor(e/36e5)} h ago`}let aL={structure:"Structure",summaries:"Summaries",embeddings:"Search vectors"},aR={structure:"Indexing",summaries:"Summarizing",embeddings:"Embedding"},aI=["structure","summaries","embeddings"],aD=e=>e.total>0?` ${aA(e.done)} / ${aA(e.total)}`:"";function aB(e){return e.usedBy.length>0?"usedBy":e.uses.length>0?"uses":"inside"}function aT(e){return e.reduce((e,t)=>Math.max(e,t.count),0)}let aF=(e,t,n)=>1===e?t:n;function aH(e,t){return`${e}, ${aA(t)} ${aF(t,"import","imports")}`}function aV(e){return"portal"!==e.kind?e.name:e.pages?`boxes on ${e.pages.length} other pages`:`boxes on ${e.name}`}let aq=e=>e.charAt(0).toUpperCase()+e.slice(1);function aW(e,t,n){return{who:"portal"===e.kind?aq(aV(e)):aV(e),verb:"portal"===e.kind?"use":"uses",whom:aV(t),imports:`${aA(n)} import${1===n?"":"s"}`}}function aX(e,t){return`vscode://file/${e.repo}/${e.path}${t?`:${t}`:""}`}function aY(e){performance.clearMarks(`${e}:start`),performance.mark(`${e}:start`)}function aK(e){performance.clearMarks(`${e}:start`)}function aU(e){requestAnimationFrame(()=>requestAnimationFrame(()=>{if(0===performance.getEntriesByName(`${e}:start`,"mark").length)return;let t=performance.measure(e,`${e}:start`);performance.clearMarks(`${e}:start`);let n=window;(n.__nebulosityPerf??=[]).push({name:e,ms:Math.round(10*t.duration)/10})}))}function aZ(e,t){return e.reduce((e,n)=>e+(n.source===t||n.target===t?n.count:0),0)}let aG=(e,t,n)=>`${aA(e)} ${1===e?t:n}`;function aQ(e,t){return`${aG(e.hiddenCount??0,"folder or file","folders and files")}, ${aG(t,"import","imports")}`}function aJ(e,t){return null!==t&&null!==e&&t.includes("//")?e.nodes.some(e=>e.path===t)?t:null:t}let a0=new Set(["NOT_READY","SUMMARIES_OFF"]),a1=e=>"pending"===e||"stale"===e,a2=ab("outline","external-link","ExternalLink",[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]]);var a3=e.i(16675);let a5=0,a4="";function a6(){(0,v.useEffect)(()=>{let e=document.documentElement;return 0===a5&&(a4=e.style.overflow,e.style.overflow="hidden"),a5++,()=>{0==--a5&&(e.style.overflow=a4)}},[])}let a8="inline-flex h-7 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-[5px] border border-border px-3 text-[13px] text-text hover:border-text-3";function a7({path:t,lines:n,onClose:r,onOpenInEditor:o}){a6();let[i,a]=(0,v.useState)(null),[l,s]=(0,v.useState)(null),d=(0,v.useRef)(null);(0,v.useEffect)(()=>{let e=new AbortController;return au.source(t,e.signal).then(a,e=>{e instanceof ai&&s(e)}),()=>e.abort()},[t]),(0,v.useEffect)(()=>{i&&n&&d.current&&(d.current.scrollTop=Math.max(0,(n.start-4)*20))},[i,n]),(0,v.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.stopImmediatePropagation(),r())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[r]);let u=i?.content.replace(/\r\n/g,"\n").replace(/\n$/,"")??"",[c,h]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!i)return;let t=!0;return e.A(74429).then(({highlightCode:e})=>{t&&h({text:u,html:e(u,i.language)})}),()=>{t=!1}},[i,u]);let f=i?.lineCount??0,p=i?aX(i,n?.start):void 0;return(0,rL.createPortal)((0,y.jsx)("div",{"data-source-viewer":t,className:"fixed inset-0 z-40 bg-canvas/60",onClick:r,children:(0,y.jsxs)("div",{role:"dialog","aria-label":`Source of ${t}`,onClick:e=>e.stopPropagation(),className:"absolute inset-y-0 right-0 flex w-[min(960px,80vw)] flex-col border-l border-divider bg-panel max-[600px]:w-full",children:[(0,y.jsxs)("header",{className:"flex shrink-0 items-start justify-between gap-2 border-b border-divider px-4 pb-3 pt-4",children:[(0,y.jsxs)("div",{className:"min-w-0",children:[(0,y.jsx)("h2",{title:t,className:"truncate font-mono text-[15px] font-medium leading-5 text-text",children:(0,af.d)(t,"")}),(0,y.jsx)("div",{className:"truncate font-mono text-[12px] leading-[18px] text-text-3",title:t,children:t}),(0,y.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[12.5px] leading-[18px] text-text-2",children:[i&&(0,y.jsxs)("span",{children:[aA(f)," ",1===f?"line":"lines"]}),i?.truncated&&(0,y.jsx)("span",{children:"Only the first 1 MB is shown."}),i&&(0,a3.M)(u)&&(0,y.jsx)("span",{"data-testid":"source-plain",children:"Shown without colors, too large to color quickly."}),n&&(0,y.jsxs)("span",{children:["Lines ",n.start,"–",n.end," highlighted"]}),p&&(o?(0,y.jsxs)("button",{type:"button",onClick:()=>o(n?.start),className:a8,children:["Open in VS Code ",(0,y.jsx)(a2,{"aria-hidden":!0,size:14,stroke:1.75})]}):(0,y.jsxs)("a",{href:p,className:a8,children:["Open in VS Code ",(0,y.jsx)(a2,{"aria-hidden":!0,size:14,stroke:1.75})]}))]})]}),(0,y.jsx)("button",{type:"button",onClick:r,"aria-label":"Close the source",className:"-mr-1 shrink-0 rounded-[5px] p-1 text-text-2 hover:bg-node hover:text-text",children:(0,y.jsx)(aj,{"aria-hidden":!0,size:16,stroke:1.75})})]}),(0,y.jsxs)("div",{ref:d,"data-scroll-x":!0,className:"min-h-0 flex-1 overflow-auto",children:[l&&(0,y.jsx)("p",{className:"px-4 py-3 text-[13px] text-danger [overflow-wrap:anywhere]",children:l.message}),!i&&!l&&(0,y.jsx)("p",{className:"px-4 py-3 text-[13px] text-text-2",children:"Loading…"}),i&&(0,y.jsxs)("div",{className:"relative flex min-w-max font-mono text-[13px]",style:{lineHeight:"20px"},children:[n&&(0,y.jsx)("div",{"aria-hidden":!0,className:"absolute inset-x-0 bg-node",style:{top:(n.start-1)*20+12,height:(n.end-n.start+1)*20}}),(0,y.jsx)("pre",{"aria-hidden":!0,className:"sticky left-0 select-none bg-panel py-3 pl-4 pr-3 text-right text-text-3",children:Array.from({length:f},(e,t)=>t+1).join("\n")}),c?.text===u?(0,y.jsx)("pre",{className:"syntax relative py-3 pr-6",dangerouslySetInnerHTML:{__html:c.html}}):(0,y.jsx)("pre",{className:"syntax relative py-3 pr-6",children:u})]})]})]})}),document.body)}let a9="inline-flex h-7 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-[5px] border border-border px-3 text-[13px] text-text hover:border-text-3",le="text-text underline decoration-text-3 underline-offset-2 hover:decoration-text",lt="min-h-0 flex-1 overflow-y-auto pb-4 [@media(height<480px)]:flex-none [@media(height<480px)]:overflow-visible",ln="@min-[720px]:min-h-0 @min-[720px]:overflow-y-auto @min-[720px]:pb-4",lr=(0,v.memo)(function(e){let t=e.level.nodes.find(t=>t.path===e.path&&"portal"===t.kind);return t?(0,y.jsx)(la,{portal:t,...e}):(0,y.jsx)(li,{...e})});function lo({path:e,placement:t,onScreenFolder:n=!1,alert:r,name:o,title:i,meta:a,onClose:l,children:s}){return(0,y.jsxs)("aside",{"data-panel":e,"data-placement":t,"data-on-screen":n||void 0,className:`@container pointer-events-auto flex h-full min-h-0 w-full min-w-0 flex-col border-divider bg-panel [@media(height<480px)]:overflow-y-auto ${"below"===t?"border-t":"border-l"}`,children:[(0,y.jsxs)("header",{className:"flex shrink-0 items-start justify-between gap-2 px-4 pb-3 pt-4",children:[(0,y.jsxs)("div",{className:"min-w-0",children:[(0,y.jsx)("h2",{className:"truncate font-mono text-[15px] font-medium leading-5 text-text",title:i,children:o}),a&&(0,y.jsx)("p",{className:"mt-0.5 text-[12.5px] leading-[18px] text-text-2",children:a})]}),!n&&(0,y.jsx)("button",{type:"button",onClick:l,"aria-label":"Close the panel",className:"-mr-1 shrink-0 rounded-[5px] p-1 text-text-2 hover:bg-node hover:text-text",children:(0,y.jsx)(aj,{"aria-hidden":!0,size:16,stroke:1.75})})]}),s,r&&(0,y.jsx)("p",{role:"alert","data-covers":!0,className:"pointer-events-none sticky bottom-0 shrink-0 border-t border-divider bg-panel px-4 py-2 text-center text-[13px] text-danger [overflow-wrap:anywhere]",children:r})]})}function li({path:e,level:t,indexVersion:n,summariesOff:r,onFocus:o,onOpen:i,onClose:a,onOpenInEditor:l,placement:s,onScreenFolder:d,alert:u}){var c,h;let f,[p,g]=(0,v.useState)(null),[m,x]=(0,v.useState)(null),[b,w]=(0,v.useState)(null),[k,E]=(0,v.useState)(null),[M,j]=(0,v.useState)(!1),[_,S]=(0,v.useState)(null),N=(0,v.useRef)(new Set),[C,$]=(0,v.useState)(null);(0,v.useEffect)(()=>{},[]),(0,v.useEffect)(()=>{let t=new AbortController;return au.describe(e,t.signal).then(e=>{g(e),x(null),S(t=>t??aB(e))},e=>{e instanceof ai&&x(e)}),()=>t.abort()},[e,n]),(0,v.useEffect)(()=>{p&&aU("map:select")},[p]);let O=(e,t)=>{j(!0),au.summarize(e).then(e=>{w(e),j(!1)},e=>{j(!1),e instanceof ai&&("NOT_READY"===e.code&&t?.(),E(e))})};(0,v.useEffect)(()=>{if(null===p||!a1(p.summaryStatus)&&(!0!==p.summaryOlderStyle||r))return;let e=a1(p.summaryStatus)?`${p.path}@${p.indexVersion}`:`${p.path}@older`;N.current.has(p.path)||N.current.has(e)||(N.current.add(e),O(p.path,()=>N.current.add(p.path)))},[p,r]);let A=p?.kind??function(e,t){if(""===e)return"repo";if(e===t.path)return"folder";let n=t.nodes.find(t=>t.path===e)?.kind;return"folder"===n||"file"===n?n:void 0}(e,t),[P,z]=(0,v.useState)(null),L=(0,v.useCallback)(()=>z(null),[]),R="below"===s,I=m&&(0,y.jsx)("p",{className:"text-[13px] text-danger [overflow-wrap:anywhere]",children:m.message});return(0,y.jsxs)(lo,{path:e,placement:s,onScreenFolder:d,alert:u,name:(c=t.repo,f=(0,af.d)(e,c),"folder"===A?`${f}/`:f),title:(h=t.repo,""===e?h:"folder"===A?`${e}/`:e),meta:p?function(e){let{fileCount:t,lineCount:n}=e.stats,r=`${function(e){if(e<1e3)return String(e);let t=0;for(;t<aP.length-1&&e>=aP[t+1][1];)t++;let n=Math.round(e/aP[t][1]*10)/10;return n>=1e3&&t<aP.length-1&&(n=Math.round(e/aP[++t][1]*10)/10),`${n}${aP[t][0]}`}(n)} ${aF(n,"line","lines")}`,o="file"===e.kind?r:`${aA(t)} ${aF(t,"file","files")}, ${r}`;return e.stalePaths>0?`${o}, ${aA(e.stalePaths)} changed since summarized`:o}(p):void 0,onClose:a,children:[p?(0,y.jsxs)("div",{className:`${lt} ${R?"@min-[720px]:grid @min-[720px]:grid-cols-2 @min-[720px]:grid-rows-1 @min-[720px]:pb-0":""}`,children:[(0,y.jsxs)("div",{className:`flex flex-col gap-3 px-4 ${R?`${ln} @min-[720px]:pr-3`:""}`,children:[I,(0,y.jsx)(ld,{data:p,fresh:b,refreshing:M,summaryError:k,onRetry:()=>{null!==p&&(E(null),O(p.path))}}),(0,y.jsx)(ls,{data:p,github:C,onScreenFolder:d??!1,onOpen:i,onViewSource:()=>z({}),onOpenInEditor:l&&(()=>l(p.path))})]}),(0,y.jsx)("div",{className:`px-4 pt-4 ${R?`${ln} @min-[720px]:pl-3 @min-[720px]:pt-1`:""}`,children:(0,y.jsx)(lh,{data:p,tab:_??aB(p),onTab:S,onFocus:o,onOpen:i,onViewLines:(e,t)=>z({lines:{start:e,end:t}})})})]}):(0,y.jsx)("div",{className:`${lt} px-4`,children:I||(0,y.jsx)("p",{className:"text-[13px] text-text-2",children:"Loading…"})}),P&&p?.kind==="file"&&(0,y.jsx)(a7,{path:p.path,lines:P.lines,onClose:L,onOpenInEditor:l&&(e=>l(p.path,e))})]})}function la({portal:e,path:t,level:n,onFocus:r,onTurnPage:o,onClose:i,placement:a,onScreenFolder:l,alert:s}){let d=aZ(n.edges,e.path),u=function(e,t){let n=new Map;for(let r of e.edges){let e=r.source===t?r.target:r.target===t?r.source:null;null!==e&&n.set(e,(n.get(e)??0)+r.count)}let r=new Map(e.nodes.map((e,t)=>[e.path,t]));return[...n.entries()].map(([e,t])=>({path:e,count:t})).sort((e,t)=>t.count-e.count||(r.get(e.path)??0)-(r.get(t.path)??0))}(n,e.path),c=aT(u),h=void 0!==e.page?[e.page]:e.pages??[],f=new Map(n.nodes.map(e=>[e.path,e]));return(0,v.useEffect)(()=>{aU("map:select")},[]),(0,y.jsx)(lo,{path:t,placement:a,onScreenFolder:l,alert:s,name:e.name,title:`${e.name} of ${n.path||(0,af.d)("",n.repo)}`,meta:`${aQ(e,d)} with this page`,onClose:i,children:(0,y.jsxs)("div",{className:`${lt} space-y-4 px-4`,children:[(0,y.jsxs)("section",{"aria-label":"Go to",children:[h.length>1&&(0,y.jsx)(ll,{title:"Pages behind this doorway",count:h.length}),(0,y.jsx)("ul",{className:"flex flex-wrap gap-2",children:h.map(e=>(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button","data-go-page":e,onClick:()=>o(e),className:a9,children:[e<n.page&&(0,y.jsx)(aw,{"aria-hidden":!0,size:14,stroke:1.75}),1===h.length?`Go to page ${e+1}`:`Page ${e+1}`,e>n.page&&(0,y.jsx)(ak,{"aria-hidden":!0,size:14,stroke:1.75})]})},e))})]}),(0,y.jsxs)("section",{"aria-label":"Linked from this page",children:[(0,y.jsx)(ll,{title:"Linked from this page",count:u.length}),(0,y.jsx)(lx,{items:u,empty:"No lines from this page.",render:({path:t,count:n})=>(0,y.jsx)(lp,{linked:t,name:f.get(t)?.name??t,count:n,largest:c,title:`${aH(t,n)} with ${e.name}`,onClick:()=>r(t)},t)})]})]})})}function ll({title:e,count:t}){return(0,y.jsxs)("h3",{className:"mb-2 border-b border-divider pb-2 pt-1.5 text-[13px] font-normal text-text",children:[e," ",(0,y.jsx)("span",{className:"text-text-2",children:aA(t)})]})}function ls({data:e,github:t,onScreenFolder:n,onOpen:r,onViewSource:o,onOpenInEditor:i}){let a="file"===e.kind,l="folder"===e.kind&&!n;if(!l&&!(a&&1))return null;return(0,y.jsxs)("div",{className:"flex flex-wrap gap-2",children:[l&&(0,y.jsx)("button",{type:"button",onClick:()=>r(e.path),className:"inline-flex h-7 shrink-0 items-center whitespace-nowrap rounded-[5px] bg-accent px-3 text-[13px] font-semibold text-on-accent hover:brightness-110",children:"Open folder"}),!1,a&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("button",{type:"button",onClick:o,className:a9,children:"View source"}),i?(0,y.jsx)("button",{type:"button",onClick:i,className:a9,children:"Open in VS Code"}):(0,y.jsx)("a",{href:aX(e),className:a9,children:"Open in VS Code"})]})]})}function ld({data:e,fresh:t,refreshing:n,summaryError:r,onRetry:o}){var i,a;let l,[s,d]=(0,v.useState)(!1),u=t??e,{lead:c,rest:h}=(0,a3.z)(u.summary??""),f=(i=u.summaryError,i??(r&&!a0.has(r.code)?r.message:null)),p=u.tagline?"":function(e,t){if(t?.code==="NOT_READY")return"Waiting for what's inside to be summarized first.";if(t?.code==="SUMMARIES_OFF")return t.message;switch(e){case"off":return"Summaries are off, since ANTHROPIC_API_KEY isn't set. With a key, each file and folder gets a short plain-language summary here, and search can match by meaning.";case"failed":return"The last attempt to summarize this failed.";case"pending":return"Summarizing…";default:return""}}(u.summaryStatus,r),g=""===c?[]:s?[c,...h.split(/\n\s*\n/)]:[c],{notes:m,testsNote:x}=(a=e.kind,l="file"!==a&&!0===u.summaryOlderStyle,{notes:[n&&u.tagline?"Refreshing…":"","stale"===u.summaryStatus&&!n&&!l?"Out of date, it changed since it was summarized.":""].filter(Boolean),testsNote:!!u.summary&&"file"===a&&!0===u.summaryOlderStyle}),b=m.length>0||x||null!==f;return(0,y.jsxs)("section",{"aria-label":"Summary",className:"space-y-3 [overflow-wrap:anywhere]",children:[u.tagline&&(0,y.jsx)("p",{className:"text-[13px] font-semibold leading-[18px] text-text",children:(0,y.jsx)(lu,{text:u.tagline})}),p&&(0,y.jsx)("p",{className:"text-[13px] leading-[1.55] text-text-2",children:p}),g.length>0&&(0,y.jsx)("div",{className:"space-y-2 text-[13px] leading-[1.55] text-text-2",children:g.map((e,t)=>(0,y.jsxs)("p",{children:[(0,y.jsx)(lu,{text:e}),h&&t===g.length-1&&(0,y.jsxs)(y.Fragment,{children:[" ",(0,y.jsx)("button",{type:"button","aria-expanded":s,onClick:()=>d(e=>!e),className:le,children:s?"Show less":"Full summary"})]})]},t))}),b&&(0,y.jsxs)("div",{className:"space-y-1 text-[12.5px] leading-[18px] text-text-2",children:[m.map(e=>(0,y.jsx)("p",{children:e},e)),x&&(0,y.jsx)("p",{className:"text-[12px] text-text-3",children:"Import counts in this summary leave out test files."}),f&&(0,y.jsxs)("p",{className:"text-danger",children:[f," ",(0,y.jsx)("button",{type:"button",onClick:o,className:le,children:"Try again"})]})]})]})}function lu({text:e}){return(0,y.jsx)(y.Fragment,{children:(0,a3.X)(e).map((e,t)=>e.code?(0,y.jsx)("code",{className:"font-mono text-[12px] text-text",children:e.text},t):(0,y.jsx)("span",{children:e.text},t))})}let lc={uses:"What this uses, by number of imports. Its arrows point to these.",usedBy:"What uses this, by number of imports, test files included. Their arrows point here.",inside:void 0};function lh({data:e,tab:t,onTab:n,onFocus:r,onOpen:o,onViewLines:i}){let a=(0,v.useId)(),l="file"===e.kind,s=[{id:"uses",label:"Uses",count:e.uses.length},{id:"usedBy",label:"Used by",count:e.usedBy.length},{id:"inside",label:l?"Declarations":"Contents",count:(l?e.symbols?.length:e.children?.length)??0}];return(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{role:"tablist","aria-label":"Relationships",onKeyDown:e=>{let r=s.findIndex(e=>e.id===t),o="ArrowRight"===e.key?(r+1)%s.length:"ArrowLeft"===e.key?(r-1+s.length)%s.length:"Home"===e.key?0:"End"===e.key?s.length-1:-1;-1!==o&&(e.preventDefault(),e.stopPropagation(),n(s[o].id),e.currentTarget.querySelectorAll('[role="tab"]')[o]?.focus())},className:"flex flex-wrap gap-x-[18px] border-b border-divider @max-[260px]:gap-x-3",children:s.map(e=>{let r=e.id===t;return(0,y.jsxs)("button",{type:"button",role:"tab",id:`${a}-${e.id}`,"data-tab":e.id,"aria-selected":r,"aria-controls":`${a}-panel`,tabIndex:r?0:-1,title:lc[e.id],onClick:()=>n(e.id),className:`relative whitespace-nowrap pb-2 pt-1.5 text-[13px] ${r?`text-text after:absolute after:inset-x-0 after:-bottom-px after:h-0.5 after:rounded-[1px] ${"inside"===e.id?"after:bg-accent":aS[e.id].underline}`:"text-text-2 hover:text-text"}`,children:[e.label," ",aA(e.count)]},e.id)})}),(0,y.jsxs)("div",{role:"tabpanel",id:`${a}-panel`,"aria-labelledby":`${a}-${t}`,className:"pt-2",children:["uses"===t&&(0,y.jsx)(lf,{items:e.uses,empty:"Imports nothing outside itself.",onFocus:r},"uses"),"usedBy"===t&&(0,y.jsx)(lf,{items:e.usedBy,empty:"Nothing outside it imports it.",onFocus:r,usedBy:!0},"usedBy"),"inside"===t&&l&&(0,y.jsx)(lx,{items:e.symbols??[],empty:e.importsOnly?"Not read, since it's over the 1 MB size cap. Only its imports were.":"None found.",render:e=>(0,y.jsx)(lm,{symbol:e,onViewLines:i},`${e.name}:${e.startLine}`)}),"inside"===t&&!l&&(0,y.jsx)(lx,{items:e.children??[],empty:"Nothing inside.",render:e=>(0,y.jsx)(lg,{child:e,onFocus:r,onOpen:o},e.path)})]})]})}function lf({items:e,empty:t,onFocus:n,usedBy:r=!1}){let o=aT(e);return(0,y.jsx)(lx,{items:e,empty:t,render:e=>(0,y.jsx)(lp,{chip:e.path,name:(0,af.k)(e.path),count:e.count,largest:o,title:aH(e.path,e.count),onClick:()=>n(e.path),usedBy:r},e.path)})}function lp({name:e,count:t,largest:n,title:r,onClick:o,chip:i,linked:a,usedBy:l=!1}){return(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button","data-chip":i,"data-linked":a,title:r,onClick:o,className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2.5 rounded-[5px] px-2 py-1.5 text-left hover:bg-node",children:[(0,y.jsx)("span",{className:"truncate font-mono text-[12.5px] leading-[18px] text-text",children:e}),(0,y.jsx)("span",{className:"text-[11.5px] leading-4 text-text-2",children:aA(t)}),(0,y.jsx)("span",{"aria-hidden":!0,className:`col-span-2 mt-[5px] h-[3px] rounded-[2px] ${aS[l?"usedBy":"uses"].fill}`,style:{width:`${n<=0?1.5:Math.min(100,Math.max(1.5,100*t/n))}%`}})]})})}function lg({child:e,onFocus:t,onOpen:n}){let r,o="folder"===e.kind;return(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button","data-child":e.path,title:(r="folder"===e.kind?`${e.path}, ${aA(e.fileCount)} ${aF(e.fileCount,"file","files")}`:e.path,e.tagline?`${r}
|
|
3
|
+
${e.tagline}`:r),onClick:()=>o?n(e.path):t(e.path),className:"grid w-full grid-cols-[14px_minmax(0,1fr)_auto] items-center gap-x-2 rounded-[5px] px-2 py-1.5 text-left hover:bg-node",children:[(0,y.jsx)(o?aM:aE,{"aria-hidden":!0,size:14,stroke:1.75,className:"text-text-3"}),(0,y.jsx)("span",{className:`truncate font-mono text-[12.5px] leading-[18px] text-text ${o?"":"col-span-2"}`,children:e.name}),o&&(0,y.jsx)("span",{className:"text-[11.5px] leading-4 text-text-2",children:aA(e.fileCount)})]})})}function lm({symbol:e,onViewLines:t}){return(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button",title:`Show ${e.name} in the source`,onClick:()=>t(e.startLine,e.endLine),className:"flex w-full flex-wrap items-baseline gap-x-3 rounded-[5px] px-2 py-1.5 text-left hover:bg-node",children:[(0,y.jsx)("span",{className:`min-w-0 flex-[1_1_6ch] truncate font-mono text-[12.5px] leading-[18px] ${e.exported?"text-text":"text-text-2"}`,children:e.name}),(0,y.jsx)("span",{className:"ml-auto shrink-0 whitespace-nowrap text-[11.5px] leading-4 text-text-2",children:`${e.kind}, line ${e.startLine}`})]})})}function lx({items:e,empty:t,render:n}){let[r,o]=(0,v.useState)(!1);return 0===e.length?(0,y.jsx)("p",{className:"px-2 py-1.5 text-[13px] text-text-2",children:t}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("ul",{className:"space-y-0.5",children:(r?e:e.slice(0,8)).map(n)}),e.length>8&&(0,y.jsx)("button",{type:"button","aria-expanded":r,onClick:()=>o(e=>!e),className:"mt-1 rounded-[5px] px-2 py-1 text-[12.5px] text-text-2 hover:text-text",children:r?"Show fewer":`+${aA(e.length-8)} more`})]})}function ly({onClose:e,embedded:t=!1}){return a6(),(0,v.useEffect)(()=>{let t=t=>{"Escape"===t.key&&(t.stopImmediatePropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),(0,rL.createPortal)((0,y.jsx)("div",{"data-testid":"help",className:"fixed inset-0 z-50 flex items-center justify-center bg-canvas/70 p-4 max-[360px]:p-2",onClick:e,children:(0,y.jsxs)("div",{role:"dialog","aria-label":"How to use the Map",onClick:e=>e.stopPropagation(),className:"max-h-[85vh] w-[760px] max-w-full overflow-y-auto rounded-lg border border-border bg-panel p-6 max-[360px]:p-4",children:[(0,y.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("h2",{className:"text-[18px] font-medium text-text",children:"How to use the Map"}),!1,(0,y.jsx)("p",{className:"mt-1 text-[14px] text-text-2",children:"A map of the repo's folders and files, and of which code imports which. Open this again with the ? button at the top right, or the ? key."})]}),(0,y.jsx)("button",{type:"button",onClick:e,"aria-label":"Close help",className:"shrink-0 rounded-md p-1 text-text-2 hover:bg-node hover:text-text",children:(0,y.jsx)(aj,{"aria-hidden":!0,size:16,stroke:1.75})})]}),(0,y.jsxs)("div",{className:"mt-6 grid gap-x-8 gap-y-6 text-[14px] leading-normal text-text sm:grid-cols-2",children:[(0,y.jsxs)(lv,{title:"Getting around",children:[(0,y.jsxs)("li",{children:[(0,y.jsx)("b",{children:"Click"})," a box to see what it is, in the inspector beside or under the Map."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)("b",{children:"Double-click"})," a folder to go inside it, or click a folder in the explorer on the left."]}),t&&(0,y.jsxs)("li",{children:["In VS Code, ",(0,y.jsx)("b",{children:"double-click"})," a file to open it in the editor, or press ",(0,y.jsx)("b",{children:"Open in VS Code"})," in the inspector."]}),(0,y.jsxs)("li",{children:["Go back up with the path at the top left, ",(0,y.jsx)(lb,{children:"Backspace"}),", or your browser's Back button. The repo's name at its start goes back to the top."]}),(0,y.jsxs)("li",{children:["Big folders are split into pages of related boxes. Turn the page with the arrows in the toolbar, or ",(0,y.jsx)(lb,{children:"←"})," ",(0,y.jsx)(lb,{children:"→"}),"."]}),(0,y.jsxs)("li",{children:["A busy folder opens at a readable size, from its top. Drag to see the rest, or press ",(0,y.jsx)("b",{children:"Fit"})," in the toolbar to see it all."]}),(0,y.jsxs)("li",{children:["Search files and concepts with ",(0,y.jsx)(lb,{children:"Ctrl K"})," (",(0,y.jsx)(lb,{children:"⌘K"})," on a Mac)."]})]}),(0,y.jsxs)(lv,{title:"Reading the Map",children:[(0,y.jsx)("li",{children:"A box is a folder or a file. A folder's dot grows with how many files it holds, and it has a second card behind it. A file has a page."}),(0,y.jsx)("li",{children:"A line from A to B means A uses code from B, and the arrow points at what's being used. Its weight, and the number on it, show how many imports it carries."}),(0,y.jsx)("li",{children:'Hover a box to bring its lines forward. Hover a line to read it as a sentence, like "editor uses base, 12 imports". Where lines join, it lists every line on that stretch, and a click keeps the list open until you press Escape or click elsewhere.'}),(0,y.jsxs)("li",{children:[(0,y.jsx)("b",{children:"Strong links only"}),", in the toolbar, hides the lines under 2% of the heaviest line's imports. Every line of the box you select or hover still shows."]}),(0,y.jsxs)("li",{children:["With a box selected, ",(0,y.jsx)("b",{children:"Uses"})," or ",(0,y.jsx)("b",{children:"Used by"})," in the toolbar keeps only its lines to what it uses, or from what uses it, in color, and turns its other lines gray. ",(0,y.jsx)("b",{children:"All"})," colors both, and it's back to All when you select something else."]}),(0,y.jsxs)("li",{children:["Busy folders (more than 60 lines) draw only the lines of the box you hover or select, until you ask for ",(0,y.jsx)("b",{children:"Show all lines"}),"."]}),(0,y.jsx)("li",{children:'Boxes with no lines on the page sit under a line that says "Not linked to anything here". Lines to other pages end at a doorway, a dashed box like "Lines to page 2", and double-clicking it goes there.'})]}),(0,y.jsxs)(lv,{title:"Colors",children:[(0,y.jsxs)("li",{children:[(0,y.jsx)(lw,{className:"border-2 border-accent bg-node-sel"})," Purple is the box you selected, the lines to what it uses, and what they join. ",(0,y.jsxs)("span",{className:"whitespace-nowrap",children:[(0,y.jsx)(lw,{className:"bg-used-by-edge"})," Gold"]})," is the lines from what uses it. Everything else fades."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)(lw,{className:"outline-2 outline-offset-1 outline-agent"})," Orange is what Claude Code is touching right now."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)(lw,{className:"rounded-full bg-ok"})," The cyan dot at the bottom left says the index is up to date."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)(lw,{className:"rounded-full bg-danger"})," Red means something failed."]})]}),(0,y.jsxs)(lv,{title:"The inspector",children:[(0,y.jsxs)("li",{children:["A short summary, and ",(0,y.jsx)("b",{children:"Full summary"})," for the rest."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)("b",{children:"Uses"}),", ",(0,y.jsx)("b",{children:"Used by"})," and ",(0,y.jsx)("b",{children:"Contents"})," are tabs. Click a row to jump to it on the Map."]}),(0,y.jsxs)("li",{children:["For a file, ",(0,y.jsx)("b",{children:"View source"})," shows its code, and a declaration jumps to its line there."]})]}),(0,y.jsx)(lv,{title:"Claude Code",children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("li",{children:"The status bar along the bottom shows Claude Code's newest tool call as it works."}),(0,y.jsx)("li",{children:"Boxes holding what it touched get an orange ring for 30 seconds."})]})}),(0,y.jsx)(lv,{title:"The index",children:(0,y.jsxs)("li",{children:["The status bar's first cell says whether the index is up to date. Click it for each stage",", and to re-index."]})})]}),(0,y.jsx)("h3",{className:"mt-6 text-[13px] font-medium text-text",children:"Keyboard"}),(0,y.jsxs)("dl",{className:"mt-2 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-[13px] text-text-2 max-[360px]:grid-cols-1 max-[360px]:[&_dd]:mb-1.5",children:[(0,y.jsx)("dt",{children:(0,y.jsx)(lb,{children:"Ctrl K"})}),(0,y.jsx)("dd",{children:"Search files and concepts"}),(0,y.jsx)("dt",{children:(0,y.jsx)(lb,{children:"Esc"})}),(0,y.jsx)("dd",{children:"Close what's open, let go of the selection, then clear Claude Code's highlights"}),(0,y.jsx)("dt",{children:(0,y.jsx)(lb,{children:"Backspace"})}),(0,y.jsx)("dd",{children:"Up one folder"}),(0,y.jsxs)("dt",{children:[(0,y.jsx)(lb,{children:"←"})," ",(0,y.jsx)(lb,{children:"→"})]}),(0,y.jsx)("dd",{children:"Previous or next page of a big folder"}),(0,y.jsx)("dt",{children:(0,y.jsx)(lb,{children:"?"})}),(0,y.jsx)("dd",{children:"This help"})]})]})}),document.body)}function lv({title:e,children:t}){return(0,y.jsxs)("section",{children:[(0,y.jsx)("h3",{className:"text-[13px] font-medium text-text",children:e}),(0,y.jsx)("ul",{className:"mt-2 space-y-1.5 text-text-2 [&_b]:font-medium [&_b]:text-text",children:t})]})}function lb({children:e}){return(0,y.jsx)("kbd",{className:"rounded-md border border-border bg-node px-1.5 py-px font-sans text-[12px] text-text",children:e})}function lw({className:e}){return(0,y.jsx)("span",{"aria-hidden":!0,className:`mr-1 inline-block h-3 w-3 rounded-sm align-[-1px] ${e}`})}let lk="mcp__nebulosity__";function lE(e){let t=""===e[0]?"the repo":e[0];return e.length>1?`${t} +${e.length-1}`:t}function lM(e){let t=e.tool.startsWith(lk)?e.tool.slice(lk.length):e.tool,{paths:n}=e,r=n.length>0;switch(t){case"describe":return r?`Reading ${lE(n)}`:"Reading";case"overview":return"Reading the repo overview";case"search":return r?`Searching \xb7 ${lE(n)}`:"Searching";case"imports":return n.length>=2?`Tracing ${n[0]} → ${n[1]}`:r?`Following the imports of ${lE(n)}`:"Following imports";case"architecture":return r?`Reading how ${lE(n)} is organized`:"Reading how the code is organized";case"calls":return r?`Following the calls into ${lE(n)}`:"Following calls";case"show_on_map":return r?`Showing ${lE(n)} on the map`:"Showing on the map";default:return r?`${t} \xb7 ${lE(n)}`:t}}var lj=Object.defineProperty,l_={},lS={Graph:()=>l5,alg:()=>lD};for(var lN in lS)lj(l_,lN,{get:lS[lN],enumerable:!0});var lC=Object.defineProperty,l$=(e,t)=>{for(var n in t)lC(e,n,{get:t[n],enumerable:!0})},lO=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),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){var t;let n;return(null!=(t=null==(n=this.isDirected()?this.successors(e):this.neighbors(e))?void 0:n.length)?t:0)===0}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]=o,o):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,l,s=!1;"object"==typeof e&&null!==e&&"v"in e?(o=e.v,i=e.w,a=e.name,2==arguments.length&&(l=t,s=!0)):(o=e,i=t,a=r,arguments.length>2&&(l=n,s=!0)),o=""+o,i=""+i,void 0!==a&&(a=""+a);let d=lz(this._isDirected,o,i,a);if(d in this._edgeLabels)return s&&(this._edgeLabels[d]=l),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[d]=s?l:this._defaultEdgeLabelFn(o,i,a);let u=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=u.v,i=u.w,Object.freeze(u),this._edgeObjs[d]=u,lA(this._preds[i],o),lA(this._sucs[o],i),this._in[i][d]=u,this._out[o][d]=u,this._edgeCount++,this}edge(e,t,n){let r=1==arguments.length?lL(this._isDirected,e):lz(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||null===r?{label:r}:r}hasEdge(e,t,n){return(1==arguments.length?lL(this._isDirected,e):lz(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=1==arguments.length?lL(this._isDirected,e):lz(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],lP(this._preds[t],e),lP(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 lA(e,t){e[t]?e[t]++:e[t]=1}function lP(e,t){void 0===e[t]||--e[t]||delete e[t]}function lz(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 lL(e,t){return lz(e,t.v,t.w,t.name)}function lR(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 lI(e){let t=new lO(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}l$({},{read:()=>lI,write:()=>lR});var lD={};l$(lD,{CycleException:()=>lZ,bellmanFord:()=>lT,components:()=>lF,dijkstra:()=>lq,dijkstraAll:()=>lW,findCycles:()=>lY,floydWarshall:()=>lU,isAcyclic:()=>lQ,postorder:()=>l0,preorder:()=>l1,prim:()=>l2,shortestPaths:()=>l3,tarjan:()=>lX,topsort:()=>lG});var lB=()=>1;function lT(e,t,n,r){return function(e,t,n,r){let o={},i,a=0,l=e.nodes(),s=function(e){let t=o[e.v],r=o[e.w];if(!t||!r)return;let a=n(e);t.distance+a<r.distance&&(o[e.w]={distance:t.distance+a,predecessor:e.v},i=!0)},d=function(){l.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;s({v:n,w:r})})})};l.forEach(function(e){o[e]={distance:e===t?0:1/0,predecessor:""}});let u=l.length;for(let e=1;e<u&&(i=!1,a++,d(),i);e++);if(a===u-1&&(i=!1,d(),i))throw Error("The graph contains a negative weight cycle");return o}(e,String(t),n||lB,r||function(t){var n;return null!=(n=e.outEdges(t))?n:[]})}function lF(e){let t={},n=[],r;return e.nodes().forEach(function(o){r=[],function n(o){var i,a;o in t||(t[o]=!0,r.push(o),null==(i=e.successors(o))||i.forEach(n),null==(a=e.predecessors(o))||a.forEach(n))}(o),r.length&&n.push(r)}),n}var lH=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(){if(0===this.size())throw Error("Queue underflow");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}},lV=()=>1;function lq(e,t,n,r){return function(e,t,n,r){let o={},i=new lH,a,l,s=function(e){let t=e.v!==a?e.v:e.w,r=o[t];if(!r)return;let s=n(e),d=l.distance+s;if(s<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+s);d<r.distance&&(r.distance=d,r.predecessor=a,i.decrease(t,d))};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;){let e=o[a=i.removeMin()];if(!e||1/0===e.distance)break;l=e,r(a).forEach(s)}return o}(e,String(t),n||lV,r||function(t){var n;return null!=(n=e.outEdges(t))?n:[]})}function lW(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=lq(e,o,t,n),r},{})}function lX(e){let t=0,n=[],r={},o=[];return e.nodes().forEach(function(i){i in r||function i(a){var l;let s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),null==(l=e.successors(a))||l.forEach(function(e){if(e in r){let t=r[e];null!=t&&t.onStack&&(s.lowlink=Math.min(s.lowlink,t.index))}else{i(e);let t=r[e];t&&(s.lowlink=Math.min(s.lowlink,t.lowlink))}}),s.lowlink===s.index){let e=[],t;do{let o=r[t=n.pop()];o&&(o.onStack=!1),e.push(t)}while(a!==t)o.push(e)}}(i)}),o}function lY(e){return lX(e).filter(function(t){var n;let r=t[0];return!!r&&(t.length>1||1===t.length&&(null!=(n=e.outEdges(r,r))?n:[]).length>0)})}var lK=()=>1;function lU(e,t,n){var r,o,i;let a,l;return r=e,o=t||lK,i=n||function(t){var n;return null!=(n=e.outEdges(t))?n:[]},a={},(l=r.nodes()).forEach(function(e){let t={};a[e]=t,t[e]={distance:0,predecessor:""},l.forEach(function(n){e!==n&&(t[n]={distance:1/0,predecessor:""})}),i(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=o(n);t[r]={distance:i,predecessor:e}})}),l.forEach(function(e){let t=a[e];t&&l.forEach(function(n){let r=a[n];r&&l.forEach(function(n){let o=r[e],i=t[n],a=r[n];if(o&&i&&a){let e=o.distance+i.distance;e<a.distance&&(a.distance=e,a.predecessor=i.predecessor)}})})}),a}var lZ=class extends Error{constructor(e){super(e),this.name="CycleException"}};function lG(e){let t={},n={},r=[];if(e.sinks().forEach(function o(i){var a;if(i in n)throw new lZ;i in t||(n[i]=!0,t[i]=!0,null==(a=e.predecessors(i))||a.forEach(o),delete n[i],r.push(i))}),Object.keys(t).length!==e.nodeCount())throw new lZ;return r}function lQ(e){try{lG(e)}catch(e){if(e instanceof lZ)return!1;throw e}return!0}function lJ(e,t,n){var r,o,i;let a,l;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:[]},l={},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,l){return n in o||(o[n]=!0,r||(l=a(l,n)),i(n).forEach(function(n){l=e(t,n,r,o,i,a,l)}),r&&(l=a(l,n))),l}(e,t,"post"===n,l,a,o,i)}),i}function l0(e,t){return lJ(e,t,"post")}function l1(e,t){return lJ(e,t,"pre")}function l2(e,t){var n;let r=new lO,o={},i=new lH,a;function l(e){let n=e.v===a?e.w:e.v,r=i.priority(n);if(void 0!==r){let l=t(e);l<r&&(o[n]=a,i.decrease(n,l))}}if(0===e.nodeCount())return r;e.nodes().forEach(function(e){i.add(e,1/0),r.setNode(e)});let s=e.nodes()[0];void 0!==s&&i.decrease(s,0);let d=!1;for(;i.size()>0;){if((a=i.removeMin())in o)r.setEdge(a,o[a]);else{if(d)throw Error("Input graph is not connected: "+e);d=!0}null==(n=e.nodeEdges(a))||n.forEach(l)}return r}function l3(e,t,n,r){return function(e,t,n,r){if(void 0===n)return lq(e,t,n,r);let o=!1,i=e.nodes();for(let a=0;a<i.length;a++){let l=i[a];if(void 0===l)continue;let s=r(l);for(let e=0;e<s.length;e++){let t=s[e];if(!t)continue;let r=t.v===l?t.v:t.w,i=r===t.v?t.w:t.v;0>n({v:r,w:i})&&(o=!0)}if(o)return lT(e,t,n,r)}return lq(e,t,n,r)}(e,t,n,null!=r?r:t=>{var n;return null!=(n=e.outEdges(t))?n:[]})}var l5=lO;function l4(e,t,n,r){let o=r;for(;e.hasNode(o);)o=r+""+ ++sr;return n.dummy=t,e.setNode(o,n),o}function l6(e){let t=new l5({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 l8(e,t){let n,r,o=e.x,i=e.y,a=t.x-o,l=t.y-i,s=e.width/2,d=e.height/2;if(!a&&!l)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(l)*s>Math.abs(a)*d?(l<0&&(d=-d),n=d*a/l,r=d):(a<0&&(s=-s),n=s,r=s*l/a),{x:o+n,y:i+r}}function l7(e){let t=so(st(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 l9(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),l4(e,"border",o,t)}function se(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 st(e){return se(Math.max,e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?5e-324:n}))}function sn(e,t){return t()}var sr=0;function so(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 si(e,t){let n={};for(let r of t)void 0!==e[r]&&(n[r]=e[r]);return n}function sa(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),{})}function sl(e,t,n){var r,o,i,a,l,s;if(!(e&&t&&n&&"edge"===t.dummy&&"edge"===n.dummy&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let d=!0;t.edgeObj.w===n.edgeObj.w&&(d=!1);let u=d?null!=(o=null==(r=e[t.edgeObj.v])?void 0:r.rank)?o:0/0:null!=(a=null==(i=e[t.edgeObj.w])?void 0:i.rank)?a:0/0,c=Object.entries(e).find(e=>{var n,r;return(null==(n=e[1].edgeObj)?void 0:n.v)===t.edgeObj.v&&(null==(r=e[1].edgeObj)?void 0:r.w)===t.edgeObj.w&&e[1].rank===u}),h=Object.entries(e).find(e=>{var t,r;return(null==(t=e[1].edgeObj)?void 0:t.v)===n.edgeObj.v&&(null==(r=e[1].edgeObj)?void 0:r.w)===n.edgeObj.w&&e[1].rank===u});if(!c||!h)return 0;let f=null!=(l=c[1].order)?l:0/0,p=null!=(s=h[1].order)?s:0/0;return isNaN(f-p)?0:f-p}var ss=class{constructor(){var e;let t,n;n=void 0,(t="symbol"!=typeof(e="_sentinel")?e+"":e)in this?lj(this,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):this[t]=n;let r={};r._next=r._prev=r,this._sentinel=r}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return sd(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&sd(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,su)),n=n._prev;return"["+e.join(", ")+"]"}};function sd(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function su(e,t){if("_next"!==e&&"_prev"!==e)return t}var sc=()=>1;function sh(e,t,n,r,o){let i=[],a=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let a=e.edge(r),l=e.node(r.v);o&&i.push({v:r.v,w:r.w}),l.out-=a,sf(t,n,l)}),(e.outEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,sf(t,n,a)}),e.removeNode(r.v),a}function sf(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 sp(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=se(Math.min,i?i.map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen):[]);return 1/0===a&&(a=0),o.rank=a})}function sg(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var sm=function(e){let t,n,r=new l5({directed:!1}),o=e.nodes();if(0===o.length)throw Error("Graph must have at least one node");let i=o[0],a=e.nodeCount();for(r.setNode(i,{});function(e,t){return e.nodes().forEach(function n(r){let o=t.nodeEdges(r);o&&o.forEach(o=>{let i=o.v,a=r===i?o.w:i;e.hasNode(a)||sg(t,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),n(a))})}),e.nodeCount()}(r,e)<a&&(t=function(e,t){return t.edges().reduce((n,r)=>{let o=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=sg(t,r)),o<n[0]?[o,r]:n},[1/0,null])[1]}(r,e));)n=r.hasNode(t.v)?sg(e,t):-sg(e,t),function(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}(r,e,n);return r},{preorder:sx,postorder:sy}=lD;function sv(e){var t;let n,r,o;t=e,o=new l5().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)})}),sp(e=o);let i=sm(e);for(sk(i),sb(i,e);n=sE(i);)r=sM(i,e,n),sj(i,e,n,r)}function sb(e,t){let n=sy(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=sw(r,o,i))})}function sw(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 l=t.nodeEdges(n);return l&&l.forEach(i=>{let l=i.v===n,s=l?i.w:i.v;if(s!==r){var d,u,c;let r=l===o,h=t.edge(i).weight;if(a+=r?h:-h,d=e,u=n,c=s,d.hasEdge(u,c)){let t=e.edge(n,s).cutvalue;a+=r?-t:t}}}),a}function sk(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,n,r,o,i){let a=r,l=t.node(o);n[o]=!0;let s=t.neighbors(o);return s&&s.forEach(i=>{Object.hasOwn(n,i)||(r=e(t,n,r,i,o))}),l.low=a,l.lim=r++,i?l.parent=i:delete l.parent,r}(e,{},1,t)}function sE(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function sM(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),l=i,s=!1;return i.lim>a.lim&&(l=a,s=!0),t.edges().filter(t=>s===s_(e,e.node(t.v),l)&&s!==s_(e,e.node(t.w),l)).reduce((e,n)=>sg(t,n)<sg(t,e)?n:e)}function sj(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),sk(e),sb(e,t),function(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=sx(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 s_(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}sv.initLowLimValues=sk,sv.initCutValues=sb,sv.calcCutValue=sw,sv.leaveEdge=sE,sv.enterEdge=sM,sv.exchangeEdges=sj;function sS(e,t,n,r,o,i){let a=o[t][i-1],l=l4(e,"border",{width:0,height:0,rank:i,borderType:t},n);o[t][i]=l,e.setParent(l,r),a&&e.setEdge(a,l,{weight:1})}function sN(e){e.nodes().forEach(t=>sC(e.node(t))),e.edges().forEach(t=>sC(e.edge(t)))}function sC(e){let t=e.width;e.width=e.height,e.height=t}function s$(e){e.y=-e.y}function sO(e){let t=e.x;e.x=e.y,e.y=t}function sA(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 sP(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"+ ++sr););return t}(e),a=new l5({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t)),o.forEach(r=>{let o=e.node(r),l=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,l||i);let s=e[n](r);s&&s.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 sz(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function sL(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function sR(e,t,n){var r;if(!n)return!1;let o=null==(r=t.node(e))?void 0:r.edgeObj;if(!o||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(null==o?void 0:o.v),a=n.indexOf(null==o?void 0:o.w);return -1!==i&&-1!==a&&i===(a+1)%n.length||i===(a-1)%n.length}var sI=new WeakMap;function sD(e,t,n){let r=t;for(;void 0!==r;){let t=e.parent(r);if(t===n)return r;r=t}}function sB(e,t,n,r=null){var o,i;let a=(null==n?void 0:n.useDynamic)!==!1,l=a&&null!=(o=null==r?void 0:r.graph)?o:null,s=a&&null!=(i=null==r?void 0:r.rawNodes)?i:null;t(" makeSpaceForEdgeLabels",()=>{var t;let n;return n=(t=e).graph(),void(n.ranksep/=2,t.edges().forEach(e=>{var r;let o=t.edge(e);o.minlen*=2,"c"!==(null!=(r=o.labelpos)?r:"r").toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?o.width+=o.labeloffset:o.height+=o.labeloffset)}))}),t(" 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)}})}),t(" acyclic",()=>{var t,n,r;let o,i,a,s;("greedy"===e.graph().acyclicer?function(e,t){var n,r;let o,i,a,l,s;if(1>=e.nodeCount())return[];let d=(n=e,r=t||sc,o=new l5,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 l=o.node(e.v),s=o.node(e.w);a=Math.max(a,l.out+=n),i=Math.max(i,s.in+=n)}),l=(function(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t})(a+i+3).map(()=>new ss),s=i+1,o.nodes().forEach(e=>{sf(l,s,o.node(e))}),{graph:o,buckets:l,zeroIdx:s});return(function(e,t,n){var r;let o=[],i=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)sh(e,t,n,l);for(;l=i.dequeue();)sh(e,t,n,l);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(l=null==(r=t[i])?void 0:r.dequeue()){o=o.concat(sh(e,t,n,l,!0)||[]);break}}}return o})(d.graph,d.buckets,d.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}(e,(t=e,e=>t.edge(e).weight)):(n=e,r=null!=l?l:null,o=[],i={},a={},s=function e(t){Object.hasOwn(a,t)||(a[t]=!0,i[t]=!0,n.outEdges(t).forEach(t=>{Object.hasOwn(i,t.w)?o.push(t):e(t.w)}),delete i[t])},r&&"function"==typeof r.node&&(s=function e(t){var l;Object.hasOwn(a,t)||(a[t]=!0,i[t]=!0,null==(l=n.outEdges(t))||l.forEach(a=>{var l,s,d,u,c;let h;Object.hasOwn(i,a.w)||(null==(l=r.node(t))?void 0:l.rank)>(null==(s=r.node(a.w))?void 0:s.rank)&&(d=n,u=a.w,c=a,h=new Set,function e(t){var n;if(d.sources().includes(t))return!0;for(let r of(h.add(t),null!=(n=d.inEdges(t))?n:[]))if((r.v!==c.v||r.w!==c.w)&&!h.has(r.v)&&e(r.v))return!0;return!1}(u))?o.push(a):e(a.w)}),delete i[t])}),n.sources().forEach(s),n.nodes().forEach(s),o)).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"+ ++sr)})}),t(" nestingGraph.run",()=>{var t,n;let r,o,i,a,l,s;return r=l4(e,"root",{},"_root"),a=2*(i=se(Math.max,Object.values((s={},(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)),s[n]=r})(e,1)),o=s)))-1)+1,e.graph().nestingRoot=r,e.edges().forEach(t=>e.edge(t).minlen*=a),l=(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,l){var s;let d=t.children(l);if(!d.length){l!==n&&t.setEdge(n,l,{weight:0,minlen:r});return}let u=l9(t,"_bt"),c=l9(t,"_bb"),h=t.node(l);t.setParent(u,l),h.borderTop=u,t.setParent(c,l),h.borderBottom=c,d.forEach(s=>{var d;e(t,n,r,o,i,a,s);let h=t.node(s),f=h.borderTop?h.borderTop:s,p=h.borderBottom?h.borderBottom:s,g=h.borderTop?o:2*o,m=f!==p?1:i-(null!=(d=a[l])?d:0)+1;t.setEdge(u,f,{weight:g,minlen:m,nestingEdge:!0}),t.setEdge(p,c,{weight:g,minlen:m,nestingEdge:!0})}),t.parent(l)||t.setEdge(n,u,{weight:0,minlen:i+(null!=(s=a[l])?s:0)})}(e,r,a,l,i,o,t)}),e.graph().nodeRankFactor=a)}),t(" rank",()=>(function(e){let t=e.graph().ranker;if("function"==typeof t)return t(e);switch(t){case"network-simplex":default:sv(e);break;case"tight-tree":var n;sp(n=e),sm(n);break;case"longest-path":sp(e);case"none":}})(l6(e))),t(" 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};l4(t,"edge-proxy",r,"_ep")}})}),t(" removeEmptyRanks",()=>{let t,n,r,o;return t=se(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)})}),t(" 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)}))}),t(" normalizeRanks",()=>{let t;return t=se(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)})}),t(" 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)}),t(" 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))})}),t(" normalize.run",()=>{e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,r,o,i=t.v,a=e.node(i).rank,l=t.w,s=e.node(l).rank,d=t.name,u=e.edge(t),c=u.labelRank;if(s!==a+1){for(e.removeEdge(t),o=0,++a;a<s;++o,++a)u.points=[],n=l4(e,"edge",r={width:0,height:0,edgeLabel:u,edgeObj:t,rank:a},"_d"),a===c&&(r.width=u.width,r.height=u.height,r.dummy="edge-label",r.labelpos=u.labelpos),e.setEdge(i,n,{weight:u.weight},d),0===o&&e.graph().dummyChains.push(n),i=n;e.setEdge(i,l,{weight:u.weight},d)}})(e,t))}),t(" parentDummyChains",()=>{var t,n;let r,o,i,a;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(Array.isArray((a=t.graph()).dummyChains)&&a.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),l=Math.max(t[n].lim,t[r].lim),s;s=n;do o.push(s=e.parent(s));while(s&&(t[s].low>a||l>t[s].lim))let d=s,u=r;for(;(u=e.parent(u))!==d;)i.push(u);return{path:o.concat(i.reverse()),lca:d}}(t,i,r.v,r.w),a=o.path,l=o.lca,s=0,d=a[0],u=!0;for(;e!==r.w;){if(n=t.node(e),u){for(;(d=a[s])!==l&&t.node(d).maxRank<n.rank;)s++;d===l&&(u=!1)}if(!u){for(;s<a.length-1&&t.node(a[s+1]).minRank<=n.rank;)s++;d=a[s]}void 0!==d&&t.setParent(e,d),e=t.successors(e)[0]}}))}),t(" 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),o&&Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let e=o.minRank,r=o.maxRank+1;e<r;++e)sS(t,"borderLeft","_bl",n,o,e),sS(t,"borderRight","_br",n,o,e)}})}),t(" order",()=>(function e(t,n={},r=null){if("function"==typeof n.customOrder)return void n.customOrder(t,e);let o=st(t),i=sP(t,so(1,o+1),"inEdges"),a=sP(t,so(o-1,-1,-1),"outEdges"),l=function(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),o=so(se(Math.max,r.map(t=>e.node(t).rank))+1).map(()=>[]);return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(function r(i){if(n[i])return;n[i]=!0,o[e.node(i).rank].push(i);let a=e.successors(i);a&&[...a].sort((n,r)=>{var o,i;return o=n,i=r,sl(t,e.node(o),e.node(i))}).forEach(r)}),o}(t,r);if(sz(t,l),n.disableOptimalOrderHeuristic)return;let s=1/0,d,u=n.constraints||[];for(let e=0,n=0;n<4;++e,++n){(function(e,t,n,r){let o=!0,i=new l5;e.forEach(function(e){var a;let l,s;n.forEach(e=>i.setEdge(e.left,e.right));let d=e.graph().root,{result:u,usedBias:c}=function e(t,n,r,o,i){var a,l,s,d,u,c,h,f,p,g,m;let x,y=null,v=i;"boolean"==typeof o?(v=o,y=null):void 0!==o&&(y=o);let b=t.children(n),w=t.node(n),k=w?w.borderLeft:void 0,E=w?w.borderRight:void 0,M={};k&&(b=b.filter(e=>e!==k&&e!==E));let j=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,b);j.forEach(n=>{if(t.children(n.v).length){var o,i;let{result:a}=e(t,n.v,r,y,v);M[n.v]=a,Object.hasOwn(a,"barycenter")&&(o=n,i=a,void 0!==o.barycenter?(o.barycenter=(o.barycenter*o.weight+i.barycenter*i.weight)/(o.weight+i.weight),o.weight+=i.weight):(o.barycenter=i.barycenter,o.weight=i.weight))}});let _=(x={},j.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),x[e.v]=n}),r.edges().forEach(e=>{let t=x[e.v],n=x[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=>si(e,["vs","i","barycenter","weight"]))}(Object.values(x).filter(e=>!e.indegree)));!function(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}(_,M);let S={},N=!1;for(let e=0;e<_.length;e++)for(let n=e+1;n<_.length;n++)if(!(!_[e]||!_[n]||!(null!=(a=_[e])&&a.barycenter)||!(null!=(l=_[n])&&l.barycenter))&&(null==(s=_[e])?void 0:s.barycenter)===_[n].barycenter){let r=null!=(u=null==(d=_[e])?void 0:d.vs[0])?u:"",o=null!=(h=null==(c=_[n])?void 0:c.vs[0])?h:"",i=t.node(r),a=t.node(o);if("edge"===i.dummy&&"edge"===a.dummy&&(null==(f=i.edgeObj)?void 0:f.v)===(null==(p=a.edgeObj)?void 0:p.v)&&(null==(g=i.edgeObj)?void 0:g.w)===(null==(m=a.edgeObj)?void 0:m.w))if(i.edgeLabel.reversed){S[o]=_[e],_.splice(e,1),e--;break}else S[r]=_[n],_.splice(n,1),n--;else N=!0}let C=function(e,t,n,r,o){var i;let a,l={},s=null,d=null,u=o;"boolean"==typeof t?(u=t,l={}):t&&(l=t,s=null!=n?n:null,d=null!=r?r:null);let c=(i=e=>Object.hasOwn(e,"barycenter"),a={lhs:[],rhs:[]},e.forEach(e=>{i(e)?a.lhs.push(e):a.rhs.push(e)}),a),h=c.lhs,f=c.rhs.sort((e,t)=>t.i-e.i),p=[],g=0,m=0,x=0;for(let[e,t]of(h.sort(function(e,t,n){return(r,o)=>{if(r.barycenter<o.barycenter)return -1;if(r.barycenter>o.barycenter)return 1;if(e&&("string"==typeof r.vs[0]||"string"==typeof o.vs[0])){let n=sl(t,e.node(r.vs[0]),e.node(o.vs[0]));if(0!==n)return n}return n?o.i-r.i:r.i-o.i}}(d,s,!!u)),Object.entries(l))){let n=h.findIndex(t=>t.vs[0]===e);h.splice(n+1,0,t)}x=sA(p,f,x),h.forEach(e=>{x+=e.vs.length,p.push(e.vs),g+=e.barycenter*e.weight,m+=e.weight,x=sA(p,f,x)});let y={vs:p.flat(1)};return m&&(y.barycenter=g/m,y.weight=m),y}(_,S,y,t,v);if(k&&E){C.vs=[k,C.vs,E].flat(1);let e=t.predecessors(k);if(e&&e.length){let n=t.node(e[0]),r=t.predecessors(E),o=t.node(r[0]);Object.hasOwn(C,"barycenter")||(C.barycenter=0,C.weight=0),C.barycenter=(C.barycenter*C.weight+n.order+o.order)/(C.weight+2),C.weight+=2}}return Object.defineProperty(C,"result",{value:C,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(C,"usedBias",{value:N,enumerable:!1,configurable:!0,writable:!0}),C}(e,d,i,r,o);t&&c&&(o=!o),u.vs.forEach((t,n)=>e.node(t).order=n),a=u.vs,l={},a.forEach(t=>{let n=e.parent(t),r,o;for(;n;){if((r=e.parent(n))?(o=l[r],l[r]=n):(o=s,s=n),o&&o!==n)return void i.setEdge(o,n);n=r}})})})(e%2?i:a,e%4>=2,u,r),l=l7(t);let o=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 l=2*a-1;a-=1;let s=Array(l).fill(0),d=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;d+=e.weight*n}),d}(e,t[r-1],t[r]);return n}(t,l);o<s?(n=0,d=Object.assign({},l),s=o):o===s&&(d=structuredClone(l))}sz(t,d)})(e,n,s)),t(" insertSelfEdges",()=>{var t;l7(t=e).forEach(e=>{let n=0;e.forEach((e,r)=>{let o=t.node(e);"number"!=typeof o.rank&&(o.rank=0),o.order=r+n,(o.selfEdges||[]).forEach(e=>{l4(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:r+ ++n,e:e.e,edgeLabel:e.label},"_se"),Array.isArray(e.label.points)&&7===e.label.points.length||(e.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete o.selfEdges})})}),t(" adjustCoordinateSystem",()=>{var t;let n;("lr"===(n=null==(t=e.graph().rankdir)?void 0:t.toLowerCase())||"rl"===n)&&sN(e)}),t(" position",()=>{var t,r,o,i,a;let l,s,d,u,c,h,f,p,g,m,x,y,v,b,w;return t=e,r=n.corePath,void(x=l7(a=t=l6(t)),v=(y=a.graph()).ranksep,b=y.rankalign,w=0,x.forEach(e=>{let t=e.reduce((e,t)=>{var n;let r=null!=(n=a.node(t).height)?n:0;return e>r?e:r},0);e.forEach(e=>{let n=a.node(e);"top"===b?n.y=w+n.height/2:"bottom"===b?n.y=w+t-n.height/2:n.y=w+t/2}),w+=t+v}),Object.entries((s=l7(o=t),d=Object.assign((l={},s.length&&s.reduce(function(e,t){let n=0,r=0,i=e.length,a=t[t.length-1];return t.forEach((e,s)=>{let d=function(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}(o,e),u=d?o.node(d).order:i;(d||e===a)&&(t.slice(r,s+1).forEach(e=>{let t=o.predecessors(e);t&&t.forEach(t=>{let r=o.node(t),i=r.order;(i<n||u<i)&&!(r.dummy&&o.node(e).dummy)&&sL(l,t,e)})}),r=s+1,n=u)}),t}),l),function(e,t){let n={};function r(t,r,o,i,a){so(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)&&sL(n,t,o)})}})}return t.length&&t.reduce(function(t,n){let o=-1,i=-1,a=0;return n.forEach((l,s)=>{if("border"===e.node(l).dummy){let t=e.predecessors(l);if(t&&t.length){let l=t[0];if(void 0===l)return;i=e.node(l).order,r(n,a,s,o,i),a=s,o=i}}r(n,a,n.length,i,t.length)}),n}),n}(o,s)),u={},["u","d"].forEach(e=>{c="u"===e?s:Object.values(s).reverse(),["l","r"].forEach(t=>{var n,i;let a,l,s;"r"===t&&(c=c.map(e=>Object.values(e).reverse()));let h=(n=c,i=t=>("u"===e?o.predecessors(t):o.successors(t))||[],a={},l={},s={},n.forEach(e=>{e.forEach((e,t)=>{a[e]=e,l[e]=e,s[e]=t})}),n.forEach(e=>{let t=-1,n=-1,u=!1,c=e,h=e.findIndex(e=>(null==r?void 0:r.includes(e))||sR(e,o,r));h>0&&(c=[e[h],...e.slice(0,h),...e.slice(h+1)],u=!0),c.forEach(e=>{var c;let h=i(e);if(h&&h.length){null!=r&&r.includes(e)&&(h=h.filter(e=>sR(e,o,r)));let i=h.sort((e,t)=>{let n=s[e],r=s[t];return(void 0!==n?n:0)-(void 0!==r?r:0)}),f=(i.length-1)/2;for(let r=Math.floor(f),o=Math.ceil(f);r<=o;++r){let o=i[r];if(void 0===o)continue;let h=s[o];if(void 0!==h&&l[e]===e&&t<h&&s[o]!==n&&!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)}(d,e,o)){let r=a[o];void 0!==r&&(l[o]=e,l[e]=a[e]=r,t=h,u&&(t=-1,n=null!=(c=s[o])?c:-1,u=!1))}}}})}),{root:a,align:l}),f=function(e,t,n,r,o=!1){var i,a,l,s,d,u,c;let h,f,p,g={},m=(i=e,a=t,l=n,s=o,h=new l5,p=(d=(f=i.graph()).nodesep,u=f.edgesep,c=s,(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?u:d)/2,i+=(o.dummy?u:d)/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=l[e];if(void 0!==n){if(h.setNode(n),void 0!==t){let r=l[t];if(void 0!==r){let o=h.edge(r,n);h.setEdge(r,n,Math.max(p(i,e,t),o||0))}}t=e}})}),h),x=o?"borderLeft":"borderRight";function y(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 y(function(e){let t=m.inEdges(e);t?g[e]=t.reduce((e,t)=>{var n;let r=null!=(n=g[t.v])?n:0,o=m.edge(t);return Math.max(e,r+(void 0!==o?o:0))},0):g[e]=0},function(e){return m.predecessors(e)||[]}),y(function(t){let n=m.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=g[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);1/0!==r&&o.borderType!==x&&(g[t]=Math.max(void 0!==g[t]?g[t]:0,r))},function(e){return m.successors(e)||[]}),Object.keys(r).forEach(e=>{var t;let r=n[e];void 0!==r&&(g[e]=null!=(t=g[r])?t:0)}),g}(o,c,h.root,h.align,"r"===t);"r"===t&&(f=sa(f,e=>-e)),u[e+t]=f})}),h=Object.values(u).reduce((e,t)=>{let n=-1/0,r=1/0;Object.entries(t).forEach(([e,t])=>{var i,a;let l=(i=o,a=e,i.node(a).width/2);n=Math.max(t+l,n),r=Math.min(t-l,r)});let i=n-r;return i<e[0]&&(e=[i,t]),e},[1/0,null])[1],p=se(Math.min,f=Object.values(h)),g=se(Math.max,f),["u","d"].forEach(e=>{["l","r"].forEach(t=>{let n=e+t,r=u[n];if(!r||r===h)return;let o=Object.values(r),i=p-se(Math.min,o);"l"!==t&&(i=g-se(Math.max,o)),i&&(u[n]=sa(r,e=>e+i))})}),i=o.graph().align,(m=u.ul)?sa(m,(e,t)=>{var n,r;if(i){let e=u[i.toLowerCase()];if(e&&void 0!==e[t])return e[t]}let o=Object.values(u).map(e=>{let n=e[t];return void 0!==n?n:0}).sort((e,t)=>e-t);return((null!=(n=o[1])?n:0)+(null!=(r=o[2])?r:0))/2}):{})).forEach(([e,n])=>t.node(e).x=n))}),t(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{let n=t.node(e),r=e=>"number"==typeof e&&isFinite(e);if("selfedge"===n.dummy){let o=t.node(n.e.v),i=r(null==o?void 0:o.x)?o.x:0,a=r(null==o?void 0:o.y)?o.y:0,l=r(null==o?void 0:o.width)?o.width:0,s=r(null==o?void 0:o.height)?o.height:0,d=r(n.x)?n.x:i,u=r(n.y)?n.y:a,c=l/2,h=s/2;n.edgeLabel.points=[{x:d+c,y:u-h},{x:d+c,y:u-h},{x:d,y:u},{x:d-c,y:u+h},{x:d-c,y:u+h},{x:d,y:u},{x:d,y:u}],n.edgeLabel.x=d,n.edgeLabel.y=u,t.setEdge(n.e,n.edgeLabel),t.removeNode(e)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||7!==e.label.points.length){let t=r(n.x)?n.x:0,o=r(n.y)?n.y:0,i=r(n.width)?n.width:0,a=r(n.height)?n.height:0,l=i/2,s=a/2;e.label.points=[{x:t+l,y:o-s},{x:t+l,y:o-s},{x:t,y:o},{x:t-l,y:o+s},{x:t-l,y:o+s},{x:t,y:o},{x:t,y:o}]}})})});let d=JSON.parse(JSON.stringify(e._nodes));return t(" 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)})}),t(" 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)})}),t(" 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}})}),t(" 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=>s$(n.node(e))),n.edges().forEach(e=>{var t;let r=n.edge(e);null==(t=r.points)||t.forEach(s$),Object.hasOwn(r,"y")&&s$(r)})),("lr"===o||"rl"===o)&&((r=e).nodes().forEach(e=>sO(r.node(e))),r.edges().forEach(e=>{var t;let n=r.edge(e);null==(t=n.points)||t.forEach(sO),Object.hasOwn(n,"x")&&sO(n)}),sN(e))}),t(" translateGraph",()=>(function(e){let t=1/0,n=0,r=1/0,o=0,i=e.graph(),a=i.marginx||0,l=i.marginy||0;function s(e){let i=e.x,a=e.y,l=e.width,s=e.height;t=Math.min(t,i-l/2),n=Math.max(n,i+l/2),r=Math.min(r,a-s/2),o=Math.max(o,a+s/2)}e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,"x")&&s(n)}),t-=a,r-=l,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+l})(e)),t(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w)return;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(l8(r,i)),n.points.push(l8(o,a))})}),t(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}),t(" 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)}})}),{graph:e,rawNodes:d}}function sT(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var sF=["nodesep","edgesep","ranksep","marginx","marginy"],sH={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},sV=["acyclicer","ranker","rankdir","align","rankalign"],sq=["width","height","rank"],sW={width:0,height:0},sX=["minlen","weight","width","height","labeloffset"],sY={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},sK=["labelpos"];function sU(e){let t=new l5({multigraph:!0,compound:!0}),n=sG(e.graph());return t.setGraph(Object.assign({},sH,sZ(n,sF),si(n,sV))),e.nodes().forEach(n=>{let r=sZ(sG(e.node(n)),sq);Object.keys(sW).forEach(e=>{void 0===r[e]&&(r[e]=sW[e])}),t.setNode(n,r);let o=e.parent(n);void 0!==o&&t.setParent(n,o)}),e.edges().forEach(n=>{let r=sG(e.edge(n));t.setEdge(n,Object.assign({},sY,sZ(r,sX),si(r,sK)))}),t}function sZ(e,t){return sa(si(e,t),Number)}function sG(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n}),t}function sQ(e,t){return Math.min(1,1440/(1.15*e),780/(1.15*t))}function sJ(e,t,n,r){return Array.from({length:e},(e,o)=>({x:n+o%t*272,y:r+96*Math.floor(o/t)}))}let s0=(e,t)=>e*(t+40)-40;function s1(e){return new Set(e.filter(e=>e.source!==e.target).flatMap(e=>[e.source,e.target]))}function s2(e,t){return"folder"===e.kind?{type:"folder",path:e.path}:"portal"===e.kind?void 0===e.page?null:{type:"page",page:e.page}:t?{type:"editor",path:e.path}:null}function s3(e,t){let{width:n,height:r}=e.getBoundingClientRect();return null!==t&&t.width===n&&t.height===r?t:{width:n,height:r}}function s5(){let e=(0,v.useRef)(null),[t,n]=(0,v.useState)(null),[r,o]=(0,v.useState)(null),i=(0,v.useCallback)(t=>{e.current=t,n(t)},[]);return(0,v.useLayoutEffect)(()=>{let t=e.current;if(null===t)return;let n=s3(t,r);n!==r&&o(n)}),(0,v.useEffect)(()=>{if(null===t)return;let e=new ResizeObserver(()=>o(e=>s3(t,e)));return e.observe(t),()=>e.disconnect()},[t]),[i,r]}let s4="rounded-md px-2.5 py-1 text-[14px] text-text hover:bg-node";function s6({box:e,position:t,onOpen:n,onTurnPage:r,onDetails:o,onOpenFile:i}){var a,l,s;let d,[u,c]=s5(),[h,f,p]=rB(e=>e.transform),g=rB(e=>e.width),m=rB(e=>e.height),x=(a={left:t.x*p+h,top:t.y*p+f,width:232*p,height:56*p},l=c??{width:0,height:0},d=Math.max(Math.min("bottom"==(s=a.top,s+a.height/2<m/2?"bottom":"top")?a.top+a.height+8:a.top-8-l.height,m-8-l.height),8),{left:Math.min(Math.max(a.left+a.width/2-l.width/2,8),g-8-l.width),top:d}),v=s2(e,void 0!==i);return(0,y.jsxs)("div",{ref:u,"data-box-actions":e.path,"data-keep-clear":!0,style:{left:x.left,top:x.top,visibility:null===c?"hidden":void 0},className:"absolute z-[6] flex items-center gap-1 rounded-lg bg-panel p-1",children:[v?.type==="folder"&&(0,y.jsx)("button",{type:"button",onClick:()=>n(v.path),title:"Open this folder (or double-click it)",className:s4,children:"Open"}),v?.type==="editor"&&(0,y.jsx)("button",{type:"button",onClick:()=>i?.(v.path),title:"Open in VS Code (or double-click it)",className:s4,children:"Open"}),v?.type==="page"&&(0,y.jsxs)("button",{type:"button",onClick:()=>r(v.page),title:`Go to page ${v.page+1} (or double-click the doorway)`,className:s4,children:["Go to page ",v.page+1]}),(0,y.jsx)("button",{type:"button",onClick:()=>o(e.path),title:"Show its details over the Map",className:s4,children:"Details"})]})}let s8=[{type:"target",position:g.Top,x:115.5,y:0,width:1,height:1},{type:"source",position:g.Bottom,x:115.5,y:55,width:1,height:1}];function s7(e,t,n){let r=new Map(e.map(e=>[e.id,e])),o=e.length===t.length,i=t.map((t,i)=>{let a=r.get(t.id);return void 0!==a&&n(a,t)?(e[i]!==a&&(o=!1),a):(o=!1,t)});return o?e:i}function s9(e,t){return e.position.x===t.position.x&&e.position.y===t.position.y&&e.data.box===t.data.box&&e.data.tone===t.data.tone&&e.data.agent===t.data.agent&&e.data.pulseKey===t.data.pulseKey&&e.data.dot===t.data.dot&&e.data.portal===t.data.portal}function de(e,t){return e.source===t.source&&e.target===t.target&&e.data?.points===t.data?.points&&e.data?.width===t.data?.width&&e.data?.headWidth===t.data?.headWidth&&e.data?.color===t.data?.color&&e.data?.count===t.data?.count&&e.data?.countStrong===t.data?.countStrong&&e.data?.labelAt?.x===t.data?.labelAt?.x&&e.data?.labelAt?.y===t.data?.labelAt?.y}function dt({words:e,at:t,pinned:n,held:r,cardRef:o,followRef:i,placedRef:a}){var l,s;let d,u,[c,h]=(0,v.useState)(t);(0,v.useLayoutEffect)(()=>{if(void 0!==i)return i.current=h,()=>{i.current=null}},[i]);let[f,p]=s5(),g=rB(e=>e.width),m=rB(e=>e.height),x={width:g,height:m},b=n?r??null:null,w=rB(e=>n?e.transform:null),k=null===w?{x:0,y:0}:{x:c.spot.x*w[2]+w[0]-c.point.x,y:c.spot.y*w[2]+w[1]-c.point.y},E=null===p?null:null!==b?(l=b,s=p,d=l.rises?s.height-l.height:0,u=l.tail?.side,{left:l.left,top:l.top-d,tail:l.tail&&("left"===u||"right"===u)?{side:l.tail.side,at:l.tail.at+d}:l.tail,rises:l.rises}):function(e,t,n,r,o,i,a){let{width:l,height:s}=r,d=n+1+7,u=t?[{left:e.x-d-l,top:e.y+16-s,tail:{side:"right",at:s-16},rises:!0},{left:e.x+d,top:e.y+16-s,tail:{side:"left",at:s-16},rises:!0},{left:e.x-d-l,top:e.y-16,tail:{side:"right",at:16},rises:!1},{left:e.x+d,top:e.y-16,tail:{side:"left",at:16},rises:!1}]:[{left:e.x+16-l,top:e.y-d-s,tail:{side:"bottom",at:l-16},rises:!0},{left:e.x-16,top:e.y-d-s,tail:{side:"bottom",at:16},rises:!0},{left:e.x+16-l,top:e.y+d,tail:{side:"top",at:l-16},rises:!1},{left:e.x-16,top:e.y+d,tail:{side:"top",at:16},rises:!1}],c=u.map(n=>{let r=t?Math.max(8,Math.min(n.top,o.height-8-s)):Math.max(8,Math.min(n.left,o.width-8-l)),i=(t?e.y:e.x)-r;return null===n.tail||i<12||i>(t?s:l)-12?n:{...n,...t?{top:r}:{left:r},tail:{side:n.tail.side,at:i}}}),h=[...u,...c],f=e=>({...e,width:l,height:s}),p=e=>e.left>=8&&e.top>=8&&e.left+l<=o.width-8&&e.top+s<=o.height-8,g=e=>[...i,...a].every(t=>!ac(f(e),t)),m={left:e.x-6,top:e.y-6,width:12,height:12},x=e=>!ac(f(e),m)&&a.every(t=>!ac(f(e),t)),y=u.map(e=>({...ah(e,r,o),tail:null,rises:e.rises})),v=[e.y-6-1-s,e.y+6+1].map(t=>({...ah({left:e.x-l/2,top:t},r,o),tail:null,rises:t<e.y}));return h.find(e=>p(e)&&g(e))??h.find(e=>p(e)&&x(e))??y.find(g)??[...y,...v].find(x)??y[0]}(c.point,c.upright,c.half,p,x,c.line,c.clear),M=E;if(n&&null!==E&&null!==p){let e={left:E.left+k.x,top:E.top+k.y},t=ah(e,p,x);M={...E,...t,tail:t.left===e.left&&t.top===e.top?E.tail:null}}(0,v.useLayoutEffect)(()=>{void 0!==a&&(a.current=null===M||null===p?null:{...M,...p})});let j=null!==b?Math.max(b.height,b.rises?b.top+b.height-8:m-8-b.top):Math.max(function(e,t,n,r,o){let i,a,l;if(!t)return Math.max(e.y-(n+1+7)-8,o.height-8-e.y-(n+1+7));let s=e.y>=20&&e.y<=o.height-8-12;return(i=e.x,a=n,l=r,Math.max(i-(a+1+7)-8,o.width-8-i-(a+1+7))>=l&&s)?o.height-16:Math.max(e.y-6-1-8,o.height-8-e.y-6-1)}(c.point,c.upright,c.half,p?.width??Math.min(280,g-16),x),46*!!n),_=!n&&"run"===e.kind&&j<46,S="run"!==e.kind||_?0:n?e.rows.length:function(e,t){let n=e<=6?e:5;for(;n>0&&10+18*(1+n+ +(n<e))>t;)n--;return n}(e.rows.length,j),N="run"!==e.kind||_?0:e.rows.length-S,C="one"===e.kind?e.sentence:e.title;return(0,y.jsxs)("div",{ref:e=>{f(e),o&&(o.current=e)},"data-line-card":n?"pinned":"hover","data-lines":"one"===e.kind?1:e.rows.length,role:n?"group":void 0,"aria-label":C,style:{left:M?.left??0,top:M?.top??0,width:b?.width,maxWidth:Math.min(280,g-16),maxHeight:n?Math.min(j,Math.max(b?.height??0,208)):void 0,visibility:null===M?"hidden":void 0},className:`absolute z-[8] flex w-max flex-col rounded-md border border-border bg-panel py-1 text-[12px] leading-[18px] text-text ${n?"nowheel":"pointer-events-none"}`,children:["one"===e.kind?(0,y.jsxs)("p",{className:"flex whitespace-nowrap px-2",children:[(0,y.jsx)("span",{className:"truncate",title:e.parts.who,children:e.parts.who}),(0,y.jsxs)("span",{className:"shrink-0 whitespace-pre",children:[" ",e.parts.verb," "]}),(0,y.jsx)("span",{className:"truncate",title:e.parts.whom,children:e.parts.whom}),(0,y.jsxs)("span",{className:"shrink-0 whitespace-pre",children:[", ",e.parts.imports]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("p",{className:"flex shrink-0 gap-3 whitespace-nowrap px-2",children:[(0,y.jsx)("span",{className:"truncate font-medium",title:e.title,children:e.title}),(0,y.jsx)("span",{className:"ml-auto shrink-0 text-text-3",children:_?`${aA(e.rows.length)} lines`:"imports"})]}),(0,y.jsx)("ul",{className:n?"min-h-0 overflow-y-auto overscroll-contain":void 0,children:e.rows.slice(0,S).map(e=>(0,y.jsxs)("li",{className:"flex gap-3 whitespace-nowrap px-2",children:[(0,y.jsx)("span",{className:"truncate text-text-2",title:e.name,children:e.name}),(0,y.jsx)("span",{className:"ml-auto shrink-0 tabular-nums",children:aA(e.count)})]},e.id))}),N>0&&(0,y.jsxs)("p",{title:`and ${aA(N)} more, click to see all`,className:"shrink-0 truncate px-2 text-text-3",children:["and ",aA(N)," more, click to see all"]})]}),M?.tail&&(0,y.jsx)(dn,{side:M.tail.side,at:M.tail.at})]})}function dn({side:e,at:t}){let n="top"===e||"bottom"===e,r="bottom"===e?{left:t-6-1,top:"100%"}:"top"===e?{left:t-6-1,bottom:"100%"}:"right"===e?{top:t-6-1,left:"100%"}:{top:t-6-1,right:"100%"},o="bottom"===e?"M 0 0 L 6 8 L 12 0":"top"===e?"M 0 8 L 6 0 L 12 8":"right"===e?"M 0 0 L 8 6 L 0 12":"M 8 0 L 0 6 L 8 12";return(0,y.jsx)("svg",{"aria-hidden":!0,"data-tail":e,width:n?12:8,height:n?8:12,style:r,className:"absolute overflow-visible fill-panel stroke-border",children:(0,y.jsx)("path",{d:o,strokeWidth:1,strokeLinejoin:"round"})})}function dr(e,t){return t?`color-mix(in srgb, ${e} var(--fade), var(--canvas))`:e}function di(e,t){return"selected"===e?"var(--accent)":"linked"===e?"var(--linked-border)":"preview"===e||t?"var(--text-3)":"var(--border)"}let da={previous:aw,next:ak,many:ab("outline","stack-2","Stack2",[["path",{d:"M12 4l-8 4l8 4l8 -4l-8 -4",key:"svg-0"}],["path",{d:"M4 12l8 4l8 -4",key:"svg-1"}],["path",{d:"M4 16l8 4l8 -4",key:"svg-2"}]])};function dl({box:e,tone:t,dot:n}){let r=dr("linked"===t?"var(--linked-glyph)":"preview"===t?"var(--text-2)":"var(--glyph-dim)","faded"===t);return(0,y.jsx)("svg",{"aria-hidden":!0,width:24,height:24,viewBox:"0 0 24 24",className:"absolute left-[12px] top-[16px]",children:"selected"===t?(0,y.jsx)("circle",{cx:12,cy:12,r:n/2,fill:"var(--core)",stroke:"var(--accent)",strokeWidth:3}):"folder"===e.kind?(0,y.jsx)("circle",{cx:12,cy:12,r:n/2,fill:r}):(0,y.jsx)("path",{d:"M7 5 h6 l4 4 v10 h-10 z M13 5 v4 h4",fill:"none",stroke:r,strokeWidth:1.4,strokeLinejoin:"round"})})}let ds=(0,v.memo)(function({data:e}){let t,{box:n,tone:r,agent:o,pulseKey:i,portal:a,dot:l}=e,s="faded"===r,d="selected"===r,u=a?`${a.title}, ${a.caption}. ${"many"===a.direction?"Select it to pick a page.":"Double-click to go there."}`:(t=n.path||n.name,n.tagline?`${t}: ${n.tagline}`:t),c=d?"var(--node-sel)":a?"transparent":dr("var(--node)",s),h=a?da[a.direction]:null;return(0,y.jsxs)("div",{"data-box":n.path,"data-tone":r,title:u,style:{background:c},className:`relative h-[56px] w-[232px] rounded-[5px] ${o?"outline-2 outline-offset-2 outline-agent":""}`,children:[i>0&&(0,y.jsx)("span",{"aria-hidden":!0,className:"neb-pulse pointer-events-none absolute inset-0 rounded-[5px]"},i),(0,y.jsx)("span",{"aria-hidden":!0,style:{borderColor:dr(di(r,void 0!==a),s),borderWidth:d?1.5:1},className:`pointer-events-none absolute inset-0 rounded-[5px] ${a?"border-dashed":"border-solid"}`}),h?(0,y.jsx)(h,{"aria-hidden":!0,size:16,stroke:1.75,className:"absolute left-[16px] top-[20px]",style:{color:dr("var(--text-3)",s)}}):(0,y.jsx)(dl,{box:n,tone:r,dot:l}),a?(0,y.jsxs)("div",{className:"absolute inset-y-0 left-[44px] right-[14px] flex flex-col justify-center",children:[(0,y.jsx)("div",{className:"truncate text-[13px] font-medium leading-[18px]",style:{color:dr("var(--text)",s)},children:a.title}),(0,y.jsx)("div",{className:"truncate text-[11.5px] leading-4",style:{color:dr("var(--text-3)",s)},children:a.caption})]}):(0,y.jsxs)("div",{className:"absolute inset-y-0 left-[44px] right-[14px] flex items-center gap-2",children:[(0,y.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[12.5px]",style:{color:dr("var(--text)",s)},children:n.name}),"folder"===n.kind&&(0,y.jsx)("span",{className:"shrink-0 text-[11.5px] tabular-nums",style:{color:dr("var(--text-2)",s)},children:aA(n.fileCount)})]}),(0,y.jsx)(oB,{type:"target",position:g.Top,className:"!opacity-0"}),(0,y.jsx)(oB,{type:"source",position:g.Bottom,className:"!opacity-0"})]})});function dd(e,t){return t<=1||e<=1?1:1+5*Math.log(e)/Math.log(t)}function du(e){return{half:Math.max(4.5,.9*e+3),length:Math.max(7,1.2*e+5)}}let dc=e=>Math.max(0,...e.filter(e=>"folder"===e.kind).map(e=>e.fileCount)),dh=e=>Math.max(0,...e.map(e=>e.count));function df(e){let t=dh(e),n=new Map;for(let r of e)r.source!==r.target&&n.set(r.target,Math.max(n.get(r.target)??0,dd(r.count,t)));return n}function dp(e,t){let n=e=>`${e.source}->${e.target}`,r=e.filter(e=>e.count>1);return new Set([...r.filter(e=>e.source!==e.target).sort((e,t)=>t.count-e.count||(e.source<t.source?-1:+(e.source>t.source))||(e.target<t.target?-1:+(e.target>t.target))).slice(0,3).map(n),...null===t?[]:r.filter(e=>e.source===t||e.target===t).map(n)])}let dg=[.5,.3,.7,.15,.85,0,1];function dm(e){let t=e.intoChannel>e.outChannel;return void 0===e.lane?[{line:e,channel:e.outChannel,arrives:!0,ends:[{x:e.portOut,dir:"up",port:"out"},{x:e.portIn,dir:"down",port:"in"}]}]:[{line:e,channel:e.outChannel,arrives:!1,ends:[{x:e.portOut,dir:"up",port:"out"},{x:e.lane,dir:t?"down":"up"}]},{line:e,channel:e.intoChannel,arrives:!0,ends:[{x:e.lane,dir:t?"up":"down"},{x:e.portIn,dir:"down",port:"in"}]}]}let dx=e=>e.x+116,dy=(e,t)=>e.key<t.key?-1:+(e.key>t.key),dv=e=>[Math.min(...e.ends.map(e=>e.x)),Math.max(...e.ends.map(e=>e.x))],db=e=>`${e.edge.target} ${e.intoChannel<e.outChannel?"up":"down"}`,dw=e=>e.arrives?`in ${e.line.edge.target}`:`out ${e.line.edge.source}`,dk=e=>e>.5&&e<24-1e-6;function dE(e,t){for(let n of e.lines)"out"===e.side?n.portOut=t:n.portIn=t}function dM(e,t){for(let n of(e.x=t,e.lines))n.lane=t}function dj(e,t,n,r,o){let i=e.flat();if(0===i.length)return t;let a=n/2+16,l=i.map(e=>[e-a,e+232+a]).sort((e,t)=>e[0]-t[0]),s=[];for(let[e,t]of l){let n=s[s.length-1];n&&e<=n[1]?n[1]=Math.max(n[1],t):s.push([e,t])}let d=o.filter(e=>dS(e.span,r)),u=e=>d.every(t=>Math.abs(t.x-e)>=(t.width+n)/2+8-1e-6),c=e=>(e+n)/2+8,h=[],f=s[0][0]+a-28;h.push({lo:-1/0,hi:s[0][0],start:f});for(let e=0;e+1<s.length;e++){let[t,n]=[s[e][1],s[e+1][0]];n>=t&&h.push({lo:t,hi:n,start:(t+n)/2})}let p=s[s.length-1][1]-a+28;h.push({lo:s[s.length-1][1],hi:1/0,start:p});let g=[];for(let e of h){let t=[e.start,...d.flatMap(e=>[e.x-c(e.width),e.x+c(e.width)])].filter(t=>t>=e.lo&&t<=e.hi&&u(t)).filter(t=>-1/0===e.lo?t<=e.start:1/0!==e.hi||t>=e.start);t.length>0&&g.push(t.reduce((t,n)=>Math.abs(n-e.start)<Math.abs(t-e.start)?n:t))}return 0===g.length?h.reduce((e,n)=>Math.abs(n.start-t)<Math.abs(e-t)?n.start:e,h[0].start):g.reduce((e,n)=>{let[r,o]=[Math.abs(n-t),Math.abs(e-t)];return r<o||r===o&&n<e?n:e})}function d_(e,t,n,r,o){let i=n/2+16,a=e.flat().every(e=>t<=e-i||t>=e+232+i),l=o.every(e=>!dS(e.span,r)||Math.abs(e.x-t)>=(e.width+n)/2+8-1e-6);return a&&l}let dS=(e,t)=>e[0]<=t[1]&&t[0]<=e[1];function dN(e){let t=new Map(e.map(e=>[e,new Set])),n=new Map(e.map(e=>[e,new Set]));for(let r of e)for(let o of e)r!==o&&(dA(r,o)?n.get(o).add(r):dP(r,o)&&t.get(o).add(r));let r=[],o=new Set(e);for(;o.size>0;){let e=e=>[...t.get(e)].filter(e=>o.has(e)).length,i=[...o].filter(e=>[...n.get(e)].every(e=>!o.has(e))),a=(i.length>0?i:[...o]).sort((t,n)=>e(t)-e(n)||t.line.width-n.line.width||dy(t.line,n.line))[0];r.push(a),o.delete(a)}return r}function dC(e){if(1===e.length)return e[0];let t=e.reduce((e,t)=>t.line.width>e.line.width||t.line.width===e.line.width&&0>dy(t.line,e.line)?t:e),n=e.flatMap(e=>e.ends).filter((e,t,n)=>n.findIndex(t=>1e-6>Math.abs(t.x-e.x)&&t.dir===e.dir)===t);return{line:t.line,channel:t.channel,arrives:t.arrives,ends:n,members:[...e]}}function d$(e,t,n,r=new Map){let o=dO(e,t,n,r,!0);return!function(e,t,n){let r=new Map;for(let[t,o]of e){let e=o!==n.get(t);for(let n=1;n<o.length;n++){let[i,a]=[o[n-1],o[n]];i.x===a.x&&(r.has(i.x)||r.set(i.x,[]),r.get(i.x).push({key:t,fresh:e,lo:Math.min(i.y,a.y),hi:Math.max(i.y,a.y)}))}}for(let e of r.values())for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let[o,i]=[e[n],e[r]];if(o.key===i.key||!o.fresh&&!i.fresh)continue;let[a,l]=[t.get(o.key),t.get(i.key)];if(a.source!==l.source&&a.target!==l.target&&Math.min(o.hi,i.hi)-Math.max(o.lo,i.lo)>1)return!0}return!1}(o,new Map(t.map(e=>[`${e.source}->${e.target}`,e])),r)?o:dO(e,t,n,r,!1)}function dO(e,t,n,r,o){let i=dh(t),a=df(t),l=t.filter(t=>t.source!==t.target&&e.has(t.source)&&e.has(t.target)),s=void 0===n?l:l.filter(e=>n.has(`${e.source}->${e.target}`)),d=[...new Set(l.flatMap(e=>[e.source,e.target]))],u=[...new Set(d.map(t=>e.get(t).y))].sort((e,t)=>e-t),c=u.map(t=>d.filter(n=>e.get(n).y===t).map(t=>e.get(t).x)),h=s.map(t=>{let n=e.get(t.source),r=e.get(t.target),o=dd(t.count,i);return{key:`${t.source}->${t.target}`,edge:t,width:o,head:du(a.get(t.target)),s:n,t:r,outChannel:u.indexOf(n.y)+1,intoChannel:u.indexOf(r.y)}}),f=new Map;for(let e of h){let t=r.get(e.key);void 0!==t&&function(e,t,n){if(t.length<2||t[0].y!==e.s.y+56||t[t.length-1].y!==e.t.y)return!1;if(e.portOut=t[0].x,e.portIn=t[t.length-1].x,e.outChannel===e.intoChannel)return!0;let r=n[Math.min(e.outChannel,e.intoChannel)]+28,o=t.slice(1).findIndex((e,n)=>e.x===t[n].x&&Math.min(e.y,t[n].y)<=r&&r<=Math.max(e.y,t[n].y));return!(o<0)&&(e.lane=t[o].x,!0)}(e,t,u)&&f.set(e,t)}let p=h.filter(e=>!f.has(e)),g=new Map,m=new Map;for(let e of f.keys())g.set(e.edge.source,e.portOut),m.set(e.edge.target,e.portIn);let x=e=>[Math.min(e.outChannel,e.intoChannel),Math.max(e.outChannel,e.intoChannel)],y=e=>c.slice(e[0],e[1]),v=[],b=(e,t,n)=>{e.lines.push(t),e.width=Math.max(e.width,t.width),e.span=[Math.min(e.span[0],n[0]),Math.max(e.span[1],n[1])],e.rows=y(e.span)},w=[];for(let e of f.keys()){if(void 0!==e.lane){let[t,n]=[db(e),x(e)],r=v.find(n=>n.group===t&&1e-6>Math.abs(n.x-e.lane));void 0!==r?b(r,e,n):v.push({x:e.lane,width:e.width,span:n,group:t,lines:[e],kept:!0,rows:y(n)})}w.push({x:e.portOut,width:e.width,span:[e.outChannel,e.outChannel]},{x:e.portIn,width:e.width,span:[e.intoChannel,e.intoChannel]})}let k=(e,t)=>[...w,...v.filter(n=>n!==e&&(void 0===t||n.group!==t))];for(let e of p.filter(e=>e.outChannel!==e.intoChannel).sort((e,t)=>dx(e.s)+dx(e.t)-(dx(t.s)+dx(t.t))||dy(e,t))){let t=x(e),n=y(t),r=db(e),o=(dx(e.s)+dx(e.t))/2,i=dj(n,o,e.width,t,k(null,r)),a=d_(n,i,e.width,t,k(null,r)),l=g.get(e.edge.source),s=e=>void 0!==l&&dk(Math.abs(l-e)),d=v.filter(o=>o.group===r&&60>Math.abs(o.x-i)&&!s(o.x)&&(!a||d_(n,o.x,e.width,t,k(o))||Math.abs(o.x-i)<(o.width+e.width)/2+8&&d_(n,o.x,e.width,t,[])&&k(o).every(n=>!dS(n.span,t)||Math.abs(n.x-o.x)>=Math.min(Math.abs(n.x-i),(n.width+e.width)/2+8)-1))).sort((e,t)=>Math.abs(e.x-i)-Math.abs(t.x-i)||e.x-t.x)[0];if(void 0!==d){e.lane=d.x,b(d,e,t);continue}e.lane=a&&d_(n,i,e.width,t,k(null))?i:dj(n,o,e.width,t,k(null)),v.push({x:e.lane,width:e.width,span:t,group:r,lines:[e],kept:!1,rows:n})}for(let e of p)e.portOut=g.get(e.edge.source)??dx(e.s),e.portIn=m.get(e.edge.target)??dx(e.t);let E=new Map,M=(t,n)=>{let r="out"===n?t.edge.source:t.edge.target,o=`${n} ${r}`;return E.has(o)||E.set(o,{box:e.get(r),side:n,lines:[],fixed:("out"===n?g:m).has(r)}),E.get(o)};for(let e of h)for(let t of["out","in"])M(e,t).lines.push(e);let j=(e,t)=>d_(e.rows,t,e.width,e.span,k(e)),_=v.filter(e=>!e.kept);for(let e of _){if(1!==e.lines.length)continue;let[t]=e.lines,n=[t.portOut,t.portIn].find(t=>j(e,t));void 0!==n&&dM(e,n)}let S=void 0===n?[]:l.filter(t=>{let r,o;return!n.has(`${t.source}->${t.target}`)&&(r=e.get(t.target),u.indexOf(r.y)===(o=e.get(t.source),u.indexOf(o.y)+1))}).map(t=>({out:E.get(`out ${t.source}`)??dx(e.get(t.source)),in:E.get(`in ${t.target}`)??dx(e.get(t.target))}));for(let e of(!function(e,t,n,r,o,i,a){let l={out:new Map,in:new Map};for(let e of t)for(let t of e.lines)l[e.side].set(t,e);let s=new Map;for(let e of n)for(let t of e.lines)s.set(t,e);let d=e=>"out"===e.side?e.lines[0].portOut:e.lines[0].portIn,u=new Map;for(let e of i)for(let t of[e.out,e.in])"number"!=typeof t&&u.set(t,[...u.get(t)??[],e]);let c=e=>"number"==typeof e?e:d(e),h=new Map;for(let t of e)for(let e of new Set([t.outChannel,t.intoChannel]))h.set(e,[...h.get(e)??[],t]);let f=new Map,p=e=>{f.has(e)||f.set(e,h.get(e).flatMap(dm).filter(t=>t.channel===e));let t=f.get(e);for(let{line:e,arrives:n,ends:r}of t)r[0].x=void 0!==e.lane&&n?e.lane:e.portOut,r[1].x=void 0===e.lane||n?e.portIn:e.lane;return t},g=e=>dk(Math.abs(e.ends[0].x-e.ends[1].x)),m=(e,t)=>(e.line.width+t.line.width)/2+8-1e-6,x=(e,t,n,r,o)=>{let i;return Math.abs(n.x-o.x)<m(t,r)&&(!(1e-6>Math.abs(n.x-o.x))||(t.line.edge.source!==r.line.edge.source||"out"!==n.port&&"out"!==o.port)&&(t.line.edge.target!==r.line.edge.target||"in"!==n.port&&"in"!==o.port))&&!(1e-6>Math.abs(n.x-o.x)&&(i=n.x,a&&e.some(e=>1e-6>Math.abs(e.ends[0].x-i)&&1e-6>Math.abs(e.ends[1].x-i))))},y=(e,t,n)=>{let r=t.ends[n];return g(t)||e.some(n=>n.line!==t.line&&n.ends.some(o=>o.dir!==r.dir&&x(e,t,r,n,o)))},v=(e,t,n,r)=>{let i=n.ends[r],a=n.ends[1-r].x,h=n.line,f=new Set([a,a-24,a+24]);for(let e of t){if(e.line===h)continue;let t=m(n,e)+2e-6;for(let n of e.ends)n.dir!==i.dir&&f.add(n.x-t).add(n.x+t)}let p=[];if(void 0!==i.port){let t=l[i.port].get(h);if(t.fixed)return p;let n=d(t);for(let e of u.get(t)??[]){let n=c("out"===t.side?e.in:e.out);f.add(n).add(n-24).add(n+24)}for(let r of f)1e-6>Math.abs(r-n)||r<t.box.x+20-1e-6||r>t.box.x+232-20+1e-6||p.push({cost:Math.abs(r-n)*t.lines.length,lines:new Set(t.lines),channels:[e],apply:()=>dE(t,r),restore:()=>dE(t,n),valid:()=>!0,point:t})}else{let e=s.get(h);if(void 0===e)return p;let t=e.x,n=[...new Set(e.lines.flatMap(e=>[e.outChannel,e.intoChannel]))];for(let r of f)1e-6>Math.abs(r-t)||p.push({cost:Math.abs(r-t)*e.lines.length,lines:new Set(e.lines),channels:n,apply:()=>dM(e,r),restore:()=>dM(e,t),valid:()=>o(e,r)})}return p},b=e=>{let t;return e.channels.reduce((t,n)=>t+((e,t)=>{let n=p(e),r=new Map;for(let e of n)for(let t of e.ends){let n=Math.floor(t.x/16);r.has(n)||r.set(n,[]),r.get(n).push({run:e,end:t})}let o=e=>void 0===t||t.has(e.line),i=0;for(let e of n)if(o(e))for(let t of(g(e)&&(i+=1),e.ends)){let a=e.line.width/2+3+8;for(let l=Math.floor((t.x-a)/16);l<=Math.floor((t.x+a)/16);l++)for(let a of r.get(l)??[])!(a.run.line===e.line||a.end.dir===t.dir||"down"===t.dir&&o(a.run))&&x(n,e,t,a.run,a.end)&&(i+=2)}return i})(n,e.lines),0)+(void 0===e.point?0:.01*(t=e.point,(u.get(t)??[]).filter(e=>dk(Math.abs(c(e.out)-c(e.in)))).length))},w=0;for(let e=0;e<3&&w<4e3;e++){let e=!1;for(let t of[...h.keys()].sort((e,t)=>e-t)){let n=p(t);for(let o of[...n.filter(g),...n.filter(e=>!g(e))]){if(w>4e3)break;if(r.has(o.line))continue;p(t);let i=[0,1].filter(e=>y(n,o,e));if(0===i.length)continue;let a=null;for(let e of i.flatMap(e=>v(t,n,o,e)).sort((e,t)=>e.cost-t.cost)){if(++w>4e3)break;let t=b(e);e.apply();let n=e.valid()?t-b(e):0;e.restore(),n>0&&(null===a||n>a.gain)&&(a={move:e,gain:n})}null!==a&&(a.move.apply(),e=!0)}}if(!e)break}}(h,[...E.values()],_,new Set(f.keys()),j,S,o),p)){let t=Math.abs(e.portOut-e.portIn);if(void 0!==e.lane||0===t||t>.5)continue;let[n,r]=[M(e,"out"),M(e,"in")];r.fixed?n.fixed||dE(n,e.portIn):dE(r,e.portOut)}for(let e of _){let t=e.lines.flatMap(e=>[e.portIn,e.portOut]),n=t.find(t=>.5>=Math.abs(e.x-t));void 0===n||t.includes(e.x)||dM(e,n)}let N=p.flatMap(dm),C=[...f.keys()].flatMap(e=>dm(e).map(t=>{var n,r,o;return{...t,y:(n=f.get(e),r=t.channel,o=u,n.slice(1).find((e,t)=>{let i;return e.y===n[t].y&&(i=e.y,o.filter(e=>e+56<=i).length===r)})?.y)}})),$=new Map;for(let e of N)1e-6>Math.abs(e.ends[0].x-e.ends[1].x)||$.set(e.channel,[...$.get(e.channel)??[],e]);for(let[e,t]of $){let n=new Map;for(let e of t)n.set(dw(e),[...n.get(dw(e))??[],e]);let r=C.filter(t=>t.channel===e&&void 0!==t.y),o=h.filter(t=>t.intoChannel===e),i=[];for(let[t,a]of n){let n=r.filter(e=>dw(e)===t),l=r.filter(e=>dw(e)!==t),s=[];for(let t of a){let[i,a]=dv(t),d=[...new Set(n.map(e=>e.y))].map(e=>{let t=n.filter(t=>t.y===e).map(dv),r=[Math.min(...t.map(e=>e[0])),Math.max(...t.map(e=>e[1]))];return{y:e,covered:r,past:Math.max(0,r[0]-i)+Math.max(0,a-r[1])}}).sort((e,t)=>e.past-t.past||e.y-t.y).find(n=>(function(e,t,n,r,o,i,a){let[l,s]=dv(e),d=[];return l<n[0]-1e-6&&d.push([l,n[0]]),s>n[1]+1e-6&&d.push([n[1],s]),d.every(([n,l])=>r.every(r=>{let[o,i]=dv(r),a=(r.line.width+e.line.width)/2+4;return l+a<=o||i+a<=n||Math.abs(t-r.y)>=(r.line.width+e.line.width)/2+8-1e-6&&!(dA(e,r)&&t>r.y)&&!(dA(r,e)&&t<r.y)})&&o.every(r=>r.edge.target===e.line.edge.target||r.portIn+r.head.half+e.line.width/2<=n||r.portIn-r.head.half-e.line.width/2>=l||t<=a[i]-r.head.length-3-3+1e-6))})(t,n.y,n.covered,l,o,e,u));if(void 0===d){s.push(t);continue}t.y=d.y,r.push(t)}s.length>0&&i.push(s)}let a=i.map(dC);if(r.length>0)!function(e,t,n,r){let o=[...n],i=dz(e,r),a=e<=0?Math.min(i,r[0]-12):e>=r.length?Math.max(i,r[r.length-1]+56+12):i;for(let n of dN(t)){let t,[l,s]=dv(n),d=o.filter(e=>{let[t,r]=dv(e),o=(e.line.width+n.line.width)/2+4;return!(s+o<=t||r+o<=l)}),u=o.filter(e=>e.arrives&&e.line.portIn+e.line.head.half+n.line.width/2>l&&e.line.portIn-e.line.head.half-n.line.width/2<s),c=Math.max(n.arrives?n.line.head.length:0,...u.map(e=>e.line.head.length))+3;for(let[o,i,l]of[[12,8,8],[3,3,8],[3,3,1]]){let s=e>0?r[e-1]+56+o:-1/0,u=e<r.length?r[e]-c-i:1/0,h=e=>(e.line.width+n.line.width)/2+l,f=[a,s,u,...d.flatMap(e=>[e.y-h(e),e.y+h(e)])].filter(Number.isFinite).filter(e=>e>=s-1e-6&&e<=u+1e-6&&d.every(t=>Math.abs(e-t.y)>=h(t)-1e-6&&!(dA(n,t)&&e>t.y)&&!(dA(t,n)&&e<t.y))),p=e=>Math.abs(e-a)+1e3*d.filter(t=>dP(n,t)&&e>t.y||dP(t,n)&&e<t.y).length;if(f.length>0){t=f.reduce((e,t)=>p(t)<p(e)||p(t)===p(e)&&t<e?t:e);break}}n.y=t??i,o.push(n)}}(e,a,r,u);else{let t=[];for(let e of dN(a)){let[n,r]=dv(e),o=t=>t.every(t=>{let[o,i]=dv(t),a=(t.line.width+e.line.width)/2+4;return r+a<=o||i+a<=n}),i=Math.max(-1,...t.flatMap((t,n)=>t.some(t=>dP(t,e))?[n]:[]))+1;for(;i<t.length&&!o(t[i]);)i++;i===t.length&&t.push([]),t[i].push(e),e.track=i}!function(e,t,n){let r=t.map(e=>Math.max(...e.map(e=>e.line.width))),o=r.slice(1).map((e,t)=>(r[t]+e)/2+8),i=r.slice(1).map((e,t)=>(r[t]+e)/2+1),a=o.reduce((e,t)=>e+t,0),l=i.reduce((e,t)=>e+t,0),s=Math.max(0,...t.flat().filter(e=>e.arrives).map(e=>e.line.head.length))+3,d=e>0?n[e-1]+56+12:-1/0,u=e<n.length?n[e]-s-8:1/0,c=o;if(Number.isFinite(d)&&Number.isFinite(u)&&a>u-d){l>u-d&&(d=n[e-1]+56+3),l>u-d&&(u=n[e]-s-3);let t=Math.max(0,u-d),r=a===l?0:Math.max(0,Math.min(1,(t-l)/(a-l)));c=l>t?i.map(e=>e*t/l):o.map((e,t)=>i[t]+(e-i[t])*r)}let h=c.reduce((e,t)=>e+t,0),f=dz(e,n)-h/2,p=f=e<=0?Math.min(dz(e,n),u)-h:e>=n.length?Math.max(dz(e,n),d):Math.max(d,Math.min(f,u-h));t.forEach((e,t)=>{for(let n of(t>0&&(p+=c[t-1]),e))n.y=p})}(e,t,u)}for(let e of a)for(let t of e.members??[])t.y=e.y}let O=new Map,A=new Map;for(let e of N)A.set(e.line,[...A.get(e.line)??[],e]);for(let e of h){if(f.has(e)){O.set(e.key,f.get(e));continue}let[t,n]=A.get(e),r={x:e.portOut,y:e.s.y+56},o={x:e.portIn,y:e.t.y},i=e=>e.y??dz(e.channel,u),a=void 0===e.lane?[r,{x:r.x,y:i(t)},{x:o.x,y:i(t)},o]:[r,{x:r.x,y:i(t)},{x:e.lane,y:i(t)},{x:e.lane,y:i(n)},{x:o.x,y:i(n)},o];O.set(e.key,function(e){let t=e.filter((t,n)=>0===n||t.x!==e[n-1].x||t.y!==e[n-1].y);return t.filter((e,n)=>{if(0===n||n===t.length-1)return!0;let[r,o]=[t[n-1],t[n+1]];return(r.x!==e.x||e.x!==o.x)&&(r.y!==e.y||e.y!==o.y)})}(a))}return O}function dA(e,t){let n=(e.line.width+t.line.width)/2+1;return e.ends.some(e=>"up"===e.dir&&t.ends.some(t=>"down"===t.dir&&Math.abs(e.x-t.x)<n))}function dP(e,t){let n=(e,t)=>{let[n,r]=dv(t);return e>n&&e<r};return dA(e,t)||e.ends.some(e=>"up"===e.dir&&n(e.x,t))||t.ends.some(t=>"down"===t.dir&&n(t.x,e))}function dz(e,t){return e<=0?t[0]-32:e>=t.length?t[t.length-1]+56+32:(t[e-1]+56+t[e])/2}function dL(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y);return{x:e.x+(t.x-e.x)*n/r,y:e.y+(t.y-e.y)*n/r}}let dR=(e,t)=>2*Math.abs(e.x-t.x)<e.width+t.width&&2*Math.abs(e.y-t.y)<e.height+t.height,dI=(0,v.memo)(function({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,data:i,interactionWidth:a}){let l=i&&i.points.length>=2?i.points:[{x:t,y:n},{x:r,y:o}],s=i?.width??1,d=i?.color??"var(--edge-dim)",{half:u,length:c}=du(i?.headWidth??s),h=l[l.length-1],f={x:h.x,y:h.y-3},p=[...l.slice(0,-1),{x:f.x,y:f.y-c+1}],g=i?.labelAt!==void 0?i.count:void 0,m=`M ${f.x-u} ${f.y-c} L ${f.x+u} ${f.y-c} L ${f.x} ${f.y} Z`;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(o4,{id:e,path:function(e,t=8){if(e.length<2)return"";let n=`M ${e[0].x} ${e[0].y}`;for(let r=1;r<e.length-1;r++){let[o,i,a]=[e[r-1],e[r],e[r+1]],l=Math.min(t,Math.hypot(i.x-o.x,i.y-o.y)/2,Math.hypot(a.x-i.x,a.y-i.y)/2),s=dL(i,o,l),d=dL(i,a,l);n+=` L ${s.x} ${s.y} Q ${i.x} ${i.y} ${d.x} ${d.y}`}let r=e[e.length-1];return`${n} L ${r.x} ${r.y}`}(p),style:{stroke:d,strokeWidth:s,strokeLinecap:"butt",strokeLinejoin:"round"},interactionWidth:Math.max(a??20,s+10)}),(0,y.jsx)("path",{d:m,fill:d,stroke:d,strokeWidth:1,strokeLinejoin:"round",className:"pointer-events-none"}),g&&i?.labelAt&&(0,y.jsx)(iH,{children:(0,y.jsx)("div",{"data-edge-label":e,"data-edge-count":g,style:{transform:`translate(-50%, -50%) translate(${i.labelAt.x}px, ${i.labelAt.y}px)`,zIndex:1001},className:`pointer-events-none absolute whitespace-nowrap rounded-[4px] border border-divider bg-canvas px-1.5 text-[11.5px] leading-[16px] tabular-nums ${i.countStrong?"text-text":"text-text-3"}`,children:g})})]})});function dD(e,t,n){let r=n.x-t.x,o=n.y-t.y,i=r*r+o*o;if(0===i)return t;let a=Math.min(1,Math.max(0,((e.x-t.x)*r+(e.y-t.y)*o)/i));return{x:t.x+a*r,y:t.y+a*o}}let dB=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),dT=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),dF=e=>"#"+e.map(e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,"0")).join("").toUpperCase();function dH(e,t,n){let[r,o]=[dT(e),dT(t)];return dF(r.map((e,t)=>e+(o[t]-e)*n))}function dV(e,t="#000000"){let n=e.trim().toLowerCase(),r=null,o=/^#([0-9a-f]{3,8})$/.exec(n);if(o&&[3,4,6,8].includes(o[1].length)){let e=o[1].length<=4?[...o[1]].map(e=>e+e).join(""):o[1];r=[0,2,4,6].map(t=>t<e.length?parseInt(e.slice(t,t+2),16):255),r[3]/=255}let i=/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*(?:,\s*([\d.]+%?)\s*)?\)$/.exec(n);if(i){let e=void 0===i[4]?1:i[4].endsWith("%")?parseFloat(i[4])/100:parseFloat(i[4]);r=[Number(i[1]),Number(i[2]),Number(i[3]),e]}if(null===r||r.some(e=>Number.isNaN(e)))return null;let[a,l,s,d]=r,u=dT(t),c=Math.min(1,Math.max(0,d));return dF([a,l,s].map((e,t)=>u[t]+(e-u[t])*c))}let dq=new Set(["dark","light","hc","hc-light"]);function dW(){let e=document.documentElement.getAttribute("data-kind");return null!==e&&dq.has(e)?e:"dark"}function dX(e){let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-kind"]}),()=>t.disconnect()}function dY(e){if(0===e.size)return{x:0,y:0,width:0,height:0};let t=1/0,n=1/0,r=-1/0,o=-1/0;for(let{x:i,y:a}of e.values())t=Math.min(t,i),n=Math.min(n,a),r=Math.max(r,i+232),o=Math.max(o,a+56);return{x:t,y:n,width:r-t,height:o-n}}function dK(e){let t=1/0,n=1/0,r=-1/0,o=-1/0;for(let{points:i,width:a,headHalf:l}of e){if(0===i.length)continue;for(let{x:e,y:l}of i)t=Math.min(t,e-a/2),n=Math.min(n,l-a/2),r=Math.max(r,e+a/2),o=Math.max(o,l+a/2);let e=i[i.length-1];t=Math.min(t,e.x-l),r=Math.max(r,e.x+l)}return 1/0===t?null:{x:t,y:n,width:r-t,height:o-n}}function dU(e,t){let n=dh(t),r=df(t),o=new Map(t.map(e=>[aN(e),e]));return dK([...e].flatMap(([e,t])=>{let i=o.get(e);if(void 0===i)return[];let a=dd(i.count,n);return[{points:t,width:a,headHalf:du(r.get(i.target)??a).half}]}))}function dZ(e,t,n){let r=e+t/2,o=t/2+.15*t/2;if(void 0===n)return{middle:r,size:2*o};let i=Math.max(o,r-(n.start-16)),a=Math.max(o,n.start+n.size+16-r);return{middle:r+(a-i)/2,size:i+a}}function dG(e,t){let n=dZ(e.x,e.width,t&&{start:t.x,size:t.width}),r=dZ(e.y,e.height,t&&{start:t.y,size:t.height});return{middle:{x:n.middle,y:r.middle},width:n.size,height:r.size}}let dQ=(e,t)=>Math.min(1,t.width/e.width,t.height/e.height);function dJ(e,t,n){let r=dG(e);if(null===t)return r;let o=dG(e,t);return dQ(o,n)>=.85*dQ(r,n)?o:r}function d0(e,t,n=0,r=null){let o=t.height-n,i=(e,r)=>({x:t.width/2-e.middle.x*r,y:n+o/2-e.middle.y*r,zoom:r});if(0===e.width||0===e.height||0===t.width||0===t.height)return i(dG(e),1);let a={width:t.width,height:o},l=dG(e),s=dQ(l,a);if(s>=.75){let t=dJ(e,r,a),n=dQ(t,a);return n>=.75?i(t,n):i(l,s)}let d=e=>Math.min(1,Math.max(.75,(t.width-144)/e)),u=d(e.width),c=e.x+e.width/2;if(null!==r){let t=Math.min(e.x,r.x),n=Math.max(e.x+e.width,r.x+r.width);d(n-t)>=.85*u&&(u=d(n-t),c=(t+n)/2)}return{x:t.width/2-c*u,y:64-e.y*u,zoom:u}}let d1=e=>new Set(""===e?[]:e.split("\n"));function d2(e,t,n,r,o){let i=new Map([...t].filter(([e])=>n.has(e))),a=new Map([...i.keys()].filter(e=>r.has(e)).map(t=>[t,e.sizes.get(t)]));return function(e,t,n,r,o=new Map){let i=[];for(let[n,r]of e)for(let e=0;e+1<r.length;e++)i.push({key:n,a:r[e],b:r[e+1],width:t.get(n)??1});let a=i.map(e=>({key:e.key,room:{x:(e.a.x+e.b.x)/2,y:(e.a.y+e.b.y)/2,width:Math.abs(e.b.x-e.a.x)+e.width+4,height:Math.abs(e.b.y-e.a.y)+e.width+4}})),l=[],s=(e,t)=>{let o={x:t.x,y:t.y,...n.get(e)};return!a.some(t=>t.key!==e&&dR(o,t.room))&&!l.some(e=>dR(o,{...e,width:e.width+6,height:e.height+6}))&&!r.some(e=>dR(o,e))},d=new Map,u=(e,t)=>{d.set(e,t),l.push({x:t.x,y:t.y,...n.get(e)})},c=[...n.keys()].filter(t=>e.has(t)).sort((e,n)=>(t.get(n)??1)-(t.get(e)??1)||(e<n?-1:+(e>n)));for(let e of c){let t=o.get(e);void 0!==t&&s(e,t)&&u(e,t)}let h=e=>{let t=n.get(e);for(let n of function(e,t){let n=t.filter(t=>t.key!==e),r=[];for(let o of t){if(o.key!==e)continue;let t=o.a.y===o.b.y,[i,a]=t?[Math.min(o.a.x,o.b.x),Math.max(o.a.x,o.b.x)]:[Math.min(o.a.y,o.b.y),Math.max(o.a.y,o.b.y)],l=[[i,a]];for(let e of n){if(!(t?e.a.y===e.b.y&&Math.abs(e.a.y-o.a.y)<(e.width+o.width)/2+1:e.a.x===e.b.x&&Math.abs(e.a.x-o.a.x)<(e.width+o.width)/2+1))continue;let[n,r]=t?[Math.min(e.a.x,e.b.x),Math.max(e.a.x,e.b.x)]:[Math.min(e.a.y,e.b.y),Math.max(e.a.y,e.b.y)];l=l.flatMap(([e,t])=>r<=e||n>=t?[[e,t]]:[[e,Math.max(e,n)],[Math.min(t,r),t]].filter(([e,t])=>t-e>.5))}for(let[e,n]of l)r.push(t?{a:{x:e,y:o.a.y},b:{x:n,y:o.a.y},length:n-e}:{a:{x:o.a.x,y:e},b:{x:o.a.x,y:n},length:n-e})}return r.sort((e,t)=>t.length-e.length)}(e,i)){let r=n.a.y===n.b.y,o=r?t.width:t.height,i=n.length-o;if(!(i<0))for(let t of dg){let a=o/2+i*t,l=r?{x:Math.min(n.a.x,n.b.x)+a,y:n.a.y}:{x:n.a.x,y:Math.min(n.a.y,n.b.y)+a};if(s(e,l))return l}}};for(let e of c){if(d.has(e))continue;let t=h(e);void 0!==t&&u(e,t)}return d}(i,e.widths,a,[...e.boxes,...function(e,t){let n=dh(t),r=df(t),o=new Map(t.map(e=>[`${e.source}->${e.target}`,e])),i=new Map;for(let[t,a]of e){let e=o.get(t);if(void 0===e||a.length<2||i.has(e.target))continue;let l=a[a.length-1],{half:s,length:d}=du(r.get(e.target)??dd(e.count,n));i.set(e.target,{x:l.x,y:l.y-3-d/2,width:2*s+4,height:d+4})}return[...i.values()]}(i,e.edges)],o)}let d3={box:ds},d5={routed:dI},d4=e=>`color-mix(in srgb, ${e} 70%, var(--canvas))`;function d6({nodes:e,positions:t,tones:n}){return(0,y.jsx)("div",{"aria-hidden":!0,"data-testid":"back-cards",className:"pointer-events-none",children:e.filter(e=>"folder"===e.kind).map(e=>{let r=t.get(e.path);if(void 0===r)return null;let o=n.get(e.path)??"normal",i="faded"===o;return(0,y.jsx)("div",{"data-back-card":e.path,style:{position:"absolute",left:r.x+5,top:r.y+5,width:232,height:56,borderRadius:5,background:d4(dr("var(--node)",i)),border:`1px solid ${d4(dr(di(o,!1),i))}`}},e.path)})})}function d8({divider:e}){return(0,y.jsxs)("div",{"data-testid":"loose-divider","aria-hidden":!0,style:{position:"absolute",left:e.x,top:e.y-11,width:e.width,height:22},className:"pointer-events-none flex items-center gap-3",children:[(0,y.jsx)("span",{className:"h-px flex-1 bg-divider"}),(0,y.jsx)("span",{className:"whitespace-nowrap text-[12px] text-text-3",children:"Not linked to anything here"}),(0,y.jsx)("span",{className:"h-px flex-1 bg-divider"})]})}let d7=(0,v.memo)(function({level:e,selected:t,agent:n,pulses:r,onSelect:o,onOpen:i,onTurnPage:a,onDrawn:l,quietLines:s,strongOnly:d,direction:u,covered:c,actionsFor:h,onDetails:f,onOpenFile:p}){let g=rB(e=>e.width>=1700?8:6),m=(0,v.useSyncExternalStore)(dX,dW,()=>"dark"),x=(0,v.useMemo)(()=>(function(e,t,n=100,r=6){let o=new Map,i=t.filter(e=>e.source!==e.target),a=s1(t),l=e.filter(e=>a.has(e.path)),s=e.filter(e=>!a.has(e.path)),d=[...i].sort((e,t)=>t.count-e.count||(e.source<t.source?-1:+(e.source>t.source))||(e.target<t.target?-1:+(e.target>t.target))).slice(0,n),u=Math.max(1,Math.ceil(Math.sqrt(s.length)));if(0===l.length)return sJ(s.length,u,0,0).forEach((e,t)=>o.set(s[t].path,e)),o;let c=new l_.Graph;for(let e of(c.setGraph({rankdir:"TB",nodesep:40,ranksep:64,marginx:0,marginy:0}),c.setDefaultEdgeLabel(()=>({})),l))c.setNode(e.path,{width:232,height:56});for(let e of d)c.setEdge(e.source,e.target,{weight:Math.max(1,Math.round(Math.sqrt(e.count)))});!function(e,t={}){(function e(t,n,r){var o;let i=t.nodes().filter(e=>t.children(e).length),a={};i.forEach(o=>{let i=t.node(o);if(i&&i.rankdir){let l=new l5({multigraph:!0,compound:!0});l.setGraph({rankdir:i.rankdir});let s=t.children(o);s.forEach(e=>{let n={...t.node(e)};l.setNode(e,n);let r=t.parent(e);r&&r!==o&&s.includes(r)&&l.setParent(e,r)});let d=new Set;t.edges().forEach(e=>{let n=sD(t,e.v,o),r=sD(t,e.w,o);if(n&&r&&n!==r){let o=`${n}\0${r}`;d.has(o)||(d.add(o),l.setEdge(n,r,{...t.edge(e)}))}}),e(l,n,r);let u=sU(l);sB(u,n,r,null),sT(l,u);let c=1/0,h=1/0,f=-1/0,p=-1/0;l.nodes().forEach(e=>{if(e===o)return;let t=l.node(e);t&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.width&&"number"==typeof t.height&&(c=Math.min(c,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),h=Math.min(h,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),isFinite(c)&&isFinite(h)&&isFinite(f)&&isFinite(p)||(c=h=0,f=p=0);let g=f-c,m=p-h;a[o]={minX:c,minY:h,maxX:f,maxY:p,width:g,height:m,offsetX:c,offsetY:h},i._dagreClusterSubgraph=l}});let l=[],s=new Map;i.forEach(e=>{let n=t.node(e);n&&n.rankdir&&a[e]&&s.set(e,(t.children(e)||[]).filter(t=>t!==e))});let d=new Set([...s.values()].flat()),u=new Map;s.forEach((e,n)=>{d.has(n)||u.set(n,(e=>{let n=[],r=(t.children(e)||[]).filter(t=>t!==e);for(;r.length>0;){let e=r.shift();n.push(e),(t.children(e)||[]).filter(t=>t!==e).forEach(e=>r.push(e))}return n})(n))});let c=new Set([...u.values()].flat()),h=e=>{for(let[t,n]of u)if(n.includes(e))return t;return e},f=[];t.edges().forEach(e=>{(c.has(e.v)||c.has(e.w))&&f.push({edge:e,label:t.edge(e)})});let p=new Map;c.forEach(e=>{let n=t.parent(e);p.set(e,"string"==typeof n?n:void 0)}),u.forEach((e,n)=>{let r=t.node(n),o=[];e.forEach(e=>{let n=t.node(e);n&&(o.push({id:e,node:n,parent:p.get(e)}),t.removeNode(e))});let i=f.filter(({edge:t})=>e.includes(t.v)||e.includes(t.w)),s=a[n];r&&(l.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:s,children:e,removedNodes:o,removedEdges:i}),r.width=s.width,r.height=s.height)});let g=new Set;f.forEach(({edge:e,label:n})=>{let r=h(e.v),o=h(e.w);if(r!==o&&t.hasNode(r)&&t.hasNode(o)){let e=`${r}\0${o}`;g.has(e)||(g.add(e),t.setEdge(r,o,{...n,width:0,height:0}))}});let m=sU(t),x=sB(m,n,r,null!=(o=sI.get(t))?o:null);sI.set(t,x),sT(t,m),g.forEach(e=>{let n=e.indexOf("\0"),r=e.slice(0,n),o=e.slice(n+1);t.hasEdge(r,o)&&t.removeEdge(r,o)}),l.forEach(({clusterId:e,subgraph:n,bounds:r,removedNodes:o,removedEdges:i})=>{var a,l;let s=t.node(e),d=null!=(a=null==s?void 0:s.x)?a:0,u=null!=(l=null==s?void 0:s.y)?l:0,c=(r.minX+r.maxX)/2,h=(r.minY+r.maxY)/2;o.forEach(({id:e,node:n,parent:r})=>{t.setNode(e,n),void 0!==r&&t.setParent(e,r)}),i.forEach(({edge:e,label:n})=>{t.setEdge(e,n)}),n.nodes().forEach(r=>{if(r===e)return;let o=n.node(r),i=t.node(r);i&&o&&"number"==typeof o.x&&"number"==typeof o.y&&(i.x=d+(o.x-c),i.y=u+(o.y-h))}),delete s._dagreClusterSubgraph}),i.forEach(e=>{var n,r;let o=t.node(e),i=a[e];if(o&&o.rankdir&&o._dagreClusterSubgraph&&i){let a=o._dagreClusterSubgraph,l=null!=(n=o.x)?n:0,s=null!=(r=o.y)?r:0,d=(i.minX+i.maxX)/2,u=(i.minY+i.maxY)/2;a.nodes().forEach(n=>{if(n===e)return;let r=a.node(n),o=t.node(n);if(o&&r&&"number"==typeof r.x&&"number"==typeof r.y){let e=r.x-d,t=r.y-u;o.x=l+e,o.y=s+t}}),delete o._dagreClusterSubgraph}})})(e,sn,t)}(c);let h=0,f=0;for(let[e,t]of function(e,t){let n=new Map;for(let{path:t,x:r,y:o}of e)n.set(o,[...n.get(o)??[],{path:t,x:r}]);let r=new Map,o=0;for(let e of[...n.keys()].sort((e,t)=>e-t)){let i=n.get(e).sort((e,t)=>e.x-t.x||(e.path<t.path?-1:1)),a=Math.ceil(i.length/t),l=Math.ceil(i.length/a);for(let e=0;e<a;e++){let t=i.slice(e*l,(e+1)*l),n=-(232*t.length+(t.length-1)*40)/2;t.forEach((t,i)=>r.set(t.path,{x:n+272*i,y:o+96*e}))}o+=96*a-40+64}return r}(l.map(e=>({path:e.path,...c.node(e.path)})),r))o.set(e,t),h=Math.max(h,t.y+56),f=Math.max(f,t.x+232);if(0===s.length)return o;let p=Math.max(1,Math.floor((h+40)/96)),g=Math.ceil(s.length/p),m=f+80+s0(g,232)+f,x=Math.max(h,64+s0(Math.ceil(s.length/g),56)),y=Math.min(u,s.length);return(sQ(Math.max(2*f,s0(y,232)),h+120+s0(Math.ceil(s.length/y),56))>sQ(m,x)?sJ(s.length,y,-s0(y,232)/2,h+120):sJ(s.length,g,f+80,64)).forEach((e,t)=>o.set(s[t].path,e)),o})(e.nodes,e.edges,void 0,g),[e,g]),b=(0,v.useMemo)(()=>(function(e,t,n){let r=s1(t),o=e=>{let t=e.map(e=>n.get(e)).filter(e=>void 0!==e);return{left:Math.min(...t.map(e=>e.x)),right:Math.max(...t.map(e=>e.x+232)),top:Math.min(...t.map(e=>e.y)),bottom:Math.max(...t.map(e=>e.y+56))}},i=e.filter(e=>r.has(e.path)).map(e=>e.path),a=e.filter(e=>!r.has(e.path)).map(e=>e.path);if(0===i.length||0===a.length)return null;let l=o(i),s=o(a);if(s.left>=l.right)return{x:s.left,y:s.top-32,width:s.right-s.left};let d=Math.min(l.left,s.left);return{x:d,y:(l.bottom+s.top)/2,width:Math.max(l.right,s.right)-d}})(e.nodes,e.edges,x),[e,x]),w=(0,v.useMemo)(()=>new Map(e.nodes.map(e=>[e.path,e])),[e]),k=(0,v.useMemo)(()=>new Map(e.nodes.filter(e=>"portal"===e.kind).map(t=>{var n;return[t.path,{direction:(n=e.page,void 0===t.page?"many":t.page<n?"previous":"next"),title:void 0!==t.page?`Lines to page ${t.page+1}`:`Lines to ${aG(t.pages?.length??0,"more page","more pages")}`,caption:aQ(t,aZ(e.edges,t.path))}]})),[e]),E=(0,v.useMemo)(()=>dc(e.nodes),[e]),M=(0,v.useMemo)(()=>dh(e.edges),[e]),j=(0,v.useMemo)(()=>df(e.edges),[e]),_=(0,v.useMemo)(()=>dp(e.edges,t),[e,t]),[S,N]=(0,v.useState)(null),[C,$]=(0,v.useState)(null),[O,A]=(0,v.useState)(null),[P,z]=(0,v.useState)(e),L=P!==e;L&&(z(e),A(null),N(null),$(null));let R=(0,v.useMemo)(()=>aO(e.nodes.map(e=>e.path),e.edges,t,O,{quietLines:s,strongOnly:d,pinned:n,direction:u}),[e,t,O,s,d,n,u]),I=(0,v.useMemo)(()=>{let t=aO(e.nodes.map(e=>e.path),e.edges,null,null,{quietLines:s,strongOnly:d});return e.edges.map(aN).filter(e=>"hidden"!==t.edges.get(e)).join("\n")},[e,s,d]),D=(0,v.useMemo)(()=>d$(x,e.edges,d1(I)),[x,e,I]),B=e.edges.map(aN).filter(e=>"hidden"!==R.edges.get(e)).join("\n"),T=(0,v.useMemo)(()=>{let r=aO(e.nodes.map(e=>e.path),e.edges,t,null,{quietLines:s,strongOnly:d,pinned:n});return e.edges.map(aN).filter(e=>"hidden"!==r.edges.get(e)).join("\n")},[e,t,s,d,n]),F=(0,v.useMemo)(()=>({edges:e.edges,widths:new Map(e.edges.map(e=>[aN(e),dd(e.count,M)])),sizes:new Map(e.edges.map(e=>[aN(e),{width:7*aA(e.count).length+14,height:18}])),boxes:e.nodes.flatMap(e=>{let t=x.get(e.path);return void 0===t?[]:[{x:t.x+118.5,y:t.y+30.5,width:237,height:61}]})}),[e,x,M]),H=n=>{let r=null===n||n.rest!==D,o=r?D:n.routes,i=B===(r?I:n.drawn)?o:function(e,t,n,r,o){let i=new Map;for(let[e,t]of r)o.has(e)&&i.set(e,t);for(let[e,t]of n)o.has(e)&&i.set(e,t);return d$(e,t,o,i)}(x,e.edges,D,o,d1(B)),a=r?d2(F,D,d1(I),dp(e.edges,null),new Map):n.restCounts,l=r||n.selected!==t||n.settled!==T?d2(F,i,d1(T),_,a):n.settledCounts,s=B===T?l:d2(F,i,d1(B),_,l);return{rest:D,drawn:B,routes:i,selected:t,settled:T,restCounts:a,settledCounts:l,counts:s}},[V,q]=(0,v.useState)(()=>H(null));(V.rest!==D||V.drawn!==B||V.selected!==t||V.settled!==T)&&q(H(V));let{routes:W,counts:X}=V,[Y,K,U]=function(e){let[t,n]=(0,v.useState)(e),r=(0,v.useCallback)(e=>n(t=>oi(e,t)),[]);return[t,n,r]}([]),[Z,G,Q]=function(e){let[t,n]=(0,v.useState)(e),r=(0,v.useCallback)(e=>n(t=>oi(e,t)),[]);return[t,n,r]}([]),{setViewport:J,getViewport:ee,screenToFlowPosition:et}=oy(),en=rB(e=>e.width),er=rB(e=>e.height),eo=rB(e=>e.domNode),ei=(0,v.useRef)({setViewport:J,onDrawn:l,positions:x,routes:W,edges:e.edges,canvas:{width:en,height:er}});(0,v.useEffect)(()=>{ei.current={setViewport:J,onDrawn:l,positions:x,routes:W,edges:e.edges,canvas:{width:en,height:er}}},[J,l,x,W,e.edges,en,er]);let ea=(0,v.useRef)(!1);(0,v.useEffect)(()=>{let t=e.nodes.map(e=>{var t,o,i;return o=x.get(e.path)??{x:0,y:0},i={box:e,tone:R.boxes.get(e.path)??"normal",agent:n.has(e.path),pulseKey:r.get(e.path)?.key??0,dot:(t=e.fileCount,E<=0?6:6+12*Math.log10(Math.max(0,t)+1)/Math.log10(E+1)),portal:k.get(e.path)},{id:e.path,type:"box",position:o,width:232,height:56,measured:{width:232,height:56},handles:s8,draggable:!1,connectable:!1,data:i}});K(e=>s7(e,t,s9))},[e,x,k,R,n,r,E,K]),(0,v.useEffect)(()=>{let n=e.edges.flatMap(e=>{let n=aN(e),r=R.edges.get(n)??"normal";if("hidden"===r)return[];let o="selected"===r?{color:e.target===t?aS.usedBy.line:aS.uses.line,layer:2}:"preview"===r?{color:"var(--text-2)",layer:1}:{color:"var(--edge-dim)",layer:0},i={id:n,type:"routed",data:{points:W.get(n)??[],width:dd(e.count,M),headWidth:j.get(e.target),color:o.color,count:X.has(n)?aA(e.count):void 0,countStrong:"selected"===r,labelAt:X.get(n)},source:e.source,target:e.target,focusable:!1};return[{layer:o.layer,edge:i}]}).sort((e,t)=>e.layer-t.layer).map(e=>e.edge);G(e=>s7(e,n,de))},[e,W,X,R,t,M,j,G]);let el=`${e.repo}
|
|
4
|
+
${e.path}
|
|
5
|
+
${e.page}
|
|
6
|
+
${g}`,es=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(es.current===el||!(Y.length===e.nodes.length&&Y.every((t,n)=>t.id===e.nodes[n].path)))return;let t=requestAnimationFrame(()=>{es.current=el,ea.current=!1;let e=ei.current;e.setViewport(d0(dY(e.positions),e.canvas,0,dU(e.routes,e.edges)),{duration:0}),e.onDrawn()});return()=>cancelAnimationFrame(t)},[el,Y,e.nodes]);let ed=(0,v.useRef)(null);(0,v.useEffect)(()=>{let e=ed.current;if((ed.current={width:en,height:er},null!==e&&0!==en&&0!==er&&es.current===el)&&(e.width!==en||e.height!==er))if(N(null),$(null),ea.current){let t=ee();J({x:t.x+(en-e.width)/2,y:t.y+(er-e.height)/2,zoom:t.zoom},{duration:0})}else{let e=dU(ei.current.routes,ei.current.edges);J(d0(dY(x),{width:en,height:er},0,e),{duration:0})}},[en,er,el,x,J,ee]);let eu=(0,v.useMemo)(()=>d1(B),[B]),ec=(0,v.useMemo)(()=>new Map(e.edges.map(e=>[aN(e),e])),[e]),eh=(0,v.useRef)(null),ef=(0,v.useRef)(null),ep=(e,t)=>{let n=W.get(t),r=function(e,t,n,r){let o=n.get(e);if(void 0===o)return null;let i=function(e,t){let n=null;for(let r=0;r+1<e.length;r++){let o=dD(t,e[r],e[r+1]),i=dB(t,o);(null===n||i<n.away)&&(n={point:o,segment:r,away:i})}return n&&{point:n.point,segment:n.segment}}(o,t);if(null===i)return null;let a=o[i.segment],l=o[i.segment+1];return{lines:[...n].filter(([t,n])=>t===e||r.has(t)&&n.some((e,t)=>{let r,o,s,d=n[t+1];return void 0!==d&&(r={x:l.x-a.x,y:l.y-a.y},o={x:d.x-e.x,y:d.y-e.y},(s=Math.hypot(r.x,r.y)*Math.hypot(o.x,o.y))>0&&Math.abs(r.x*o.y-r.y*o.x)/s<.01)&&.75>=dB(i.point,dD(i.point,e,d))})).map(([e])=>e).sort(),point:i.point,segment:i.segment}}(t,et({x:e.clientX,y:e.clientY}),W,eu),o=ec.get(t);if(null===r||null===eo||void 0===o||void 0===n)return null;let i=eo.getBoundingClientRect(),a=ee(),l=r.point,s={x:l.x*a.zoom+a.x,y:l.y*a.zoom+a.y},d=n[r.segment],u=n[r.segment+1],c=dd(o.count,M),h=function(e,t,n,r,o){let i=e=>({x:e.x*n.zoom+n.x,y:e.y*n.zoom+n.y}),a=r*n.zoom/2+3,l=[];for(let n=0;n+1<e.length;n++){let r=i(e[n]),o=i(e[n+1]);dB(t,dD(t,r,o))>40||l.push({left:Math.min(r.x,o.x)-a,top:Math.min(r.y,o.y)-a,width:Math.abs(o.x-r.x)+2*a,height:Math.abs(o.y-r.y)+2*a})}let s=e.at(-1);if(void 0!==s){let e=i({x:s.x,y:s.y-3}),r=o.half*n.zoom+3,a=o.length*n.zoom,d={left:e.x-r,top:e.y-a,width:2*r,height:a};40>=dB(t,{x:Math.max(d.left,Math.min(t.x,d.left+d.width)),y:Math.max(d.top,Math.min(t.y,e.y))})&&l.push(d)}return l}(n,s,a,c,du(j.get(o.target)??c)),f=[...(eo.parentElement??eo).querySelectorAll("[data-keep-clear]")].map(e=>{let t=e.getBoundingClientRect();return{left:t.left-i.left,top:t.top-i.top,width:t.width,height:t.height}}),p=Math.abs(u.y-d.y)>Math.abs(u.x-d.x);return{key:r.lines.join("\n"),lines:r.lines,point:s,spot:l,upright:p,half:c*a.zoom/2,line:h,clear:f}},eg=(e,t)=>{let n=ep(e,t.id);null!==n&&(null!==S&&S.key===n.key?eh.current?.(n):N(n))},em=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(null===C)return;let e=e=>{"Escape"===e.key&&(e.stopPropagation(),$(null))},t=e=>{if(e.target instanceof Node&&em.current?.contains(e.target)||($(null),!(e.target instanceof Element&&e.target.closest(".react-flow__pane"))))return;let t=e=>{e.target instanceof Element&&e.target.closest(".react-flow__pane")&&e.stopPropagation()};document.addEventListener("click",t,{capture:!0,once:!0}),document.addEventListener("pointerdown",()=>document.removeEventListener("click",t,{capture:!0}),{capture:!0,once:!0})};return window.addEventListener("keydown",e,!0),document.addEventListener("pointerdown",t,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("pointerdown",t,!0)}},[C]);let ex=L?null:C??S;return(0,y.jsxs)(iT,{nodes:Y,edges:Z,onNodesChange:U,onEdgesChange:Q,nodeTypes:d3,edgeTypes:d5,onNodeClick:(e,t)=>o(t.id),onNodeDoubleClick:(e,t)=>{let n=s2(t.data.box,void 0!==p);n?.type==="folder"?i(n.path):n?.type==="page"?a(n.page):n?.type==="editor"&&p?.(n.path)},onNodeMouseEnter:(e,t)=>A(t.id),onNodeMouseLeave:()=>A(null),onPaneClick:()=>o(null),onMoveStart:e=>{null!==e&&(ea.current=!0,N(null))},onEdgeMouseEnter:eg,onEdgeMouseMove:eg,onEdgeMouseLeave:()=>N(null),onEdgeClick:(e,t)=>{let n=ep(e,t.id);null!==n&&$({...n,held:null!==S&&S.key===n.key?ef.current:null})},nodesDraggable:!1,nodesConnectable:!1,zoomOnDoubleClick:!1,minZoom:.1,maxZoom:2,colorMode:"light"===m||"hc-light"===m?"light":"dark",proOptions:{hideAttribution:!0},inert:c,children:[(0,y.jsxs)(iq,{children:[(0,y.jsx)(d6,{nodes:e.nodes,positions:x,tones:R.boxes}),b&&(0,y.jsx)(d8,{divider:b})]}),null!==h&&w.has(h)&&x.has(h)&&(0,y.jsx)(s6,{box:w.get(h),position:x.get(h),onOpen:i,onTurnPage:a,onDetails:f,onOpenFile:p}),null!==ex&&(0,y.jsx)(dt,{words:function(e,t){let n,r;if(1===e.length){let n,r,o,i,[a]=e;return{kind:"one",id:aN(a),parts:aW((n=a.source,t.get(n)),(r=a.target,t.get(r)),a.count),sentence:function(e,t,n){let{who:r,verb:o,whom:i,imports:a}=aW(e,t,n);return`${r} ${o} ${i}, ${a}`}((o=a.source,t.get(o)),(i=a.target,t.get(i)),a.count)}}let o=e=>"portal"===t.get(e).kind?aq(aV(t.get(e))):t.get(e).name,i=e.every(t=>t.target===e[0].target),a=!i&&e.every(t=>t.source===e[0].source),l=i?`Into ${aV((n=e[0].target,t.get(n)))}`:a?`From ${aV((r=e[0].source,t.get(r)))}`:"Lines here",s=e.map(e=>{let n,r;return{id:aN(e),name:i?o(e.source):a?o(e.target):`${aV((n=e.source,t.get(n)))} → ${aV((r=e.target,t.get(r)))}`,count:e.count}});return s.sort((e,t)=>t.count-e.count||(e.name<t.name?-1:+(e.name>t.name))||(e.id<t.id?-1:1)),{kind:"run",title:l,rows:s}}(ex.lines.map(e=>ec.get(e)),w),at:ex,pinned:null!==C,cardRef:null===C?void 0:em,held:C?.held,followRef:null===C?eh:void 0,placedRef:null===C?ef:void 0},null===C?`hover
|
|
7
|
+
${ex.key}`:`pinned
|
|
8
|
+
${ex.key}
|
|
9
|
+
${ex.point.x},${ex.point.y}`)]})});function d9(e,t,n=!1){let r=[...""===e?[]:[`path=${encodeURIComponent(e).replaceAll("%2F","/")}`],...t>0?[`page=${t+1}`]:[],...n?["embed=vscode"]:[]];return 0===r.length?"/":`/?${r.join("&")}`}function ue(e){let t=new URLSearchParams(e),n=t.get("page")??"";return{path:t.get("path")??"",page:/^\d+$/.test(n)&&Number(n)>=1?Number(n)-1:0}}function ut(e){let t="object"==typeof e&&null!==e?e.mapDepth:void 0;return"number"==typeof t&&Number.isInteger(t)&&t>0?t:0}let un=ab("outline","chevron-down","ChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]);function ur({entry:e,fallback:t}){return e?.remote?(0,y.jsxs)("span",{title:`${e.remote.owner}/${e.remote.name}`,className:"flex min-w-0 items-baseline text-text",children:[(0,y.jsx)("span",{"data-repo-owner":!0,className:"truncate after:content-['/'] group-data-[owner=hidden]/crumb:max-w-0 max-[360px]:hidden",children:e.remote.owner}),(0,y.jsx)("span",{className:"max-w-full shrink-0 truncate",children:e.remote.name})]}):(0,y.jsx)("span",{title:t,className:"truncate text-text",children:t})}function uo({repo:e,onSwitched:t,onHome:n}){let[r,o]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[l,s]=(0,v.useState)(null),[d,u]=(0,v.useState)({left:0,width:320}),c=am(i,()=>a(!1)),h=(0,v.useCallback)(()=>{c.current&&u(ap(c.current,320,"start"))},[c]);ag(i,h),(0,v.useEffect)(()=>{au.repos().then(o,()=>{})},[e]);let f=e.slice(e.lastIndexOf("/")+1),p=(0,y.jsx)(ur,{entry:r?.repos.find(t=>t.root===e),fallback:f}),g=(0,y.jsx)("button",{type:"button","data-testid":"repo-name",onClick:n,title:"Go to the top level",className:"flex min-w-0 rounded-[4px] px-0.5 hover:bg-node",children:p});return null===r||r.repos.length<2?g:(0,y.jsxs)("div",{ref:c,className:"relative min-w-0",children:[(0,y.jsxs)("div",{className:"flex min-w-0 items-center",children:[g,(0,y.jsx)("button",{type:"button","data-testid":"repo-menu",onClick:()=>{i||h(),a(e=>!e)},"aria-label":"Switch repository",title:"Switch repository",className:"grid h-6 w-5 shrink-0 place-items-center rounded-[4px] text-text-3 hover:bg-node hover:text-text",children:(0,y.jsx)(un,{"aria-hidden":!0,size:14,stroke:1.75})})]}),i&&(0,y.jsx)("ul",{"data-testid":"repo-list","data-covers":!0,style:d,className:"absolute top-8 z-30 overflow-y-auto rounded-md border border-border bg-panel py-1 font-sans text-[13px]",children:r.repos.map(n=>(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button",onClick:()=>{var r;return r=n.root,void(a(!1),r!==e&&au.setActiveRepo(r).then(t,e=>s(e instanceof ai?e.message:"Couldn't switch repos.")))},className:"block w-full px-3 py-2 text-left hover:bg-node",children:[(0,y.jsx)("span",{className:n.root===e?"font-medium text-text":"text-text",children:n.remote?`${n.remote.owner} / ${n.remote.name}`:n.name}),(0,y.jsx)("span",{title:n.root,className:"block truncate font-mono text-[12px] text-text-3",children:n.root})]})},n.root))}),l&&(0,y.jsx)("span",{title:l,className:"ml-2 block truncate text-[12px] text-danger",children:l})]})}let ui=ab("outline","search","Search",[["path",{d:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);function ua(e){return"(file)"===e.symbol?"imports and exports":`${e.symbol} \xb7 ${e.startLine===e.endLine?`line ${e.startLine}`:`lines ${e.startLine}–${e.endLine}`}`}function ul({onPick:t,onClose:n}){var r;let o,i,a;a6();let[l,s]=s5(),[d,u]=(0,v.useState)(""),[c,h]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[g,m]=(0,v.useState)(0),x=(0,v.useRef)(null),b=(0,v.useRef)(null),[w,k]=(0,v.useState)(null);(0,v.useEffect)(()=>{x.current?.focus();let t=!0;return e.A(74429).then(e=>{t&&k(()=>(t,n)=>e.highlightCode(t,n))}),()=>{t=!1}},[]),(0,v.useEffect)(()=>{let e=d.trim();if(""===e)return;let t=new AbortController,n=setTimeout(()=>{au.search(e,40,t.signal).then(e=>{h(e),p(null),m(0)},e=>{e instanceof ai&&p(e)})},150);return()=>{clearTimeout(n),t.abort()}},[d]);let E=(o=(r=null!==c&&c.query===d.trim()?c.hits:[]).filter(e=>"folder"===e.kind),{folders:o,files:i=r.filter(e=>"file"===e.kind),ordered:[...o,...i]}),M=E.ordered,j=Math.min(g,M.length-1);return(0,v.useEffect)(()=>{b.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})},[j]),(0,y.jsx)("div",{className:"pointer-events-auto fixed inset-0 z-30 bg-canvas/70",onClick:n,children:(0,y.jsxs)("div",{role:"dialog","aria-label":"Search",onClick:e=>e.stopPropagation(),className:"mx-auto mt-[12vh] w-[640px] max-w-[92vw] overflow-hidden rounded-[6px] border border-border bg-panel",children:[(0,y.jsxs)("div",{ref:l,children:[(0,y.jsxs)("div",{className:"flex items-center gap-3 border-b border-divider px-4",children:[(0,y.jsx)(ui,{"aria-hidden":!0,size:16,stroke:1.75,className:"shrink-0 text-text-2"}),(0,y.jsx)("input",{ref:x,value:d,onChange:e=>u(e.target.value),onKeyDown:e=>{"Escape"===e.key?n():"ArrowDown"===e.key?(e.preventDefault(),m(Math.min(j+1,M.length-1))):"ArrowUp"===e.key?(e.preventDefault(),m(Math.max(j-1,0))):"Enter"===e.key&&M[j]&&t(M[j])},placeholder:"Search files and concepts",spellCheck:!1,"aria-label":"Search",className:"w-full bg-transparent py-3 text-[15px] text-text placeholder:text-text-2 focus:outline-none"})]}),f&&(0,y.jsx)("p",{className:"px-4 py-3 text-[13px] text-danger",children:f.message}),c?.note&&M.length>0&&(0,y.jsx)("p",{className:"px-4 pt-2 text-[12px] text-text-2",children:c.note})]}),(0,y.jsxs)("ul",{ref:b,role:"listbox",style:{maxHeight:null===(a=s?.height??null)?void 0:`min(52vh, calc(88vh - 10px - ${a}px))`},className:"max-h-[52vh] overflow-y-auto py-1",children:[M.map((e,n)=>(0,y.jsxs)(v.Fragment,{children:[(0===n||n===E.folders.length)&&(0,y.jsxs)("li",{role:"presentation",className:"px-4 pb-1 pt-2 text-[12px] font-medium text-text-2",children:["folder"===e.kind?"Folders":"Files"," ",(0,y.jsx)("span",{className:"font-normal",children:aA("folder"===e.kind?E.folders.length:E.files.length)})]}),(0,y.jsx)("li",{role:"option","aria-selected":n===j,children:(0,y.jsxs)("button",{type:"button","data-hit":e.path,onMouseEnter:()=>m(n),onClick:()=>t(e),className:`flex w-full gap-3 px-4 py-2 text-left ${n===j?"bg-row-sel":"hover:bg-node"}`,children:["folder"===e.kind?(0,y.jsx)(aM,{"aria-hidden":!0,size:16,stroke:1.75,className:"mt-0.5 shrink-0 text-glyph-dim"}):(0,y.jsx)(aE,{"aria-hidden":!0,size:16,stroke:1.75,className:"mt-0.5 shrink-0 text-text-2"}),(0,y.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,y.jsx)("span",{title:e.path,className:"block truncate font-mono text-[13px] text-text",children:e.path}),e.tagline&&(0,y.jsx)("span",{title:e.tagline,className:"block truncate text-[13px] text-text-2",children:e.tagline}),e.code&&(0,y.jsxs)("span",{title:`${ua(e.code)}, ${e.code.snippet}`,className:"block truncate font-mono text-[12px] text-text-2",children:[ua(e.code),","," ",w?(0,y.jsx)("span",{className:"syntax",dangerouslySetInnerHTML:{__html:w(e.code.snippet,(0,af.b)(e.path))}}):(0,y.jsx)("span",{className:"syntax",children:e.code.snippet})]})]})]})})]},e.path)),""!==d.trim()&&null!==c&&c.query===d.trim()&&0===M.length&&(0,y.jsx)("li",{className:"px-4 py-3 text-[13px] text-text-2",children:c.note??"Nothing matched."})]})]})})}let us=new Intl.Collator("en",{numeric:!0,sensitivity:"base"}),ud=(e,t)=>us.compare(e.name,t.name)||(e.name<t.name?-1:+(e.name>t.name)),uu={selected:"bg-row-sel text-text",linked:"text-text hover:bg-node",plain:"text-text-2 hover:bg-node"},uc={selected:"bg-accent",linked:"bg-linked-glyph",plain:"bg-glyph-dim"};function uh({count:e,tall:t,children:n}){return(0,y.jsxs)("div",{className:`flex shrink-0 items-center justify-between gap-2 pl-[14px] text-[11.5px] text-text-3 ${t?"h-10 pr-2":"h-[34px] pr-[14px]"}`,children:[(0,y.jsx)("span",{className:"truncate",children:"Explorer"}),(0,y.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5 whitespace-nowrap",children:[e,n]})]})}function uf({row:e,tone:t,onPick:n,onOpen:r}){let o="folder"===e.kind;return(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button","data-explorer-row":e.path,"aria-current":"selected"===t?"true":void 0,"aria-label":o?e.label:void 0,title:e.path,onClick:t=>n(e.path,t),onDoubleClick:o?()=>r(e.path):void 0,className:`grid h-[26px] w-full grid-cols-[16px_minmax(0,1fr)_36px_minmax(44px,max-content)] items-center gap-2 pl-[14px] pr-3 text-left focus-visible:-outline-offset-2 ${uu[t]}`,children:[(0,y.jsx)(o?aM:aE,{"aria-hidden":!0,size:14,stroke:1.75,className:"text-text-3"}),(0,y.jsx)("span",{className:`truncate font-mono text-[12.5px] ${o?"":"col-span-3"}`,children:e.name}),o&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{"aria-hidden":!0,className:`h-[3px] rounded-[2px] ${uc[t]}`,style:{width:e.bar}}),(0,y.jsx)("span",{className:"whitespace-nowrap text-right text-[11.5px] tabular-nums text-text-3",children:aA(e.files)})]})]})})}function up({view:e,selected:t,linked:n,onPick:r,onOpen:o}){let i=(0,v.useRef)(null);return(0,v.useEffect)(()=>(function(e,t){let n=null!==e&&null!==t?e.querySelector(`[data-explorer-row="${CSS.escape(t)}"]`):null;if(null===e||null===n)return;let r=n.offsetTop,o=r+n.offsetHeight;r<e.scrollTop?e.scrollTop=r:o>e.scrollTop+e.clientHeight&&(e.scrollTop=o-e.clientHeight)})(i.current,t),[t,e]),(0,y.jsxs)("div",{ref:i,className:"relative min-h-0 flex-1 overflow-y-auto pb-[10px]",children:[(0,y.jsx)("ul",{"aria-label":"Folders and files",children:e.rows.map(e=>{var i;return(0,y.jsx)(uf,{row:e,tone:(i=e.path,i===t?"selected":n.has(i)?"linked":"plain"),onPick:r,onOpen:o},e.path)})}),null!==e.pageLine&&(0,y.jsx)("p",{className:"px-[14px] pt-2 text-[11.5px] leading-4 text-text-3",children:e.pageLine})]})}function ug({id:e,view:t,selected:n,linked:r,onPick:o,onOpen:i,onClose:a}){let l=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=l.current,t=e?.querySelector('[aria-current="true"]')??e?.querySelector("[data-explorer-row]");t?.focus({preventScroll:!0})},[]),(0,y.jsxs)("div",{ref:l,id:e,role:"dialog","aria-label":"Explorer",className:"absolute bottom-0 left-full top-0 z-20 flex w-[236px] max-w-[calc(100vw_-_48px)] flex-col border-r border-divider bg-panel",children:[(0,y.jsx)(uh,{count:t.count,tall:!0,children:(0,y.jsx)("button",{type:"button",onClick:a,"aria-label":"Close the explorer",className:"grid h-6 w-6 place-items-center rounded-md text-text-2 hover:bg-node hover:text-text",children:(0,y.jsx)(aj,{"aria-hidden":!0,size:16,stroke:1.75})})}),(0,y.jsx)(up,{view:t,selected:n,linked:r,onPick:o,onOpen:i})]})}function um({view:e,selected:t,linked:n,onSelect:r,onOpen:o}){let[i,a]=(0,v.useState)(!1),[l,s]=(0,v.useState)(0),d=(0,v.useId)(),u=(0,v.useRef)(null),c=(0,v.useCallback)(()=>{a(!1),s(0)},[]),h=am(i,c),f=(0,v.useCallback)(()=>{h.current?.contains(document.activeElement)&&u.current?.focus(),c()},[c,h]);return(0,v.useEffect)(()=>{if(0===l)return;let e=setTimeout(f,350);return()=>clearTimeout(e)},[l,f]),(0,v.useEffect)(()=>{if(!i)return;let e=e=>{"Escape"===e.key&&(e.stopPropagation(),f())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[i,f]),(0,y.jsxs)("aside",{ref:h,"aria-label":"Explorer",onBlur:e=>{i&&e.relatedTarget instanceof Node&&!e.currentTarget.contains(e.relatedTarget)&&c()},className:"relative flex h-full w-full flex-col items-center border-r border-divider bg-panel pt-1.5",children:[(0,y.jsx)("button",{ref:u,type:"button","aria-label":"Open the explorer",title:"Explorer","aria-expanded":i,"aria-controls":i?d:void 0,onClick:()=>i?f():a(!0),className:`grid h-7 w-7 shrink-0 place-items-center rounded-[5px] ${i?"bg-node text-text":"text-text-2 hover:bg-node hover:text-text"}`,children:(0,y.jsx)(aM,{"aria-hidden":!0,size:18,stroke:1.75})}),i&&(0,y.jsx)(ug,{id:d,view:e,selected:t,linked:n,onPick:(e,t)=>{r(e),0===t.detail?f():s(e=>e+1)},onOpen:e=>{o(e),f()},onClose:f})]})}let ux=(0,v.memo)(function({level:e,selected:t,linked:n,form:r,onSelect:o,onOpen:i}){let a=(0,v.useMemo)(()=>{var t,n,r;let o,i,a,l;return o=dc(t=e.nodes),i=t.filter(e=>"folder"===e.kind).sort((e,t)=>t.fileCount-e.fileCount||ud(e,t)),a=t.filter(e=>"file"===e.kind).sort(ud),{rows:l=[...i.map(e=>{var t;let n;return{kind:"folder",path:e.path,name:e.name,files:e.fileCount,bar:(t=e.fileCount,o<=0?3:Math.min(36,Math.max(3,36*Math.log10(Math.max(0,t)+1)/Math.log10(o+1)))),label:`${e.name}, ${n=e.fileCount,`${aA(n)} ${1===n?"file":"files"}`}`}}),...a.map(e=>({kind:"file",path:e.path,name:e.name}))],count:(n=l.length,`${aA(n)} ${1===n?"item":"items"}`),pageLine:(r=l.length,e.pageCount<=1?null:`Page ${e.page+1} of ${e.pageCount}, ${aA(r)} of ${aA(r+e.hiddenCount)} folders and files`)}},[e]);return"rail"===r?(0,y.jsx)(um,{view:a,selected:t,linked:n,onSelect:o,onOpen:i}):(0,y.jsxs)("aside",{"aria-label":"Explorer",className:"flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden border-r border-divider bg-panel",children:[(0,y.jsx)(uh,{count:a.count}),(0,y.jsx)(up,{view:a,selected:t,linked:n,onPick:e=>o(e),onOpen:i})]})});var uy=e.i(5500),uy=uy;function uv({enabled:e}){return(0,y.jsx)("button",{type:"button","data-testid":"back",disabled:!e,onClick:()=>window.history.back(),"aria-label":"Back",title:e?"Back to where you were":"Back (nothing to go back to yet)",className:"grid h-7 w-7 shrink-0 place-items-center rounded-md text-text hover:bg-node max-[360px]:w-6 disabled:opacity-35 disabled:hover:bg-transparent",children:(0,y.jsx)(aw,{"aria-hidden":!0,size:18,stroke:2})})}let ub=()=>()=>{},uw={field:"max-[640px]:min-w-0 max-[640px]:w-7 max-[640px]:flex-none max-[640px]:cursor-pointer max-[640px]:justify-center max-[640px]:p-0",words:"max-[640px]:hidden"},uk={field:"max-[1000px]:min-w-0 max-[1000px]:w-7 max-[1000px]:flex-none max-[1000px]:cursor-pointer max-[1000px]:justify-center max-[1000px]:p-0 max-[360px]:hidden",words:"max-[1000px]:hidden"};function uE({crumb:e,onSearch:t,onHelp:n,embedded:r,canGoBack:o,toolbar:i,status:a}){let l=(0,v.useSyncExternalStore)(ub,()=>/Mac|iPhone|iPad/.test(navigator.platform),()=>!1),s=i?uk:uw,d=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(uy.Image,{src:"/icon.svg",alt:"",width:18,height:18,unoptimized:!0,className:"shrink-0"}),(0,y.jsx)("span",{className:"text-[13px] font-semibold text-text max-[900px]:hidden",children:"Nebulosity"})]});return(0,y.jsxs)("header",{className:`relative z-20 flex shrink-0 items-center gap-3 border-b border-divider bg-panel pl-3 pr-2.5 max-[360px]:gap-1.5 max-[360px]:pl-2 max-[360px]:pr-1.5 ${r?"h-[38px]":"h-[42px]"}`,children:[(0,y.jsxs)("div",{className:"flex min-w-0 flex-[1_1_auto] items-center gap-2.5 max-[360px]:gap-1",children:[!r&&(0,y.jsx)("span",{className:"flex shrink-0 items-center gap-2 max-[360px]:hidden",children:d}),!r&&(0,y.jsx)("span",{"aria-hidden":!0,className:"h-4 w-px shrink-0 bg-divider max-[360px]:hidden"}),(0,y.jsx)(uv,{enabled:o}),e]}),(0,y.jsxs)("button",{type:"button",onClick:t,"data-testid":"search-button","aria-label":"Search files and concepts",title:`Search files and concepts (${l?"⌘K":"Ctrl K"})`,className:`flex h-7 min-w-[160px] flex-[0_1000_440px] cursor-text items-center gap-2 rounded-[5px] border border-border bg-canvas pl-2.5 pr-1.5 text-[13px] text-text-3 hover:border-text-3 ${s.field}`,children:[(0,y.jsx)(ui,{"aria-hidden":!0,size:14,stroke:2,className:"shrink-0"}),(0,y.jsx)("span",{className:`w-0 flex-1 truncate text-left ${s.words}`,children:"Search files and concepts"}),(0,y.jsx)("kbd",{className:"shrink-0 rounded-[4px] border border-border px-1.5 font-sans text-[11.5px] leading-[17px] text-text-3 max-[1000px]:hidden",children:l?"⌘K":"Ctrl K"})]}),(0,y.jsxs)("div",{className:`flex items-center justify-end gap-1.5 ${i?"shrink-0":"flex-1 max-[640px]:flex-none"}`,children:[i,!r&&(0,y.jsx)("button",{type:"button",onClick:n,"data-testid":"help-button","aria-label":"How to use the Map",title:"How to use the Map (?)",className:"grid h-7 w-7 shrink-0 place-items-center rounded-[5px] border border-border text-[13px] font-semibold text-text-2 hover:border-text-3 hover:text-text max-[480px]:hidden",children:"?"}),a]})]})}function uM({doorways:e,agent:t,quiet:n}){return(0,y.jsxs)("p",{"data-testid":"legend",className:"shrink-0 border-t border-divider px-3.5 py-2.5 text-[12px] leading-[1.45] text-text-3",children:["Dot size shows how many files a folder has. Line weight, and the number on a line, show how many imports it carries. Arrows point at the code being used. Folders are stacked cards, and a page marks a single file.",e&&" A dashed box is a doorway to another page of this folder.",t&&" An orange ring is what Claude Code is touching right now.",n&&" In a busy folder, hover a box to see its lines."]})}let uj=ab("outline","check","Check",[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]]),u_=ab("outline","chevron-left","ChevronLeft",[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]]),uS=ab("outline","chevron-right","ChevronRight",[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]]),uN=ab("outline","dots","Dots",[["path",{d:"M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]),uC=[{id:"all",label:"All",title:"Highlight every line of the selected box",dot:"bg-text"},{id:"uses",label:"Uses",title:"Highlight only its lines to what it uses, the rest in gray",mark:aS.uses.fill,dot:aS.uses.fill},{id:"usedBy",label:"Used by",title:"Highlight only its lines from what uses it, the rest in gray",mark:aS.usedBy.fill,dot:aS.usedBy.fill}],u$="Select a box to choose which of its lines are highlighted",uO={all:"",uses:"The selected box uses nothing on this page",usedBy:"Nothing on this page uses the selected box"},uA="grid h-6 min-w-[26px] shrink-0 place-items-center rounded-[5px] border border-border px-2 text-[12.5px] text-text-2 hover:border-text-3 hover:text-text disabled:opacity-40 disabled:hover:border-border disabled:hover:text-text-2";function uP({on:e}){return(0,y.jsx)("span",{"aria-hidden":!0,className:`grid h-3.5 w-3.5 shrink-0 place-items-center rounded-[3px] ${e?"bg-accent text-on-accent":"border border-border"}`,children:e&&(0,y.jsx)(uj,{size:11,stroke:3})})}function uz({level:e,strongOnly:t,onStrongOnly:n,busy:r,showAllLines:o,onShowAllLines:i,onTurnPage:a,canvasWidth:l,inHeader:s,narrow:d,helpInMenu:u,onHelp:c,searchInMenu:h,onSearch:f,hasSelection:p,direction:g,onDirection:m,emptySides:x}){let v=oy(),b=rT(),w=()=>{let e=dY(new Map(v.getNodes().map(e=>[e.id,e.position]))),t=dK(v.getEdges().flatMap(({data:e})=>e?[{points:e.points,width:e.width,headHalf:du(e.headWidth??e.width).half}]:[])),{width:n,height:r}=b.getState();v.setViewport(function(e,t,n){if(0===e.width||0===e.height||0===n.width||0===n.height)return{x:n.width/2-(e.x+e.width/2),y:n.height/2-(e.y+e.height/2),zoom:1};let r=dJ(e,t,n),o=dQ(r,n);return{x:n.width/2-r.middle.x*o,y:n.height/2-r.middle.y*o,zoom:o}}(e,t,{width:n,height:r}),{duration:0})},k=!s&&l>=470,E=!s&&l>=330,M=!s&&l>=500,j=e.pageCount>1,_=!s&&l>=(j?760:600),S=s&&d,N=j&&l>=260&&!S,C=function(e){let t=e.edges.filter(e=>e.source!==e.target);if(0===t.length)return null;let n=[...t].sort((e,t)=>t.count-e.count||(e.source<t.source?-1:+(e.source>t.source))||(e.target<t.target?-1:+(e.target>t.target)))[0],r=t=>e.nodes.find(e=>e.path===t)?.name??t;return{from:r(n.source),to:r(n.target),count:n.count,total:t.reduce((e,t)=>e+t.count,0)}}(e),$=0===a_(e.edges,null),O=$?"Every line on this page carries at least 2% of the heaviest line's imports, so there's nothing to hide":"Draw only the lines with at least 2% of the heaviest line's imports, and every line of the box you select or hover",A=[];h&&A.push({label:"Search files and concepts",act:f}),j&&!N&&A.push({label:`Previous page (${e.page+1} of ${e.pageCount})`,disabled:0===e.page,act:()=>a(e.page-1)},{label:"Next page",disabled:e.page>=e.pageCount-1,act:()=>a(e.page+1)}),S&&A.push({label:"Show the whole level",act:w}),_||A.push({group:"Lines of the selected box",items:uC.map(e=>{let t=x.includes(e.id);return{label:e.label,radio:!0,on:g===e.id,dot:e.dot,disabled:!p||t,title:p?t?uO[e.id]:e.title:u$,act:()=>m(e.id)}})}),k||A.push({label:"Strong links only",on:t,disabled:$,title:O,act:()=>n(!t)}),r&&(s||!M)&&A.push({label:"Show all lines",on:o,act:()=>i(!o)}),E||A.push({label:"Zoom in",act:()=>void v.zoomIn({duration:0})},{label:"Zoom out",act:()=>void v.zoomOut({duration:0})}),u&&A.push({label:"How to use the Map",act:c});let P=(0,y.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[N&&(0,y.jsx)(uL,{level:e,onTurn:a,short:s||l<400}),_&&(0,y.jsx)(uR,{direction:g,onDirection:m,hasSelection:p,emptySides:x}),k&&(0,y.jsxs)("label",{title:O,className:`mr-1 flex items-center gap-[7px] rounded-[4px] text-[13px] text-text-2 has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-focus ${$?"cursor-default opacity-40":"cursor-pointer hover:text-text"}`,children:[(0,y.jsx)("input",{type:"checkbox","data-testid":"strong-only",checked:t,disabled:$,onChange:e=>n(e.target.checked),className:"sr-only"}),(0,y.jsx)(uP,{on:t}),"Strong links only"]}),E&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("button",{type:"button",onClick:()=>void v.zoomOut({duration:0}),"aria-label":"Zoom out",title:"Zoom out",className:uA,children:"−"}),(0,y.jsx)("button",{type:"button",onClick:()=>void v.zoomIn({duration:0}),"aria-label":"Zoom in",title:"Zoom in",className:uA,children:"+"})]}),!S&&(0,y.jsx)("button",{type:"button","data-testid":"fit",onClick:w,title:"Show the whole level",className:uA,children:"Fit"}),A.length>0&&(0,y.jsx)(uD,{items:A})]});return s?P:(0,y.jsxs)("div",{"data-testid":"toolbar",className:"flex h-9 shrink-0 items-center justify-between gap-3 border-b border-divider pl-3.5 pr-2 text-[13px]",children:[(0,y.jsx)("div",{className:"flex min-w-0 items-center gap-2 text-text-2",children:M&&(r?(0,y.jsxs)("span",{"data-testid":"lines-note",className:"flex min-w-0 items-center gap-2",children:[(0,y.jsx)("span",{className:"truncate",title:o?`All ${aA(e.edges.length)} lines shown`:"A busy folder, so lines show when you hover a box, or select it",children:o?`All ${aA(e.edges.length)} lines shown`:"A busy folder, so lines show when you hover a box"}),(0,y.jsx)("button",{type:"button","data-testid":"lines-toggle",onClick:()=>i(!o),className:"shrink-0 text-text underline decoration-text-3 underline-offset-2 hover:decoration-text",children:o?"Show on hover only":"Show all lines"})]}):C&&(0,y.jsxs)("span",{"data-testid":"finding",className:"truncate",title:`Heaviest link is ${C.from} → ${C.to}, ${aA(C.count)} of ${aA(C.total)} imports between these boxes`,children:["Heaviest link is ",(0,y.jsxs)("span",{className:"font-mono text-[12.5px] text-text",children:[C.from," → ",C.to]}),", ",aA(C.count)," of ",aA(C.total)," imports"]}))}),P]})}function uL({level:e,onTurn:t,short:n}){let r,o=n=>{let r="left"===n?e.page-1:e.page+1;return(0,y.jsx)("button",{type:"button","data-testid":`page-${"left"===n?"previous":"next"}`,disabled:r<0||r>=e.pageCount,onClick:()=>t(r),"aria-label":`${"left"===n?"Previous":"Next"} page`,title:`${"left"===n?"Previous":"Next"} page (${"left"===n?"←":"→"})`,className:`${uA} px-1`,children:(0,y.jsx)("left"===n?u_:uS,{"aria-hidden":!0,size:14,stroke:2})})};return(0,y.jsxs)("span",{className:"mr-1 flex items-center gap-1",children:[o("left"),(0,y.jsx)("span",{"data-testid":"page-note",title:(r=e.nodes.filter(e=>"portal"!==e.kind).length,`Page ${e.page+1} of ${e.pageCount} \xb7 ${aA(r)} of ${aA(r+e.hiddenCount)} folders and files`),className:"whitespace-nowrap px-1 text-[12.5px] text-text-2",children:n?`${e.page+1} / ${e.pageCount}`:`Page ${e.page+1} of ${e.pageCount}`}),o("right")]})}function uR({direction:e,onDirection:t,hasSelection:n,emptySides:r}){let o=uC.filter(e=>n&&!r.includes(e.id));return(0,y.jsx)("span",{role:"radiogroup","aria-label":"Lines of the selected box","data-testid":"sides",title:n?void 0:u$,onKeyDown:n=>{let r=o.findIndex(t=>t.id===e),i="ArrowRight"===n.key||"ArrowDown"===n.key?o[(r+1)%o.length]:"ArrowLeft"===n.key||"ArrowUp"===n.key?o[(r-1+o.length)%o.length]:"Home"===n.key?o[0]:"End"===n.key?o[o.length-1]:void 0;void 0!==i&&(n.preventDefault(),n.stopPropagation(),t(i.id),n.currentTarget.querySelector(`[data-side="${i.id}"]`)?.focus())},className:`mr-1.5 flex h-6 shrink-0 items-stretch rounded-[5px] border border-border p-px text-[12.5px] ${n?"":"opacity-40"}`,children:uC.map(o=>{let i=o.id===e,a=r.includes(o.id);return(0,y.jsxs)("button",{type:"button",role:"radio","aria-checked":i,"data-side":o.id,disabled:!n||a,tabIndex:i?0:-1,title:n?a?uO[o.id]:o.title:u$,onClick:()=>t(o.id),className:`relative whitespace-nowrap rounded-[4px] px-2 leading-none disabled:cursor-default ${i?"bg-node text-text":"text-text-2 hover:text-text disabled:hover:text-text-2"} ${a&&n?"opacity-40":""}`,children:[o.label,i&&n&&o.mark&&(0,y.jsx)("span",{"aria-hidden":!0,className:`absolute inset-x-1.5 bottom-0 h-0.5 rounded-[1px] ${o.mark}`})]},o.id)})})}function uI({on:e,dot:t}){return(0,y.jsx)("span",{"aria-hidden":!0,className:"grid h-3.5 w-3.5 shrink-0 place-items-center rounded-full border border-border",children:e&&(0,y.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${t}`})})}function uD({items:e}){let[t,n]=(0,v.useState)(!1),[r,o]=(0,v.useState)({right:0,width:220}),i=am(t,()=>n(!1)),a=(0,v.useCallback)(()=>{i.current&&o(ap(i.current,220,"end"))},[i]);ag(t,a);let l=(0,v.useId)(),s=e=>(0,y.jsxs)("button",{type:"button",role:e.radio?"menuitemradio":void 0===e.on?"menuitem":"menuitemcheckbox","aria-checked":e.on,disabled:e.disabled,title:e.title,onClick:()=>{e.act(),(void 0===e.on||e.radio)&&n(!1)},className:"flex w-full items-center gap-2 rounded-[4px] px-2.5 py-1.5 text-left text-text-2 hover:bg-node hover:text-text disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-text-2",children:[e.radio?(0,y.jsx)(uI,{on:e.on??!1,dot:e.dot??"bg-text"}):void 0!==e.on&&(0,y.jsx)(uP,{on:e.on}),(0,y.jsx)("span",{title:e.label,className:"truncate",children:e.label})]},e.label);return(0,y.jsxs)("div",{ref:i,className:"relative",children:[(0,y.jsx)("button",{type:"button","data-testid":"toolbar-more","aria-label":"More",title:"More","aria-expanded":t,onClick:()=>{t||a(),n(e=>!e)},className:`${uA} px-1`,children:(0,y.jsx)(uN,{"aria-hidden":!0,size:14,stroke:2})}),t&&(0,y.jsx)("div",{role:"menu","data-testid":"toolbar-menu","data-covers":!0,style:r,className:"absolute top-8 z-30 overflow-y-auto rounded-md border border-border bg-panel p-1 text-[13px]",children:e.map((t,n)=>"group"in t?(0,y.jsxs)("div",{role:"group","aria-labelledby":`${l}-${n}`,className:`border-divider ${n>0?"mt-1 border-t pt-1":""} ${n<e.length-1?"mb-1 border-b pb-1":""}`,children:[(0,y.jsx)("p",{id:`${l}-${n}`,title:t.group,className:"truncate px-2.5 pb-0.5 pt-1 text-[11.5px] text-text-3",children:t.group}),t.items.map(s)]},t.group):s(t))})]})}let uB={ok:"bg-ok",busy:"bg-text-3",warn:"bg-danger",off:"bg-text-3"},uT=["structure","summaries","embeddings"];function uF({status:e,recent:t,connected:n,highlightCount:r,onClear:o,items:i,weakHidden:a,embedded:l,dots:s}){let[d,u]=(0,v.useState)(0);(0,v.useEffect)(()=>{let e=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(e)},[]);let c=t[0],h=void 0!==c?{text:lM(c),title:function(e,t){let n=e=>t>0?` \xb7 ${az(Math.max(0,t-Date.parse(e.at)))}`:"",[r,...o]=e;return void 0===r?"":[`${lM(r)}${n(r)}`,...r.paths.length>1?r.paths:[],...o.map(e=>`Earlier: ${lM(e)}${n(e)}`)].join("\n")}(t,d),active:!0}:{text:n?"Claude Code, no tool calls yet":"Claude Code isn't connected",title:n?"Claude Code is connected to the live channel":"Claude Code isn't connected to the live channel",active:!1},f=(0,y.jsx)("span",{"aria-hidden":!0,className:`h-1.5 w-1.5 shrink-0 rounded-full ${h.active?"bg-agent":n?"bg-text-3":"border border-text-3"}`});if(s)return(0,y.jsxs)("span",{className:"flex shrink-0 items-center gap-2.5 pl-1",children:[(0,y.jsx)(uH,{status:e,compact:!0}),(0,y.jsx)("span",{title:`${h.text}. ${h.title}`,className:"grid h-6 w-4 place-items-center",children:f})]});let p=0===r?null:`${r.toLocaleString("en-US")} highlighted`;return(0,y.jsxs)("footer",{"data-testid":"activity-bar",className:"relative z-20 flex h-6 shrink-0 items-center gap-4 border-t border-divider bg-panel px-3 text-[11.5px] text-text-3",children:[(0,y.jsx)(uH,{status:e,compact:!1}),!l&&null!==e&&(0,y.jsxs)("span",{className:"shrink-0 whitespace-nowrap max-[560px]:hidden",children:[aA(e.stages.structure.total)," files"]}),(0,y.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",title:h.title,children:[f,(0,y.jsx)("span",{className:`truncate max-[420px]:hidden ${h.active?"text-text-2":""}`,children:h.text}),h.active&&d>0&&(0,y.jsx)("span",{className:"shrink-0 max-[800px]:hidden",children:az(Math.max(0,d-Date.parse(c.at)))})]}),null!==p&&(0,y.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,y.jsx)("span",{className:"max-[640px]:hidden",children:p}),(0,y.jsx)("button",{type:"button",onClick:o,title:"Clear Claude Code's highlights (Esc)",className:"text-text-2 underline decoration-text-3 underline-offset-2 hover:text-text",children:"Clear"})]}),(0,y.jsxs)("span",{className:"ml-auto shrink-0 whitespace-nowrap max-[800px]:hidden",children:[aA(i)," ",1===i?"item":"items",a>0?`, ${aA(a)} weak ${1===a?"link":"links"} hidden`:""]}),!l&&(0,y.jsx)("span",{className:"shrink-0 whitespace-nowrap max-[1100px]:hidden",children:"Ctrl K to search"})]})}function uH({status:e,compact:t}){let[n,r]=(0,v.useState)(!1),[o,i]=(0,v.useState)(null),a=am(n,()=>r(!1)),[l,s]=(0,v.useState)({right:0,width:340}),d=(0,v.useCallback)(()=>{a.current&&s(ap(a.current,340,"end"))},[a]);if(ag(n&&t,d),null===e)return null;let u=function(e){for(let t of aI)if("running"===e.stages[t].state)return{tone:"busy",text:`${aR[t]}${aD(e.stages[t])}`};for(let t of aI)if("failed"===e.stages[t].state)return{tone:"warn",text:`${aL[t]} failed`};if("ready"!==e.stages.structure.state)return{tone:"warn",text:"Not indexed yet"};if("off"===e.stages.summaries.state)return{tone:"off",text:"Summaries off (no API key)"};for(let t of aI){let n=e.stages[t];if("idle"===n.state&&n.total>n.done)return{tone:"busy",text:`${aL[t]}${aD(n)}`}}return{tone:"ok",text:"Up to date"}}(e);return(0,y.jsxs)("div",{ref:a,className:"relative flex min-w-0 shrink-0 items-center",children:[(0,y.jsxs)("button",{type:"button","data-testid":"status-pill",onClick:()=>{!n&&t&&d(),r(e=>!e)},"aria-expanded":n,title:`${u.text}. The index status, and Re-index`,className:"flex min-w-0 items-center gap-1.5 rounded-[4px] px-0.5 hover:text-text",children:[(0,y.jsx)("span",{"aria-hidden":!0,className:`h-1.5 w-1.5 shrink-0 rounded-full ${uB[u.tone]}`}),!t&&(0,y.jsx)("span",{className:"truncate max-[420px]:hidden",children:u.text})]}),n&&(0,y.jsxs)("div",{"data-testid":"status-menu","data-covers":!0,style:t?l:{width:"min(340px, calc(100vw - 24px))",maxHeight:"calc(100vh - 80px)"},className:`absolute z-30 space-y-3 overflow-y-auto rounded-md border border-border bg-panel p-3 text-[12px] text-text-2 ${t?"top-7":"bottom-6 left-0"}`,children:[uT.map(t=>{var n;return(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"text-[13px] text-text",children:(n=e.stages[t],`${aL[t]}${aD(n)}, ${n.state}`)}),e.stages[t].note&&(0,y.jsx)("div",{children:e.stages[t].note})]},t)}),(0,y.jsx)("div",{className:"flex items-center justify-between gap-3 border-t border-divider pt-3",children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{className:"truncate",title:o??`Index version ${e.indexVersion}`,children:o??`Index version ${e.indexVersion}`}),(0,y.jsx)("button",{type:"button",onClick:()=>{i("Starting…"),au.reindex(e=>i(`${e.stage} ${aA(e.done)} / ${aA(e.total)}`)).then(e=>i(`Re-indexed ${aA(e.files)} files in ${(e.totalMs/1e3).toFixed(1)} s`),e=>i(e instanceof ai?e.message:"The re-index failed"))},className:"shrink-0 rounded-[5px] border border-border px-2 py-0.5 text-[12.5px] text-text hover:border-text-3",children:"Re-index"})]})})]})]})}let uV=e=>"string"==typeof e&&e.length<=1024,uq=new Set(["dark","light","hc","hc-light"]),uW=e=>"string"==typeof e&&e.length>0&&e.length<=64,uX=e=>uV(e)&&""!==e,uY="vscode"===new URLSearchParams(window.location.search).get("embed"),uK=()=>()=>{},uU=null,uZ={post:e=>uU?.post(e)};function uG(){return`${document.documentElement.clientWidth}x${window.innerHeight}`}function uQ(e){window.addEventListener("resize",e);let t=new ResizeObserver(e);return t.observe(document.documentElement),()=>{window.removeEventListener("resize",e),t.disconnect()}}let uJ=e=>`${e.path}\0${e.page}`,u0="min(320px, calc(100% - 56px))",u1=e=>`${e.repo}\0${e.path}\0${e.page}`;function u2(e){let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)}let u3=(e,t,n)=>({repo:n.repo,version:n.indexVersion,levels:new Map(null!==e&&e.repo===n.repo&&e.version===n.indexVersion?e.levels:[]).set(uJ(t),n)});function u5(){var e;let t,n,{status:r,error:o,refresh:i}=function(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[o,i]=(0,v.useState)(0);return(0,v.useEffect)(()=>{let e=new AbortController;au.status(e.signal).then(e=>{t(e),r(null)},e=>{e instanceof ai&&r(e)});let n=setTimeout(()=>i(e=>e+1),2e3);return()=>{e.abort(),null!==n&&clearTimeout(n)}},[o]),(0,v.useEffect)(()=>{let e=()=>i(e=>e+1);return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[]),{status:e,error:n,refresh:(0,v.useCallback)(()=>i(e=>e+1),[])}}(),[a,l]=(0,v.useState)(()=>ue(window.location.search)),s=a.path,[d,u]=(0,v.useState)(null),[c,h]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[g,m]=(0,v.useState)(null),[x,b]=(0,v.useState)(null),[w,k]=(0,v.useState)(g);w!==g&&(k(g),b(null));let[E,M]=(0,v.useState)(()=>ut(window.history.state)>0),[j,_]=(0,v.useState)(null),[S,N]=(0,v.useState)(!1),[C,$]=(0,v.useState)(!1),[O,A]=(0,v.useState)([]),[P,z]=(0,v.useState)([]),[L,R]=(0,v.useState)(-1/0),I=(0,v.useCallback)(()=>{A([]),R(Date.now())},[]),[D,B]=(0,v.useState)(!1),[T,F]=(0,v.useState)(!0),[H,V]=(0,v.useState)("all"),[q,W]=(0,v.useState)(g);q!==g&&(W(g),V("all"));let[X,Y]=(0,v.useState)(new Map),K=function(){let[e,t]=(0,v.useSyncExternalStore)(uQ,uG,()=>"1440x900").split("x").map(Number);return{width:e,height:t}}(),U=(0,v.useSyncExternalStore)(uK,()=>uY,()=>!1),[Z]=s5(),[G,Q]=s5(),[J]=s5(),ee=(0,v.useRef)(a),et=(0,v.useRef)(g);(0,v.useEffect)(()=>{ee.current=a,et.current=g},[a,g]);let en=(0,v.useRef)("push"),er=r?.repo??null,eo=r?.indexVersion??null,ei=null!==d&&d.repo===er?d.levels.get(uJ(a))??null:null,ea=null!==d&&d.repo===er&&d.version===eo&&d.levels.has(uJ(a)),el=(0,v.useRef)(ei);(0,v.useEffect)(()=>{el.current=ei},[ei]);let es=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(null===er||null===eo||ea)return;let e=new AbortController;return au.level(a.path,a.page,e.signal).then(e=>{let t={path:a.path,page:e.page};u(n=>u3(n,t,e)),e.page!==a.page&&(window.history.replaceState({mapDepth:ut(window.history.state)},"",d9(t.path,t.page,uY)),l(t)),h(null)},e=>{e instanceof ai&&h(e)}),()=>e.abort()},[er,eo,a,ea]),(0,v.useEffect)(()=>{if(null===j||null===er)return;let e=new AbortController;return au.level((0,af.B)(j.target),0,e.signal,j.target).then(e=>{if(j.quiet&&!e.nodes.some(e=>e.path===j.target)){aK("map:level"),_(null);return}let t={path:e.path,page:e.page};u(n=>u3(n,t,e)),en.current=j.history,l(t),m(j.target),_(null),h(null)},e=>{e instanceof ai&&(aK("map:level"),j.quiet||p({error:e,place:uJ(ee.current),selected:et.current}),_(null))}),()=>e.abort()},[j,er]),(0,v.useEffect)(()=>{if(null===f)return;let e=setTimeout(()=>p(null),6e3);return()=>clearTimeout(e)},[f]),(0,v.useEffect)(()=>{var e,t;let n=(e=function(e,t,n=!1){if(e===d9(t.path,t.page,n))return"none";let r=ue(e.includes("?")?e.slice(e.indexOf("?")):"");return r.path===t.path&&r.page===t.page?"replace":"push"}(window.location.pathname+window.location.search,a,uY),t=en.current,"push"===e&&"replace"===t?"replace":e);en.current="push";let r=ut(window.history.state);"push"===n?(window.history.pushState({mapDepth:r+1},"",d9(a.path,a.page,uY)),M(!0)):"replace"===n&&window.history.replaceState({mapDepth:r},"",d9(a.path,a.page,uY))},[a]),(0,v.useEffect)(()=>{let e=()=>{aY("map:level"),l(ue(window.location.search)),m(null),_(null),M(ut(window.history.state)>0)};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]);let ed=(0,v.useCallback)(e=>{e!==s&&aY("map:level"),l({path:e,page:0}),m(null),_(null)},[s]),eu=(0,v.useCallback)(e=>{aY("map:level"),l({path:s,page:e}),m(null),_(null)},[s]),ec=(0,v.useCallback)((e,t={})=>{if(""===e)return void ed("");if((0,af.B)(e)===s&&ei?.nodes.some(t=>t.path===e)){aY("map:select"),m(e),_(null);return}aY("map:level"),_({target:e,history:t.history??"push",quiet:t.quiet??!1})},[ed,s,ei]),eh=(0,v.useCallback)(e=>{if("nebulosity.follow"===e.type)ec(e.path,{history:"replace",quiet:!0});else if("nebulosity.show"===e.type)ec(e.path,{quiet:!0});else if("nebulosity.highlight"===e.type)z(e.paths);else if("nebulosity.clear"===e.type)z([]);else if("nebulosity.theme"===e.type){let t=function(e,t){let n=dV(t.editor);if(null===n)return null;let r=e=>void 0===e?null:dV(e,n),o=r(t.side),i=r(t.fg);return null===o||null===i?null:{kind:e,editor:n,side:o,fg:i,border:r(t.border)??void 0,desc:r(t.desc)??void 0,focus:r(t.focus)??void 0}}(e.kind,e.colors);null!==t&&function(e,t){let n,r,o,i,a,l,s,d;for(let[u,c]of Object.entries((n="light"===t.kind||"hc-light"===t.kind,r="hc"===t.kind||"hc-light"===t.kind,o=t.editor,i=t.fg,a=n?"#9333EA":"#A855F7",s=dH(o,i,(l={node:n?.05:.09,line:n?.28:.3,linked:.75,edge:.3,glyph:n?.4:.45}).line),d="hc-light"===t.kind?"#A16207":n?"#CA8A04":"#FCD34D",{canvas:o,panel:t.side,node:r?o:dH(o,i,l.node),"node-sel":dH(o,a,n?.1:.16),"row-sel":dH(t.side,a,n?.12:.18),divider:t.border??dH(o,i,.12),border:r?t.border??s:s,"linked-border":r?n?"#7E22CE":"#C084FC":dH(o,a,l.linked),text:i,"text-2":dH(i,o,.22),"text-3":t.desc??dH(i,o,.3),"edge-dim":dH(o,i,r?.5:l.edge),"edge-strong":n?"#7E22CE":"#E9D5FF","glyph-dim":dH(o,i,r?.6:l.glyph),"linked-glyph":n?"#A855F7":"#C084FC","used-by-edge":d,accent:a,"on-accent":n?"#FFFFFF":"#120C1C",core:n?a:"#F0FDFF",agent:n?"#C2410C":"#F08A4B",danger:n?"#B91C1C":"#F07A7A",ok:n?"#0E7490":"#5FC9D9",focus:t.focus??(n?"#0E7490":"#67E8F9"),fade:r?"70%":"50%"})))e.style.setProperty(`--${u}`,c);e.setAttribute("data-kind",t.kind)}(document.documentElement,t)}},[ec]),ef=(0,v.useCallback)(()=>{let e=el.current;return null===e||u1(e)!==es.current?null:{type:"nebulosity.drawn",path:ee.current.path,page:ee.current.page,selected:et.current}},[]),ep=(t=(0,v.useRef)(eh),n=(0,v.useRef)(ef),(0,v.useEffect)(()=>{t.current=eh,n.current=ef},[eh,ef]),(0,v.useEffect)(()=>{if(uY){var e,r,o;let i,a,l,s,d;return(uU??=(e=window,i=null,r=e=>i?.onMessage(e),o=()=>i?.onReady()??null,a=null,l=t=>{null!==a&&e.parent.postMessage(t,a)},s=t=>{if(t.source!==e.parent||!t.origin.startsWith("vscode-webview://"))return;let n=function(e){if("object"!=typeof e||null===e)return null;switch(e.type){case"nebulosity.hello":return 1===e.version?{type:"nebulosity.hello",version:1}:null;case"nebulosity.follow":return uX(e.path)?{type:"nebulosity.follow",path:e.path}:null;case"nebulosity.show":return uX(e.path)?{type:"nebulosity.show",path:e.path}:null;case"nebulosity.highlight":{if(!Array.isArray(e.paths))return null;let t=e.paths,n=[];for(let e=0;e<Math.min(t.length,1e3)&&n.length<50;e++){let r=t[e];uV(r)&&n.push(r)}return{type:"nebulosity.highlight",paths:n}}case"nebulosity.clear":return{type:"nebulosity.clear"};case"nebulosity.theme":{if("string"!=typeof e.kind||!uq.has(e.kind)||"object"!=typeof e.colors||null===e.colors)return null;let t=e.colors,n={};for(let e of["editor","side","fg"]){if(!uW(t[e]))return null;n[e]=t[e]}for(let e of["border","desc","focus"])uW(t[e])&&(n[e]=t[e]);return{type:"nebulosity.theme",kind:e.kind,colors:n}}default:return null}}(t.data);if(null!==n){if("nebulosity.hello"===n.type){a=t.origin,l({type:"nebulosity.ready",version:1});let e=o?.()??null;null!==e&&l(e);return}null!==a&&t.origin===a&&r(n)}},e.addEventListener("message",s),d={post:l,connected:()=>null!==a,dispose(){e.removeEventListener("message",s),a=null}},{attach:e=>(i=e,()=>{i===e&&(i=null)}),post:e=>d.post(e)})).attach({onMessage:e=>t.current(e),onReady:()=>n.current()})}},[]),uY?uZ:null),eg=(0,v.useCallback)(e=>{null!==e&&aY("map:select"),m(e)},[]),em=(0,v.useCallback)((e,t)=>{ep?.post({type:"nebulosity.open",path:e,...void 0===t?{}:{line:t}})},[ep]),ex=null===ep?void 0:em,ey=function(e){let[t,n]=(0,v.useState)([]),[r,o]=(0,v.useState)(!1),i=(0,v.useRef)(e);return(0,v.useEffect)(()=>{i.current=e},[e]),(0,v.useEffect)(()=>{var e,t;let r,a,l;return e=()=>{let e=new EventSource("/api/live/stream");return e.addEventListener("ready",()=>o(!0)),e.addEventListener("error",()=>o(!1)),e.addEventListener("tool",e=>{let t=JSON.parse(e.data);n(e=>(function(e,t,n=3){return[t,...e].slice(0,n)})(e,t)),i.current(t)}),e},t=window,r=e(),a=()=>{r?.close(),r=null},l=t=>{t.persisted&&null===r&&(r=e())},t.addEventListener("pagehide",a),t.addEventListener("pageshow",l),()=>{t.removeEventListener("pagehide",a),t.removeEventListener("pageshow",l),a()}},[]),{recent:t,connected:r}}((0,v.useCallback)(e=>{if(null!==ei){let t=e.paths.flatMap(e=>(0,af.K)(ei,e)??[]);Y(e=>(function(e,t,n){let r=new Map(e);for(let e of new Set(t)){let t=r.get(e);t&&n-t.at<800||r.set(e,{key:(t?.key??0)+1,at:n})}return r})(e,t,Date.now()))}let t=e.action;t?.type==="highlight_nodes"?A(t.nodeIds):t?.type==="clear_highlights"?A([]):t?.type==="focus_node"&&ec(t.nodeId)},[ei,ec])),[ev,eb]=(0,v.useState)(0),ew=ey.recent[0]?.at??null;(0,v.useEffect)(()=>{if(null===ew)return;let e=setInterval(()=>{let t=Date.now();eb(t),t-Date.parse(ew)>=3e4&&clearInterval(e)},1e3);return()=>clearInterval(e)},[ew]);let ek=null===ei?"":[...function(e,t,n,r,o=-1/0,i=[]){return new Set([...t.filter(e=>{let t=Date.parse(e.at);return r-t<3e4&&t>o}).flatMap(e=>e.paths),...n,...i].flatMap(t=>(0,af.K)(e,t)??[]))}(ei,ey.recent,O,ev,L,P)].sort().join("\0"),eE=(0,v.useMemo)(()=>new Set(""===ek?[]:ek.split("\0")),[ek]),eM=aJ(ei,g),ej=(0,v.useMemo)(()=>{var e,t;return null===ei?[]:(e=ei.edges,null===(t=eM)?[]:[...e.some(e=>e.source===t&&e.target!==t)?[]:["uses"],...e.some(e=>e.target===t&&e.source!==t)?[]:["usedBy"]])},[ei,eM]),e_=ej.includes(H)?"all":H,eS=(0,v.useMemo)(()=>{var e;return new Set(null===ei?[]:(e=ei.edges,null===eM?[]:e.filter(e=>aC(e,eM,e_))).flatMap(e=>[e.source,e.target]))},[ei,eM,e_]),eN=(0,v.useCallback)(()=>{l({path:"",page:0}),m(null),_(null),A([]),z([]),i()},[i]),eC=(0,v.useCallback)(()=>{aU("map:level"),null!==ep&&(es.current=null===el.current?null:u1(el.current),u2(()=>{let e=ef();null!==e&&ep.post(e)}))},[ep,ef]);(0,v.useEffect)(()=>{if(null!==ep&&null!==ef())return u2(()=>{let e=ef();null!==e&&ep.post(e)})},[g,ep,ef]);let e$=(0,v.useCallback)(()=>ed(""),[ed]),eO=(0,v.useCallback)(()=>$(!1),[]),eA=(0,v.useCallback)(()=>m(null),[]),eP=(0,v.useCallback)(()=>b(null),[]),ez=(0,v.useCallback)(e=>b(e),[]),eL=ei?.page??0,eR=ei?.pageCount??1,eI=aJ(ei,g),eD=null!==eI,eB=O.length>0,eT=function({width:e,height:t,embedded:n,selected:r}){let o=n?"none":e>=1180?"full":e>=600?"rail":"none",i="full"===o?236:40*("rail"===o),a=e-i-300>=560?"beside":t>=640?"below":e>=600?"drawer":"cover",l="beside"===a||r?a:"none",s=e-i-300*("beside"===l),d=t<420,u=t<300?"inHeader":"bar",c=t>=560&&s>=420&&"drawer"!==l&&"cover"!==l,h=(n?38:42)+36*!d+24*("bar"===u)+44*!!c,f="below"===l?Math.ceil((h+160)/(1-.42)):h+160;return{explorer:o,inspector:l,toolbarInHeader:d,status:u,legend:c,canvasWidth:s,minHeight:f}}({width:K.width,height:K.height,embedded:U,selected:null!==eI}),eF="cover"===eT.inspector;eF||null===eI||x===eI||b(eI);let eH=eF&&null!==eI&&x===eI;(0,v.useEffect)(()=>{let e=e=>{let t=function(e,t){if((e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase())return{type:"search"};if(t.typing||t.dialogOpen)return null;switch(e.key){case"?":return{type:"help"};case"Escape":return t.selected?{type:"deselect"}:t.highlighted?{type:"clear-highlights"}:null;case"Backspace":return""!==t.levelPath?{type:"up"}:null;case"ArrowLeft":return t.page>0?{type:"page",page:t.page-1}:null;case"ArrowRight":return t.page<t.pageCount-1?{type:"page",page:t.page+1}:null;default:return null}}(e,{typing:e.target instanceof HTMLElement&&["INPUT","TEXTAREA"].includes(e.target.tagName),dialogOpen:null!==document.querySelector('[role="dialog"]'),levelPath:s,page:eL,pageCount:eR,selected:eD,highlighted:eB});null!==t&&("search"===t.type?(e.preventDefault(),N(!0)):"help"===t.type?$(!0):"deselect"===t.type?eH?b(null):m(null):"clear-highlights"===t.type?I():"up"===t.type?ed((0,af.B)(s)):eu(t.page))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s,ed,eL,eR,eu,eD,eB,I,eH]);let eV=null!==ei&&T?a_(ei.edges,eI,eE):0,eq=null!==f&&f.place===uJ(a)&&f.selected===g?f.error:null,eW=c??eq,eX=eI??("beside"===eT.inspector&&null!==ei?ei.path:null),eY=null!==ei&&null!==eX&&"none"!==eT.inspector&&(!eF||eH),eK=eY&&eF,eU=eF&&!eY?eI:null,eZ=null!==eW&&!eK,eG=eY&&"drawer"===eT.inspector,eQ=null===(e=Q?.height??null)||24+e<=64?"band":"card",eJ=null!==ei&&ei.edges.length>60,e0=!D&&eJ,e1=null===ei?0:ei.nodes.filter(e=>"portal"!==e.kind).length;if(o?.code==="INDEX_EMPTY")return(0,y.jsx)(u6,{});let e2=ei&&(0,y.jsx)(uz,{level:ei,strongOnly:T,onStrongOnly:F,busy:eJ,showAllLines:D,onShowAllLines:B,onTurnPage:eu,canvasWidth:eT.canvasWidth,inHeader:eT.toolbarInHeader,narrow:K.width<480,helpInMenu:U||K.width<480,onHelp:()=>$(!0),searchInMenu:eT.toolbarInHeader&&K.width<360,onSearch:()=>N(!0),hasSelection:null!==eI,direction:e_,onDirection:V,emptySides:ej}),e3=e=>(0,y.jsx)(uF,{status:r,recent:ey.recent,connected:ey.connected,highlightCount:O.length,onClear:I,items:e1,weakHidden:eV,embedded:U,dots:e}),e5=eY&&null!==eX&&ei&&"none"!==eT.inspector&&(0,y.jsx)(lr,{path:eX,level:ei,indexVersion:eo??0,summariesOff:r?.stages.summaries.state==="off",onFocus:ec,onOpen:ed,onTurnPage:eu,onClose:eF?eP:eA,onOpenInEditor:ex,placement:eT.inspector,onScreenFolder:null===eI,alert:eK?eW?.message:void 0},eX);return(0,y.jsxs)("div",{"data-testid":"map-shell",style:{minHeight:eT.minHeight},className:"flex h-dvh flex-col",children:[(0,y.jsx)(uE,{crumb:ei&&er?(0,y.jsx)(ax,{repo:(0,y.jsx)(uo,{repo:er,onSwitched:eN,onHome:e$}),repoRoot:er,trail:ei.breadcrumb,onOpen:ed,compact:K.width<360}):(0,y.jsx)("span",{className:"min-w-0 flex-1"}),onSearch:()=>N(!0),onHelp:()=>$(!0),embedded:U,canGoBack:E,toolbar:eT.toolbarInHeader?e2:void 0,status:"inHeader"===eT.status?e3(!0):void 0}),(0,y.jsxs)("div",{className:"flex min-h-0 flex-1",children:[ei&&"none"!==eT.explorer&&(0,y.jsx)("div",{style:{width:"full"===eT.explorer?236:40},className:"relative z-10 shrink-0",children:(0,y.jsx)(ux,{level:ei,selected:eI,linked:eS,form:eT.explorer,onSelect:eg,onOpen:ed})}),(0,y.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[!eT.toolbarInHeader&&e2,(0,y.jsxs)("main",{ref:Z,className:"relative min-h-0 flex-1 overflow-hidden",children:[ei&&(0,y.jsx)(d7,{level:ei,selected:eI,agent:eE,pulses:X,onSelect:eg,onOpen:ed,onTurnPage:eu,onDrawn:eC,quietLines:e0,strongOnly:T,direction:e_,covered:eK,actionsFor:eU,onDetails:ez,onOpenFile:ex}),!ei&&!c&&(0,y.jsx)("p",{className:"absolute inset-0 grid place-items-center px-4 text-center text-[13px] text-text-2",children:"Loading the map…"}),eW&&eZ&&(0,y.jsx)("div",{style:{right:eG?u0:0},className:"pointer-events-none absolute inset-y-0 left-0",children:(0,y.jsx)(u4,{message:eW.message,form:eQ,bandRef:G,cardRef:J})}),("drawer"===eT.inspector||"cover"===eT.inspector)&&e5&&(0,y.jsx)("div",{"data-inspector-place":eT.inspector,"data-keep-clear":!0,style:{width:"drawer"===eT.inspector?u0:"100%"},className:"absolute inset-y-0 right-0 z-10",children:e5})]}),ei&&eT.legend&&(0,y.jsx)(uM,{doorways:ei.nodes.some(e=>"portal"===e.kind),agent:eE.size>0,quiet:e0}),"below"===eT.inspector&&e5&&(0,y.jsx)("div",{"data-inspector-place":"below",style:{height:"42%"},className:"min-h-0 shrink-0",children:e5})]}),"beside"===eT.inspector&&e5&&(0,y.jsx)("div",{"data-inspector-place":"beside",style:{width:300},className:"min-h-0 shrink-0",children:e5})]}),"bar"===eT.status&&e3(!1),C&&(0,y.jsx)(ly,{onClose:eO,embedded:U}),S&&(0,y.jsx)(ul,{onPick:e=>{N(!1),ec(e.path)},onClose:()=>N(!1)})]})}function u4({message:e,form:t,bandRef:n,cardRef:r}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{ref:n,role:"band"===t?"alert":void 0,"aria-hidden":"band"!==t||void 0,className:`pointer-events-none absolute inset-x-0 top-6 z-[7] flex justify-center px-4 text-[13px] text-danger ${"band"===t?"":"invisible"}`,children:(0,y.jsx)("p",{"data-keep-clear":"band"===t||void 0,className:"max-w-full rounded-[5px] bg-canvas px-2 text-center [overflow-wrap:anywhere]",children:e})}),"card"===t&&(0,y.jsx)("div",{ref:r,role:"alert","data-keep-clear":!0,style:{maxWidth:"calc(100% - 32px)"},className:"pointer-events-none absolute left-4 top-4 z-[7] rounded-md border border-divider bg-panel px-3 py-2 text-[13px] text-danger [overflow-wrap:anywhere]",children:e})]})}function u6(){return(0,y.jsx)("div",{className:"grid h-dvh place-items-center px-4",children:(0,y.jsxs)("div",{className:"max-w-md space-y-2 text-center text-[14px] text-text-2 [overflow-wrap:anywhere]",children:[(0,y.jsx)("p",{className:"text-[15px] font-medium text-text",children:"No repository indexed yet."}),(0,y.jsxs)("p",{children:["Index one from a terminal with ",(0,y.jsx)("code",{className:"rounded-md bg-node px-1 font-mono text-[13px] text-text",children:"nebulosity index <path-to-repo>"}),", then reload."]}),(0,y.jsxs)("p",{children:["In a checkout of Nebulosity it's ",(0,y.jsx)("code",{className:"rounded-md bg-node px-1 font-mono text-[13px] text-text",children:"npm run index -- <path-to-repo>"}),"."]})]})})}e.s(["default",0,function(){return(0,y.jsx)(iI,{children:(0,y.jsx)(u5,{})})}],75772)},5500,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"Image",{enumerable:!0,get:function(){return v}});let r=e.r(55682),o=e.r(90809),i=e.r(43476),a=o._(e.r(71645)),l=r._(e.r(74080)),s=r._(e.r(25633)),d=e.r(8927),u=e.r(65856),c=e.r(49381),h=r._(e.r(1948)),f=e.r(18581);function p(e,t,n,r,o,i,a){let l=e?.src;e&&e["data-loaded-src"]!==l&&(e["data-loaded-src"]=l,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&o(!0),n?.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let r=!1,o=!1;n.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>o,persist:()=>{},preventDefault:()=>{r=!0,t.preventDefault()},stopPropagation:()=>{o=!0,t.stopPropagation()}})}r?.current&&r.current(e)}}))}function g(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}"u"<typeof window&&(globalThis.__NEXT_IMAGE_IMPORTED=!0);let m="u"<typeof window?a.useEffect:a.useLayoutEffect,x=(0,a.forwardRef)(({src:e,srcSet:t,sizes:n,height:r,width:o,decoding:l,className:s,style:d,fetchPriority:u,placeholder:c,loading:h,unoptimized:x,fill:y,onLoadRef:v,onLoadingCompleteRef:b,setBlurComplete:w,setShowAltText:k,sizesInput:E,onLoad:M,onError:j,..._},S)=>{let N=(0,a.useRef)(!1),C=(0,a.useRef)(null);m(()=>{let{current:e}=N,{current:t}=C;e||null===t||(j&&(t.src=t.src),t.complete&&p(t,c,v,b,w,x,E),N.current=!0)},[e,c,v,b,j,x,E]);let $=(0,f.useMergedRef)(S,C);return(0,i.jsx)("img",{..._,...g(u),loading:h,width:o,height:r,decoding:l,"data-nimg":y?"fill":"1",className:s,style:d,sizes:n,srcSet:t,src:e,ref:$,onLoad:e=>{p(e.currentTarget,c,v,b,w,x,E)},onError:e=>{k(!0),"empty"!==c&&w(!0),j&&j(e)}})});function y({isAppRouter:e,imgAttributes:t}){let n={as:"image",imageSrcSet:t.srcSet,imageSizes:t.sizes,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,...g(t.fetchPriority)};return e&&l.default.preload?(l.default.preload(t.src,n),null):(0,i.jsx)(s.default,{children:(0,i.jsx)("link",{rel:"preload",href:t.srcSet?void 0:t.src,...n},"__nimg-"+t.src+t.srcSet+t.sizes)})}let v=(0,a.forwardRef)((e,t)=>{let n=(0,a.useContext)(u.RouterContext),r=(0,c.useImageConfig)(),{onLoad:o,onLoadingComplete:l}=e,s=(0,a.useRef)(o);(0,a.useEffect)(()=>{s.current=o},[o]);let f=(0,a.useRef)(l);(0,a.useEffect)(()=>{f.current=l},[l]);let[p,g]=(0,a.useState)(!1),[m,v]=(0,a.useState)(!1),{props:b,meta:w}=(0,d.getImgProps)(e,{defaultLoader:h.default,imgConf:r,blurComplete:p,showAltText:m});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(x,{...b,unoptimized:w.unoptimized,placeholder:w.placeholder,fill:w.fill,onLoadRef:s,onLoadingCompleteRef:f,setBlurComplete:g,setShowAltText:v,sizesInput:e.sizes,ref:t}),w.preload?(0,i.jsx)(y,{isAppRouter:!n,imgAttributes:b}):null]})});("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},49381,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useImageConfig",{enumerable:!0,get:function(){return l}});let r=e.r(71645),o=e.r(87690),i=e.r(18556),a={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function l(){let e=(0,r.useContext)(i.ImageConfigContext);return(0,o.prepareImageConfig)(a,e)}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},18581,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useMergedRef",{enumerable:!0,get:function(){return o}});let r=e.r(71645);function o(e,t){let n=(0,r.useRef)(null),o=(0,r.useRef)(null);return(0,r.useCallback)(r=>{if(null===r){let e=n.current;e&&(n.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(n.current=i(e,r)),t&&(o.current=i(t,r))},[e,t])}function i(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let n=e(t);return"function"==typeof n?n:()=>e(null)}}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},70965,(e,t,n)=>{function r(e,t){let n=e||75;return t?.qualities?.length?t.qualities.reduce((e,t)=>Math.abs(t-n)<Math.abs(e-n)?t:e,t.qualities[0]):n}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"findClosestQuality",{enumerable:!0,get:function(){return r}})},8927,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"getImgProps",{enumerable:!0,get:function(){return s}});let r=e.r(43369),o=e.r(88143),i=["-moz-initial","fill","none","scale-down",void 0];function a(e){return void 0!==e.default}function l(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:0/0:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):0/0}function s({src:e,sizes:t,unoptimized:n=!1,priority:d=!1,preload:u=!1,loading:c,className:h,quality:f,width:p,height:g,fill:m=!1,style:x,overrideSrc:y,onLoad:v,onLoadingComplete:b,placeholder:w="empty",blurDataURL:k,fetchPriority:E,decoding:M="async",layout:j,objectFit:_,objectPosition:S,lazyBoundary:N,lazyRoot:C,...$},O){var A;let P,z,{imgConf:L,showAltText:R,blurComplete:I,defaultLoader:D}=O;if(void 0===D)throw Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config");let B=$.loader||D;delete $.loader,delete $.srcSet;let T="__next_img_default"in B;if(T){if("custom"===L.loader)throw Error(`Image with src "${e}" is missing "loader" prop.
|
|
10
|
+
Read more: https://nextjs.org/docs/messages/next-image-missing-loader`)}else{let e=B;B=t=>{let{config:n,...r}=t;return e(r)}}if(j){"fill"===j&&(m=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[j];e&&(x={...x,...e});let n={responsive:"100vw",fill:"100vw"}[j];n&&!t&&(t=n)}let F="",H=l(p),V=l(g);if((A=e)&&"object"==typeof A&&(a(A)||void 0!==A.src)){let t=a(e)?e.default:e;if(!t.src)throw Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(t)}`);if(!t.height||!t.width)throw Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(t)}`);if(P=t.blurWidth,z=t.blurHeight,k=k||t.blurDataURL,F=t.src,!m)if(H||V){if(H&&!V){let e=H/t.width;V=Math.round(t.height*e)}else if(!H&&V){let e=V/t.height;H=Math.round(t.width*e)}}else H=t.width,V=t.height}let q=!d&&!u&&("lazy"===c||void 0===c);(!(e="string"==typeof e?e:F)||e.startsWith("data:")||e.startsWith("blob:"))&&(n=!0,q=!1),L.unoptimized&&(n=!0),T&&!L.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(n=!0);let W=l(f),X=Object.assign(m?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:_,objectPosition:S}:{},R?{}:{color:"transparent"},x),Y=I||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,o.getImageBlurSvg)({widthInt:H,heightInt:V,blurWidth:P,blurHeight:z,blurDataURL:k||"",objectFit:X.objectFit})}")`:`url("${w}")`,K=i.includes(X.objectFit)?"fill"===X.objectFit?"100% 100%":"cover":X.objectFit,U=Y?{backgroundSize:K,backgroundPosition:X.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:Y}:{},Z=function({config:e,src:t,unoptimized:n,width:o,quality:i,sizes:a,loader:l}){if(n){if(t.startsWith("/")&&!t.startsWith("//")){let e=(0,r.getDeploymentId)();if(t.includes("/_next/static/immutable")&&!(0,r.getAssetToken)())e=void 0;else if(e){let n=t.indexOf("?");if(-1!==n){let r=new URLSearchParams(t.slice(n+1));r.get("dpl")||(r.append("dpl",e),t=t.slice(0,n)+"?"+r.toString())}else t+=`?dpl=${e}`}}return{src:t,srcSet:void 0,sizes:void 0}}let{widths:s,kind:d}=function({deviceSizes:e,allSizes:t},n,r){if(r){let n=/(^|\s)(1?\d?\d)vw/g,o=[];for(let e;e=n.exec(r);)o.push(parseInt(e[2]));if(o.length){let n=.01*Math.min(...o);return{widths:t.filter(t=>t>=e[0]*n),kind:"w"}}return{widths:t,kind:"w"}}return"number"!=typeof n?{widths:e,kind:"w"}:{widths:[...new Set([n,2*n].map(e=>t.find(t=>t>=e)||t[t.length-1]))],kind:"x"}}(e,o,a),u=s.length-1;return{sizes:a||"w"!==d?a:"100vw",srcSet:s.map((n,r)=>`${l({config:e,src:t,quality:i,width:n})} ${"w"===d?n:r+1}${d}`).join(", "),src:l({config:e,src:t,quality:i,width:s[u]})}}({config:L,src:e,unoptimized:n,width:H,quality:W,sizes:t,loader:B}),G=q?"lazy":c;return{props:{...$,loading:G,fetchPriority:E,width:H,height:V,decoding:M,className:h,style:{...X,...U},sizes:Z.sizes,srcSet:Z.srcSet,src:y||Z.src},meta:{unoptimized:n,preload:u||d,placeholder:w,fill:m}}}},25633,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return g},defaultHead:function(){return c}};for(var o in r)Object.defineProperty(n,o,{enumerable:!0,get:r[o]});let i=e.r(55682),a=e.r(90809),l=e.r(43476),s=a._(e.r(71645)),d=i._(e.r(98879)),u=e.r(42732);function c(){return[(0,l.jsx)("meta",{charSet:"utf-8"},"charset"),(0,l.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function h(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===s.default.Fragment?e.concat(s.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}let f=["name","httpEquiv","charSet","itemProp"];function p(e){let t,n,r,o;return e.reduce(h,[]).reverse().concat(c().reverse()).filter((t=new Set,n=new Set,r=new Set,o={},e=>{let i=!0,a=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){a=!0;let n=e.key.slice(e.key.indexOf("$")+1);t.has(n)?i=!1:t.add(n)}switch(e.type){case"title":case"base":n.has(e.type)?i=!1:n.add(e.type);break;case"meta":for(let t=0,n=f.length;t<n;t++){let n=f[t];if(e.props.hasOwnProperty(n))if("charSet"===n)r.has(n)?i=!1:r.add(n);else{let t=e.props[n],r=o[n]||new Set;("name"!==n||!a)&&r.has(t)?i=!1:(r.add(t),o[n]=r)}}}return i})).reverse().map((e,t)=>{let n=e.key||t;return s.default.cloneElement(e,{key:n})})}let g=function({children:e}){let t=(0,s.useContext)(u.HeadManagerContext);return(0,l.jsx)(d.default,{reduceComponentsToState:p,headManager:t,children:e})};("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},88143,(e,t,n)=>{function r({widthInt:e,heightInt:t,blurWidth:n,blurHeight:o,blurDataURL:i,objectFit:a}){let l=n?40*n:e,s=o?40*o:t,d=l&&s?`viewBox='0 0 ${l} ${s}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${d}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${d?"none":"contain"===a?"xMidYMid":"cover"===a?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${i}'/%3E%3C/svg%3E`}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},18556,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"ImageConfigContext",{enumerable:!0,get:function(){return i}});let r=e.r(55682)._(e.r(71645)),o=e.r(87690),i=r.default.createContext(o.imageConfigDefault)},87690,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0});var r={VALID_LOADERS:function(){return i},imageConfigDefault:function(){return d},prepareImageConfig:function(){return s}};for(var o in r)Object.defineProperty(n,o,{enumerable:!0,get:r[o]});let i=["default","imgix","cloudinary","akamai","custom"],a={},l=new WeakMap;function s(e,t){let n=e??a,r=t??a,o=l.get(n);if(o){let e=o.get(r);if(e)return e}let i=e||t||d,s=[...i.deviceSizes].sort((e,t)=>e-t),u=[...i.imageSizes],c={deviceSizes:s,imageSizes:u,allSizes:[...s,...u].sort((e,t)=>e-t),qualities:void 0===i.qualities?void 0:[...i.qualities].sort((e,t)=>e-t),path:i.path,loader:i.loader,dangerouslyAllowSVG:i.dangerouslyAllowSVG,unoptimized:i.unoptimized,domains:i.domains,remotePatterns:i.remotePatterns,localPatterns:"u"<typeof window&&void 0!==t?t.localPatterns:i.localPatterns,output:i.output};return o||(o=new WeakMap,l.set(n,o)),o.set(r,c),c}let d={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumDiskCacheSize:void 0,maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1,customCacheHandler:!1}},1948,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return a}});let r=e.r(70965),o=e.r(43369);function i({config:e,src:t,width:n,quality:a}){let l=(0,o.getDeploymentId)();if(t.startsWith("/")&&!t.startsWith("//"))if(t.includes("/_next/static/immutable")&&!(0,o.getAssetToken)())l=void 0;else{let e=t.indexOf("?");if(-1!==e){let n=new URLSearchParams(t.slice(e+1)),r=n.get("dpl");if(r){l=r,n.delete("dpl");let o=n.toString();t=t.slice(0,e)+(o?"?"+o:"")}}}if(t.startsWith("/")&&t.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Error(`Image with src "${t}" is using a query string which is not configured in images.localPatterns.
|
|
11
|
+
Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`);let s=(0,r.findClosestQuality)(a,e);return`${e.path}?url=${encodeURIComponent(t)}&w=${n}&q=${s}${t.startsWith("/")&&l?`&dpl=${l}`:""}`}i.__next_img_default=!0;let a=i},65856,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"RouterContext",{enumerable:!0,get:function(){return r}});let r=(e.r(55682)._(e.r(71645))).default.createContext(null)},98879,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return l}});let r=e.r(71645),o="u"<typeof window,i=o?()=>{}:r.useLayoutEffect,a=o?()=>{}:r.useEffect;function l(e){let{headManager:t,reduceComponentsToState:n}=e;function l(){if(t&&t.mountedInstances){let e=r.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(n(e))}}return o&&(t?.mountedInstances?.add(e.children),l()),i(()=>(t?.mountedInstances?.add(e.children),()=>{t?.mountedInstances?.delete(e.children)})),i(()=>(t&&(t._pendingUpdate=l),()=>{t&&(t._pendingUpdate=l)})),a(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},55838,(e,t,n)=>{var r=e.r(71645),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,a=r.useEffect,l=r.useLayoutEffect,s=r.useDebugValue;function d(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return l(function(){o.value=n,o.getSnapshot=t,d(o)&&u({inst:o})},[e,n,t]),a(function(){return d(o)&&u({inst:o}),e(function(){d(o)&&u({inst:o})})},[e]),s(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},52822,(e,t,n)=>{var r=e.r(71645),o=e.r(2239),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=o.useSyncExternalStore,l=r.useRef,s=r.useEffect,d=r.useMemo,u=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var c=l(null);if(null===c.current){var h={hasValue:!1,value:null};c.current=h}else h=c.current;var f=a(e,(c=d(function(){function e(e){if(!s){if(s=!0,a=e,e=r(e),void 0!==o&&h.hasValue){var t=h.value;if(o(t,e))return l=t}return l=e}if(t=l,i(a,e))return t;var n=r(e);return void 0!==o&&o(t,n)?(a=e,t):(a=e,l=n)}var a,l,s=!1,d=void 0===n?null:n;return[function(){return e(t())},null===d?void 0:function(){return e(d())}]},[t,n,r,o]))[0],c[1]);return s(function(){h.hasValue=!0,h.value=f},[f]),u(f),f}},2239,(e,t,n)=>{e.i(47167),t.exports=e.r(55838)},30224,(e,t,n)=>{e.i(47167),t.exports=e.r(52822)}])})();
|