@shepai/cli 1.92.2 → 1.94.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.
Files changed (144) hide show
  1. package/dist/src/presentation/web/app/actions/get-merge-review-data.d.ts.map +1 -1
  2. package/dist/src/presentation/web/app/actions/get-merge-review-data.js +3 -13
  3. package/dist/src/presentation/web/components/common/feature-drawer-tabs/activity-tab.d.ts.map +1 -1
  4. package/dist/src/presentation/web/components/common/feature-drawer-tabs/activity-tab.js +1 -3
  5. package/dist/src/presentation/web/components/common/feature-drawer-tabs/feature-drawer-tabs.stories.d.ts.map +1 -1
  6. package/dist/src/presentation/web/components/common/feature-drawer-tabs/feature-drawer-tabs.stories.js +0 -4
  7. package/dist/src/presentation/web/components/common/merge-review/merge-review-config.d.ts +0 -8
  8. package/dist/src/presentation/web/components/common/merge-review/merge-review-config.d.ts.map +1 -1
  9. package/dist/src/presentation/web/components/common/merge-review/merge-review.d.ts.map +1 -1
  10. package/dist/src/presentation/web/components/common/merge-review/merge-review.js +3 -6
  11. package/dist/src/presentation/web/components/common/merge-review/merge-review.stories.d.ts +0 -2
  12. package/dist/src/presentation/web/components/common/merge-review/merge-review.stories.d.ts.map +1 -1
  13. package/dist/src/presentation/web/components/common/merge-review/merge-review.stories.js +0 -17
  14. package/dist/src/presentation/web/lib/format-duration.d.ts +11 -0
  15. package/dist/src/presentation/web/lib/format-duration.d.ts.map +1 -0
  16. package/dist/src/presentation/web/lib/format-duration.js +26 -0
  17. package/dist/tsconfig.build.tsbuildinfo +1 -1
  18. package/package.json +1 -1
  19. package/web/.next/BUILD_ID +1 -1
  20. package/web/.next/build-manifest.json +2 -2
  21. package/web/.next/fallback-build-manifest.json +2 -2
  22. package/web/.next/prerender-manifest.json +3 -3
  23. package/web/.next/required-server-files.js +2 -2
  24. package/web/.next/required-server-files.json +2 -2
  25. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +18 -18
  26. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  27. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  28. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +21 -21
  29. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  30. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  31. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +21 -21
  32. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  33. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  34. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +14 -14
  35. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  36. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  37. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +18 -18
  38. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  39. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  40. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +21 -21
  41. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  42. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  43. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +21 -21
  44. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  45. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  46. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +14 -14
  47. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  48. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  49. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +14 -14
  50. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  51. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  52. package/web/.next/server/app/_global-error.html +2 -2
  53. package/web/.next/server/app/_global-error.rsc +1 -1
  54. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  55. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  56. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  57. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  58. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  59. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  60. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  61. package/web/.next/server/app/api/attachments/preview/route.js.nft.json +1 -1
  62. package/web/.next/server/app/settings/page/server-reference-manifest.json +5 -5
  63. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  64. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  65. package/web/.next/server/app/skills/page/server-reference-manifest.json +6 -6
  66. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  67. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  68. package/web/.next/server/app/tools/page/server-reference-manifest.json +6 -6
  69. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  70. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  71. package/web/.next/server/app/version/page/server-reference-manifest.json +1 -1
  72. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  73. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  74. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  75. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_da7eef33.js +1 -1
  76. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_da7eef33.js.map +1 -1
  77. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_0a9251aa.js +1 -1
  78. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_0a9251aa.js.map +1 -1
  79. package/web/.next/server/chunks/ssr/[root-of-the-server]__11033878._.js +1 -1
  80. package/web/.next/server/chunks/ssr/[root-of-the-server]__11033878._.js.map +1 -1
  81. package/web/.next/server/chunks/ssr/[root-of-the-server]__17143953._.js +1 -1
  82. package/web/.next/server/chunks/ssr/[root-of-the-server]__17143953._.js.map +1 -1
  83. package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
  84. package/web/.next/server/chunks/ssr/[root-of-the-server]__45aad79d._.js +1 -1
  85. package/web/.next/server/chunks/ssr/[root-of-the-server]__45aad79d._.js.map +1 -1
  86. package/web/.next/server/chunks/ssr/[root-of-the-server]__4be9a9bb._.js +1 -1
  87. package/web/.next/server/chunks/ssr/[root-of-the-server]__5cc4752a._.js +1 -1
  88. package/web/.next/server/chunks/ssr/[root-of-the-server]__5cc4752a._.js.map +1 -1
  89. package/web/.next/server/chunks/ssr/[root-of-the-server]__5d87af2e._.js +1 -1
  90. package/web/.next/server/chunks/ssr/[root-of-the-server]__845a9d2a._.js +1 -1
  91. package/web/.next/server/chunks/ssr/[root-of-the-server]__845a9d2a._.js.map +1 -1
  92. package/web/.next/server/chunks/ssr/[root-of-the-server]__89e8a5cc._.js +2 -2
  93. package/web/.next/server/chunks/ssr/[root-of-the-server]__9de266fa._.js +1 -1
  94. package/web/.next/server/chunks/ssr/[root-of-the-server]__9de266fa._.js.map +1 -1
  95. package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js +1 -1
  96. package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js.map +1 -1
  97. package/web/.next/server/chunks/ssr/[root-of-the-server]__fdc75809._.js +1 -1
  98. package/web/.next/server/chunks/ssr/[root-of-the-server]__fdc75809._.js.map +1 -1
  99. package/web/.next/server/chunks/ssr/_135edb9c._.js +1 -1
  100. package/web/.next/server/chunks/ssr/_135edb9c._.js.map +1 -1
  101. package/web/.next/server/chunks/ssr/_8dacd1e7._.js +1 -1
  102. package/web/.next/server/chunks/ssr/_8dacd1e7._.js.map +1 -1
  103. package/web/.next/server/chunks/ssr/{_16a7514c._.js → _9f6b01ba._.js} +2 -2
  104. package/web/.next/server/chunks/ssr/{_16a7514c._.js.map → _9f6b01ba._.js.map} +1 -1
  105. package/web/.next/server/chunks/ssr/_cc77a143._.js +1 -1
  106. package/web/.next/server/chunks/ssr/_cc77a143._.js.map +1 -1
  107. package/web/.next/server/chunks/ssr/_df15bd24._.js +1 -1
  108. package/web/.next/server/chunks/ssr/_df15bd24._.js.map +1 -1
  109. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  110. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  111. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_021a05f2.js +1 -1
  112. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_021a05f2.js.map +1 -1
  113. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js +1 -1
  114. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js.map +1 -1
  115. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js +1 -1
  116. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js.map +1 -1
  117. package/web/.next/server/chunks/ssr/src_presentation_web_c4348b8a._.js +2 -2
  118. package/web/.next/server/chunks/ssr/src_presentation_web_c4348b8a._.js.map +1 -1
  119. package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js +1 -1
  120. package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js.map +1 -1
  121. package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js +1 -1
  122. package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js.map +1 -1
  123. package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js +1 -1
  124. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  125. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  126. package/web/.next/server/chunks/ssr/src_presentation_web_e4510d10._.js +2 -2
  127. package/web/.next/server/chunks/ssr/src_presentation_web_e4510d10._.js.map +1 -1
  128. package/web/.next/server/pages/500.html +2 -2
  129. package/web/.next/server/server-reference-manifest.js +1 -1
  130. package/web/.next/server/server-reference-manifest.json +28 -28
  131. package/web/.next/static/chunks/{0a1511515cbdf02e.js → 0e4078228269008c.js} +2 -2
  132. package/web/.next/static/chunks/{1da59e0c79357cf8.js → 2f0da3c393fc4f04.js} +1 -1
  133. package/web/.next/static/chunks/{449251751b4908f7.js → 34a9700c5d94478b.js} +1 -1
  134. package/web/.next/static/chunks/{166e31f7adad1949.js → 47d6a912ef998ba6.js} +1 -1
  135. package/web/.next/static/chunks/{2ae98439dac3693e.js → 5014c892e1ecc7d6.js} +1 -1
  136. package/web/.next/static/chunks/{62652f0d1304c333.js → 8656ca74dcb26191.js} +1 -1
  137. package/web/.next/static/chunks/{85c0a8c9420d2064.js → 949f140ebb0ba001.js} +1 -1
  138. package/web/.next/static/chunks/{ceb79276cb6d8b88.js → a2d089b6a5c4fe0b.js} +1 -1
  139. package/web/.next/static/chunks/{7bf51da075913f1c.js → aef300837193b9fe.js} +1 -1
  140. package/web/.next/static/chunks/{4a13c8befddbfae9.js → b2c294b25be01866.js} +1 -1
  141. package/web/.next/static/chunks/{97b0a13714eb4d92.js → fca533d905e50d78.js} +1 -1
  142. /package/web/.next/static/{KEWoM0Hk-MbG0_3S8cSrW → FBd4oUGtZ_PQpjMeHHiks}/_buildManifest.js +0 -0
  143. /package/web/.next/static/{KEWoM0Hk-MbG0_3S8cSrW → FBd4oUGtZ_PQpjMeHHiks}/_clientMiddlewareManifest.json +0 -0
  144. /package/web/.next/static/{KEWoM0Hk-MbG0_3S8cSrW → FBd4oUGtZ_PQpjMeHHiks}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17840,e=>{"use strict";var t=e.i(79054),r=e.i(31406),n=e.i(60112),o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=o((e,t)=>{var r=Object.defineProperty,n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o=(e,t,n)=>{let o;return(o="symbol"!=typeof t?t+"":t)in e?r(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n},a=n((e,t)=>{function r(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function a(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var i=o;o=a,a=i}return o+"\x01"+a+"\x01"+(void 0===n?"\0":n)}function i(e,t){return a(e,t.v,t.w,t.name)}t.exports=class{constructor(e){o(this,"_isDirected",!0),o(this,"_isMultigraph",!1),o(this,"_isCompound",!1),o(this,"_label"),o(this,"_defaultNodeLabelFn",()=>{}),o(this,"_defaultEdgeLabelFn",()=>{}),o(this,"_nodes",{}),o(this,"_in",{}),o(this,"_preds",{}),o(this,"_out",{}),o(this,"_sucs",{}),o(this,"_edgeObjs",{}),o(this,"_edgeLabels",{}),o(this,"_nodeCount",0),o(this,"_edgeCount",0),o(this,"_parent"),o(this,"_children"),e&&(this._isDirected=!Object.hasOwn(e,"directed")||e.directed,this._isMultigraph=!!Object.hasOwn(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.hasOwn(e,"compound")&&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 this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._in[t]).length)}sinks(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._out[t]).length)}setNodes(e,t){var r=arguments,n=this;return e.forEach(function(e){r.length>1?n.setNode(e,t):n.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?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 Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var r=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(r),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(r),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(var r=t;void 0!==r;r=this.parent(r))if(r===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}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let n=new Set(t);for(var r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([r,n]){e(r)&&t.setNode(r,n)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var n={};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,function e(o){var a=r.parent(o);return void 0===a||t.hasNode(a)?(n[o]=a,a):a in n?n[a]:e(a)}(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var r=this,n=arguments;return e.reduce(function(e,o){return n.length>1?r.setEdge(e,o,t):r.setEdge(e,o),o}),this}setEdge(){var e,t,n,o,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(e=s.v,t=s.w,n=s.name,2==arguments.length&&(o=arguments[1],i=!0)):(e=s,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var d=a(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,d))return i&&(this._edgeLabels[d]=o),this;if(void 0!==n&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[d]=i?o:this._defaultEdgeLabelFn(e,t,n);var l=function(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var i=o;o=a,a=i}var s={v:o,w:a};return n&&(s.name=n),s}(this._isDirected,e,t,n);return e=l.v,t=l.w,Object.freeze(l),this._edgeObjs[d]=l,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][d]=l,this._out[e][d]=l,this._edgeCount++,this}edge(e,t,r){var n=1==arguments.length?i(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return this._edgeLabels[n]}edgeAsObj(){let e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,r){var n=1==arguments.length?i(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return Object.hasOwn(this._edgeLabels,n)}removeEdge(e,t,r){var o=1==arguments.length?i(this._isDirected,arguments[0]):a(this._isDirected,e,t,r),s=this._edgeObjs[o];return s&&(e=s.v,t=s.w,delete this._edgeLabels[o],delete this._edgeObjs[o],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][o],delete this._out[e][o],this._edgeCount--),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)}filterEdges(e,t,r){if(e){var n=Object.values(e);return r?n.filter(function(e){return e.v===t&&e.w===r||e.v===r&&e.w===t}):n}}}}),i=n((e,t)=>{t.exports="3.0.2"}),s=n((e,t)=>{t.exports={Graph:a(),version:i()}}),d=n((e,t)=>{var r=a();t.exports={write:function(e){var t,r,n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e).nodes().map(function(e){var r=t.node(e),n=t.parent(e),o={v:e};return void 0!==r&&(o.value=r),void 0!==n&&(o.parent=n),o}),edges:(r=e).edges().map(function(e){var t=r.edge(e),n={v:e.v,w:e.w};return void 0!==e.name&&(n.name=e.name),void 0!==t&&(n.value=t),n})};return void 0!==e.graph()&&(n.value=structuredClone(e.graph())),n},read:function(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}}),l=n((e,t)=>{t.exports=function(e,t,n,o){return function(e,t,r,n){var o={},a=!0,i=0,s=e.nodes(),d=function(e){var t=r(e);o[e.v].distance+t<o[e.w].distance&&(o[e.w]={distance:o[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){n(e).forEach(function(t){var r=t.v===e?t.v:t.w,n=r===t.v?t.w:t.v;d({v:r,w:n})})})};s.forEach(function(e){o[e]={distance:e===t?0:1/0}});for(var c=s.length,u=1;u<c&&(a=!1,i++,l(),a);u++);if(i===c-1&&(a=!1,l(),a))throw Error("The graph contains a negative weight cycle");return o}(e,String(t),n||r,o||function(t){return e.outEdges(t)})};var r=()=>1}),c=n((e,t)=>{t.exports=function(e){var t,r={},n=[];return e.nodes().forEach(function(o){t=[],function n(o){Object.hasOwn(r,o)||(r[o]=!0,t.push(o),e.successors(o).forEach(n),e.predecessors(o).forEach(n))}(o),t.length&&n.push(t)}),n}}),u=n((e,t)=>{t.exports=class{constructor(){o(this,"_arr",[]),o(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var 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){var r=this._keyIndices;if(!Object.hasOwn(r,e=String(e))){var n=this._arr,o=n.length;return r[e]=o,n.push({key:e,priority:t}),this._decrease(o),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var r=this._keyIndices[e];if(t>this._arr[r].priority)throw Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)}_heapify(e){var t=this._arr,r=2*e,n=r+1,o=e;r<t.length&&(o=t[r].priority<t[o].priority?r:o,n<t.length&&(o=t[n].priority<t[o].priority?n:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){for(var t,r=this._arr,n=r[e].priority;0!==e&&!(r[t=e>>1].priority<n);)this._swap(e,t),e=t}_swap(e,t){var r=this._arr,n=this._keyIndices,o=r[e],a=r[t];r[e]=a,r[t]=o,n[a.key]=e,n[o.key]=t}}}),h=n((e,t)=>{var r=u();t.exports=function(e,t,o,a){return function(e,t,n,o){var a,i,s={},d=new r,l=function(e){var t=e.v!==a?e.v:e.w,r=s[t],o=n(e),l=i.distance+o;if(o<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);l<r.distance&&(r.distance=l,r.predecessor=a,d.decrease(t,l))};for(e.nodes().forEach(function(e){var r=e===t?0:1/0;s[e]={distance:r},d.add(e,r)});d.size()>0&&(i=s[a=d.removeMin()]).distance!==1/0;)o(a).forEach(l);return s}(e,String(t),o||n,a||function(t){return e.outEdges(t)})};var n=()=>1}),p=n((e,t)=>{var r=h();t.exports=function(e,t,n){return e.nodes().reduce(function(o,a){return o[a]=r(e,a,t,n),o},{})}}),f=n((e,t)=>{t.exports=function(e,t,r){if(void 0!==e[t].predecessor)throw Error("Invalid source vertex");if(void 0===e[r].predecessor&&r!==t)throw Error("Invalid destination vertex");return{weight:e[r].distance,path:function(e,t,r){for(var n=[],o=r;o!==t;)n.push(o),o=e[o].predecessor;return n.push(t),n.reverse()}(e,t,r)}}}),g=n((e,t)=>{t.exports=function(e){var t=0,r=[],n={},o=[];return e.nodes().forEach(function(a){Object.hasOwn(n,a)||function a(i){var s=n[i]={onStack:!0,lowlink:t,index:t++};if(r.push(i),e.successors(i).forEach(function(e){Object.hasOwn(n,e)?n[e].onStack&&(s.lowlink=Math.min(s.lowlink,n[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,n[e].lowlink))}),s.lowlink===s.index){var d,l=[];do n[d=r.pop()].onStack=!1,l.push(d);while(i!==d)o.push(l)}}(a)}),o}}),v=n((e,t)=>{var r=g();t.exports=function(e){return r(e).filter(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}}),m=n((e,t)=>{t.exports=function(e,t,n){var o,a,i,s,d;return o=e,a=t||r,i=n||function(t){return e.outEdges(t)},s={},(d=o.nodes()).forEach(function(e){s[e]={},s[e][e]={distance:0},d.forEach(function(t){e!==t&&(s[e][t]={distance:1/0})}),i(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=a(t);s[e][r]={distance:n,predecessor:e}})}),d.forEach(function(e){var t=s[e];d.forEach(function(r){var n=s[r];d.forEach(function(r){var o=n[e],a=t[r],i=n[r],s=o.distance+a.distance;s<i.distance&&(i.distance=s,i.predecessor=a.predecessor)})})}),s};var r=()=>1}),y=n((e,t)=>{function r(e){var t={},r={},o=[];if(e.sinks().forEach(function a(i){if(Object.hasOwn(r,i))throw new n;Object.hasOwn(t,i)||(r[i]=!0,t[i]=!0,e.predecessors(i).forEach(a),delete r[i],o.push(i))}),Object.keys(t).length!==e.nodeCount())throw new n;return o}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),w=n((e,t)=>{var r=y();t.exports=function(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}}),b=n((e,t)=>{t.exports=function(e,t,r,n,o){Array.isArray(t)||(t=[t]);var a=(e.isDirected()?e.successors:e.neighbors).bind(e),i={};return t.forEach(function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);o=function e(t,r,n,o,a,i,s){return Object.hasOwn(o,r)||(o[r]=!0,n||(s=i(s,r)),a(r).forEach(function(r){s=e(t,r,n,o,a,i,s)}),n&&(s=i(s,r))),s}(e,t,"post"===r,i,a,n,o)}),o}}),x=n((e,t)=>{var r=b();t.exports=function(e,t,n){return r(e,t,n,function(e,t){return e.push(t),e},[])}}),E=n((e,t)=>{var r=x();t.exports=function(e,t){return r(e,t,"post")}}),k=n((e,t)=>{var r=x();t.exports=function(e,t){return r(e,t,"pre")}}),j=n((e,t)=>{var r=a(),n=u();t.exports=function(e,t){var o,a=new r,i={},s=new n;function d(e){var r=e.v===o?e.w:e.v,n=s.priority(r);if(void 0!==n){var a=t(e);a<n&&(i[r]=o,s.decrease(r,a))}}if(0===e.nodeCount())return a;e.nodes().forEach(function(e){s.add(e,1/0),a.setNode(e)}),s.decrease(e.nodes()[0],0);for(var l=!1;s.size()>0;){if(Object.hasOwn(i,o=s.removeMin()))a.setEdge(o,i[o]);else{if(l)throw Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(o).forEach(d)}return a}}),_=n((e,t)=>{var r=h(),n=l();t.exports=function(e,t,o,a){return function(e,t,o,a){if(void 0===o)return r(e,t,o,a);for(var i=!1,s=e.nodes(),d=0;d<s.length;d++){for(var l=a(s[d]),c=0;c<l.length;c++){var u=l[c],h=u.v===s[d]?u.v:u.w,p=h===u.v?u.w:u.v;0>o({v:h,w:p})&&(i=!0)}if(i)return n(e,t,o,a)}return r(e,t,o,a)}(e,t,o,a||function(t){return e.outEdges(t)})}}),C=n((e,t)=>{t.exports={bellmanFord:l(),components:c(),dijkstra:h(),dijkstraAll:p(),extractPath:f(),findCycles:v(),floydWarshall:m(),isAcyclic:w(),postorder:E(),preorder:k(),prim:j(),shortestPaths:_(),reduce:b(),tarjan:g(),topsort:y()}}),N=s();t.exports={Graph:N.Graph,json:d(),alg:C(),version:N.version}}),i=o((e,t)=>{function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function n(e,t){if("_next"!==e&&"_prev"!==e)return t}t.exports=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,r=t._prev;for(;r!==t;)e.push(JSON.stringify(r,n)),r=r._prev;return"["+e.join(", ")+"]"}}}),s=o((e,t)=>{var r=a().Graph,n=i();t.exports=function(e,t){var a,i;let l,c,u,h,p;if(1>=e.nodeCount())return[];let f=(a=e,i=t||o,l=new r,c=0,u=0,a.nodes().forEach(e=>{l.setNode(e,{v:e,in:0,out:0})}),a.edges().forEach(e=>{let t=l.edge(e.v,e.w)||0,r=i(e);l.setEdge(e.v,e.w,t+r),u=Math.max(u,l.node(e.v).out+=r),c=Math.max(c,l.node(e.w).in+=r)}),h=(function(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t})(u+c+3).map(()=>new n),p=c+1,l.nodes().forEach(e=>{d(h,p,l.node(e))}),{graph:l,buckets:h,zeroIdx:p});return(function(e,t,r){let n=[],o=t[t.length-1],a=t[0],i;for(;e.nodeCount();){for(;i=a.dequeue();)s(e,t,r,i);for(;i=o.dequeue();)s(e,t,r,i);if(e.nodeCount()){for(let o=t.length-2;o>0;--o)if(i=t[o].dequeue()){n=n.concat(s(e,t,r,i,!0));break}}}return n})(f.graph,f.buckets,f.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var o=()=>1;function s(e,t,r,n,o){let a=o?[]:void 0;return e.inEdges(n.v).forEach(n=>{let i=e.edge(n),s=e.node(n.v);o&&a.push({v:n.v,w:n.w}),s.out-=i,d(t,r,s)}),e.outEdges(n.v).forEach(n=>{let o=e.edge(n),a=n.w,i=e.node(a);i.in-=o,d(t,r,i)}),e.removeNode(n.v),a}function d(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}}),d=o((e,t)=>{var r=a().Graph;function n(e,t,r,n){for(var o=n;e.hasNode(o);)o=d(n);return r.dummy=t,e.setNode(o,r),o}t.exports={addBorderNode:function(e,t,r,o){let a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=o),n(e,"border",a,t)},addDummyNode:n,applyWithChunking:o,asNonCompoundGraph:function(e){let t=new r({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t},buildLayerMatrix:function(e){let t=l(i(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),o=n.rank;void 0!==o&&(t[o][n.order]=r)}),t},intersectRect:function(e,t){let r,n,o=e.x,a=e.y,i=t.x-o,s=t.y-a,d=e.width/2,l=e.height/2;if(!i&&!s)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*d>Math.abs(i)*l?(s<0&&(l=-l),r=l*i/s,n=l):(i<0&&(d=-d),r=d,n=d*s/i),{x:o+r,y:a+n}},mapValues:function(e,t){let r=t;return"string"==typeof t&&(r=e=>e[t]),Object.entries(e).reduce((e,[t,n])=>(e[t]=r(n,t),e),{})},maxRank:i,normalizeRanks:function(e){let t=o(Math.min,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?Number.MAX_VALUE:r}));e.nodes().forEach(r=>{let n=e.node(r);Object.hasOwn(n,"rank")&&(n.rank-=t)})},notime:function(e,t){return t()},partition:function(e,t){let r={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?r.lhs.push(e):r.rhs.push(e)}),r},pick:function(e,t){let r={};for(let n of t)void 0!==e[n]&&(r[n]=e[n]);return r},predecessorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.inEdges(t).forEach(t=>{r[t.v]=(r[t.v]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},range:l,removeEmptyRanks:function(e){let t=o(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),r=[];e.nodes().forEach(n=>{let o=e.node(n).rank-t;r[o]||(r[o]=[]),r[o].push(n)});let n=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,r)=>{void 0===t&&r%a!=0?--n:void 0!==t&&n&&t.forEach(t=>e.node(t).rank+=n)})},simplify:function(e){let t=new r().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},o=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})}),t},successorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.outEdges(t).forEach(t=>{r[t.w]=(r[t.w]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},time:function(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}},uniqueId:d,zipObject:c};function o(e,t){if(!(t.length>65535))return e.apply(null,t);{let r=function(e,t=65535){let r=[];for(let n=0;n<e.length;n+=t){let o=e.slice(n,n+t);r.push(o)}return r}(t);return e.apply(null,r.map(t=>e.apply(null,t)))}}function i(e){return o(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var s=0;function d(e){return e+""+ ++s}function l(e,t,r=1){null==t&&(t=e,e=0);let n=e=>e<t;r<0&&(n=e=>t<e);let o=[];for(let t=e;n(t);t+=r)o.push(t);return o}function c(e,t){return e.reduce((e,r,n)=>(e[r]=t[n],e),{})}}),l=o((e,t)=>{var r=s(),n=d().uniqueId;t.exports={run:function(e){var t,o;let a,i,s;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(a=[],i={},s={},(o=e).nodes().forEach(function e(t){Object.hasOwn(s,t)||(s[t]=!0,i[t]=!0,o.outEdges(t).forEach(t=>{Object.hasOwn(i,t.w)?a.push(t):e(t.w)}),delete i[t])}),a)).forEach(t=>{let r=e.edge(t);e.removeEdge(t),r.forwardName=t.name,r.reversed=!0,e.setEdge(t.w,t.v,r,n("rev"))})},undo:function(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}}}),c=o((e,t)=>{var r=d();t.exports={run:function(e){e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,o,a,i=t.v,s=e.node(i).rank,d=t.w,l=e.node(d).rank,c=t.name,u=e.edge(t),h=u.labelRank;if(l!==s+1){for(e.removeEdge(t),a=0,++s;s<l;++a,++s)u.points=[],o={width:0,height:0,edgeLabel:u,edgeObj:t,rank:s},n=r.addDummyNode(e,"edge",o,"_d"),s===h&&(o.width=u.width,o.height=u.height,o.dummy="edge-label",o.labelpos=u.labelpos),e.setEdge(i,n,{weight:u.weight},c),0===a&&e.graph().dummyChains.push(n),i=n;e.setEdge(i,d,{weight:u.weight},c)}})(e,t))},undo:function(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,o;for(e.setEdge(r.edgeObj,n);r.dummy;)o=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=o,r=e.node(t)})}}}),u=o((e,t)=>{var{applyWithChunking:r}=d();t.exports={longestPath:function(e){var t={};e.sources().forEach(function n(o){var a=e.node(o);if(Object.hasOwn(t,o))return a.rank;t[o]=!0;var i=r(Math.min,e.outEdges(o).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return i===1/0&&(i=0),a.rank=i})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}}),h=o((e,t)=>{var r=a().Graph,n=u().slack;t.exports=function(e){var t,o,a,i,s=new r({directed:!1}),d=e.nodes()[0],l=e.nodeCount();for(s.setNode(d,{});t=s,o=e,t.nodes().forEach(function e(r){o.nodeEdges(r).forEach(a=>{var i=a.v,s=r===i?a.w:i;t.hasNode(s)||n(o,a)||(t.setNode(s,{}),t.setEdge(r,s,{}),e(s))})}),t.nodeCount()<l;)a=function(e,t){return t.edges().reduce((r,o)=>{let a=1/0;return e.hasNode(o.v)!==e.hasNode(o.w)&&(a=n(t,o)),a<r[0]?[a,o]:r},[1/0,null])[1]}(s,e),i=s.hasNode(a.v)?n(e,a):-n(e,a),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(s,e,i);return s}}),p=o((e,t)=>{var r=h(),n=u().slack,o=u().longestPath,i=a().alg.preorder,s=a().alg.postorder,l=d().simplify;function c(e){o(e=l(e));var t,n,a=r(e);for(g(a),p(a,e);t=v(a);)n=m(a,e,t),y(a,e,t,n)}function p(e,t){var r=s(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,o,a,i;return n=e,o=t,a=r,i=n.node(a).parent,void(n.edge(a,i).cutvalue=f(n,o,a))})}function f(e,t,r){var n=e.node(r).parent,o=!0,a=t.edge(r,n),i=0;return a||(o=!1,a=t.edge(n,r)),i=a.weight,t.nodeEdges(r).forEach(a=>{var s=a.v===r,d=s?a.w:a.v;if(d!==n){var l,c,u,h=s===o,p=t.edge(a).weight;if(i+=h?p:-p,l=e,c=r,u=d,l.hasEdge(c,u)){var f=e.edge(r,d).cutvalue;i+=h?-f:f}}}),i}function g(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,o,a){var i=n,s=t.node(o);return r[o]=!0,t.neighbors(o).forEach(a=>{Object.hasOwn(r,a)||(n=e(t,r,n,a,o))}),s.low=i,s.lim=n++,a?s.parent=a:delete s.parent,n}(e,{},1,t)}function v(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function m(e,t,r){var o=r.v,a=r.w;t.hasEdge(o,a)||(o=r.w,a=r.v);var i=e.node(o),s=e.node(a),d=i,l=!1;return i.lim>s.lim&&(d=s,l=!0),t.edges().filter(t=>l===w(e,e.node(t.v),d)&&l!==w(e,e.node(t.w),d)).reduce((e,r)=>n(t,r)<n(t,e)?r:e)}function y(e,t,r,n){var o,a,s,d,l=r.v,c=r.w;e.removeEdge(l,c),e.setEdge(n.v,n.w,{}),g(e),p(e,t),o=e,a=t,s=o.nodes().find(e=>!a.node(e).parent),(d=(d=i(o,s)).slice(1)).forEach(e=>{var t=o.node(e).parent,r=a.edge(e,t),n=!1;r||(r=a.edge(t,e),n=!0),a.node(e).rank=a.node(t).rank+(n?r.minlen:-r.minlen)})}function w(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=c,c.initLowLimValues=g,c.initCutValues=p,c.calcCutValue=f,c.leaveEdge=v,c.enterEdge=m,c.exchangeEdges=y}),f=o((e,t)=>{var r=u().longestPath,n=h(),o=p();t.exports=function(e){var t,i=e.graph().ranker;if(i instanceof Function)return i(e);switch(e.graph().ranker){case"network-simplex":default:o(e);break;case"tight-tree":r(t=e),n(t);break;case"longest-path":a(e);case"none":}};var a=r}),g=o((e,t)=>{t.exports=function(e){var t;let r,n,o=(r={},n=0,(t=e).children().forEach(function e(o){let a=n;t.children(o).forEach(e),r[o]={low:a,lim:n++}}),r);e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeObj,a=function(e,t,r,n){let o=[],a=[],i=Math.min(t[r].low,t[n].low),s=Math.max(t[r].lim,t[n].lim),d,l;d=r;do o.push(d=e.parent(d));while(d&&(t[d].low>i||s>t[d].lim))for(l=d,d=n;(d=e.parent(d))!==l;)a.push(d);return{path:o.concat(a.reverse()),lca:l}}(e,o,n.v,n.w),i=a.path,s=a.lca,d=0,l=i[0],c=!0;for(;t!==n.w;){if(r=e.node(t),c){for(;(l=i[d])!==s&&e.node(l).maxRank<r.rank;)d++;l===s&&(c=!1)}if(!c){for(;d<i.length-1&&e.node(l=i[d+1]).minRank<=r.rank;)d++;l=i[d]}e.setParent(t,l),t=e.successors(t)[0]}})}}),v=o((e,t)=>{var r=d();t.exports={run:function(e){var t,n,o;let a=r.addDummyNode(e,"root",{},"_root"),i=(n={},(t=e).children().forEach(e=>(function e(r,o){var a=t.children(r);a&&a.length&&a.forEach(t=>e(t,o+1)),n[r]=o})(e,1)),n),s=Object.values(i),d=r.applyWithChunking(Math.max,s)-1,l=2*d+1;e.graph().nestingRoot=a,e.edges().forEach(t=>e.edge(t).minlen*=l);let c=(o=e).edges().reduce((e,t)=>e+o.edge(t).weight,0)+1;e.children().forEach(t=>(function e(t,n,o,a,i,s,d){let l=t.children(d);if(!l.length){d!==n&&t.setEdge(n,d,{weight:0,minlen:o});return}let c=r.addBorderNode(t,"_bt"),u=r.addBorderNode(t,"_bb"),h=t.node(d);t.setParent(c,d),h.borderTop=c,t.setParent(u,d),h.borderBottom=u,l.forEach(r=>{e(t,n,o,a,i,s,r);let l=t.node(r),h=l.borderTop?l.borderTop:r,p=l.borderBottom?l.borderBottom:r,f=l.borderTop?a:2*a,g=h!==p?1:i-s[d]+1;t.setEdge(c,h,{weight:f,minlen:g,nestingEdge:!0}),t.setEdge(p,u,{weight:f,minlen:g,nestingEdge:!0})}),t.parent(d)||t.setEdge(n,c,{weight:0,minlen:i+s[d]})})(e,a,l,c,d,i,t)),e.graph().nodeRankFactor=l},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}}),m=o((e,t)=>{var r=d();function n(e,t,n,o,a,i){let s=a[t][i-1],d=r.addDummyNode(e,"border",{width:0,height:0,rank:i,borderType:t},n);a[t][i]=d,e.setParent(d,o),s&&e.setEdge(s,d,{weight:1})}t.exports=function(e){e.children().forEach(function t(r){let o=e.children(r),a=e.node(r);if(o.length&&o.forEach(t),Object.hasOwn(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,o=a.maxRank+1;t<o;++t)n(e,"borderLeft","_bl",r,a,t),n(e,"borderRight","_br",r,a,t)}})}}),y=o((e,t)=>{function r(e){e.nodes().forEach(t=>n(e.node(t))),e.edges().forEach(t=>n(e.edge(t)))}function n(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.y=-e.y}function a(e){let t=e.x;e.x=e.y,e.y=t}t.exports={adjust:function(e){let t=e.graph().rankdir.toLowerCase();("lr"===t||"rl"===t)&&r(e)},undo:function(e){var t,n;let i=e.graph().rankdir.toLowerCase();("bt"===i||"rl"===i)&&((t=e).nodes().forEach(e=>o(t.node(e))),t.edges().forEach(e=>{let r=t.edge(e);r.points.forEach(o),Object.hasOwn(r,"y")&&o(r)})),("lr"===i||"rl"===i)&&((n=e).nodes().forEach(e=>a(n.node(e))),n.edges().forEach(e=>{let t=n.edge(e);t.points.forEach(a),Object.hasOwn(t,"x")&&a(t)}),r(e))}}}),w=o((e,t)=>{var r=d();t.exports=function(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),o=n.map(t=>e.node(t).rank),a=r.applyWithChunking(Math.max,o),i=r.range(a+1).map(()=>[]);return n.sort((t,r)=>e.node(t).rank-e.node(r).rank).forEach(function r(n){t[n]||(t[n]=!0,i[e.node(n).rank].push(n),e.successors(n).forEach(r))}),i}}),b=o((e,t)=>{var r=d().zipObject;t.exports=function(e,t){let n=0;for(let o=1;o<t.length;++o)n+=function(e,t,n){let o=r(n,n.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:o[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),i=1;for(;i<n.length;)i<<=1;let s=2*i-1;i-=1;let d=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+i;d[t]+=e.weight;let r=0;for(;t>0;)t%2&&(r+=d[t+1]),t=t-1>>1,d[t]+=e.weight;l+=e.weight*r}),l}(e,t[o-1],t[o]);return n}}),x=o((e,t)=>{t.exports=function(e,t=[]){return t.map(t=>{let r=e.inEdges(t);if(!r.length)return{v:t};{let n=r.reduce((t,r)=>{let n=e.edge(r),o=e.node(r.v);return{sum:t.sum+n.weight*o.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:t,barycenter:n.sum/n.weight,weight:n.weight}}})}}),E=o((e,t)=>{var r=d();t.exports=function(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];void 0!==t&&void 0!==r&&(r.indegree++,t.out.push(n[e.w]))}),function(e){let t=[];for(;e.length;){let r=e.pop();t.push(r),r.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 r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(r)),r.out.forEach(function(t){return r=>{r.in.push(t),0==--r.indegree&&e.push(r)}}(r))}return t.filter(e=>!e.merged).map(e=>r.pick(e,["vs","i","barycenter","weight"]))}(Object.values(n).filter(e=>!e.indegree))}}),k=o((e,t)=>{var r=d();function n(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}t.exports=function(e,t){var o;let a=r.partition(e,e=>Object.hasOwn(e,"barycenter")),i=a.lhs,s=a.rhs.sort((e,t)=>t.i-e.i),d=[],l=0,c=0,u=0;i.sort((o=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:o?t.i-e.i:e.i-t.i)),u=n(d,s,u),i.forEach(e=>{u+=e.vs.length,d.push(e.vs),l+=e.barycenter*e.weight,c+=e.weight,u=n(d,s,u)});let h={vs:d.flat(!0)};return c&&(h.barycenter=l/c,h.weight=c),h}}),j=o((e,t)=>{var r=x(),n=E(),o=k();t.exports=function e(t,a,i,s){var d,l;let c=t.children(a),u=t.node(a),h=u?u.borderLeft:void 0,p=u?u.borderRight:void 0,f={};h&&(c=c.filter(e=>e!==h&&e!==p));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,o;let a=e(t,r.v,i,s);f[r.v]=a,Object.hasOwn(a,"barycenter")&&(n=r,o=a,void 0!==n.barycenter?(n.barycenter=(n.barycenter*n.weight+o.barycenter*o.weight)/(n.weight+o.weight),n.weight+=o.weight):(n.barycenter=o.barycenter,n.weight=o.weight))}});let v=n(g,i);d=v,l=f,d.forEach(e=>{e.vs=e.vs.flatMap(e=>l[e]?l[e].vs:e)});let m=o(v,s);if(h&&(m.vs=[h,m.vs,p].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(p)[0]);Object.hasOwn(m,"barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.order+r.order)/(m.weight+2),m.weight+=2}return m}}),_=o((e,t)=>{var r=a().Graph,n=d();t.exports=function(e,t,o,a){a||(a=e.nodes());let i=function(e){for(var t;e.hasNode(t=n.uniqueId("_root")););return t}(e),s=new r({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return a.forEach(r=>{let n=e.node(r),a=e.parent(r);(n.rank===t||n.minRank<=t&&t<=n.maxRank)&&(s.setNode(r),s.setParent(r,a||i),e[o](r).forEach(t=>{let n=t.v===r?t.w:t.v,o=s.edge(n,r),a=void 0!==o?o.weight:0;s.setEdge(n,r,{weight:e.edge(t).weight+a})}),Object.hasOwn(n,"minRank")&&s.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),s}}),C=o((e,t)=>{t.exports=function(e,t,r){let n={},o;r.forEach(r=>{let a=e.parent(r),i,s;for(;a;){if((i=e.parent(a))?(s=n[i],n[i]=a):(s=o,o=a),s&&s!==a)return void t.setEdge(s,a);a=i}})}}),N=o((e,t)=>{var r=w(),n=b(),o=j(),i=_(),s=C(),l=a().Graph,c=d();function u(e,t,r){let n=new Map,o=(e,t)=>{n.has(e)||n.set(e,[]),n.get(e).push(t)};for(let t of e.nodes()){let r=e.node(t);if("number"==typeof r.rank&&o(r.rank,t),"number"==typeof r.minRank&&"number"==typeof r.maxRank)for(let e=r.minRank;e<=r.maxRank;e++)e!==r.rank&&o(e,t)}return t.map(function(t){return i(e,t,r,n.get(t)||[])})}function h(e,t){Object.values(t).forEach(t=>t.forEach((t,r)=>e.node(t).order=r))}t.exports=function e(t,a={}){if("function"==typeof a.customOrder)return void a.customOrder(t,e);let i=c.maxRank(t),d=u(t,c.range(1,i+1),"inEdges"),p=u(t,c.range(i-1,-1,-1),"outEdges"),f=r(t);if(h(t,f),a.disableOptimalOrderHeuristic)return;let g=1/0,v,m=a.constraints||[];for(let e=0,r=0;r<4;++e,++r){(function(e,t,r){let n=new l;e.forEach(function(e){r.forEach(e=>n.setEdge(e.left,e.right));let a=e.graph().root,i=o(e,a,n,t);i.vs.forEach((t,r)=>e.node(t).order=r),s(e,n,i.vs)})})(e%2?d:p,e%4>=2,m),f=c.buildLayerMatrix(t);let a=n(t,f);a<g?(r=0,v=Object.assign({},f),g=a):a===g&&(v=structuredClone(f))}h(t,v)}}),O=o((e,t)=>{var r=a().Graph,n=d();function o(e,t){let r={};return t.length&&t.reduce(function(t,n){let o=0,a=0,i=t.length,d=n[n.length-1];return n.forEach((t,l)=>{let c=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}(e,t),u=c?e.node(c).order:i;(c||t===d)&&(n.slice(a,l+1).forEach(t=>{e.predecessors(t).forEach(n=>{let a=e.node(n),i=a.order;(i<o||u<i)&&!(a.dummy&&e.node(t).dummy)&&s(r,n,t)})}),a=l+1,o=u)}),n}),r}function i(e,t){let r={};function o(t,o,a,i,d){let l;n.range(o,a).forEach(n=>{l=t[n],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<i||n.order>d)&&s(r,t,l)})})}return t.length&&t.reduce(function(t,r){let n=-1,a,i=0;return r.forEach((s,d)=>{if("border"===e.node(s).dummy){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,o(r,i,d,n,a),i=d,n=a)}o(r,i,r.length,a,t.length)}),r}),r}function s(e,t,r){if(t>r){let e=t;t=r,r=e}let n=e[t];n||(e[t]=n={}),n[r]=!0}function l(e,t,r){if(t>r){let e=t;t=r,r=e}return!!e[t]&&Object.hasOwn(e[t],r)}function c(e,t,r,n){let o={},a={},i={};return t.forEach(e=>{e.forEach((e,t)=>{o[e]=e,a[e]=e,i[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=n(e);if(s.length){let n=((s=s.sort((e,t)=>i[e]-i[t])).length-1)/2;for(let d=Math.floor(n),c=Math.ceil(n);d<=c;++d){let n=s[d];a[e]===e&&t<i[n]&&!l(r,e,n)&&(a[n]=e,a[e]=o[e]=o[n],t=i[n])}}})}),{root:o,align:a}}function u(e,t,n,o,a){var i,s,d,l,c,u,h;let p,f,g,v={},m=(i=e,s=t,d=n,l=a,p=new r,g=(c=(f=i.graph()).nodesep,u=f.edgesep,h=l,(e,t,r)=>{let n=e.node(t),o=e.node(r),a,i;if(a=0+n.width/2,Object.hasOwn(n,"labelpos"))switch(n.labelpos.toLowerCase()){case"l":i=-n.width/2;break;case"r":i=n.width/2}if(i&&(a+=h?i:-i),i=0,a+=(n.dummy?u:c)/2,a+=(o.dummy?u:c)/2,a+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":i=o.width/2;break;case"r":i=-o.width/2}return i&&(a+=h?i:-i),i=0,a}),s.forEach(e=>{let t;e.forEach(e=>{let r=d[e];if(p.setNode(r),t){var n=d[t],o=p.edge(n,r);p.setEdge(n,r,Math.max(g(i,e,t),o||0))}t=e})}),p),y=a?"borderLeft":"borderRight";function w(e,t){let r=m.nodes().slice(),n={},o=r.pop();for(;o;){if(n[o])e(o);else for(let e of(n[o]=!0,r.push(o),t(o)))r.push(e);o=r.pop()}}return w(function(e){v[e]=m.inEdges(e).reduce((e,t)=>Math.max(e,v[t.v]+m.edge(t)),0)},m.predecessors.bind(m)),w(function(t){let r=m.outEdges(t).reduce((e,t)=>Math.min(e,v[t.w]-m.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==y&&(v[t]=Math.max(v[t],r))},m.successors.bind(m)),Object.keys(o).forEach(e=>v[e]=v[n[e]]),v}function h(e,t){return Object.values(t).reduce((t,r)=>{let n=-1/0,o=1/0;Object.entries(r).forEach(([t,r])=>{var a,i;let s=(a=e,i=t,a.node(i).width/2);n=Math.max(r+s,n),o=Math.min(r-s,o)});let a=n-o;return a<t[0]&&(t=[a,r]),t},[1/0,null])[1]}function p(e,t){let r=Object.values(t),o=n.applyWithChunking(Math.min,r),a=n.applyWithChunking(Math.max,r);["u","d"].forEach(r=>{["l","r"].forEach(i=>{let s=r+i,d=e[s];if(d===t)return;let l=Object.values(d),c=o-n.applyWithChunking(Math.min,l);"l"!==i&&(c=a-n.applyWithChunking(Math.max,l)),c&&(e[s]=n.mapValues(d,e=>e+c))})})}function f(e,t){return n.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let t=Object.values(e).map(e=>e[n]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}t.exports={positionX:function(e){let t=n.buildLayerMatrix(e),r=Object.assign(o(e,t),i(e,t)),a={},s;["u","d"].forEach(o=>{s="u"===o?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(s=s.map(e=>Object.values(e).reverse()));let i=("u"===o?e.predecessors:e.successors).bind(e),d=c(e,s,r,i),l=u(e,s,d.root,d.align,"r"===t);"r"===t&&(l=n.mapValues(l,e=>-e)),a[o+t]=l})});let d=h(e,a);return p(a,d),f(a,e.graph().align)},findType1Conflicts:o,findType2Conflicts:i,addConflict:s,hasConflict:l,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:h,balance:f}}),M=o((e,t)=>{var r=d(),n=O().positionX;t.exports=function(e){var t;let o,a,i,s;t=e=r.asNonCompoundGraph(e),o=r.buildLayerMatrix(t),a=t.graph().ranksep,i=t.graph().rankalign,s=0,o.forEach(e=>{let r=e.reduce((e,r)=>{let n=t.node(r).height;return e>n?e:n},0);e.forEach(e=>{let n=t.node(e);"top"===i?n.y=s+n.height/2:"bottom"===i?n.y=s+r-n.height/2:n.y=s+r/2}),s+=r+a}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),R=o((e,t)=>{var r=l(),n=c(),o=f(),i=d().normalizeRanks,s=g(),u=d().removeEmptyRanks,h=v(),p=m(),w=y(),b=N(),x=M(),E=d(),k=a().Graph;t.exports=function(e,t={}){let a=t.debugTiming?E.time:E.notime;return a("layout",()=>{let d=a(" buildLayoutGraph",()=>{var t;let r,n;return t=e,r=new k({multigraph:!0,compound:!0}),n=D(t.graph()),r.setGraph(Object.assign({},_,T(n,j),E.pick(n,C))),t.nodes().forEach(e=>{let n=T(D(t.node(e)),O);Object.keys(R).forEach(e=>{void 0===n[e]&&(n[e]=R[e])}),r.setNode(e,n),r.setParent(e,t.parent(e))}),t.edges().forEach(e=>{let n=D(t.edge(e));r.setEdge(e,Object.assign({},S,T(n,P),E.pick(n,L)))}),r});return a(" runLayout",()=>{var e,l,c;return e=d,l=a,c=t,void(l(" makeSpaceForEdgeLabels",()=>{var t;let r;return r=(t=e).graph(),void(r.ranksep/=2,t.edges().forEach(e=>{let n=t.edge(e);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}),l(" removeSelfEdges",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),l(" acyclic",()=>r.run(e)),l(" nestingGraph.run",()=>h.run(e)),l(" rank",()=>o(E.asNonCompoundGraph(e))),l(" injectEdgeLabelProxies",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(r.width&&r.height){let r=t.node(e.v),n={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};E.addDummyNode(t,"edge-proxy",n,"_ep")}})}),l(" removeEmptyRanks",()=>u(e)),l(" nestingGraph.cleanup",()=>h.cleanup(e)),l(" normalizeRanks",()=>i(e)),l(" assignRankMinMax",()=>{var t;let r;return r=0,void((t=e).nodes().forEach(e=>{let n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,r=Math.max(r,n.maxRank))}),t.graph().maxRank=r)}),l(" removeEdgeLabelProxies",()=>{var t;(t=e).nodes().forEach(e=>{let r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}),l(" normalize.run",()=>n.run(e)),l(" parentDummyChains",()=>s(e)),l(" addBorderSegments",()=>p(e)),l(" order",()=>b(e,c)),l(" insertSelfEdges",()=>{var t;return t=e,void E.buildLayerMatrix(t).forEach(e=>{var r=0;e.forEach((e,n)=>{var o=t.node(e);o.order=n+r,(o.selfEdges||[]).forEach(e=>{E.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:n+ ++r,e:e.e,label:e.label},"_se")}),delete o.selfEdges})})}),l(" adjustCoordinateSystem",()=>w.adjust(e)),l(" position",()=>x(e)),l(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,a=n.y,i=r.x-o,s=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*i/3,y:a-s},{x:o+5*i/6,y:a-s},{x:o+i,y:a},{x:o+5*i/6,y:a+s},{x:o+2*i/3,y:a+s}],r.label.x=r.x,r.label.y=r.y}})}),l(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let r=t.node(e),n=t.node(r.borderTop),o=t.node(r.borderBottom),a=t.node(r.borderLeft[r.borderLeft.length-1]),i=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(i.x-a.x),r.height=Math.abs(o.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),l(" normalize.undo",()=>n.undo(e)),l(" fixupEdgeLabelCoords",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(Object.hasOwn(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}),l(" undoCoordinateSystem",()=>w.undo(e)),l(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,o=0,a=e.graph(),i=a.marginx||0,s=a.marginy||0;function d(e){let a=e.x,i=e.y,s=e.width,d=e.height;t=Math.min(t,a-s/2),r=Math.max(r,a+s/2),n=Math.min(n,i-d/2),o=Math.max(o,i+d/2)}e.nodes().forEach(t=>d(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);Object.hasOwn(r,"x")&&d(r)}),t-=i,n-=s,e.nodes().forEach(r=>{let o=e.node(r);o.x-=t,o.y-=n}),e.edges().forEach(r=>{let o=e.edge(r);o.points.forEach(e=>{e.x-=t,e.y-=n}),Object.hasOwn(o,"x")&&(o.x-=t),Object.hasOwn(o,"y")&&(o.y-=n)}),a.width=r-t+i,a.height=o-n+s})(e)),l(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e),n=t.node(e.v),o=t.node(e.w),a,i;r.points?(a=r.points[0],i=r.points[r.points.length-1]):(r.points=[],a=o,i=n),r.points.unshift(E.intersectRect(n,a)),r.points.push(E.intersectRect(o,i))})}),l(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);r.reversed&&r.points.reverse()})}),l(" acyclic.undo",()=>r.undo(e)))}),a(" updateInputGraph",()=>{var t,r;return t=e,r=d,void(t.nodes().forEach(e=>{let n=t.node(e),o=r.node(e);n&&(n.x=o.x,n.y=o.y,n.order=o.order,n.rank=o.rank,r.children(e).length&&(n.width=o.width,n.height=o.height))}),t.edges().forEach(e=>{let n=t.edge(e),o=r.edge(e);n.points=o.points,Object.hasOwn(o,"x")&&(n.x=o.x,n.y=o.y)}),t.graph().width=r.graph().width,t.graph().height=r.graph().height)}),d})};var j=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],O=["width","height","rank"],R={width:0,height:0},P=["minlen","weight","width","height","labeloffset"],S={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},L=["labelpos"];function T(e,t){return E.mapValues(E.pick(e,t),Number)}function D(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),P=o((e,t)=>{var r=d(),n=a().Graph;t.exports={debugOrdering:function(e){let t=r.buildLayerMatrix(e),o=new n({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{o.setNode(t,{label:t}),o.setParent(t,"layer"+e.node(t).rank)}),e.edges().forEach(e=>o.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{o.setNode("layer"+t,{rank:"same"}),e.reduce((e,t)=>(o.setEdge(e,t,{style:"invis"}),t))}),o}}}),S=o((e,t)=>{t.exports="2.0.4"});let L=o((e,t)=>{t.exports={graphlib:a(),layout:R(),debug:P(),util:{time:d().time,notime:d().notime},version:S()}})(),T={direction:"LR",ranksep:200,nodesep:15},D={featureNode:{width:288,height:140},repositoryNode:{width:328,height:50}};function I(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:D[e.type??""]??t}function F(e,t,r={}){let{direction:n="TB",nodeSize:o={width:172,height:36},ranksep:a=80,nodesep:i=30}=r;if(0===e.length)return{nodes:[],edges:[]};let s=new L.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:n,ranksep:a,nodesep:i});let d=new Set;for(let e of t)d.add(e.source),d.add(e.target);let l=e.filter(e=>d.has(e.id)),c=e.filter(e=>!d.has(e.id));for(let e of l){let t=I(e,o);s.setNode(e.id,{width:t.width,height:t.height})}for(let e of t)s.hasNode(e.source)&&s.hasNode(e.target)&&s.setEdge(e.source,e.target,{},e.id);L.layout(s);let{targetPosition:u,sourcePosition:h}=function(e){switch(e){case"LR":return{targetPosition:"left",sourcePosition:"right"};case"RL":return{targetPosition:"right",sourcePosition:"left"};case"BT":return{targetPosition:"bottom",sourcePosition:"top"};default:return{targetPosition:"top",sourcePosition:"bottom"}}}(n),p="LR"===n||"RL"===n,f=new Map;for(let e of l){let t=s.node(e.id),r=I(e,o);f.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=new Map;for(let e of t)f.has(e.source)&&f.has(e.target)&&(g.has(e.source)||g.set(e.source,[]),g.get(e.source).push(e.target));let v=new Map;for(let e=0;e<l.length;e++)v.set(l[e].id,e);for(let[,e]of g)e.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let m=new Set;for(let e of g.values())for(let t of e)m.add(t);let y=[...new Set(f.keys())].filter(e=>!m.has(e)),w=new Map;for(let e of y)!function e(t){if(w.has(t))return w.get(t);let r=f.get(t),n=p?r.h:r.w,o=g.get(t);if(!o||0===o.length)return w.set(t,n),n;let a=0;for(let t of o)a+=e(t);let s=Math.max(n,a+=(o.length-1)*i);return w.set(t,s),s}(e);let b=0;for(let e of y){let t=w.get(e)??0;!function e(t,r){let n=f.get(t);p?n.cy=r:n.cx=r;let o=g.get(t);if(!o||0===o.length)return;let a=0;for(let e of o)a+=w.get(e)??0;let s=r-(a+=(o.length-1)*i)/2;for(let t of o){let r=w.get(t)??0;e(t,s+r/2),s+=r+i}}(e,b+t/2),b+=t+i}let x=[];for(let e of l){let t=f.get(e.id);x.push({...e,targetPosition:u,sourcePosition:h,position:{x:t.cx-t.w/2,y:t.cy-t.h/2}})}if(c.length>0){let e=0,t=1/0;for(let r of x){let n=I(r,o);e=Math.max(e,r.position.y+n.height),t=Math.min(t,r.position.x)}t===1/0&&(t=0);for(let r=0;r<c.length;r++){let n=c[r],a=I(n,o);x.push({...n,targetPosition:u,sourcePosition:h,position:{x:t,y:e+30+r*(a.height+20)}})}}return{nodes:x,edges:[...t]}}var A=e.i(40204),$=e.i(21023);let z=(0,$.createServerReference)("40255adebc2e1db4806f644bc86394b9684e562879",$.callServer,void 0,$.findSourceMapURL,"addRepository"),G=(0,$.createServerReference)("40873135ec09f8d43dc24cbe4af0ea0deb1515e75c",$.callServer,void 0,$.findSourceMapURL,"deleteRepository"),B=(0,$.createServerReference)("407814583d0971dabb8e9aec84c6300a591a9ac18c",$.callServer,void 0,$.findSourceMapURL,"getFeatureMetadata"),q=(0,$.createServerReference)("005b53e9609c26a223a61791736e84fefeeca5a681",$.callServer,void 0,$.findSourceMapURL,"fetchGraphData");var W=e.i(39443),V=e.i(8361),U=e.i(18354),H=e.i(99045);function X(e,t){let r=new Map;for(let e of t)"dependencyEdge"===e.type&&r.set(e.target,e.source);let n=new Map,o=new Map;for(let t of e)"featureNode"===t.type?n.set(t.id,{nodeId:t.id,data:t.data,parentNodeId:r.get(t.id)}):"repositoryNode"===t.type&&o.set(t.id,{nodeId:t.id,data:t.data});return{featureMap:n,repoMap:o}}function K(e,t){return(void 0===t.state||t.state===e.state)&&(void 0===t.lifecycle||t.lifecycle===e.lifecycle)&&(void 0===t.name||t.name===e.name)&&(void 0===t.description||t.description===e.description)}let Y=(0,U.createLogger)("[Polling]"),J=0,Q=0;function Z(e,o){let a=(0,r.useRouter)(),i=(0,V.useSoundAction)("delete"),s=(0,V.useSoundAction)("create"),{nodes:d,edges:l,reconcile:c,updateFeature:u,addPendingFeature:h,removeFeature:p,restoreFeature:f,addRepository:g,removeRepository:v,replaceRepository:m,getFeatureRepositoryPath:y,getRepositoryData:w,getRepoMapSize:b,setCallbacks:x}=function(e,r){let n=(0,t.useMemo)(()=>X(e,r),[]),[o,a]=(0,t.useState)(n.featureMap),[i,s]=(0,t.useState)(n.repoMap),[d,l]=(0,t.useState)(new Map),c=(0,t.useRef)(new Map),u=(0,t.useRef)({}),h=(0,t.useMemo)(()=>({onNodeAction:e=>u.current.onNodeAction?.(e),onNodeSettings:e=>u.current.onNodeSettings?.(e),onFeatureDelete:e=>u.current.onFeatureDelete?.(e),onRepositoryAdd:e=>u.current.onRepositoryAdd?.(e),onRepositoryClick:e=>u.current.onRepositoryClick?.(e),onRepositoryDelete:e=>u.current.onRepositoryDelete?.(e)}),[]),p=(0,t.useRef)(o);p.current=o;let f=(0,t.useRef)(i);f.current=i;let g=(0,t.useMemo)(()=>(function(e,t,r,n){let o=[],a=[],i=new Map;for(let[e,r]of t)r.data.repositoryPath&&i.set(r.data.repositoryPath,e);let s=new Map;for(let[e,r]of t){let t={...r.data,...n?.onRepositoryAdd&&{onAdd:()=>n.onRepositoryAdd(e)},...n?.onRepositoryClick&&{onClick:()=>n.onRepositoryClick(e)},...n?.onRepositoryDelete&&{onDelete:n.onRepositoryDelete}};o.push({id:e,type:"repositoryNode",position:{x:0,y:0},data:t})}for(let[t,d,l]of[...[...e.entries()].map(([e,t])=>[e,t,!1]),...[...r.entries()].filter(([t])=>!e.has(t)).map(([e,t])=>[e,t,!0])]){let e="creating"===d.data.state||l,r={...d.data,...!e&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!e&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!e&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete}};if(o.push({id:t,type:"featureNode",position:{x:0,y:0},data:r}),d.parentNodeId)a.push({id:`dep-${d.parentNodeId}-${t}`,source:d.parentNodeId,target:t,type:"dependencyEdge"});else{let e=d.data.repositoryPath,r=i.get(e)??function(e){if(s.has(e))return s.get(e);let t=`virtual-repo-${e}`,r=e.split("/").filter(Boolean).at(-1)??e;return o.push({id:t,type:"repositoryNode",position:{x:0,y:0},data:{name:r,repositoryPath:e}}),s.set(e,t),t}(e);a.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let d=a.length>0;for(let e of o)e.data.showHandles=d;return{nodes:o,edges:a}})(o,i,d,h),[o,i,d,h]),v=(0,t.useRef)({key:"",positions:new Map}),{nodes:m,edges:y}=(0,t.useMemo)(()=>{let e=g.nodes.map(e=>e.id).sort().join(","),t=g.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}`;if(r!==v.current.key){let e=F(g.nodes,g.edges,T),t=new Map;for(let r of e.nodes)t.set(r.id,{position:r.position,targetPosition:r.targetPosition,sourcePosition:r.sourcePosition});return v.current={key:r,positions:t},e}let{positions:n}=v.current;return{nodes:g.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:g.edges}},[g]),w=(0,t.useCallback)((e,t)=>{let{featureMap:r,repoMap:n}=X(e,t),o=new Set([...r.values()].map(e=>`${e.data.name}\0${e.data.repositoryPath}`));a(e=>{let t=[...e.entries()].filter(([,e])=>"creating"===e.data.state),n=new Map(r);for(let[e,r]of t){let t=`${r.data.name}\0${r.data.repositoryPath}`;o.has(t)||n.set(e,r)}for(let[e,t]of c.current){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),c.current.delete(e))}return n}),l(e=>{if(0===e.size)return e;let t=!1,r=new Map(e);for(let[n,a]of e){let e=`${a.data.name}\0${a.data.repositoryPath}`;o.has(e)&&(r.delete(n),t=!0)}return t?r:e}),s(n)},[]),b=(0,t.useCallback)((e,t)=>{a(r=>{let n=r.get(e);if(!n)return c.current.set(e,{...c.current.get(e),...t}),r;if(c.current.delete(e),K(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o}),l(r=>{let n=r.get(e);if(!n||K(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o})},[]),x=(0,t.useCallback)((e,t,r)=>{l(n=>{let o=new Map(n);return o.set(e,{nodeId:e,data:t,parentNodeId:r}),o})},[]),E=(0,t.useCallback)(e=>{l(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),k=(0,t.useCallback)(e=>{a(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),j=(0,t.useCallback)((e,t)=>{a(r=>{let n=new Map(r);return n.set(e,t),n})},[]),_=(0,t.useCallback)((e,t)=>{s(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),C=(0,t.useCallback)(e=>{s(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),N=(0,t.useCallback)((e,t,r)=>{s(n=>{if(!n.has(e))return n;let o=new Map(n);return o.delete(e),o.set(t,{nodeId:t,data:r}),o})},[]),O=(0,t.useCallback)(e=>p.current.get(e)?.data.repositoryPath,[]),M=(0,t.useCallback)(e=>f.current.get(e)?.data,[]);return{nodes:m,edges:y,reconcile:w,updateFeature:b,addPendingFeature:x,removePendingFeature:E,removeFeature:k,restoreFeature:j,addRepository:_,removeRepository:C,replaceRepository:N,getFeatureRepositoryPath:O,getRepositoryData:M,getRepoMapSize:(0,t.useCallback)(()=>f.current.size,[]),setCallbacks:(0,t.useCallback)(e=>{u.current=e},[])}}(e,o),E=(0,t.useRef)(d),k=(0,t.useRef)(l);(0,t.useEffect)(()=>{E.current=d,k.current=l},[d,l]);let j=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),_=(0,t.useMemo)(()=>e.filter(e=>"featureNode"===e.type).map(e=>{let t=e.data;return`${e.id}:${t.state}:${t.lifecycle}`}).sort().join(","),[e]),C=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${j}|${_}`;t!==C.current&&(C.current=t,c(e,o))},[j,_,e,o,c]);let N=(0,t.useRef)(new Map),{events:O}=(0,W.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=N.current;for(let r of e){if("featureNode"!==r.type)continue;let e=r.data,o=t.get(r.id);void 0!==o&&o!==e.state&&(O.some(t=>t.featureId===e.featureId&&(0,H.mapEventTypeToState)(t.eventType)===e.state)||("done"===e.state?n.toast.success(e.name,{description:"Feature completed!"}):"action-required"===e.state?n.toast.warning(e.name,{description:"Waiting for your approval",action:{label:"Review",onClick:()=>a.push(`/feature/${e.featureId}`)}}):"error"===e.state&&n.toast.error(e.name,{description:e.errorMessage??"Agent failed"}))),t.set(r.id,e.state)}},[_,e,O,a]);let M=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(M.current>O.length&&(M.current=0),O.length<=M.current)return;let e=O.slice(M.current);for(let{featureId:t,state:r,lifecycle:n}of(M.current=O.length,(0,H.resolveSseEventUpdates)(e)))(void 0!==r||void 0!==n)&&u(`feat-${t}`,{...void 0!==r&&{state:r},...void 0!==n&&{lifecycle:n}})},[O,u]),(0,t.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;u(`feat-${t}`,{state:"running"})};return window.addEventListener("shep:feature-approved",e),()=>window.removeEventListener("shep:feature-approved",e)},[u]);let R=(0,t.useRef)(new Set),P=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(P.current>O.length&&(P.current=0),O.length<=P.current)return;let e=O.slice(P.current);for(let t of(P.current=O.length,e)){if("Feature metadata updated"!==t.message||R.current.has(t.featureId))continue;R.current.add(t.featureId);let e=`feat-${t.featureId}`;B(t.featureId).then(t=>{t&&u(e,{name:t.name,description:t.description})}).catch(()=>{})}},[O,u]),(0,t.useEffect)(()=>{Y.debug("polling enabled (3000ms interval)");let e=setInterval(async()=>{try{let{nodes:e,edges:t}=await q();c(e,t)}catch{Y.warn("poll fetch failed — will retry next interval")}},3e3);return()=>{Y.debug("polling disabled"),clearInterval(e)}},[c]);let S=(0,t.useCallback)(e=>{},[]),L=(0,t.useCallback)(e=>{},[]),D=(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${J++}`,o={name:t?.name??"New Feature",description:t?.description??"Describe what this feature does",featureId:t?.featureId??`#${n.slice(-4)}`,lifecycle:"requirements",state:t?.state??"running",progress:0,repositoryPath:t?.repositoryPath??"",branch:t?.branch??""};return h(n,o,"dependencyEdge"===r&&e?e:void 0),n},[h]),I=(0,t.useCallback)((e,t)=>{let r=`feat-${e}`,o=E.current.filter(e=>e.id===r).map(e=>({nodeId:e.id,data:e.data}))[0];p(r),i.play(),n.toast.success("Feature deleted successfully"),a.push("/"),(0,A.deleteFeature)(e,t).then(e=>{e.error&&(o&&f(r,o),n.toast.error(e.error))}).catch(()=>{o&&f(r,o),n.toast.error("Failed to delete feature")})},[a,i,p,f]),$=(0,t.useCallback)(async e=>{let t=`repo-${e}`,r=new Set(k.current.filter(e=>e.source===t).map(e=>e.target)),o=w(t),a=new Map;for(let e of r){let t=E.current.find(t=>t.id===e);t&&a.set(e,{nodeId:e,data:t.data})}let s=()=>{for(let[e,r]of(o&&g(t,o),a))f(e,r)};for(let e of(v(t),r))p(e);try{let t=await G(e);if(!t.success){n.toast.error(t.error??"Failed to remove repository"),s();return}i.play(),n.toast.success("Repository removed")}catch{n.toast.error("Failed to remove repository"),s()}},[i,v,p,g,f,w]),U=(0,t.useCallback)(e=>{let t=F(E.current,k.current,{...T,direction:e});c(t.nodes,t.edges)},[c]);return{nodes:d,edges:l,onNodesChange:S,handleConnect:L,handleAddRepository:(0,t.useCallback)(e=>{let t=0===b(),r=`repo-temp-${++Q}`,o=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return g(r,{name:o,repositoryPath:e,id:r}),z({path:e,name:o}).then(e=>{if(e.error){v(r),n.toast.error(e.error);return}let t=e.repository;m(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id}),s.play()}).catch(()=>{v(r),n.toast.error("Failed to add repository")}),{wasEmpty:t,repoPath:e}},[g,v,m,s,b]),handleLayout:U,handleDeleteFeature:I,handleDeleteRepository:$,createFeatureNode:D,getFeatureRepositoryPath:y,getRepositoryData:w,setCallbacks:x}}e.s(["useControlCenterState",()=>Z],17840)},48246,e=>{"use strict";var t=e.i(20314),r=e.i(53271),n=e.i(79054),o=e.i(31406),a=e.i(3214),i=e.i(3645);let s=(0,i.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var d=e.i(35364);e.i(54793);var l=e.i(7729);e.i(47506);var c=e.i(89313),u=e.i(92002);let h=(0,i.default)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);var p=e.i(8986),f=e.i(38573),g=e.i(19933),v=e.i(67669),m=e.i(24042),y=e.i(64970),w=e.i(31777);e.i(81803);var b=e.i(72714),x=e.i(2287),E=e.i(2828);e.i(99348);var k=e.i(17466),j=e.i(8537),_=e.i(75921),C=e.i(76852);function N({data:e}){let o=(0,_.useFeatureFlags)(),[i,s]=(0,n.useState)(!1),l=(0,C.useRepositoryActions)(e.repositoryPath?{repositoryPath:e.repositoryPath}:null),c=(0,j.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),N="Booting"===c.status||"Ready"===c.status;return(0,t.jsxs)("div",{className:(0,w.cn)("group relative",e.onDelete&&e.id&&"pl-10"),children:[e.showHandles?(0,t.jsx)(r.Handle,{type:"target",position:u.Position.Left,isConnectable:!1,className:"opacity-0!"}):null,e.onDelete&&e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute top-1/2 left-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100",children:(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Remove repository","data-testid":"repository-node-delete-button",onClick:e=>{e.stopPropagation(),s(!0)},className:"bg-card text-muted-foreground hover:border-destructive hover:text-destructive flex h-7 w-7 cursor-pointer items-center justify-center rounded-full border shadow-sm transition-colors",children:(0,t.jsx)(v.Trash2,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(E.TooltipContent,{children:"Remove repository"})]})})}),(0,t.jsx)(x.Dialog,{open:i,onOpenChange:s,children:(0,t.jsxs)(x.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(x.DialogHeader,{children:[(0,t.jsx)(x.DialogTitle,{children:"Remove repository?"}),(0,t.jsxs)(x.DialogDescription,{children:["This will remove ",(0,t.jsx)("strong",{children:e.name})," and all its features from your workspace. The repository files on disk won't be affected."]})]}),(0,t.jsxs)(x.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(x.DialogClose,{asChild:!0,children:(0,t.jsx)(d.Button,{variant:"outline",children:"Cancel"})}),(0,t.jsx)(d.Button,{variant:"destructive",onClick:()=>{s(!1),e.onDelete?.(e.id)},children:"Remove"})]})]})})]}):null,(0,t.jsxs)("div",{role:"button",tabIndex:0,"data-testid":"repository-node-card","data-repo-name":e.name,onClick:t=>{t.stopPropagation(),e.onClick?.()},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),t.stopPropagation(),e.onClick?.())},className:"nodrag bg-card flex min-w-[18rem] cursor-pointer items-center gap-3 rounded-full border px-4 py-3 shadow-sm",children:[(0,t.jsx)(h,{className:"text-muted-foreground h-5 w-5 shrink-0"}),(0,t.jsx)("span",{"data-testid":"repository-node-name",className:"min-w-0 truncate text-sm font-medium",children:e.name}),(0,t.jsxs)("div",{className:(0,w.cn)("flex shrink-0 items-center gap-2",(e.repositoryPath??e.onAdd)&&"ml-auto"),onClick:e=>e.stopPropagation(),children:[e.repositoryPath?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open in IDE",onClick:l.openInIde,loading:l.ideLoading,error:!!l.ideError,icon:p.Code2,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open in IDE"})]})}),(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open in Shell",onClick:l.openInShell,loading:l.shellLoading,error:!!l.shellError,icon:f.Terminal,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open in Shell"})]})}),(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open Folder",onClick:l.openFolder,loading:l.folderLoading,error:!!l.folderError,icon:g.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open Folder"})]})}),o.envDeploy?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:N?"Stop Dev Server":"Start Dev Server",onClick:N?c.stop:c.deploy,loading:c.deployLoading||c.stopLoading,error:!!c.deployError,icon:N?y.Square:m.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:N?"Stop Dev Server":"Start Dev Server"})]})}),N?(0,t.jsx)(k.DeploymentStatusBadge,{status:c.status,url:c.url,targetId:e.repositoryPath}):null]}):null]}):null,e.onAdd?(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Add feature","data-testid":"repository-node-add-button",onClick:t=>{t.stopPropagation(),e.onAdd?.()},className:"text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors hover:text-blue-500",children:(0,t.jsx)(a.Plus,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(E.TooltipContent,{children:"Add feature"})]})}):null]})]}),e.onAdd||e.showHandles?(0,t.jsx)(r.Handle,{type:"source",position:u.Position.Right,isConnectable:!e.showHandles,className:"opacity-0!"}):null]})}function O(e){let[n]=(0,u.getBezierPath)({sourceX:e.sourceX,sourceY:e.sourceY,targetX:e.targetX,targetY:e.targetY,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition});return(0,t.jsx)(r.BaseEdge,{id:e.id,path:n,style:{strokeDasharray:"5 5"}})}e.i(1650),e.i(45811),e.i(25235);let M={x:30,y:30,zoom:.85};function R({onResetViewport:e}){let{setViewport:o}=(0,r.useReactFlow)(),a=(0,n.useCallback)(()=>{o(e(),{duration:400})},[e,o]);return(0,t.jsx)(r.ControlButton,{onClick:a,title:"Reset view","aria-label":"Reset view",children:(0,t.jsx)(s,{style:{fill:"none"}})})}function P({nodes:e,edges:o,selectedFeatureId:i,defaultViewport:s,onNodesChange:u,onAddFeature:h,onConnect:p,onNodeClick:f,onPaneClick:g,onCanvasDrag:v,onMoveEnd:m,onResetViewport:y,toolbar:w,emptyState:b}){let x=(0,n.useMemo)(()=>({featureNode:c.FeatureNode,repositoryNode:N}),[]),E=(0,n.useMemo)(()=>({dependencyEdge:O}),[]),k=(0,n.useMemo)(()=>null==i?e:e.map(e=>"featureNode"===e.type&&e.data.featureId===i?{...e,selected:!0}:e),[e,i]);return 0===e.length?b?(0,t.jsx)("div",{"data-testid":"features-canvas-empty",className:"h-full w-full",children:b}):(0,t.jsx)("div",{"data-testid":"features-canvas-empty",children:(0,t.jsx)(l.EmptyState,{title:"No features yet",description:"Get started by creating your first feature.",action:(0,t.jsxs)(d.Button,{onClick:h,children:[(0,t.jsx)(a.Plus,{className:"mr-2 h-4 w-4"}),"New Feature"]})})}):(0,t.jsx)("div",{"data-testid":"features-canvas","data-no-drawer-close":!0,className:"pointer-events-auto h-full w-full",children:(0,t.jsxs)(r.ReactFlow,{nodes:k,edges:o,nodeTypes:x,edgeTypes:E,onConnect:p,onNodesChange:u,onNodeClick:f,onPaneClick:g,onMoveStart:v,onMoveEnd:m,defaultViewport:s??M,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[(0,t.jsx)(r.Background,{}),(0,t.jsx)(r.Controls,{showInteractive:!1,children:y?(0,t.jsx)(R,{onResetViewport:y}):null}),w]})})}var S=e.i(5147),L=e.i(8361),T=e.i(30153);let D="shep-canvas-viewport",I={x:30,y:30,zoom:.85},F=(0,i.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var A=e.i(33548),$=e.i(23925),z=e.i(83428),G=e.i(78521);let B=["cd ~/my-repo",'shep feat new "create modern, sleek dashboards"'];function q({onRepositorySelect:e,className:r}){let[o,i]=(0,n.useState)(!1),[s,d]=(0,n.useState)(!1);async function l(){if(!s){d(!0);try{let t=await (0,G.pickFolder)();t&&e?.(t)}finally{d(!1)}}}let c=(0,n.useCallback)(async()=>{await navigator.clipboard.writeText(B.join("\n")),i(!0),setTimeout(()=>i(!1),2e3)},[]);return(0,t.jsxs)("div",{"data-testid":"control-center-empty-state",className:(0,w.cn)("relative h-full w-full",r),children:[(0,t.jsx)("div",{className:"absolute inset-0 [background-image:radial-gradient(circle,_var(--color-border)_1px,_transparent_1px)] [background-size:24px_24px]"}),(0,t.jsxs)("div",{className:"absolute top-8 left-8 z-10",children:[(0,t.jsx)("h1",{className:"text-4xl font-bold tracking-tight",children:"Features"}),(0,t.jsx)("p",{className:"text-muted-foreground text-3xl font-light",children:"Control Center"})]}),(0,t.jsx)("div",{className:"relative z-10 flex h-full items-center justify-center",children:(0,t.jsxs)("div",{className:"flex max-w-lg flex-col items-center gap-6",children:[(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:[(0,t.jsx)(h,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"text-xs font-semibold tracking-widest uppercase",children:"Repositories"})]}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:l,disabled:s,className:"border-muted-foreground/30 hover:border-primary hover:text-primary flex cursor-pointer items-center gap-3 rounded-lg border-2 border-dashed px-8 py-4 transition-colors disabled:cursor-wait disabled:opacity-60",children:[s?(0,t.jsx)(z.Loader2,{className:"h-5 w-5 animate-spin"}):(0,t.jsx)(a.Plus,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:s?"Opening...":"Add Repository"})]}),(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-3",children:[(0,t.jsx)("div",{className:"bg-border h-px w-16"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(F,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-xs font-semibold tracking-widest uppercase",children:"Or start from the command line"})]}),(0,t.jsx)("div",{className:"bg-border h-px w-16"})]}),(0,t.jsxs)("div",{"data-testid":"cli-code-block",className:"relative w-full rounded-lg bg-zinc-900 px-5 py-4 font-mono text-sm text-zinc-100",children:[(0,t.jsx)("button",{type:"button","data-testid":"cli-code-block-copy",onClick:c,className:"absolute top-3 right-3 cursor-pointer rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-800 hover:text-zinc-200","aria-label":"Copy commands",children:o?(0,t.jsx)($.Check,{className:"h-4 w-4"}):(0,t.jsx)(A.Copy,{className:"h-4 w-4"})}),(0,t.jsx)("div",{className:"space-y-1",children:B.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-zinc-500 select-none",children:"$ "}),(0,t.jsx)("span",{children:e})]},e))})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"Feature will appear on canvas once created"})]})})]})}var W=e.i(17840);let V={maxZoom:1,padding:.5,duration:500};function U({initialNodes:e,initialEdges:a}){let i,s,d,l=(0,o.useRouter)(),c=(0,o.usePathname)(),u=(i=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),i?.[1]??null),h=(0,L.useSoundAction)("click"),{guardedNavigate:p}=(0,T.useDrawerCloseGuard)(),{fitView:f}=(0,r.useReactFlow)(),g=(0,n.useRef)(null),{defaultViewport:v,onMoveEnd:m,resetViewport:y}=(s=(0,n.useRef)(function(){try{let e=localStorage.getItem(D);if(null==e)return I;let t=JSON.parse(e);return!(null==t||"object"!=typeof t||Array.isArray(t))&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.zoom&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.zoom)&&t.zoom>0?t:I}catch{return I}}()).current,d=(0,n.useRef)(null),(0,n.useEffect)(()=>()=>{null!=d.current&&clearTimeout(d.current)},[]),{defaultViewport:s,onMoveEnd:(0,n.useCallback)(e=>{null!=d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{try{localStorage.setItem(D,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,n.useCallback)(()=>{try{localStorage.removeItem(D)}catch{}return I},[])}),{nodes:w,edges:b,onNodesChange:x,handleConnect:E,handleAddRepository:k,handleDeleteFeature:j,handleDeleteRepository:_,createFeatureNode:C,setCallbacks:N}=(0,W.useControlCenterState)(e,a),{setFeatures:O}=(0,S.useSidebarFeaturesContext)(),M=(0,n.useMemo)(()=>w.filter(e=>"featureNode"===e.type),[w]),R=(0,n.useMemo)(()=>M.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}`}).sort().join(","),[M]);(0,n.useEffect)(()=>{O(M.map(e=>{let t=e.data,r=(0,S.mapNodeStateToSidebarStatus)(t.state);return r?{featureId:t.featureId,name:t.name,status:r,...null!=t.startedAt&&{startedAt:t.startedAt},...null!=t.runtime&&{duration:t.runtime},...t.agentType&&{agentType:t.agentType},...t.modelId&&{modelId:t.modelId}}:null}).filter(Boolean))},[R,M,O]);let F=(0,n.useCallback)((e,t)=>{if("featureNode"===t.type){let e=t.data;"creating"!==e.state&&p(()=>{h.play(),l.push(`/feature/${e.featureId}`)})}},[l,h,p]),A=(0,n.useCallback)(()=>{h.play(),l.push("/create")},[l,h]),$=(0,n.useCallback)(e=>{h.play();let t=w.find(t=>t.id===e),r=t?.data?.repositoryPath;r?l.push(`/create?repo=${encodeURIComponent(r)}`):l.push("/create")},[w,l,h]),z=(0,n.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=b.find(t=>t.target===e),n=r?w.find(e=>e.id===r.source):null,o=n?.data?.repositoryPath;h.play();let a=new URLSearchParams;o&&a.set("repo",o),a.set("parent",t),l.push(`/create?${a.toString()}`)},[w,b,l,h]),G=(0,n.useCallback)(e=>{let t=w.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&p(()=>l.push(`/repository/${e.id}`))}},[w,l,p]),B=(0,n.useCallback)(()=>{"/"!==c&&p(()=>l.push("/"))},[l,c,p]);(0,n.useEffect)(()=>{let e=e=>{let{wasEmpty:t,repoPath:r}=k(e.detail.path);t&&setTimeout(()=>{f(V),g.current=setTimeout(()=>{p(()=>l.push(`/create?repo=${encodeURIComponent(r)}`))},600)},0)};return window.addEventListener("shep:add-repository",e),()=>{window.removeEventListener("shep:add-repository",e),null!=g.current&&clearTimeout(g.current)}},[k,f,p,l]),(0,n.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void C(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=w.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);C(r?.id??null,{state:"running",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath})};return window.addEventListener("shep:feature-created",e),()=>window.removeEventListener("shep:feature-created",e)},[w,C]),(0,n.useEffect)(()=>{N({onNodeAction:z,onFeatureDelete:j,onRepositoryAdd:$,onRepositoryClick:G,onRepositoryDelete:_})},[N,z,j,$,G,_]);let U=(0,n.useCallback)((e,t)=>{m(t)},[m]);return w.some(e=>"repositoryNode"===e.type)?(0,t.jsx)(P,{nodes:w,edges:b,selectedFeatureId:u,defaultViewport:v,onNodesChange:x,onConnect:E,onAddFeature:A,onNodeClick:F,onPaneClick:B,onMoveEnd:U,onResetViewport:y,emptyState:(0,t.jsx)(q,{onRepositorySelect:k})}):(0,t.jsx)(q,{onRepositorySelect:k})}function H({initialNodes:e,initialEdges:n,drawer:o}){return(0,t.jsxs)("div",{"data-testid":"control-center",className:"h-full w-full",children:[(0,t.jsx)(r.ReactFlowProvider,{children:(0,t.jsx)(U,{initialNodes:e,initialEdges:n})}),(0,t.jsx)("div",{children:o},"drawer")]})}e.s(["ControlCenter",()=>H],48246)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17840,e=>{"use strict";var t=e.i(79054),r=e.i(31406),n=e.i(60112),o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=o((e,t)=>{var r=Object.defineProperty,n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o=(e,t,n)=>{let o;return(o="symbol"!=typeof t?t+"":t)in e?r(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n},a=n((e,t)=>{function r(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function a(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var i=o;o=a,a=i}return o+"\x01"+a+"\x01"+(void 0===n?"\0":n)}function i(e,t){return a(e,t.v,t.w,t.name)}t.exports=class{constructor(e){o(this,"_isDirected",!0),o(this,"_isMultigraph",!1),o(this,"_isCompound",!1),o(this,"_label"),o(this,"_defaultNodeLabelFn",()=>{}),o(this,"_defaultEdgeLabelFn",()=>{}),o(this,"_nodes",{}),o(this,"_in",{}),o(this,"_preds",{}),o(this,"_out",{}),o(this,"_sucs",{}),o(this,"_edgeObjs",{}),o(this,"_edgeLabels",{}),o(this,"_nodeCount",0),o(this,"_edgeCount",0),o(this,"_parent"),o(this,"_children"),e&&(this._isDirected=!Object.hasOwn(e,"directed")||e.directed,this._isMultigraph=!!Object.hasOwn(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.hasOwn(e,"compound")&&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 this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._in[t]).length)}sinks(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._out[t]).length)}setNodes(e,t){var r=arguments,n=this;return e.forEach(function(e){r.length>1?n.setNode(e,t):n.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?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 Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var r=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(r),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(r),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(var r=t;void 0!==r;r=this.parent(r))if(r===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}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let n=new Set(t);for(var r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([r,n]){e(r)&&t.setNode(r,n)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var n={};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,function e(o){var a=r.parent(o);return void 0===a||t.hasNode(a)?(n[o]=a,a):a in n?n[a]:e(a)}(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var r=this,n=arguments;return e.reduce(function(e,o){return n.length>1?r.setEdge(e,o,t):r.setEdge(e,o),o}),this}setEdge(){var e,t,n,o,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(e=s.v,t=s.w,n=s.name,2==arguments.length&&(o=arguments[1],i=!0)):(e=s,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var d=a(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,d))return i&&(this._edgeLabels[d]=o),this;if(void 0!==n&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[d]=i?o:this._defaultEdgeLabelFn(e,t,n);var l=function(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var i=o;o=a,a=i}var s={v:o,w:a};return n&&(s.name=n),s}(this._isDirected,e,t,n);return e=l.v,t=l.w,Object.freeze(l),this._edgeObjs[d]=l,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][d]=l,this._out[e][d]=l,this._edgeCount++,this}edge(e,t,r){var n=1==arguments.length?i(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return this._edgeLabels[n]}edgeAsObj(){let e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,r){var n=1==arguments.length?i(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return Object.hasOwn(this._edgeLabels,n)}removeEdge(e,t,r){var o=1==arguments.length?i(this._isDirected,arguments[0]):a(this._isDirected,e,t,r),s=this._edgeObjs[o];return s&&(e=s.v,t=s.w,delete this._edgeLabels[o],delete this._edgeObjs[o],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][o],delete this._out[e][o],this._edgeCount--),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)}filterEdges(e,t,r){if(e){var n=Object.values(e);return r?n.filter(function(e){return e.v===t&&e.w===r||e.v===r&&e.w===t}):n}}}}),i=n((e,t)=>{t.exports="3.0.2"}),s=n((e,t)=>{t.exports={Graph:a(),version:i()}}),d=n((e,t)=>{var r=a();t.exports={write:function(e){var t,r,n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e).nodes().map(function(e){var r=t.node(e),n=t.parent(e),o={v:e};return void 0!==r&&(o.value=r),void 0!==n&&(o.parent=n),o}),edges:(r=e).edges().map(function(e){var t=r.edge(e),n={v:e.v,w:e.w};return void 0!==e.name&&(n.name=e.name),void 0!==t&&(n.value=t),n})};return void 0!==e.graph()&&(n.value=structuredClone(e.graph())),n},read:function(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}}),l=n((e,t)=>{t.exports=function(e,t,n,o){return function(e,t,r,n){var o={},a=!0,i=0,s=e.nodes(),d=function(e){var t=r(e);o[e.v].distance+t<o[e.w].distance&&(o[e.w]={distance:o[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){n(e).forEach(function(t){var r=t.v===e?t.v:t.w,n=r===t.v?t.w:t.v;d({v:r,w:n})})})};s.forEach(function(e){o[e]={distance:e===t?0:1/0}});for(var c=s.length,u=1;u<c&&(a=!1,i++,l(),a);u++);if(i===c-1&&(a=!1,l(),a))throw Error("The graph contains a negative weight cycle");return o}(e,String(t),n||r,o||function(t){return e.outEdges(t)})};var r=()=>1}),c=n((e,t)=>{t.exports=function(e){var t,r={},n=[];return e.nodes().forEach(function(o){t=[],function n(o){Object.hasOwn(r,o)||(r[o]=!0,t.push(o),e.successors(o).forEach(n),e.predecessors(o).forEach(n))}(o),t.length&&n.push(t)}),n}}),u=n((e,t)=>{t.exports=class{constructor(){o(this,"_arr",[]),o(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var 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){var r=this._keyIndices;if(!Object.hasOwn(r,e=String(e))){var n=this._arr,o=n.length;return r[e]=o,n.push({key:e,priority:t}),this._decrease(o),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var r=this._keyIndices[e];if(t>this._arr[r].priority)throw Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)}_heapify(e){var t=this._arr,r=2*e,n=r+1,o=e;r<t.length&&(o=t[r].priority<t[o].priority?r:o,n<t.length&&(o=t[n].priority<t[o].priority?n:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){for(var t,r=this._arr,n=r[e].priority;0!==e&&!(r[t=e>>1].priority<n);)this._swap(e,t),e=t}_swap(e,t){var r=this._arr,n=this._keyIndices,o=r[e],a=r[t];r[e]=a,r[t]=o,n[a.key]=e,n[o.key]=t}}}),h=n((e,t)=>{var r=u();t.exports=function(e,t,o,a){return function(e,t,n,o){var a,i,s={},d=new r,l=function(e){var t=e.v!==a?e.v:e.w,r=s[t],o=n(e),l=i.distance+o;if(o<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);l<r.distance&&(r.distance=l,r.predecessor=a,d.decrease(t,l))};for(e.nodes().forEach(function(e){var r=e===t?0:1/0;s[e]={distance:r},d.add(e,r)});d.size()>0&&(i=s[a=d.removeMin()]).distance!==1/0;)o(a).forEach(l);return s}(e,String(t),o||n,a||function(t){return e.outEdges(t)})};var n=()=>1}),p=n((e,t)=>{var r=h();t.exports=function(e,t,n){return e.nodes().reduce(function(o,a){return o[a]=r(e,a,t,n),o},{})}}),f=n((e,t)=>{t.exports=function(e,t,r){if(void 0!==e[t].predecessor)throw Error("Invalid source vertex");if(void 0===e[r].predecessor&&r!==t)throw Error("Invalid destination vertex");return{weight:e[r].distance,path:function(e,t,r){for(var n=[],o=r;o!==t;)n.push(o),o=e[o].predecessor;return n.push(t),n.reverse()}(e,t,r)}}}),g=n((e,t)=>{t.exports=function(e){var t=0,r=[],n={},o=[];return e.nodes().forEach(function(a){Object.hasOwn(n,a)||function a(i){var s=n[i]={onStack:!0,lowlink:t,index:t++};if(r.push(i),e.successors(i).forEach(function(e){Object.hasOwn(n,e)?n[e].onStack&&(s.lowlink=Math.min(s.lowlink,n[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,n[e].lowlink))}),s.lowlink===s.index){var d,l=[];do n[d=r.pop()].onStack=!1,l.push(d);while(i!==d)o.push(l)}}(a)}),o}}),v=n((e,t)=>{var r=g();t.exports=function(e){return r(e).filter(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}}),m=n((e,t)=>{t.exports=function(e,t,n){var o,a,i,s,d;return o=e,a=t||r,i=n||function(t){return e.outEdges(t)},s={},(d=o.nodes()).forEach(function(e){s[e]={},s[e][e]={distance:0},d.forEach(function(t){e!==t&&(s[e][t]={distance:1/0})}),i(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=a(t);s[e][r]={distance:n,predecessor:e}})}),d.forEach(function(e){var t=s[e];d.forEach(function(r){var n=s[r];d.forEach(function(r){var o=n[e],a=t[r],i=n[r],s=o.distance+a.distance;s<i.distance&&(i.distance=s,i.predecessor=a.predecessor)})})}),s};var r=()=>1}),y=n((e,t)=>{function r(e){var t={},r={},o=[];if(e.sinks().forEach(function a(i){if(Object.hasOwn(r,i))throw new n;Object.hasOwn(t,i)||(r[i]=!0,t[i]=!0,e.predecessors(i).forEach(a),delete r[i],o.push(i))}),Object.keys(t).length!==e.nodeCount())throw new n;return o}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),w=n((e,t)=>{var r=y();t.exports=function(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}}),b=n((e,t)=>{t.exports=function(e,t,r,n,o){Array.isArray(t)||(t=[t]);var a=(e.isDirected()?e.successors:e.neighbors).bind(e),i={};return t.forEach(function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);o=function e(t,r,n,o,a,i,s){return Object.hasOwn(o,r)||(o[r]=!0,n||(s=i(s,r)),a(r).forEach(function(r){s=e(t,r,n,o,a,i,s)}),n&&(s=i(s,r))),s}(e,t,"post"===r,i,a,n,o)}),o}}),x=n((e,t)=>{var r=b();t.exports=function(e,t,n){return r(e,t,n,function(e,t){return e.push(t),e},[])}}),E=n((e,t)=>{var r=x();t.exports=function(e,t){return r(e,t,"post")}}),k=n((e,t)=>{var r=x();t.exports=function(e,t){return r(e,t,"pre")}}),j=n((e,t)=>{var r=a(),n=u();t.exports=function(e,t){var o,a=new r,i={},s=new n;function d(e){var r=e.v===o?e.w:e.v,n=s.priority(r);if(void 0!==n){var a=t(e);a<n&&(i[r]=o,s.decrease(r,a))}}if(0===e.nodeCount())return a;e.nodes().forEach(function(e){s.add(e,1/0),a.setNode(e)}),s.decrease(e.nodes()[0],0);for(var l=!1;s.size()>0;){if(Object.hasOwn(i,o=s.removeMin()))a.setEdge(o,i[o]);else{if(l)throw Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(o).forEach(d)}return a}}),_=n((e,t)=>{var r=h(),n=l();t.exports=function(e,t,o,a){return function(e,t,o,a){if(void 0===o)return r(e,t,o,a);for(var i=!1,s=e.nodes(),d=0;d<s.length;d++){for(var l=a(s[d]),c=0;c<l.length;c++){var u=l[c],h=u.v===s[d]?u.v:u.w,p=h===u.v?u.w:u.v;0>o({v:h,w:p})&&(i=!0)}if(i)return n(e,t,o,a)}return r(e,t,o,a)}(e,t,o,a||function(t){return e.outEdges(t)})}}),C=n((e,t)=>{t.exports={bellmanFord:l(),components:c(),dijkstra:h(),dijkstraAll:p(),extractPath:f(),findCycles:v(),floydWarshall:m(),isAcyclic:w(),postorder:E(),preorder:k(),prim:j(),shortestPaths:_(),reduce:b(),tarjan:g(),topsort:y()}}),N=s();t.exports={Graph:N.Graph,json:d(),alg:C(),version:N.version}}),i=o((e,t)=>{function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function n(e,t){if("_next"!==e&&"_prev"!==e)return t}t.exports=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,r=t._prev;for(;r!==t;)e.push(JSON.stringify(r,n)),r=r._prev;return"["+e.join(", ")+"]"}}}),s=o((e,t)=>{var r=a().Graph,n=i();t.exports=function(e,t){var a,i;let l,c,u,h,p;if(1>=e.nodeCount())return[];let f=(a=e,i=t||o,l=new r,c=0,u=0,a.nodes().forEach(e=>{l.setNode(e,{v:e,in:0,out:0})}),a.edges().forEach(e=>{let t=l.edge(e.v,e.w)||0,r=i(e);l.setEdge(e.v,e.w,t+r),u=Math.max(u,l.node(e.v).out+=r),c=Math.max(c,l.node(e.w).in+=r)}),h=(function(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t})(u+c+3).map(()=>new n),p=c+1,l.nodes().forEach(e=>{d(h,p,l.node(e))}),{graph:l,buckets:h,zeroIdx:p});return(function(e,t,r){let n=[],o=t[t.length-1],a=t[0],i;for(;e.nodeCount();){for(;i=a.dequeue();)s(e,t,r,i);for(;i=o.dequeue();)s(e,t,r,i);if(e.nodeCount()){for(let o=t.length-2;o>0;--o)if(i=t[o].dequeue()){n=n.concat(s(e,t,r,i,!0));break}}}return n})(f.graph,f.buckets,f.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var o=()=>1;function s(e,t,r,n,o){let a=o?[]:void 0;return e.inEdges(n.v).forEach(n=>{let i=e.edge(n),s=e.node(n.v);o&&a.push({v:n.v,w:n.w}),s.out-=i,d(t,r,s)}),e.outEdges(n.v).forEach(n=>{let o=e.edge(n),a=n.w,i=e.node(a);i.in-=o,d(t,r,i)}),e.removeNode(n.v),a}function d(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}}),d=o((e,t)=>{var r=a().Graph;function n(e,t,r,n){for(var o=n;e.hasNode(o);)o=d(n);return r.dummy=t,e.setNode(o,r),o}t.exports={addBorderNode:function(e,t,r,o){let a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=o),n(e,"border",a,t)},addDummyNode:n,applyWithChunking:o,asNonCompoundGraph:function(e){let t=new r({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t},buildLayerMatrix:function(e){let t=l(i(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),o=n.rank;void 0!==o&&(t[o][n.order]=r)}),t},intersectRect:function(e,t){let r,n,o=e.x,a=e.y,i=t.x-o,s=t.y-a,d=e.width/2,l=e.height/2;if(!i&&!s)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*d>Math.abs(i)*l?(s<0&&(l=-l),r=l*i/s,n=l):(i<0&&(d=-d),r=d,n=d*s/i),{x:o+r,y:a+n}},mapValues:function(e,t){let r=t;return"string"==typeof t&&(r=e=>e[t]),Object.entries(e).reduce((e,[t,n])=>(e[t]=r(n,t),e),{})},maxRank:i,normalizeRanks:function(e){let t=o(Math.min,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?Number.MAX_VALUE:r}));e.nodes().forEach(r=>{let n=e.node(r);Object.hasOwn(n,"rank")&&(n.rank-=t)})},notime:function(e,t){return t()},partition:function(e,t){let r={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?r.lhs.push(e):r.rhs.push(e)}),r},pick:function(e,t){let r={};for(let n of t)void 0!==e[n]&&(r[n]=e[n]);return r},predecessorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.inEdges(t).forEach(t=>{r[t.v]=(r[t.v]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},range:l,removeEmptyRanks:function(e){let t=o(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),r=[];e.nodes().forEach(n=>{let o=e.node(n).rank-t;r[o]||(r[o]=[]),r[o].push(n)});let n=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,r)=>{void 0===t&&r%a!=0?--n:void 0!==t&&n&&t.forEach(t=>e.node(t).rank+=n)})},simplify:function(e){let t=new r().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},o=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})}),t},successorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.outEdges(t).forEach(t=>{r[t.w]=(r[t.w]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},time:function(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}},uniqueId:d,zipObject:c};function o(e,t){if(!(t.length>65535))return e.apply(null,t);{let r=function(e,t=65535){let r=[];for(let n=0;n<e.length;n+=t){let o=e.slice(n,n+t);r.push(o)}return r}(t);return e.apply(null,r.map(t=>e.apply(null,t)))}}function i(e){return o(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var s=0;function d(e){return e+""+ ++s}function l(e,t,r=1){null==t&&(t=e,e=0);let n=e=>e<t;r<0&&(n=e=>t<e);let o=[];for(let t=e;n(t);t+=r)o.push(t);return o}function c(e,t){return e.reduce((e,r,n)=>(e[r]=t[n],e),{})}}),l=o((e,t)=>{var r=s(),n=d().uniqueId;t.exports={run:function(e){var t,o;let a,i,s;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(a=[],i={},s={},(o=e).nodes().forEach(function e(t){Object.hasOwn(s,t)||(s[t]=!0,i[t]=!0,o.outEdges(t).forEach(t=>{Object.hasOwn(i,t.w)?a.push(t):e(t.w)}),delete i[t])}),a)).forEach(t=>{let r=e.edge(t);e.removeEdge(t),r.forwardName=t.name,r.reversed=!0,e.setEdge(t.w,t.v,r,n("rev"))})},undo:function(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}}}),c=o((e,t)=>{var r=d();t.exports={run:function(e){e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,o,a,i=t.v,s=e.node(i).rank,d=t.w,l=e.node(d).rank,c=t.name,u=e.edge(t),h=u.labelRank;if(l!==s+1){for(e.removeEdge(t),a=0,++s;s<l;++a,++s)u.points=[],o={width:0,height:0,edgeLabel:u,edgeObj:t,rank:s},n=r.addDummyNode(e,"edge",o,"_d"),s===h&&(o.width=u.width,o.height=u.height,o.dummy="edge-label",o.labelpos=u.labelpos),e.setEdge(i,n,{weight:u.weight},c),0===a&&e.graph().dummyChains.push(n),i=n;e.setEdge(i,d,{weight:u.weight},c)}})(e,t))},undo:function(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,o;for(e.setEdge(r.edgeObj,n);r.dummy;)o=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=o,r=e.node(t)})}}}),u=o((e,t)=>{var{applyWithChunking:r}=d();t.exports={longestPath:function(e){var t={};e.sources().forEach(function n(o){var a=e.node(o);if(Object.hasOwn(t,o))return a.rank;t[o]=!0;var i=r(Math.min,e.outEdges(o).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return i===1/0&&(i=0),a.rank=i})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}}),h=o((e,t)=>{var r=a().Graph,n=u().slack;t.exports=function(e){var t,o,a,i,s=new r({directed:!1}),d=e.nodes()[0],l=e.nodeCount();for(s.setNode(d,{});t=s,o=e,t.nodes().forEach(function e(r){o.nodeEdges(r).forEach(a=>{var i=a.v,s=r===i?a.w:i;t.hasNode(s)||n(o,a)||(t.setNode(s,{}),t.setEdge(r,s,{}),e(s))})}),t.nodeCount()<l;)a=function(e,t){return t.edges().reduce((r,o)=>{let a=1/0;return e.hasNode(o.v)!==e.hasNode(o.w)&&(a=n(t,o)),a<r[0]?[a,o]:r},[1/0,null])[1]}(s,e),i=s.hasNode(a.v)?n(e,a):-n(e,a),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(s,e,i);return s}}),p=o((e,t)=>{var r=h(),n=u().slack,o=u().longestPath,i=a().alg.preorder,s=a().alg.postorder,l=d().simplify;function c(e){o(e=l(e));var t,n,a=r(e);for(g(a),p(a,e);t=v(a);)n=m(a,e,t),y(a,e,t,n)}function p(e,t){var r=s(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,o,a,i;return n=e,o=t,a=r,i=n.node(a).parent,void(n.edge(a,i).cutvalue=f(n,o,a))})}function f(e,t,r){var n=e.node(r).parent,o=!0,a=t.edge(r,n),i=0;return a||(o=!1,a=t.edge(n,r)),i=a.weight,t.nodeEdges(r).forEach(a=>{var s=a.v===r,d=s?a.w:a.v;if(d!==n){var l,c,u,h=s===o,p=t.edge(a).weight;if(i+=h?p:-p,l=e,c=r,u=d,l.hasEdge(c,u)){var f=e.edge(r,d).cutvalue;i+=h?-f:f}}}),i}function g(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,o,a){var i=n,s=t.node(o);return r[o]=!0,t.neighbors(o).forEach(a=>{Object.hasOwn(r,a)||(n=e(t,r,n,a,o))}),s.low=i,s.lim=n++,a?s.parent=a:delete s.parent,n}(e,{},1,t)}function v(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function m(e,t,r){var o=r.v,a=r.w;t.hasEdge(o,a)||(o=r.w,a=r.v);var i=e.node(o),s=e.node(a),d=i,l=!1;return i.lim>s.lim&&(d=s,l=!0),t.edges().filter(t=>l===w(e,e.node(t.v),d)&&l!==w(e,e.node(t.w),d)).reduce((e,r)=>n(t,r)<n(t,e)?r:e)}function y(e,t,r,n){var o,a,s,d,l=r.v,c=r.w;e.removeEdge(l,c),e.setEdge(n.v,n.w,{}),g(e),p(e,t),o=e,a=t,s=o.nodes().find(e=>!a.node(e).parent),(d=(d=i(o,s)).slice(1)).forEach(e=>{var t=o.node(e).parent,r=a.edge(e,t),n=!1;r||(r=a.edge(t,e),n=!0),a.node(e).rank=a.node(t).rank+(n?r.minlen:-r.minlen)})}function w(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=c,c.initLowLimValues=g,c.initCutValues=p,c.calcCutValue=f,c.leaveEdge=v,c.enterEdge=m,c.exchangeEdges=y}),f=o((e,t)=>{var r=u().longestPath,n=h(),o=p();t.exports=function(e){var t,i=e.graph().ranker;if(i instanceof Function)return i(e);switch(e.graph().ranker){case"network-simplex":default:o(e);break;case"tight-tree":r(t=e),n(t);break;case"longest-path":a(e);case"none":}};var a=r}),g=o((e,t)=>{t.exports=function(e){var t;let r,n,o=(r={},n=0,(t=e).children().forEach(function e(o){let a=n;t.children(o).forEach(e),r[o]={low:a,lim:n++}}),r);e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeObj,a=function(e,t,r,n){let o=[],a=[],i=Math.min(t[r].low,t[n].low),s=Math.max(t[r].lim,t[n].lim),d,l;d=r;do o.push(d=e.parent(d));while(d&&(t[d].low>i||s>t[d].lim))for(l=d,d=n;(d=e.parent(d))!==l;)a.push(d);return{path:o.concat(a.reverse()),lca:l}}(e,o,n.v,n.w),i=a.path,s=a.lca,d=0,l=i[0],c=!0;for(;t!==n.w;){if(r=e.node(t),c){for(;(l=i[d])!==s&&e.node(l).maxRank<r.rank;)d++;l===s&&(c=!1)}if(!c){for(;d<i.length-1&&e.node(l=i[d+1]).minRank<=r.rank;)d++;l=i[d]}e.setParent(t,l),t=e.successors(t)[0]}})}}),v=o((e,t)=>{var r=d();t.exports={run:function(e){var t,n,o;let a=r.addDummyNode(e,"root",{},"_root"),i=(n={},(t=e).children().forEach(e=>(function e(r,o){var a=t.children(r);a&&a.length&&a.forEach(t=>e(t,o+1)),n[r]=o})(e,1)),n),s=Object.values(i),d=r.applyWithChunking(Math.max,s)-1,l=2*d+1;e.graph().nestingRoot=a,e.edges().forEach(t=>e.edge(t).minlen*=l);let c=(o=e).edges().reduce((e,t)=>e+o.edge(t).weight,0)+1;e.children().forEach(t=>(function e(t,n,o,a,i,s,d){let l=t.children(d);if(!l.length){d!==n&&t.setEdge(n,d,{weight:0,minlen:o});return}let c=r.addBorderNode(t,"_bt"),u=r.addBorderNode(t,"_bb"),h=t.node(d);t.setParent(c,d),h.borderTop=c,t.setParent(u,d),h.borderBottom=u,l.forEach(r=>{e(t,n,o,a,i,s,r);let l=t.node(r),h=l.borderTop?l.borderTop:r,p=l.borderBottom?l.borderBottom:r,f=l.borderTop?a:2*a,g=h!==p?1:i-s[d]+1;t.setEdge(c,h,{weight:f,minlen:g,nestingEdge:!0}),t.setEdge(p,u,{weight:f,minlen:g,nestingEdge:!0})}),t.parent(d)||t.setEdge(n,c,{weight:0,minlen:i+s[d]})})(e,a,l,c,d,i,t)),e.graph().nodeRankFactor=l},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}}),m=o((e,t)=>{var r=d();function n(e,t,n,o,a,i){let s=a[t][i-1],d=r.addDummyNode(e,"border",{width:0,height:0,rank:i,borderType:t},n);a[t][i]=d,e.setParent(d,o),s&&e.setEdge(s,d,{weight:1})}t.exports=function(e){e.children().forEach(function t(r){let o=e.children(r),a=e.node(r);if(o.length&&o.forEach(t),Object.hasOwn(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,o=a.maxRank+1;t<o;++t)n(e,"borderLeft","_bl",r,a,t),n(e,"borderRight","_br",r,a,t)}})}}),y=o((e,t)=>{function r(e){e.nodes().forEach(t=>n(e.node(t))),e.edges().forEach(t=>n(e.edge(t)))}function n(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.y=-e.y}function a(e){let t=e.x;e.x=e.y,e.y=t}t.exports={adjust:function(e){let t=e.graph().rankdir.toLowerCase();("lr"===t||"rl"===t)&&r(e)},undo:function(e){var t,n;let i=e.graph().rankdir.toLowerCase();("bt"===i||"rl"===i)&&((t=e).nodes().forEach(e=>o(t.node(e))),t.edges().forEach(e=>{let r=t.edge(e);r.points.forEach(o),Object.hasOwn(r,"y")&&o(r)})),("lr"===i||"rl"===i)&&((n=e).nodes().forEach(e=>a(n.node(e))),n.edges().forEach(e=>{let t=n.edge(e);t.points.forEach(a),Object.hasOwn(t,"x")&&a(t)}),r(e))}}}),w=o((e,t)=>{var r=d();t.exports=function(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),o=n.map(t=>e.node(t).rank),a=r.applyWithChunking(Math.max,o),i=r.range(a+1).map(()=>[]);return n.sort((t,r)=>e.node(t).rank-e.node(r).rank).forEach(function r(n){t[n]||(t[n]=!0,i[e.node(n).rank].push(n),e.successors(n).forEach(r))}),i}}),b=o((e,t)=>{var r=d().zipObject;t.exports=function(e,t){let n=0;for(let o=1;o<t.length;++o)n+=function(e,t,n){let o=r(n,n.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:o[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),i=1;for(;i<n.length;)i<<=1;let s=2*i-1;i-=1;let d=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+i;d[t]+=e.weight;let r=0;for(;t>0;)t%2&&(r+=d[t+1]),t=t-1>>1,d[t]+=e.weight;l+=e.weight*r}),l}(e,t[o-1],t[o]);return n}}),x=o((e,t)=>{t.exports=function(e,t=[]){return t.map(t=>{let r=e.inEdges(t);if(!r.length)return{v:t};{let n=r.reduce((t,r)=>{let n=e.edge(r),o=e.node(r.v);return{sum:t.sum+n.weight*o.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:t,barycenter:n.sum/n.weight,weight:n.weight}}})}}),E=o((e,t)=>{var r=d();t.exports=function(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];void 0!==t&&void 0!==r&&(r.indegree++,t.out.push(n[e.w]))}),function(e){let t=[];for(;e.length;){let r=e.pop();t.push(r),r.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 r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(r)),r.out.forEach(function(t){return r=>{r.in.push(t),0==--r.indegree&&e.push(r)}}(r))}return t.filter(e=>!e.merged).map(e=>r.pick(e,["vs","i","barycenter","weight"]))}(Object.values(n).filter(e=>!e.indegree))}}),k=o((e,t)=>{var r=d();function n(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}t.exports=function(e,t){var o;let a=r.partition(e,e=>Object.hasOwn(e,"barycenter")),i=a.lhs,s=a.rhs.sort((e,t)=>t.i-e.i),d=[],l=0,c=0,u=0;i.sort((o=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:o?t.i-e.i:e.i-t.i)),u=n(d,s,u),i.forEach(e=>{u+=e.vs.length,d.push(e.vs),l+=e.barycenter*e.weight,c+=e.weight,u=n(d,s,u)});let h={vs:d.flat(!0)};return c&&(h.barycenter=l/c,h.weight=c),h}}),j=o((e,t)=>{var r=x(),n=E(),o=k();t.exports=function e(t,a,i,s){var d,l;let c=t.children(a),u=t.node(a),h=u?u.borderLeft:void 0,p=u?u.borderRight:void 0,f={};h&&(c=c.filter(e=>e!==h&&e!==p));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,o;let a=e(t,r.v,i,s);f[r.v]=a,Object.hasOwn(a,"barycenter")&&(n=r,o=a,void 0!==n.barycenter?(n.barycenter=(n.barycenter*n.weight+o.barycenter*o.weight)/(n.weight+o.weight),n.weight+=o.weight):(n.barycenter=o.barycenter,n.weight=o.weight))}});let v=n(g,i);d=v,l=f,d.forEach(e=>{e.vs=e.vs.flatMap(e=>l[e]?l[e].vs:e)});let m=o(v,s);if(h&&(m.vs=[h,m.vs,p].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(p)[0]);Object.hasOwn(m,"barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.order+r.order)/(m.weight+2),m.weight+=2}return m}}),_=o((e,t)=>{var r=a().Graph,n=d();t.exports=function(e,t,o,a){a||(a=e.nodes());let i=function(e){for(var t;e.hasNode(t=n.uniqueId("_root")););return t}(e),s=new r({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return a.forEach(r=>{let n=e.node(r),a=e.parent(r);(n.rank===t||n.minRank<=t&&t<=n.maxRank)&&(s.setNode(r),s.setParent(r,a||i),e[o](r).forEach(t=>{let n=t.v===r?t.w:t.v,o=s.edge(n,r),a=void 0!==o?o.weight:0;s.setEdge(n,r,{weight:e.edge(t).weight+a})}),Object.hasOwn(n,"minRank")&&s.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),s}}),C=o((e,t)=>{t.exports=function(e,t,r){let n={},o;r.forEach(r=>{let a=e.parent(r),i,s;for(;a;){if((i=e.parent(a))?(s=n[i],n[i]=a):(s=o,o=a),s&&s!==a)return void t.setEdge(s,a);a=i}})}}),N=o((e,t)=>{var r=w(),n=b(),o=j(),i=_(),s=C(),l=a().Graph,c=d();function u(e,t,r){let n=new Map,o=(e,t)=>{n.has(e)||n.set(e,[]),n.get(e).push(t)};for(let t of e.nodes()){let r=e.node(t);if("number"==typeof r.rank&&o(r.rank,t),"number"==typeof r.minRank&&"number"==typeof r.maxRank)for(let e=r.minRank;e<=r.maxRank;e++)e!==r.rank&&o(e,t)}return t.map(function(t){return i(e,t,r,n.get(t)||[])})}function h(e,t){Object.values(t).forEach(t=>t.forEach((t,r)=>e.node(t).order=r))}t.exports=function e(t,a={}){if("function"==typeof a.customOrder)return void a.customOrder(t,e);let i=c.maxRank(t),d=u(t,c.range(1,i+1),"inEdges"),p=u(t,c.range(i-1,-1,-1),"outEdges"),f=r(t);if(h(t,f),a.disableOptimalOrderHeuristic)return;let g=1/0,v,m=a.constraints||[];for(let e=0,r=0;r<4;++e,++r){(function(e,t,r){let n=new l;e.forEach(function(e){r.forEach(e=>n.setEdge(e.left,e.right));let a=e.graph().root,i=o(e,a,n,t);i.vs.forEach((t,r)=>e.node(t).order=r),s(e,n,i.vs)})})(e%2?d:p,e%4>=2,m),f=c.buildLayerMatrix(t);let a=n(t,f);a<g?(r=0,v=Object.assign({},f),g=a):a===g&&(v=structuredClone(f))}h(t,v)}}),O=o((e,t)=>{var r=a().Graph,n=d();function o(e,t){let r={};return t.length&&t.reduce(function(t,n){let o=0,a=0,i=t.length,d=n[n.length-1];return n.forEach((t,l)=>{let c=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}(e,t),u=c?e.node(c).order:i;(c||t===d)&&(n.slice(a,l+1).forEach(t=>{e.predecessors(t).forEach(n=>{let a=e.node(n),i=a.order;(i<o||u<i)&&!(a.dummy&&e.node(t).dummy)&&s(r,n,t)})}),a=l+1,o=u)}),n}),r}function i(e,t){let r={};function o(t,o,a,i,d){let l;n.range(o,a).forEach(n=>{l=t[n],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<i||n.order>d)&&s(r,t,l)})})}return t.length&&t.reduce(function(t,r){let n=-1,a,i=0;return r.forEach((s,d)=>{if("border"===e.node(s).dummy){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,o(r,i,d,n,a),i=d,n=a)}o(r,i,r.length,a,t.length)}),r}),r}function s(e,t,r){if(t>r){let e=t;t=r,r=e}let n=e[t];n||(e[t]=n={}),n[r]=!0}function l(e,t,r){if(t>r){let e=t;t=r,r=e}return!!e[t]&&Object.hasOwn(e[t],r)}function c(e,t,r,n){let o={},a={},i={};return t.forEach(e=>{e.forEach((e,t)=>{o[e]=e,a[e]=e,i[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=n(e);if(s.length){let n=((s=s.sort((e,t)=>i[e]-i[t])).length-1)/2;for(let d=Math.floor(n),c=Math.ceil(n);d<=c;++d){let n=s[d];a[e]===e&&t<i[n]&&!l(r,e,n)&&(a[n]=e,a[e]=o[e]=o[n],t=i[n])}}})}),{root:o,align:a}}function u(e,t,n,o,a){var i,s,d,l,c,u,h;let p,f,g,v={},m=(i=e,s=t,d=n,l=a,p=new r,g=(c=(f=i.graph()).nodesep,u=f.edgesep,h=l,(e,t,r)=>{let n=e.node(t),o=e.node(r),a,i;if(a=0+n.width/2,Object.hasOwn(n,"labelpos"))switch(n.labelpos.toLowerCase()){case"l":i=-n.width/2;break;case"r":i=n.width/2}if(i&&(a+=h?i:-i),i=0,a+=(n.dummy?u:c)/2,a+=(o.dummy?u:c)/2,a+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":i=o.width/2;break;case"r":i=-o.width/2}return i&&(a+=h?i:-i),i=0,a}),s.forEach(e=>{let t;e.forEach(e=>{let r=d[e];if(p.setNode(r),t){var n=d[t],o=p.edge(n,r);p.setEdge(n,r,Math.max(g(i,e,t),o||0))}t=e})}),p),y=a?"borderLeft":"borderRight";function w(e,t){let r=m.nodes().slice(),n={},o=r.pop();for(;o;){if(n[o])e(o);else for(let e of(n[o]=!0,r.push(o),t(o)))r.push(e);o=r.pop()}}return w(function(e){v[e]=m.inEdges(e).reduce((e,t)=>Math.max(e,v[t.v]+m.edge(t)),0)},m.predecessors.bind(m)),w(function(t){let r=m.outEdges(t).reduce((e,t)=>Math.min(e,v[t.w]-m.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==y&&(v[t]=Math.max(v[t],r))},m.successors.bind(m)),Object.keys(o).forEach(e=>v[e]=v[n[e]]),v}function h(e,t){return Object.values(t).reduce((t,r)=>{let n=-1/0,o=1/0;Object.entries(r).forEach(([t,r])=>{var a,i;let s=(a=e,i=t,a.node(i).width/2);n=Math.max(r+s,n),o=Math.min(r-s,o)});let a=n-o;return a<t[0]&&(t=[a,r]),t},[1/0,null])[1]}function p(e,t){let r=Object.values(t),o=n.applyWithChunking(Math.min,r),a=n.applyWithChunking(Math.max,r);["u","d"].forEach(r=>{["l","r"].forEach(i=>{let s=r+i,d=e[s];if(d===t)return;let l=Object.values(d),c=o-n.applyWithChunking(Math.min,l);"l"!==i&&(c=a-n.applyWithChunking(Math.max,l)),c&&(e[s]=n.mapValues(d,e=>e+c))})})}function f(e,t){return n.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let t=Object.values(e).map(e=>e[n]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}t.exports={positionX:function(e){let t=n.buildLayerMatrix(e),r=Object.assign(o(e,t),i(e,t)),a={},s;["u","d"].forEach(o=>{s="u"===o?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(s=s.map(e=>Object.values(e).reverse()));let i=("u"===o?e.predecessors:e.successors).bind(e),d=c(e,s,r,i),l=u(e,s,d.root,d.align,"r"===t);"r"===t&&(l=n.mapValues(l,e=>-e)),a[o+t]=l})});let d=h(e,a);return p(a,d),f(a,e.graph().align)},findType1Conflicts:o,findType2Conflicts:i,addConflict:s,hasConflict:l,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:h,balance:f}}),M=o((e,t)=>{var r=d(),n=O().positionX;t.exports=function(e){var t;let o,a,i,s;t=e=r.asNonCompoundGraph(e),o=r.buildLayerMatrix(t),a=t.graph().ranksep,i=t.graph().rankalign,s=0,o.forEach(e=>{let r=e.reduce((e,r)=>{let n=t.node(r).height;return e>n?e:n},0);e.forEach(e=>{let n=t.node(e);"top"===i?n.y=s+n.height/2:"bottom"===i?n.y=s+r-n.height/2:n.y=s+r/2}),s+=r+a}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),R=o((e,t)=>{var r=l(),n=c(),o=f(),i=d().normalizeRanks,s=g(),u=d().removeEmptyRanks,h=v(),p=m(),w=y(),b=N(),x=M(),E=d(),k=a().Graph;t.exports=function(e,t={}){let a=t.debugTiming?E.time:E.notime;return a("layout",()=>{let d=a(" buildLayoutGraph",()=>{var t;let r,n;return t=e,r=new k({multigraph:!0,compound:!0}),n=D(t.graph()),r.setGraph(Object.assign({},_,T(n,j),E.pick(n,C))),t.nodes().forEach(e=>{let n=T(D(t.node(e)),O);Object.keys(R).forEach(e=>{void 0===n[e]&&(n[e]=R[e])}),r.setNode(e,n),r.setParent(e,t.parent(e))}),t.edges().forEach(e=>{let n=D(t.edge(e));r.setEdge(e,Object.assign({},S,T(n,P),E.pick(n,L)))}),r});return a(" runLayout",()=>{var e,l,c;return e=d,l=a,c=t,void(l(" makeSpaceForEdgeLabels",()=>{var t;let r;return r=(t=e).graph(),void(r.ranksep/=2,t.edges().forEach(e=>{let n=t.edge(e);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}),l(" removeSelfEdges",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),l(" acyclic",()=>r.run(e)),l(" nestingGraph.run",()=>h.run(e)),l(" rank",()=>o(E.asNonCompoundGraph(e))),l(" injectEdgeLabelProxies",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(r.width&&r.height){let r=t.node(e.v),n={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};E.addDummyNode(t,"edge-proxy",n,"_ep")}})}),l(" removeEmptyRanks",()=>u(e)),l(" nestingGraph.cleanup",()=>h.cleanup(e)),l(" normalizeRanks",()=>i(e)),l(" assignRankMinMax",()=>{var t;let r;return r=0,void((t=e).nodes().forEach(e=>{let n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,r=Math.max(r,n.maxRank))}),t.graph().maxRank=r)}),l(" removeEdgeLabelProxies",()=>{var t;(t=e).nodes().forEach(e=>{let r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}),l(" normalize.run",()=>n.run(e)),l(" parentDummyChains",()=>s(e)),l(" addBorderSegments",()=>p(e)),l(" order",()=>b(e,c)),l(" insertSelfEdges",()=>{var t;return t=e,void E.buildLayerMatrix(t).forEach(e=>{var r=0;e.forEach((e,n)=>{var o=t.node(e);o.order=n+r,(o.selfEdges||[]).forEach(e=>{E.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:n+ ++r,e:e.e,label:e.label},"_se")}),delete o.selfEdges})})}),l(" adjustCoordinateSystem",()=>w.adjust(e)),l(" position",()=>x(e)),l(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,a=n.y,i=r.x-o,s=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*i/3,y:a-s},{x:o+5*i/6,y:a-s},{x:o+i,y:a},{x:o+5*i/6,y:a+s},{x:o+2*i/3,y:a+s}],r.label.x=r.x,r.label.y=r.y}})}),l(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let r=t.node(e),n=t.node(r.borderTop),o=t.node(r.borderBottom),a=t.node(r.borderLeft[r.borderLeft.length-1]),i=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(i.x-a.x),r.height=Math.abs(o.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),l(" normalize.undo",()=>n.undo(e)),l(" fixupEdgeLabelCoords",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(Object.hasOwn(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}),l(" undoCoordinateSystem",()=>w.undo(e)),l(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,o=0,a=e.graph(),i=a.marginx||0,s=a.marginy||0;function d(e){let a=e.x,i=e.y,s=e.width,d=e.height;t=Math.min(t,a-s/2),r=Math.max(r,a+s/2),n=Math.min(n,i-d/2),o=Math.max(o,i+d/2)}e.nodes().forEach(t=>d(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);Object.hasOwn(r,"x")&&d(r)}),t-=i,n-=s,e.nodes().forEach(r=>{let o=e.node(r);o.x-=t,o.y-=n}),e.edges().forEach(r=>{let o=e.edge(r);o.points.forEach(e=>{e.x-=t,e.y-=n}),Object.hasOwn(o,"x")&&(o.x-=t),Object.hasOwn(o,"y")&&(o.y-=n)}),a.width=r-t+i,a.height=o-n+s})(e)),l(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e),n=t.node(e.v),o=t.node(e.w),a,i;r.points?(a=r.points[0],i=r.points[r.points.length-1]):(r.points=[],a=o,i=n),r.points.unshift(E.intersectRect(n,a)),r.points.push(E.intersectRect(o,i))})}),l(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);r.reversed&&r.points.reverse()})}),l(" acyclic.undo",()=>r.undo(e)))}),a(" updateInputGraph",()=>{var t,r;return t=e,r=d,void(t.nodes().forEach(e=>{let n=t.node(e),o=r.node(e);n&&(n.x=o.x,n.y=o.y,n.order=o.order,n.rank=o.rank,r.children(e).length&&(n.width=o.width,n.height=o.height))}),t.edges().forEach(e=>{let n=t.edge(e),o=r.edge(e);n.points=o.points,Object.hasOwn(o,"x")&&(n.x=o.x,n.y=o.y)}),t.graph().width=r.graph().width,t.graph().height=r.graph().height)}),d})};var j=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],O=["width","height","rank"],R={width:0,height:0},P=["minlen","weight","width","height","labeloffset"],S={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},L=["labelpos"];function T(e,t){return E.mapValues(E.pick(e,t),Number)}function D(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),P=o((e,t)=>{var r=d(),n=a().Graph;t.exports={debugOrdering:function(e){let t=r.buildLayerMatrix(e),o=new n({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{o.setNode(t,{label:t}),o.setParent(t,"layer"+e.node(t).rank)}),e.edges().forEach(e=>o.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{o.setNode("layer"+t,{rank:"same"}),e.reduce((e,t)=>(o.setEdge(e,t,{style:"invis"}),t))}),o}}}),S=o((e,t)=>{t.exports="2.0.4"});let L=o((e,t)=>{t.exports={graphlib:a(),layout:R(),debug:P(),util:{time:d().time,notime:d().notime},version:S()}})(),T={direction:"LR",ranksep:200,nodesep:15},D={featureNode:{width:288,height:140},repositoryNode:{width:328,height:50}};function I(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:D[e.type??""]??t}function F(e,t,r={}){let{direction:n="TB",nodeSize:o={width:172,height:36},ranksep:a=80,nodesep:i=30}=r;if(0===e.length)return{nodes:[],edges:[]};let s=new L.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:n,ranksep:a,nodesep:i});let d=new Set;for(let e of t)d.add(e.source),d.add(e.target);let l=e.filter(e=>d.has(e.id)),c=e.filter(e=>!d.has(e.id));for(let e of l){let t=I(e,o);s.setNode(e.id,{width:t.width,height:t.height})}for(let e of t)s.hasNode(e.source)&&s.hasNode(e.target)&&s.setEdge(e.source,e.target,{},e.id);L.layout(s);let{targetPosition:u,sourcePosition:h}=function(e){switch(e){case"LR":return{targetPosition:"left",sourcePosition:"right"};case"RL":return{targetPosition:"right",sourcePosition:"left"};case"BT":return{targetPosition:"bottom",sourcePosition:"top"};default:return{targetPosition:"top",sourcePosition:"bottom"}}}(n),p="LR"===n||"RL"===n,f=new Map;for(let e of l){let t=s.node(e.id),r=I(e,o);f.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=new Map;for(let e of t)f.has(e.source)&&f.has(e.target)&&(g.has(e.source)||g.set(e.source,[]),g.get(e.source).push(e.target));let v=new Map;for(let e=0;e<l.length;e++)v.set(l[e].id,e);for(let[,e]of g)e.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let m=new Set;for(let e of g.values())for(let t of e)m.add(t);let y=[...new Set(f.keys())].filter(e=>!m.has(e)),w=new Map;for(let e of y)!function e(t){if(w.has(t))return w.get(t);let r=f.get(t),n=p?r.h:r.w,o=g.get(t);if(!o||0===o.length)return w.set(t,n),n;let a=0;for(let t of o)a+=e(t);let s=Math.max(n,a+=(o.length-1)*i);return w.set(t,s),s}(e);let b=0;for(let e of y){let t=w.get(e)??0;!function e(t,r){let n=f.get(t);p?n.cy=r:n.cx=r;let o=g.get(t);if(!o||0===o.length)return;let a=0;for(let e of o)a+=w.get(e)??0;let s=r-(a+=(o.length-1)*i)/2;for(let t of o){let r=w.get(t)??0;e(t,s+r/2),s+=r+i}}(e,b+t/2),b+=t+i}let x=[];for(let e of l){let t=f.get(e.id);x.push({...e,targetPosition:u,sourcePosition:h,position:{x:t.cx-t.w/2,y:t.cy-t.h/2}})}if(c.length>0){let e=0,t=1/0;for(let r of x){let n=I(r,o);e=Math.max(e,r.position.y+n.height),t=Math.min(t,r.position.x)}t===1/0&&(t=0);for(let r=0;r<c.length;r++){let n=c[r],a=I(n,o);x.push({...n,targetPosition:u,sourcePosition:h,position:{x:t,y:e+30+r*(a.height+20)}})}}return{nodes:x,edges:[...t]}}var A=e.i(77859),$=e.i(21023);let z=(0,$.createServerReference)("40d0e6f3ac1def0298e4af52455600ac3a4c3e267c",$.callServer,void 0,$.findSourceMapURL,"addRepository"),G=(0,$.createServerReference)("40faa6eea26f895ccdbad2e930f6adc94420f0f6f4",$.callServer,void 0,$.findSourceMapURL,"deleteRepository"),B=(0,$.createServerReference)("408080847c2e8b50a1ac8306da66a035ce5b443e9e",$.callServer,void 0,$.findSourceMapURL,"getFeatureMetadata"),q=(0,$.createServerReference)("0019dfaa0e4ea9016973f017445d91fdc866c7ecce",$.callServer,void 0,$.findSourceMapURL,"fetchGraphData");var W=e.i(39443),V=e.i(8361),U=e.i(18354),H=e.i(99045);function X(e,t){let r=new Map;for(let e of t)"dependencyEdge"===e.type&&r.set(e.target,e.source);let n=new Map,o=new Map;for(let t of e)"featureNode"===t.type?n.set(t.id,{nodeId:t.id,data:t.data,parentNodeId:r.get(t.id)}):"repositoryNode"===t.type&&o.set(t.id,{nodeId:t.id,data:t.data});return{featureMap:n,repoMap:o}}function K(e,t){return(void 0===t.state||t.state===e.state)&&(void 0===t.lifecycle||t.lifecycle===e.lifecycle)&&(void 0===t.name||t.name===e.name)&&(void 0===t.description||t.description===e.description)}let Y=(0,U.createLogger)("[Polling]"),J=0,Q=0;function Z(e,o){let a=(0,r.useRouter)(),i=(0,V.useSoundAction)("delete"),s=(0,V.useSoundAction)("create"),{nodes:d,edges:l,reconcile:c,updateFeature:u,addPendingFeature:h,removeFeature:p,restoreFeature:f,addRepository:g,removeRepository:v,replaceRepository:m,getFeatureRepositoryPath:y,getRepositoryData:w,getRepoMapSize:b,setCallbacks:x}=function(e,r){let n=(0,t.useMemo)(()=>X(e,r),[]),[o,a]=(0,t.useState)(n.featureMap),[i,s]=(0,t.useState)(n.repoMap),[d,l]=(0,t.useState)(new Map),c=(0,t.useRef)(new Map),u=(0,t.useRef)({}),h=(0,t.useMemo)(()=>({onNodeAction:e=>u.current.onNodeAction?.(e),onNodeSettings:e=>u.current.onNodeSettings?.(e),onFeatureDelete:e=>u.current.onFeatureDelete?.(e),onRepositoryAdd:e=>u.current.onRepositoryAdd?.(e),onRepositoryClick:e=>u.current.onRepositoryClick?.(e),onRepositoryDelete:e=>u.current.onRepositoryDelete?.(e)}),[]),p=(0,t.useRef)(o);p.current=o;let f=(0,t.useRef)(i);f.current=i;let g=(0,t.useMemo)(()=>(function(e,t,r,n){let o=[],a=[],i=new Map;for(let[e,r]of t)r.data.repositoryPath&&i.set(r.data.repositoryPath,e);let s=new Map;for(let[e,r]of t){let t={...r.data,...n?.onRepositoryAdd&&{onAdd:()=>n.onRepositoryAdd(e)},...n?.onRepositoryClick&&{onClick:()=>n.onRepositoryClick(e)},...n?.onRepositoryDelete&&{onDelete:n.onRepositoryDelete}};o.push({id:e,type:"repositoryNode",position:{x:0,y:0},data:t})}for(let[t,d,l]of[...[...e.entries()].map(([e,t])=>[e,t,!1]),...[...r.entries()].filter(([t])=>!e.has(t)).map(([e,t])=>[e,t,!0])]){let e="creating"===d.data.state||l,r={...d.data,...!e&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!e&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!e&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete}};if(o.push({id:t,type:"featureNode",position:{x:0,y:0},data:r}),d.parentNodeId)a.push({id:`dep-${d.parentNodeId}-${t}`,source:d.parentNodeId,target:t,type:"dependencyEdge"});else{let e=d.data.repositoryPath,r=i.get(e)??function(e){if(s.has(e))return s.get(e);let t=`virtual-repo-${e}`,r=e.split("/").filter(Boolean).at(-1)??e;return o.push({id:t,type:"repositoryNode",position:{x:0,y:0},data:{name:r,repositoryPath:e}}),s.set(e,t),t}(e);a.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let d=a.length>0;for(let e of o)e.data.showHandles=d;return{nodes:o,edges:a}})(o,i,d,h),[o,i,d,h]),v=(0,t.useRef)({key:"",positions:new Map}),{nodes:m,edges:y}=(0,t.useMemo)(()=>{let e=g.nodes.map(e=>e.id).sort().join(","),t=g.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}`;if(r!==v.current.key){let e=F(g.nodes,g.edges,T),t=new Map;for(let r of e.nodes)t.set(r.id,{position:r.position,targetPosition:r.targetPosition,sourcePosition:r.sourcePosition});return v.current={key:r,positions:t},e}let{positions:n}=v.current;return{nodes:g.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:g.edges}},[g]),w=(0,t.useCallback)((e,t)=>{let{featureMap:r,repoMap:n}=X(e,t),o=new Set([...r.values()].map(e=>`${e.data.name}\0${e.data.repositoryPath}`));a(e=>{let t=[...e.entries()].filter(([,e])=>"creating"===e.data.state),n=new Map(r);for(let[e,r]of t){let t=`${r.data.name}\0${r.data.repositoryPath}`;o.has(t)||n.set(e,r)}for(let[e,t]of c.current){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),c.current.delete(e))}return n}),l(e=>{if(0===e.size)return e;let t=!1,r=new Map(e);for(let[n,a]of e){let e=`${a.data.name}\0${a.data.repositoryPath}`;o.has(e)&&(r.delete(n),t=!0)}return t?r:e}),s(n)},[]),b=(0,t.useCallback)((e,t)=>{a(r=>{let n=r.get(e);if(!n)return c.current.set(e,{...c.current.get(e),...t}),r;if(c.current.delete(e),K(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o}),l(r=>{let n=r.get(e);if(!n||K(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o})},[]),x=(0,t.useCallback)((e,t,r)=>{l(n=>{let o=new Map(n);return o.set(e,{nodeId:e,data:t,parentNodeId:r}),o})},[]),E=(0,t.useCallback)(e=>{l(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),k=(0,t.useCallback)(e=>{a(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),j=(0,t.useCallback)((e,t)=>{a(r=>{let n=new Map(r);return n.set(e,t),n})},[]),_=(0,t.useCallback)((e,t)=>{s(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),C=(0,t.useCallback)(e=>{s(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),N=(0,t.useCallback)((e,t,r)=>{s(n=>{if(!n.has(e))return n;let o=new Map(n);return o.delete(e),o.set(t,{nodeId:t,data:r}),o})},[]),O=(0,t.useCallback)(e=>p.current.get(e)?.data.repositoryPath,[]),M=(0,t.useCallback)(e=>f.current.get(e)?.data,[]);return{nodes:m,edges:y,reconcile:w,updateFeature:b,addPendingFeature:x,removePendingFeature:E,removeFeature:k,restoreFeature:j,addRepository:_,removeRepository:C,replaceRepository:N,getFeatureRepositoryPath:O,getRepositoryData:M,getRepoMapSize:(0,t.useCallback)(()=>f.current.size,[]),setCallbacks:(0,t.useCallback)(e=>{u.current=e},[])}}(e,o),E=(0,t.useRef)(d),k=(0,t.useRef)(l);(0,t.useEffect)(()=>{E.current=d,k.current=l},[d,l]);let j=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),_=(0,t.useMemo)(()=>e.filter(e=>"featureNode"===e.type).map(e=>{let t=e.data;return`${e.id}:${t.state}:${t.lifecycle}`}).sort().join(","),[e]),C=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${j}|${_}`;t!==C.current&&(C.current=t,c(e,o))},[j,_,e,o,c]);let N=(0,t.useRef)(new Map),{events:O}=(0,W.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=N.current;for(let r of e){if("featureNode"!==r.type)continue;let e=r.data,o=t.get(r.id);void 0!==o&&o!==e.state&&(O.some(t=>t.featureId===e.featureId&&(0,H.mapEventTypeToState)(t.eventType)===e.state)||("done"===e.state?n.toast.success(e.name,{description:"Feature completed!"}):"action-required"===e.state?n.toast.warning(e.name,{description:"Waiting for your approval",action:{label:"Review",onClick:()=>a.push(`/feature/${e.featureId}`)}}):"error"===e.state&&n.toast.error(e.name,{description:e.errorMessage??"Agent failed"}))),t.set(r.id,e.state)}},[_,e,O,a]);let M=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(M.current>O.length&&(M.current=0),O.length<=M.current)return;let e=O.slice(M.current);for(let{featureId:t,state:r,lifecycle:n}of(M.current=O.length,(0,H.resolveSseEventUpdates)(e)))(void 0!==r||void 0!==n)&&u(`feat-${t}`,{...void 0!==r&&{state:r},...void 0!==n&&{lifecycle:n}})},[O,u]),(0,t.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;u(`feat-${t}`,{state:"running"})};return window.addEventListener("shep:feature-approved",e),()=>window.removeEventListener("shep:feature-approved",e)},[u]);let R=(0,t.useRef)(new Set),P=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(P.current>O.length&&(P.current=0),O.length<=P.current)return;let e=O.slice(P.current);for(let t of(P.current=O.length,e)){if("Feature metadata updated"!==t.message||R.current.has(t.featureId))continue;R.current.add(t.featureId);let e=`feat-${t.featureId}`;B(t.featureId).then(t=>{t&&u(e,{name:t.name,description:t.description})}).catch(()=>{})}},[O,u]),(0,t.useEffect)(()=>{Y.debug("polling enabled (3000ms interval)");let e=setInterval(async()=>{try{let{nodes:e,edges:t}=await q();c(e,t)}catch{Y.warn("poll fetch failed — will retry next interval")}},3e3);return()=>{Y.debug("polling disabled"),clearInterval(e)}},[c]);let S=(0,t.useCallback)(e=>{},[]),L=(0,t.useCallback)(e=>{},[]),D=(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${J++}`,o={name:t?.name??"New Feature",description:t?.description??"Describe what this feature does",featureId:t?.featureId??`#${n.slice(-4)}`,lifecycle:"requirements",state:t?.state??"running",progress:0,repositoryPath:t?.repositoryPath??"",branch:t?.branch??""};return h(n,o,"dependencyEdge"===r&&e?e:void 0),n},[h]),I=(0,t.useCallback)((e,t)=>{let r=`feat-${e}`,o=E.current.filter(e=>e.id===r).map(e=>({nodeId:e.id,data:e.data}))[0];p(r),i.play(),n.toast.success("Feature deleted successfully"),a.push("/"),(0,A.deleteFeature)(e,t).then(e=>{e.error&&(o&&f(r,o),n.toast.error(e.error))}).catch(()=>{o&&f(r,o),n.toast.error("Failed to delete feature")})},[a,i,p,f]),$=(0,t.useCallback)(async e=>{let t=`repo-${e}`,r=new Set(k.current.filter(e=>e.source===t).map(e=>e.target)),o=w(t),a=new Map;for(let e of r){let t=E.current.find(t=>t.id===e);t&&a.set(e,{nodeId:e,data:t.data})}let s=()=>{for(let[e,r]of(o&&g(t,o),a))f(e,r)};for(let e of(v(t),r))p(e);try{let t=await G(e);if(!t.success){n.toast.error(t.error??"Failed to remove repository"),s();return}i.play(),n.toast.success("Repository removed")}catch{n.toast.error("Failed to remove repository"),s()}},[i,v,p,g,f,w]),U=(0,t.useCallback)(e=>{let t=F(E.current,k.current,{...T,direction:e});c(t.nodes,t.edges)},[c]);return{nodes:d,edges:l,onNodesChange:S,handleConnect:L,handleAddRepository:(0,t.useCallback)(e=>{let t=0===b(),r=`repo-temp-${++Q}`,o=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return g(r,{name:o,repositoryPath:e,id:r}),z({path:e,name:o}).then(e=>{if(e.error){v(r),n.toast.error(e.error);return}let t=e.repository;m(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id}),s.play()}).catch(()=>{v(r),n.toast.error("Failed to add repository")}),{wasEmpty:t,repoPath:e}},[g,v,m,s,b]),handleLayout:U,handleDeleteFeature:I,handleDeleteRepository:$,createFeatureNode:D,getFeatureRepositoryPath:y,getRepositoryData:w,setCallbacks:x}}e.s(["useControlCenterState",()=>Z],17840)},48246,e=>{"use strict";var t=e.i(20314),r=e.i(53271),n=e.i(79054),o=e.i(31406),a=e.i(3214),i=e.i(3645);let s=(0,i.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var d=e.i(35364);e.i(54793);var l=e.i(7729);e.i(47506);var c=e.i(89313),u=e.i(92002);let h=(0,i.default)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);var p=e.i(8986),f=e.i(38573),g=e.i(19933),v=e.i(67669),m=e.i(24042),y=e.i(64970),w=e.i(31777);e.i(81803);var b=e.i(72714),x=e.i(2287),E=e.i(2828);e.i(99348);var k=e.i(17466),j=e.i(8537),_=e.i(75921),C=e.i(76852);function N({data:e}){let o=(0,_.useFeatureFlags)(),[i,s]=(0,n.useState)(!1),l=(0,C.useRepositoryActions)(e.repositoryPath?{repositoryPath:e.repositoryPath}:null),c=(0,j.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),N="Booting"===c.status||"Ready"===c.status;return(0,t.jsxs)("div",{className:(0,w.cn)("group relative",e.onDelete&&e.id&&"pl-10"),children:[e.showHandles?(0,t.jsx)(r.Handle,{type:"target",position:u.Position.Left,isConnectable:!1,className:"opacity-0!"}):null,e.onDelete&&e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute top-1/2 left-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100",children:(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Remove repository","data-testid":"repository-node-delete-button",onClick:e=>{e.stopPropagation(),s(!0)},className:"bg-card text-muted-foreground hover:border-destructive hover:text-destructive flex h-7 w-7 cursor-pointer items-center justify-center rounded-full border shadow-sm transition-colors",children:(0,t.jsx)(v.Trash2,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(E.TooltipContent,{children:"Remove repository"})]})})}),(0,t.jsx)(x.Dialog,{open:i,onOpenChange:s,children:(0,t.jsxs)(x.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(x.DialogHeader,{children:[(0,t.jsx)(x.DialogTitle,{children:"Remove repository?"}),(0,t.jsxs)(x.DialogDescription,{children:["This will remove ",(0,t.jsx)("strong",{children:e.name})," and all its features from your workspace. The repository files on disk won't be affected."]})]}),(0,t.jsxs)(x.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(x.DialogClose,{asChild:!0,children:(0,t.jsx)(d.Button,{variant:"outline",children:"Cancel"})}),(0,t.jsx)(d.Button,{variant:"destructive",onClick:()=>{s(!1),e.onDelete?.(e.id)},children:"Remove"})]})]})})]}):null,(0,t.jsxs)("div",{role:"button",tabIndex:0,"data-testid":"repository-node-card","data-repo-name":e.name,onClick:t=>{t.stopPropagation(),e.onClick?.()},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),t.stopPropagation(),e.onClick?.())},className:"nodrag bg-card flex min-w-[18rem] cursor-pointer items-center gap-3 rounded-full border px-4 py-3 shadow-sm",children:[(0,t.jsx)(h,{className:"text-muted-foreground h-5 w-5 shrink-0"}),(0,t.jsx)("span",{"data-testid":"repository-node-name",className:"min-w-0 truncate text-sm font-medium",children:e.name}),(0,t.jsxs)("div",{className:(0,w.cn)("flex shrink-0 items-center gap-2",(e.repositoryPath??e.onAdd)&&"ml-auto"),onClick:e=>e.stopPropagation(),children:[e.repositoryPath?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open in IDE",onClick:l.openInIde,loading:l.ideLoading,error:!!l.ideError,icon:p.Code2,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open in IDE"})]})}),(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open in Shell",onClick:l.openInShell,loading:l.shellLoading,error:!!l.shellError,icon:f.Terminal,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open in Shell"})]})}),(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open Folder",onClick:l.openFolder,loading:l.folderLoading,error:!!l.folderError,icon:g.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open Folder"})]})}),o.envDeploy?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:N?"Stop Dev Server":"Start Dev Server",onClick:N?c.stop:c.deploy,loading:c.deployLoading||c.stopLoading,error:!!c.deployError,icon:N?y.Square:m.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:N?"Stop Dev Server":"Start Dev Server"})]})}),N?(0,t.jsx)(k.DeploymentStatusBadge,{status:c.status,url:c.url,targetId:e.repositoryPath}):null]}):null]}):null,e.onAdd?(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Add feature","data-testid":"repository-node-add-button",onClick:t=>{t.stopPropagation(),e.onAdd?.()},className:"text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors hover:text-blue-500",children:(0,t.jsx)(a.Plus,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(E.TooltipContent,{children:"Add feature"})]})}):null]})]}),e.onAdd||e.showHandles?(0,t.jsx)(r.Handle,{type:"source",position:u.Position.Right,isConnectable:!e.showHandles,className:"opacity-0!"}):null]})}function O(e){let[n]=(0,u.getBezierPath)({sourceX:e.sourceX,sourceY:e.sourceY,targetX:e.targetX,targetY:e.targetY,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition});return(0,t.jsx)(r.BaseEdge,{id:e.id,path:n,style:{strokeDasharray:"5 5"}})}e.i(1650),e.i(45811),e.i(25235);let M={x:30,y:30,zoom:.85};function R({onResetViewport:e}){let{setViewport:o}=(0,r.useReactFlow)(),a=(0,n.useCallback)(()=>{o(e(),{duration:400})},[e,o]);return(0,t.jsx)(r.ControlButton,{onClick:a,title:"Reset view","aria-label":"Reset view",children:(0,t.jsx)(s,{style:{fill:"none"}})})}function P({nodes:e,edges:o,selectedFeatureId:i,defaultViewport:s,onNodesChange:u,onAddFeature:h,onConnect:p,onNodeClick:f,onPaneClick:g,onCanvasDrag:v,onMoveEnd:m,onResetViewport:y,toolbar:w,emptyState:b}){let x=(0,n.useMemo)(()=>({featureNode:c.FeatureNode,repositoryNode:N}),[]),E=(0,n.useMemo)(()=>({dependencyEdge:O}),[]),k=(0,n.useMemo)(()=>null==i?e:e.map(e=>"featureNode"===e.type&&e.data.featureId===i?{...e,selected:!0}:e),[e,i]);return 0===e.length?b?(0,t.jsx)("div",{"data-testid":"features-canvas-empty",className:"h-full w-full",children:b}):(0,t.jsx)("div",{"data-testid":"features-canvas-empty",children:(0,t.jsx)(l.EmptyState,{title:"No features yet",description:"Get started by creating your first feature.",action:(0,t.jsxs)(d.Button,{onClick:h,children:[(0,t.jsx)(a.Plus,{className:"mr-2 h-4 w-4"}),"New Feature"]})})}):(0,t.jsx)("div",{"data-testid":"features-canvas","data-no-drawer-close":!0,className:"pointer-events-auto h-full w-full",children:(0,t.jsxs)(r.ReactFlow,{nodes:k,edges:o,nodeTypes:x,edgeTypes:E,onConnect:p,onNodesChange:u,onNodeClick:f,onPaneClick:g,onMoveStart:v,onMoveEnd:m,defaultViewport:s??M,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[(0,t.jsx)(r.Background,{}),(0,t.jsx)(r.Controls,{showInteractive:!1,children:y?(0,t.jsx)(R,{onResetViewport:y}):null}),w]})})}var S=e.i(5147),L=e.i(8361),T=e.i(30153);let D="shep-canvas-viewport",I={x:30,y:30,zoom:.85},F=(0,i.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var A=e.i(33548),$=e.i(23925),z=e.i(83428),G=e.i(78521);let B=["cd ~/my-repo",'shep feat new "create modern, sleek dashboards"'];function q({onRepositorySelect:e,className:r}){let[o,i]=(0,n.useState)(!1),[s,d]=(0,n.useState)(!1);async function l(){if(!s){d(!0);try{let t=await (0,G.pickFolder)();t&&e?.(t)}finally{d(!1)}}}let c=(0,n.useCallback)(async()=>{await navigator.clipboard.writeText(B.join("\n")),i(!0),setTimeout(()=>i(!1),2e3)},[]);return(0,t.jsxs)("div",{"data-testid":"control-center-empty-state",className:(0,w.cn)("relative h-full w-full",r),children:[(0,t.jsx)("div",{className:"absolute inset-0 [background-image:radial-gradient(circle,_var(--color-border)_1px,_transparent_1px)] [background-size:24px_24px]"}),(0,t.jsxs)("div",{className:"absolute top-8 left-8 z-10",children:[(0,t.jsx)("h1",{className:"text-4xl font-bold tracking-tight",children:"Features"}),(0,t.jsx)("p",{className:"text-muted-foreground text-3xl font-light",children:"Control Center"})]}),(0,t.jsx)("div",{className:"relative z-10 flex h-full items-center justify-center",children:(0,t.jsxs)("div",{className:"flex max-w-lg flex-col items-center gap-6",children:[(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:[(0,t.jsx)(h,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"text-xs font-semibold tracking-widest uppercase",children:"Repositories"})]}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:l,disabled:s,className:"border-muted-foreground/30 hover:border-primary hover:text-primary flex cursor-pointer items-center gap-3 rounded-lg border-2 border-dashed px-8 py-4 transition-colors disabled:cursor-wait disabled:opacity-60",children:[s?(0,t.jsx)(z.Loader2,{className:"h-5 w-5 animate-spin"}):(0,t.jsx)(a.Plus,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:s?"Opening...":"Add Repository"})]}),(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-3",children:[(0,t.jsx)("div",{className:"bg-border h-px w-16"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(F,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-xs font-semibold tracking-widest uppercase",children:"Or start from the command line"})]}),(0,t.jsx)("div",{className:"bg-border h-px w-16"})]}),(0,t.jsxs)("div",{"data-testid":"cli-code-block",className:"relative w-full rounded-lg bg-zinc-900 px-5 py-4 font-mono text-sm text-zinc-100",children:[(0,t.jsx)("button",{type:"button","data-testid":"cli-code-block-copy",onClick:c,className:"absolute top-3 right-3 cursor-pointer rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-800 hover:text-zinc-200","aria-label":"Copy commands",children:o?(0,t.jsx)($.Check,{className:"h-4 w-4"}):(0,t.jsx)(A.Copy,{className:"h-4 w-4"})}),(0,t.jsx)("div",{className:"space-y-1",children:B.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-zinc-500 select-none",children:"$ "}),(0,t.jsx)("span",{children:e})]},e))})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"Feature will appear on canvas once created"})]})})]})}var W=e.i(17840);let V={maxZoom:1,padding:.5,duration:500};function U({initialNodes:e,initialEdges:a}){let i,s,d,l=(0,o.useRouter)(),c=(0,o.usePathname)(),u=(i=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),i?.[1]??null),h=(0,L.useSoundAction)("click"),{guardedNavigate:p}=(0,T.useDrawerCloseGuard)(),{fitView:f}=(0,r.useReactFlow)(),g=(0,n.useRef)(null),{defaultViewport:v,onMoveEnd:m,resetViewport:y}=(s=(0,n.useRef)(function(){try{let e=localStorage.getItem(D);if(null==e)return I;let t=JSON.parse(e);return!(null==t||"object"!=typeof t||Array.isArray(t))&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.zoom&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.zoom)&&t.zoom>0?t:I}catch{return I}}()).current,d=(0,n.useRef)(null),(0,n.useEffect)(()=>()=>{null!=d.current&&clearTimeout(d.current)},[]),{defaultViewport:s,onMoveEnd:(0,n.useCallback)(e=>{null!=d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{try{localStorage.setItem(D,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,n.useCallback)(()=>{try{localStorage.removeItem(D)}catch{}return I},[])}),{nodes:w,edges:b,onNodesChange:x,handleConnect:E,handleAddRepository:k,handleDeleteFeature:j,handleDeleteRepository:_,createFeatureNode:C,setCallbacks:N}=(0,W.useControlCenterState)(e,a),{setFeatures:O}=(0,S.useSidebarFeaturesContext)(),M=(0,n.useMemo)(()=>w.filter(e=>"featureNode"===e.type),[w]),R=(0,n.useMemo)(()=>M.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}`}).sort().join(","),[M]);(0,n.useEffect)(()=>{O(M.map(e=>{let t=e.data,r=(0,S.mapNodeStateToSidebarStatus)(t.state);return r?{featureId:t.featureId,name:t.name,status:r,...null!=t.startedAt&&{startedAt:t.startedAt},...null!=t.runtime&&{duration:t.runtime},...t.agentType&&{agentType:t.agentType},...t.modelId&&{modelId:t.modelId}}:null}).filter(Boolean))},[R,M,O]);let F=(0,n.useCallback)((e,t)=>{if("featureNode"===t.type){let e=t.data;"creating"!==e.state&&p(()=>{h.play(),l.push(`/feature/${e.featureId}`)})}},[l,h,p]),A=(0,n.useCallback)(()=>{h.play(),l.push("/create")},[l,h]),$=(0,n.useCallback)(e=>{h.play();let t=w.find(t=>t.id===e),r=t?.data?.repositoryPath;r?l.push(`/create?repo=${encodeURIComponent(r)}`):l.push("/create")},[w,l,h]),z=(0,n.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=b.find(t=>t.target===e),n=r?w.find(e=>e.id===r.source):null,o=n?.data?.repositoryPath;h.play();let a=new URLSearchParams;o&&a.set("repo",o),a.set("parent",t),l.push(`/create?${a.toString()}`)},[w,b,l,h]),G=(0,n.useCallback)(e=>{let t=w.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&p(()=>l.push(`/repository/${e.id}`))}},[w,l,p]),B=(0,n.useCallback)(()=>{"/"!==c&&p(()=>l.push("/"))},[l,c,p]);(0,n.useEffect)(()=>{let e=e=>{let{wasEmpty:t,repoPath:r}=k(e.detail.path);t&&setTimeout(()=>{f(V),g.current=setTimeout(()=>{p(()=>l.push(`/create?repo=${encodeURIComponent(r)}`))},600)},0)};return window.addEventListener("shep:add-repository",e),()=>{window.removeEventListener("shep:add-repository",e),null!=g.current&&clearTimeout(g.current)}},[k,f,p,l]),(0,n.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void C(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=w.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);C(r?.id??null,{state:"running",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath})};return window.addEventListener("shep:feature-created",e),()=>window.removeEventListener("shep:feature-created",e)},[w,C]),(0,n.useEffect)(()=>{N({onNodeAction:z,onFeatureDelete:j,onRepositoryAdd:$,onRepositoryClick:G,onRepositoryDelete:_})},[N,z,j,$,G,_]);let U=(0,n.useCallback)((e,t)=>{m(t)},[m]);return w.some(e=>"repositoryNode"===e.type)?(0,t.jsx)(P,{nodes:w,edges:b,selectedFeatureId:u,defaultViewport:v,onNodesChange:x,onConnect:E,onAddFeature:A,onNodeClick:F,onPaneClick:B,onMoveEnd:U,onResetViewport:y,emptyState:(0,t.jsx)(q,{onRepositorySelect:k})}):(0,t.jsx)(q,{onRepositorySelect:k})}function H({initialNodes:e,initialEdges:n,drawer:o}){return(0,t.jsxs)("div",{"data-testid":"control-center",className:"h-full w-full",children:[(0,t.jsx)(r.ReactFlowProvider,{children:(0,t.jsx)(U,{initialNodes:e,initialEdges:n})}),(0,t.jsx)("div",{children:o},"drawer")]})}e.s(["ControlCenter",()=>H],48246)}]);
@@ -8,4 +8,4 @@ You can add a description to the \`${m}\` by passing a \`${D}\` component as a c
8
8
 
9
9
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${m}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
10
10
 
11
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return r.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null};e.s(["Action",()=>P,"AlertDialog",()=>f,"AlertDialogAction",()=>P,"AlertDialogCancel",()=>R,"AlertDialogContent",()=>x,"AlertDialogDescription",()=>j,"AlertDialogOverlay",()=>v,"AlertDialogPortal",()=>g,"AlertDialogTitle",()=>w,"AlertDialogTrigger",()=>p,"Cancel",()=>R,"Content",()=>x,"Description",()=>j,"Overlay",()=>v,"Portal",()=>g,"Root",()=>f,"Title",()=>w,"Trigger",()=>p,"createAlertDialogScope",()=>c],28883);var k=e.i(28883),k=k,A=e.i(31777),_=e.i(35364);function O({...e}){return(0,t.jsx)(k.Root,{"data-slot":"alert-dialog",...e})}function N({...e}){return(0,t.jsx)(k.Portal,{"data-slot":"alert-dialog-portal",...e})}function T({className:e,onClick:r,...n}){return(0,t.jsx)(k.Overlay,{"data-slot":"alert-dialog-overlay",className:(0,A.cn)("fixed inset-0 z-50 bg-black/50",e),onClick:e=>{e.stopPropagation(),r?.(e)},...n})}function I({className:e,size:r="default",...n}){return(0,t.jsxs)(N,{children:[(0,t.jsx)(T,{}),(0,t.jsx)(k.Content,{"data-slot":"alert-dialog-content","data-size":r,className:(0,A.cn)("bg-background group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg",e),...n})]})}function M({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,A.cn)("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...r})}function F({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,A.cn)("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...r})}function L({className:e,...r}){return(0,t.jsx)(k.Title,{"data-slot":"alert-dialog-title",className:(0,A.cn)("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...r})}function z({className:e,...r}){return(0,t.jsx)(k.Description,{"data-slot":"alert-dialog-description",className:(0,A.cn)("text-muted-foreground text-sm",e),...r})}function $({className:e,variant:r="default",size:n="default",...o}){return(0,t.jsx)(_.Button,{variant:r,size:n,asChild:!0,children:(0,t.jsx)(k.Action,{"data-slot":"alert-dialog-action",className:(0,A.cn)(e),...o})})}function U({className:e,variant:r="outline",size:n="default",...o}){return(0,t.jsx)(_.Button,{variant:r,size:n,asChild:!0,children:(0,t.jsx)(k.Cancel,{"data-slot":"alert-dialog-cancel",className:(0,A.cn)(e),...o})})}e.s(["AlertDialog",()=>O,"AlertDialogAction",()=>$,"AlertDialogCancel",()=>U,"AlertDialogContent",()=>I,"AlertDialogDescription",()=>z,"AlertDialogFooter",()=>F,"AlertDialogHeader",()=>M,"AlertDialogTitle",()=>L],71326);let B=(0,r.createContext)(null);function W({children:e}){let n=(0,r.useRef)(null),o=(0,r.useRef)(null),[a,i]=(0,r.useState)(!1),l=(0,r.useCallback)(e=>{n.current=e},[]),s=(0,r.useCallback)(e=>{if(n.current?.isDirty){o.current=e,i(!0);return}e()},[]),u=(0,r.useCallback)(()=>{i(!1),n.current?.onReset(),n.current=null,o.current?.(),o.current=null},[]),c=(0,r.useCallback)(()=>{i(!1),o.current=null},[]),d=(0,r.useCallback)(()=>n.current?.isDirty??!1,[]);return(0,t.jsxs)(B,{value:{setGuard:l,guardedNavigate:s,getIsDirty:d},children:[e,(0,t.jsx)(O,{open:a,children:(0,t.jsxs)(I,{children:[(0,t.jsxs)(M,{children:[(0,t.jsx)(L,{children:"Discard unsaved changes?"}),(0,t.jsx)(z,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),(0,t.jsxs)(F,{children:[(0,t.jsx)($,{variant:"destructive",onClick:u,children:"Discard"}),(0,t.jsx)(U,{onClick:c,children:"Keep editing"})]})]})})]})}function K(){let e=(0,r.useContext)(B);if(!e)throw Error("useDrawerCloseGuard must be used within DrawerCloseGuardProvider");return e}function G({open:e,isDirty:t,onClose:n,onReset:o}){let{setGuard:a,guardedNavigate:i}=K();return(0,r.useEffect)(()=>(e?a({isDirty:t,onReset:o}):a(null),()=>a(null)),[e,t,o,a]),{attemptClose:(0,r.useCallback)(()=>{i(()=>{o(),n()})},[i,n,o])}}e.s(["DrawerCloseGuardProvider",()=>W,"useDrawerCloseGuard",()=>K,"useGuardedDrawerClose",()=>G],30153)},3214,e=>{"use strict";let t=(0,e.i(3645).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>t],3214)},81975,e=>{"use strict";let t=(0,e.i(3645).default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);e.s(["Wrench",()=>t],81975)},80986,e=>{"use strict";let t=(0,e.i(3645).default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["default",()=>t])},30090,e=>{"use strict";let t=(0,e.i(3645).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["default",()=>t])},54277,e=>{"use strict";var t=e.i(30090);e.s(["CircleX",()=>t.default])},27069,e=>{"use strict";function t(e,[t,r]){return Math.min(r,Math.max(t,e))}e.s(["clamp",()=>t])},12103,e=>{"use strict";let t=(0,e.i(3645).default)("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);e.s(["Puzzle",()=>t],12103)},78521,e=>{"use strict";var t=e.i(21023);let r=(0,t.createServerReference)("00772b3578471c4553e429ce5328184282ca4ab4f1",t.callServer,void 0,t.findSourceMapURL,"pickFolder");async function n(){let e=await r();if(e.error)throw Error(e.error);return e.path}e.s(["pickFolder",()=>n],78521)},5147,e=>{"use strict";var t=e.i(20314),r=e.i(79054);let n={"action-required":"action-needed",running:"in-progress",done:"done",blocked:"blocked",error:"error",creating:null};function o(e){return n[e]}let a=(0,r.createContext)(null);function i({children:e}){let[n,o]=(0,r.useState)([]),i=(0,r.useMemo)(()=>({features:n,setFeatures:o}),[n]);return(0,t.jsx)(a.Provider,{value:i,children:e})}function l(){let e=(0,r.useContext)(a);if(!e)throw Error("useSidebarFeaturesContext must be used within a <SidebarFeaturesProvider>");return e}e.s(["SidebarFeaturesProvider",()=>i,"mapNodeStateToSidebarStatus",()=>o,"useSidebarFeaturesContext",()=>l])},76314,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={assign:function(){return s},searchParamsToUrlQuery:function(){return a},urlQueryToSearchParams:function(){return l}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});function a(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function i(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function l(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,i(e));else t.set(r,i(n));return t}function s(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,n]of r.entries())e.append(t,n)}return e}},95889,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return l},formatWithValidation:function(){return u},urlObjectKeys:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(44066)._(e.r(76314)),i=/https?|ftp|gopher|file/;function l(e){let{auth:t,hostname:r}=e,n=e.protocol||"",o=e.pathname||"",l=e.hash||"",s=e.query||"",u=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?u=t+e.host:r&&(u=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(u+=":"+e.port)),s&&"object"==typeof s&&(s=String(a.urlQueryToSearchParams(s)));let c=e.search||s&&`?${s}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||i.test(n))&&!1!==u?(u="//"+(u||""),o&&"/"!==o[0]&&(o="/"+o)):u||(u=""),l&&"#"!==l[0]&&(l="#"+l),c&&"?"!==c[0]&&(c="?"+c),o=o.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${u}${o}${c}${l}`}let s=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function u(e){return l(e)}},58464,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DecodeError:function(){return h},MiddlewareNotFoundError:function(){return C},MissingStaticPage:function(){return x},NormalizeError:function(){return y},PageNotFoundError:function(){return b},SP:function(){return v},ST:function(){return m},WEB_VITALS:function(){return a},execOnce:function(){return i},getDisplayName:function(){return d},getLocationOrigin:function(){return u},getURL:function(){return c},isAbsoluteUrl:function(){return s},isResSent:function(){return f},loadGetInitialProps:function(){return g},normalizeRepeatedSlashes:function(){return p},stringifyError:function(){return w}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=["CLS","FCP","FID","INP","LCP","TTFB"];function i(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let l=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,s=e=>l.test(e);function u(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=u();return e.substring(t.length)}function d(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function f(e){return e.finished||e.headersSent}function p(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function g(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await g(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&f(r))return n;if(!n)throw Object.defineProperty(Error(`"${d(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n}let v="u">typeof performance,m=v&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class h extends Error{}class y extends Error{}class b extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class x extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class C extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function w(e){return JSON.stringify({message:e.message,stack:e.stack})}},51380,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return a}});let n=e.r(58464),o=e.r(53626);function a(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},38670,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},24035,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return h},useLinkStatus:function(){return b}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(44066),i=e.r(20314),l=a._(e.r(79054)),s=e.r(95889),u=e.r(18152),c=e.r(80764),d=e.r(58464),f=e.r(99267);e.r(24270);let p=e.r(59624),g=e.r(51380),v=e.r(95555);function m(e){return"string"==typeof e?e:(0,s.formatUrl)(e)}function h(t){var r;let n,o,a,[s,h]=(0,l.useOptimistic)(p.IDLE_LINK_STATUS),b=(0,l.useRef)(null),{href:x,as:C,children:w,prefetch:D=null,passHref:j,replace:P,shallow:E,scroll:R,onClick:S,onMouseEnter:k,onTouchStart:A,legacyBehavior:_=!1,onNavigate:O,ref:N,unstable_dynamicOnHover:T,...I}=t;n=w,_&&("string"==typeof n||"number"==typeof n)&&(n=(0,i.jsx)("a",{children:n}));let M=l.default.useContext(u.AppRouterContext),F=!1!==D,L=!1!==D?null===(r=D)||"auto"===r?v.FetchStrategy.PPR:v.FetchStrategy.Full:v.FetchStrategy.PPR,{href:z,as:$}=l.default.useMemo(()=>{let e=m(x);return{href:e,as:C?m(C):e}},[x,C]);if(_){if(n?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});o=l.default.Children.only(n)}let U=_?o&&"object"==typeof o&&o.ref:N,B=l.default.useCallback(e=>(null!==M&&(b.current=(0,p.mountLinkInstance)(e,z,M,L,F,h)),()=>{b.current&&((0,p.unmountLinkForCurrentNavigation)(b.current),b.current=null),(0,p.unmountPrefetchableInstance)(e)}),[F,z,M,L,h]),W={ref:(0,c.useMergedRef)(B,U),onClick(t){_||"function"!=typeof S||S(t),_&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(t),!M||t.defaultPrevented||function(t,r,n,o,a,i,s){if("u">typeof window){let u,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,g.isLocalURL)(r)){a&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),s){let e=!1;if(s({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(81574);l.default.startTransition(()=>{d(n||r,a?"replace":"push",i??!0,o.current)})}}(t,z,$,b,P,R,O)},onMouseEnter(e){_||"function"!=typeof k||k(e),_&&o.props&&"function"==typeof o.props.onMouseEnter&&o.props.onMouseEnter(e),M&&F&&(0,p.onNavigationIntent)(e.currentTarget,!0===T)},onTouchStart:function(e){_||"function"!=typeof A||A(e),_&&o.props&&"function"==typeof o.props.onTouchStart&&o.props.onTouchStart(e),M&&F&&(0,p.onNavigationIntent)(e.currentTarget,!0===T)}};return(0,d.isAbsoluteUrl)($)?W.href=$:_&&!j&&("a"!==o.type||"href"in o.props)||(W.href=(0,f.addBasePath)($)),a=_?l.default.cloneElement(o,W):(0,i.jsx)("a",{...I,...W,children:n}),(0,i.jsx)(y.Provider,{value:s,children:a})}e.r(38670);let y=(0,l.createContext)(p.IDLE_LINK_STATUS),b=()=>(0,l.useContext)(y);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)}]);
11
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return r.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null};e.s(["Action",()=>P,"AlertDialog",()=>f,"AlertDialogAction",()=>P,"AlertDialogCancel",()=>R,"AlertDialogContent",()=>x,"AlertDialogDescription",()=>j,"AlertDialogOverlay",()=>v,"AlertDialogPortal",()=>g,"AlertDialogTitle",()=>w,"AlertDialogTrigger",()=>p,"Cancel",()=>R,"Content",()=>x,"Description",()=>j,"Overlay",()=>v,"Portal",()=>g,"Root",()=>f,"Title",()=>w,"Trigger",()=>p,"createAlertDialogScope",()=>c],28883);var k=e.i(28883),k=k,A=e.i(31777),_=e.i(35364);function O({...e}){return(0,t.jsx)(k.Root,{"data-slot":"alert-dialog",...e})}function N({...e}){return(0,t.jsx)(k.Portal,{"data-slot":"alert-dialog-portal",...e})}function T({className:e,onClick:r,...n}){return(0,t.jsx)(k.Overlay,{"data-slot":"alert-dialog-overlay",className:(0,A.cn)("fixed inset-0 z-50 bg-black/50",e),onClick:e=>{e.stopPropagation(),r?.(e)},...n})}function I({className:e,size:r="default",...n}){return(0,t.jsxs)(N,{children:[(0,t.jsx)(T,{}),(0,t.jsx)(k.Content,{"data-slot":"alert-dialog-content","data-size":r,className:(0,A.cn)("bg-background group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg",e),...n})]})}function M({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,A.cn)("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...r})}function F({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,A.cn)("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...r})}function L({className:e,...r}){return(0,t.jsx)(k.Title,{"data-slot":"alert-dialog-title",className:(0,A.cn)("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...r})}function z({className:e,...r}){return(0,t.jsx)(k.Description,{"data-slot":"alert-dialog-description",className:(0,A.cn)("text-muted-foreground text-sm",e),...r})}function $({className:e,variant:r="default",size:n="default",...o}){return(0,t.jsx)(_.Button,{variant:r,size:n,asChild:!0,children:(0,t.jsx)(k.Action,{"data-slot":"alert-dialog-action",className:(0,A.cn)(e),...o})})}function U({className:e,variant:r="outline",size:n="default",...o}){return(0,t.jsx)(_.Button,{variant:r,size:n,asChild:!0,children:(0,t.jsx)(k.Cancel,{"data-slot":"alert-dialog-cancel",className:(0,A.cn)(e),...o})})}e.s(["AlertDialog",()=>O,"AlertDialogAction",()=>$,"AlertDialogCancel",()=>U,"AlertDialogContent",()=>I,"AlertDialogDescription",()=>z,"AlertDialogFooter",()=>F,"AlertDialogHeader",()=>M,"AlertDialogTitle",()=>L],71326);let B=(0,r.createContext)(null);function W({children:e}){let n=(0,r.useRef)(null),o=(0,r.useRef)(null),[a,i]=(0,r.useState)(!1),l=(0,r.useCallback)(e=>{n.current=e},[]),s=(0,r.useCallback)(e=>{if(n.current?.isDirty){o.current=e,i(!0);return}e()},[]),u=(0,r.useCallback)(()=>{i(!1),n.current?.onReset(),n.current=null,o.current?.(),o.current=null},[]),c=(0,r.useCallback)(()=>{i(!1),o.current=null},[]),d=(0,r.useCallback)(()=>n.current?.isDirty??!1,[]);return(0,t.jsxs)(B,{value:{setGuard:l,guardedNavigate:s,getIsDirty:d},children:[e,(0,t.jsx)(O,{open:a,children:(0,t.jsxs)(I,{children:[(0,t.jsxs)(M,{children:[(0,t.jsx)(L,{children:"Discard unsaved changes?"}),(0,t.jsx)(z,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),(0,t.jsxs)(F,{children:[(0,t.jsx)($,{variant:"destructive",onClick:u,children:"Discard"}),(0,t.jsx)(U,{onClick:c,children:"Keep editing"})]})]})})]})}function K(){let e=(0,r.useContext)(B);if(!e)throw Error("useDrawerCloseGuard must be used within DrawerCloseGuardProvider");return e}function G({open:e,isDirty:t,onClose:n,onReset:o}){let{setGuard:a,guardedNavigate:i}=K();return(0,r.useEffect)(()=>(e?a({isDirty:t,onReset:o}):a(null),()=>a(null)),[e,t,o,a]),{attemptClose:(0,r.useCallback)(()=>{i(()=>{o(),n()})},[i,n,o])}}e.s(["DrawerCloseGuardProvider",()=>W,"useDrawerCloseGuard",()=>K,"useGuardedDrawerClose",()=>G],30153)},3214,e=>{"use strict";let t=(0,e.i(3645).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>t],3214)},81975,e=>{"use strict";let t=(0,e.i(3645).default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);e.s(["Wrench",()=>t],81975)},80986,e=>{"use strict";let t=(0,e.i(3645).default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["default",()=>t])},30090,e=>{"use strict";let t=(0,e.i(3645).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["default",()=>t])},54277,e=>{"use strict";var t=e.i(30090);e.s(["CircleX",()=>t.default])},27069,e=>{"use strict";function t(e,[t,r]){return Math.min(r,Math.max(t,e))}e.s(["clamp",()=>t])},12103,e=>{"use strict";let t=(0,e.i(3645).default)("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);e.s(["Puzzle",()=>t],12103)},78521,e=>{"use strict";var t=e.i(21023);let r=(0,t.createServerReference)("00bde5461b1a54221719fd6dfcdd08be879e5ea9c5",t.callServer,void 0,t.findSourceMapURL,"pickFolder");async function n(){let e=await r();if(e.error)throw Error(e.error);return e.path}e.s(["pickFolder",()=>n],78521)},5147,e=>{"use strict";var t=e.i(20314),r=e.i(79054);let n={"action-required":"action-needed",running:"in-progress",done:"done",blocked:"blocked",error:"error",creating:null};function o(e){return n[e]}let a=(0,r.createContext)(null);function i({children:e}){let[n,o]=(0,r.useState)([]),i=(0,r.useMemo)(()=>({features:n,setFeatures:o}),[n]);return(0,t.jsx)(a.Provider,{value:i,children:e})}function l(){let e=(0,r.useContext)(a);if(!e)throw Error("useSidebarFeaturesContext must be used within a <SidebarFeaturesProvider>");return e}e.s(["SidebarFeaturesProvider",()=>i,"mapNodeStateToSidebarStatus",()=>o,"useSidebarFeaturesContext",()=>l])},76314,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={assign:function(){return s},searchParamsToUrlQuery:function(){return a},urlQueryToSearchParams:function(){return l}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});function a(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function i(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function l(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,i(e));else t.set(r,i(n));return t}function s(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,n]of r.entries())e.append(t,n)}return e}},95889,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return l},formatWithValidation:function(){return u},urlObjectKeys:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(44066)._(e.r(76314)),i=/https?|ftp|gopher|file/;function l(e){let{auth:t,hostname:r}=e,n=e.protocol||"",o=e.pathname||"",l=e.hash||"",s=e.query||"",u=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?u=t+e.host:r&&(u=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(u+=":"+e.port)),s&&"object"==typeof s&&(s=String(a.urlQueryToSearchParams(s)));let c=e.search||s&&`?${s}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||i.test(n))&&!1!==u?(u="//"+(u||""),o&&"/"!==o[0]&&(o="/"+o)):u||(u=""),l&&"#"!==l[0]&&(l="#"+l),c&&"?"!==c[0]&&(c="?"+c),o=o.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${u}${o}${c}${l}`}let s=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function u(e){return l(e)}},58464,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DecodeError:function(){return h},MiddlewareNotFoundError:function(){return C},MissingStaticPage:function(){return x},NormalizeError:function(){return y},PageNotFoundError:function(){return b},SP:function(){return v},ST:function(){return m},WEB_VITALS:function(){return a},execOnce:function(){return i},getDisplayName:function(){return d},getLocationOrigin:function(){return u},getURL:function(){return c},isAbsoluteUrl:function(){return s},isResSent:function(){return f},loadGetInitialProps:function(){return g},normalizeRepeatedSlashes:function(){return p},stringifyError:function(){return w}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=["CLS","FCP","FID","INP","LCP","TTFB"];function i(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let l=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,s=e=>l.test(e);function u(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=u();return e.substring(t.length)}function d(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function f(e){return e.finished||e.headersSent}function p(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function g(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await g(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&f(r))return n;if(!n)throw Object.defineProperty(Error(`"${d(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n}let v="u">typeof performance,m=v&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class h extends Error{}class y extends Error{}class b extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class x extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class C extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function w(e){return JSON.stringify({message:e.message,stack:e.stack})}},51380,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return a}});let n=e.r(58464),o=e.r(53626);function a(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},38670,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},24035,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return h},useLinkStatus:function(){return b}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(44066),i=e.r(20314),l=a._(e.r(79054)),s=e.r(95889),u=e.r(18152),c=e.r(80764),d=e.r(58464),f=e.r(99267);e.r(24270);let p=e.r(59624),g=e.r(51380),v=e.r(95555);function m(e){return"string"==typeof e?e:(0,s.formatUrl)(e)}function h(t){var r;let n,o,a,[s,h]=(0,l.useOptimistic)(p.IDLE_LINK_STATUS),b=(0,l.useRef)(null),{href:x,as:C,children:w,prefetch:D=null,passHref:j,replace:P,shallow:E,scroll:R,onClick:S,onMouseEnter:k,onTouchStart:A,legacyBehavior:_=!1,onNavigate:O,ref:N,unstable_dynamicOnHover:T,...I}=t;n=w,_&&("string"==typeof n||"number"==typeof n)&&(n=(0,i.jsx)("a",{children:n}));let M=l.default.useContext(u.AppRouterContext),F=!1!==D,L=!1!==D?null===(r=D)||"auto"===r?v.FetchStrategy.PPR:v.FetchStrategy.Full:v.FetchStrategy.PPR,{href:z,as:$}=l.default.useMemo(()=>{let e=m(x);return{href:e,as:C?m(C):e}},[x,C]);if(_){if(n?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});o=l.default.Children.only(n)}let U=_?o&&"object"==typeof o&&o.ref:N,B=l.default.useCallback(e=>(null!==M&&(b.current=(0,p.mountLinkInstance)(e,z,M,L,F,h)),()=>{b.current&&((0,p.unmountLinkForCurrentNavigation)(b.current),b.current=null),(0,p.unmountPrefetchableInstance)(e)}),[F,z,M,L,h]),W={ref:(0,c.useMergedRef)(B,U),onClick(t){_||"function"!=typeof S||S(t),_&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(t),!M||t.defaultPrevented||function(t,r,n,o,a,i,s){if("u">typeof window){let u,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,g.isLocalURL)(r)){a&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),s){let e=!1;if(s({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(81574);l.default.startTransition(()=>{d(n||r,a?"replace":"push",i??!0,o.current)})}}(t,z,$,b,P,R,O)},onMouseEnter(e){_||"function"!=typeof k||k(e),_&&o.props&&"function"==typeof o.props.onMouseEnter&&o.props.onMouseEnter(e),M&&F&&(0,p.onNavigationIntent)(e.currentTarget,!0===T)},onTouchStart:function(e){_||"function"!=typeof A||A(e),_&&o.props&&"function"==typeof o.props.onTouchStart&&o.props.onTouchStart(e),M&&F&&(0,p.onNavigationIntent)(e.currentTarget,!0===T)}};return(0,d.isAbsoluteUrl)($)?W.href=$:_&&!j&&("a"!==o.type||"href"in o.props)||(W.href=(0,f.addBasePath)($)),a=_?l.default.cloneElement(o,W):(0,i.jsx)("a",{...I,...W,children:n}),(0,i.jsx)(y.Provider,{value:s,children:a})}e.r(38670);let y=(0,l.createContext)(p.IDLE_LINK_STATUS),b=()=>(0,l.useContext)(y);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)}]);