@runeya/runeya 2.0.140 → 2.0.142

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 (123) hide show
  1. package/agent/index.js.map +1 -1
  2. package/agent-manager-M4NA5YFD.js +11 -0
  3. package/{chat-L7RRHXX5.js → chat-X3X527EX.js} +9 -7
  4. package/{chunk-GOMF7NWS.js → chunk-7L6AQUBR.js} +2 -2
  5. package/{chunk-O2KOX4LU.js → chunk-C2BGNVBT.js} +35 -9
  6. package/chunk-C2BGNVBT.js.map +1 -0
  7. package/{chunk-SYCUQDA4.js → chunk-GXE5TLLJ.js} +10 -4
  8. package/chunk-GXE5TLLJ.js.map +1 -0
  9. package/{chunk-EV3TBM7E.js → chunk-IXO5KIO5.js} +9 -2
  10. package/{chunk-EV3TBM7E.js.map → chunk-IXO5KIO5.js.map} +1 -1
  11. package/{chunk-QWX6R6AW.js → chunk-NSS47H26.js} +71 -16
  12. package/chunk-NSS47H26.js.map +1 -0
  13. package/{chunk-G4TOLDZB.js → chunk-P73PTVII.js} +95 -63
  14. package/chunk-P73PTVII.js.map +1 -0
  15. package/{chunk-6HSZPK2W.js → chunk-UR3HL373.js} +3 -3
  16. package/{companion-LQVLEHU7.js → companion-2LHKU577.js} +5 -5
  17. package/{desktop-installer-page-OKE4WY5Q.js → desktop-installer-page-6JDSXK2E.js} +226 -33
  18. package/desktop-installer-page-6JDSXK2E.js.map +1 -0
  19. package/{free-port-565NMFIZ.js → free-port-5UNHDWGE.js} +2 -2
  20. package/index.js +70 -22
  21. package/index.js.map +1 -1
  22. package/install-gate-2NNH7RM2.js +60 -0
  23. package/install-gate-2NNH7RM2.js.map +1 -0
  24. package/mcp-server/index.js +84 -10
  25. package/mcp-server/index.js.map +1 -1
  26. package/mcp-server/launch.d.ts +5 -4
  27. package/mcp-server/launch.js.map +1 -1
  28. package/package.json +1 -1
  29. package/settings-manager-32SVMAFN.js +10 -0
  30. package/{src-NVQHFMTQ.js → src-5TEXF3SU.js} +938 -809
  31. package/src-5TEXF3SU.js.map +1 -0
  32. package/{vault-resolver-B5P2OUI5.js → vault-resolver-VK6W5J6W.js} +2 -2
  33. package/web/assets/{AgentScalarChatInterface.vue-Dgobg9wk.js → AgentScalarChatInterface.vue-uNy1P-l4.js} +1 -1
  34. package/web/assets/{AgentTerminalPage-B43nSPSz.js → AgentTerminalPage-CFnALyb1.js} +1 -1
  35. package/web/assets/{AiChatModals-CVZ5ilmt.js → AiChatModals-B6svb69W.js} +1 -1
  36. package/web/assets/{AppLayout-B5yKLUj9.js → AppLayout-BKlJtfuQ.js} +1 -1
  37. package/web/assets/{AuditPage-KR5ydSRG.js → AuditPage-BsSpX2TJ.js} +1 -1
  38. package/web/assets/{CloudAccountPage-RNosmi99.js → CloudAccountPage-DabrwDsa.js} +1 -1
  39. package/web/assets/{CloudMessagingPage-Dp-FDdoH.js → CloudMessagingPage-BtOJO5FB.js} +1 -1
  40. package/web/assets/{DashboardPage-Bjj11oP_.js → DashboardPage-DMByzpgW.js} +1 -1
  41. package/web/assets/{DirectoryPickerDialog-C28UH35_.js → DirectoryPickerDialog-CDyk4Z_Q.js} +1 -1
  42. package/web/assets/{EnvironmentForm-Dj2T2DuS.js → EnvironmentForm-BlGWpU2_.js} +1 -1
  43. package/web/assets/{EnvironmentFormPage-B4Bt1bXS.js → EnvironmentFormPage-B-dpyO0_.js} +1 -1
  44. package/web/assets/{EnvironmentListPage-B_V9mEhR.js → EnvironmentListPage-BlaOiTVh.js} +1 -1
  45. package/web/assets/{KanbanBoardPage-CQLiin5v.js → KanbanBoardPage-C52zM-Zw.js} +3 -3
  46. package/web/assets/{KanbanListPage-ChD0Zj0Y.js → KanbanListPage-BmNdd1aP.js} +1 -1
  47. package/web/assets/{LaunchProjectPage-ByIfq7ka.js → LaunchProjectPage-B5sXxaet.js} +1 -1
  48. package/web/assets/{LaunchServicesPage-BweD0CWu.js → LaunchServicesPage-C1u6lV4l.js} +1 -1
  49. package/web/assets/{LaunchShell-C9jV0DDh.js → LaunchShell-CeyVMzL2.js} +1 -1
  50. package/web/assets/{LogViewer-Cv024Meq.js → LogViewer-CAvRwSZu.js} +2 -2
  51. package/web/assets/{OrgKeyPrompt-D95Zm3Tl.js → OrgKeyPrompt-NDfCQ-In.js} +1 -1
  52. package/web/assets/{ProcessControls-84xtt8ud.js → ProcessControls-D23gTUiv.js} +1 -1
  53. package/web/assets/{ProcessDetailPage-CqMk8XQv.js → ProcessDetailPage-vHpK0Eer.js} +1 -1
  54. package/web/assets/{ProjectCreateDialog-C4rLTHw0.js → ProjectCreateDialog-2PZX7tq2.js} +1 -1
  55. package/web/assets/{ProjectLocationGate-BtI0T-GU.js → ProjectLocationGate-fMAxwT0y.js} +1 -1
  56. package/web/assets/{ProjectPublishDialog-v5xz8t4N.js → ProjectPublishDialog-BylWoa0n.js} +1 -1
  57. package/web/assets/{RandomJobTestPage-CzT3LSMu.js → RandomJobTestPage-DUclmkBw.js} +1 -1
  58. package/web/assets/ScenarioEditorPage-DbEsfuZa.js +14 -0
  59. package/web/assets/{SendToChatDialog-BtsCq9hv.js → SendToChatDialog-DGuOMMrS.js} +1 -1
  60. package/web/assets/{ServiceControlsBar-BFemdioZ.js → ServiceControlsBar-D6M8hYFk.js} +1 -1
  61. package/web/assets/{ServiceDetailPage-DsGHPdUc.js → ServiceDetailPage-G-A9ryZD.js} +1 -1
  62. package/web/assets/{ServiceFormPage-x3jtyV1A.js → ServiceFormPage-BgHSW1XX.js} +1 -1
  63. package/web/assets/{SettingsPage-3tVWDaUN.js → SettingsPage-CPFBr7QE.js} +6 -6
  64. package/web/assets/{UnlockPage-CPcll-ov.js → UnlockPage-B4VEN9LN.js} +1 -1
  65. package/web/assets/{VaultMigrationPage-BMS4BcsA.js → VaultMigrationPage-9qDGbF9X.js} +1 -1
  66. package/web/assets/VersionBadge-CqHdCnuJ.js +1 -0
  67. package/web/assets/VersionBadge-CtFji3sv.css +1 -0
  68. package/web/assets/{WikiPage-CM1-hJvF.js → WikiPage-Pjosr1Vn.js} +1 -1
  69. package/web/assets/{WikiView-MQLuO7ey.js → WikiView-Bcxq2mQW.js} +1 -1
  70. package/web/assets/{add-scalar-classes-BDJ0Zhvc.js → add-scalar-classes-BnJYThbS.js} +2 -2
  71. package/web/assets/{agent.store-CEmOZ8XE.js → agent.store-DTyu_McS.js} +1 -1
  72. package/web/assets/auth-D_pCPFq7.js +2 -0
  73. package/web/assets/{cloud-chat.store-DhCEhagv.js → cloud-chat.store-CMklOB48.js} +1 -1
  74. package/web/assets/{cloud-client-CmrptmtM.js → cloud-client-CX0pW7Kt.js} +2 -2
  75. package/web/assets/cloud-session-ja0-uvVS.js +2 -0
  76. package/web/assets/{editor.store-Be5P5Eur.js → editor.store-BAjGG8Ji.js} +1 -1
  77. package/web/assets/i18n-CXvcscXP.js +1 -0
  78. package/web/assets/{index-CXnyET_X.js → index-DTrxphh3.js} +101 -101
  79. package/web/assets/index-eb4FRryj.css +1 -0
  80. package/web/assets/{modal-9BC14oRF.js → modal-Cvv2YgUo.js} +1 -1
  81. package/web/assets/{project-launch.store-cO8Wr508.js → project-launch.store-C7xfTlMc.js} +1 -1
  82. package/web/assets/{project.store-CpUEwUgF.js → project.store-ZpH_PaSy.js} +1 -1
  83. package/web/assets/scenario.store-F78cizck.js +7 -0
  84. package/web/assets/{service.store-ve_P4_2O.js → service.store-Dti7eDhR.js} +1 -1
  85. package/web/assets/{settings-scope-CcYu-GYo.js → settings-scope-CUuHrUpc.js} +1 -1
  86. package/web/assets/{settings.store-CdCOUAsL.js → settings.store-De1-3IG8.js} +1 -1
  87. package/web/assets/{src-T5uKA02c.js → src-C0KK-qsF.js} +1 -1
  88. package/web/assets/{src-RO7PD0gR.js → src-DXlxwMXe.js} +1 -1
  89. package/web/assets/{theme-CPaZfI9r.js → theme-BZCAxfJD.js} +1 -1
  90. package/web/assets/trpc-B5Yw_z6v.js +3 -0
  91. package/web/assets/{useCloudOrg-DaFUgt9j.js → useCloudOrg-QzX8ryg1.js} +1 -1
  92. package/web/assets/{useEnvVarAutocomplete-CXlyG01r.js → useEnvVarAutocomplete-BdGgINv9.js} +1 -1
  93. package/web/assets/{useProjectCatalog-1vLcCQlh.js → useProjectCatalog-Cr90BND4.js} +1 -1
  94. package/web/assets/{useProjectCloudOrg-MAfohLuM.js → useProjectCloudOrg-2wwByg2k.js} +1 -1
  95. package/web/assets/{useServiceUrlHost-D9k9s21s.js → useServiceUrlHost-CxbARDeg.js} +1 -1
  96. package/web/assets/{vue-draggable-plus-SmOauPHy.js → vue-draggable-plus-pTwVkhnN.js} +1 -1
  97. package/web/favicon.svg +1 -5
  98. package/web/index.html +18 -18
  99. package/agent-manager-RZI65MSV.js +0 -11
  100. package/chunk-G4TOLDZB.js.map +0 -1
  101. package/chunk-O2KOX4LU.js.map +0 -1
  102. package/chunk-QWX6R6AW.js.map +0 -1
  103. package/chunk-SYCUQDA4.js.map +0 -1
  104. package/desktop-installer-page-OKE4WY5Q.js.map +0 -1
  105. package/settings-manager-5JHSSKQ2.js +0 -10
  106. package/src-NVQHFMTQ.js.map +0 -1
  107. package/web/assets/ScenarioEditorPage-DrWcVOHg.js +0 -14
  108. package/web/assets/VersionBadge-54viPqlY.css +0 -1
  109. package/web/assets/VersionBadge-prnLNUGg.js +0 -1
  110. package/web/assets/auth-BpxI0N26.js +0 -2
  111. package/web/assets/cloud-session-ByODsQrA.js +0 -2
  112. package/web/assets/i18n-m0G6Pfwe.js +0 -1
  113. package/web/assets/index-Dsh11_J0.css +0 -1
  114. package/web/assets/scenario.store-B5uv1DSO.js +0 -7
  115. package/web/assets/trpc-BFA-mSM8.js +0 -3
  116. /package/{agent-manager-RZI65MSV.js.map → agent-manager-M4NA5YFD.js.map} +0 -0
  117. /package/{chat-L7RRHXX5.js.map → chat-X3X527EX.js.map} +0 -0
  118. /package/{chunk-GOMF7NWS.js.map → chunk-7L6AQUBR.js.map} +0 -0
  119. /package/{chunk-6HSZPK2W.js.map → chunk-UR3HL373.js.map} +0 -0
  120. /package/{companion-LQVLEHU7.js.map → companion-2LHKU577.js.map} +0 -0
  121. /package/{free-port-565NMFIZ.js.map → free-port-5UNHDWGE.js.map} +0 -0
  122. /package/{settings-manager-5JHSSKQ2.js.map → settings-manager-32SVMAFN.js.map} +0 -0
  123. /package/{vault-resolver-B5P2OUI5.js.map → vault-resolver-VK6W5J6W.js.map} +0 -0
@@ -1,14 +0,0 @@
1
- import{B as e,C as t,N as n}from"./reactivity.esm-bundler-BQ9SB2vv.js";import{Ct as r,D as i,E as a,Ht as o,J as s,Lt as c,Nt as l,Ut as u,Yt as d,_ as f,b as p,bt as m,ct as h,en as g,et as _,ft as v,g as y,gt as b,k as x,mt as S,nn as ee,o as C,qt as w,rn as T,tn as te,tt as E,v as D,wt as O,xt as k,y as A,z as ne}from"./runtime-core.esm-bundler-DujKY9QV.js";import{F as re,I as ie,p as ae}from"./floating-ui.dom-DWhsZyqT.js";import{C as oe,J as se,O as ce,P as le,S as j,Y as M,a as N,c as ue,dt as P,ft as de,mt as fe,q as pe}from"./src-Ds4DOFJs.js";import{a as me}from"./project-launch.store-cO8Wr508.js";import{g as he,h as ge}from"./useApi-s_02lHjl-DZYO2tHU.js";import{i as _e,n as ve,o as ye,t as be}from"./scenario.store-B5uv1DSO.js";import{r as xe}from"./trpc-BFA-mSM8.js";import{a as Se,g as Ce,p as we}from"./schemas-68I2iCLF.js";import{a as Te,i as Ee}from"./dist-DoChtT9t.js";import{C as De,D as Oe,E as ke,O as Ae,S as je,T as Me,b as Ne,v as Pe,w as Fe,x as F,y as Ie}from"./index-CXnyET_X.js";import{t as Le}from"./uuid-XipkJWQw.js";var Re={name:`ControlButton`,compatConfig:{MODE:3}},ze=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},I={type:`button`,class:`vue-flow__controls-button`};function L(e,t,n,r,i,a){return S(),p(`button`,I,[k(e.$slots,`default`)])}var Be=ze(Re,[[`render`,L]]),Ve={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`},He=[f(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`},null,-1)];function Ue(e,t){return S(),p(`svg`,Ve,He)}var R={render:Ue},We={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`},Ge=[f(`path`,{d:`M0 0h32v4.2H0z`},null,-1)];function Ke(e,t){return S(),p(`svg`,We,Ge)}var qe={render:Ke},Je={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`},Ye=[f(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`},null,-1)];function Xe(e,t){return S(),p(`svg`,Je,Ye)}var Ze={render:Xe},Qe={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`},$e=[f(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`},null,-1)];function et(e,t){return S(),p(`svg`,Qe,$e)}var tt={render:et},z={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`},B=[f(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z`},null,-1)];function V(e,t){return S(),p(`svg`,z,B)}var H={render:V},nt=x({name:`Controls`,compatConfig:{MODE:3},props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Ne.BottomLeft}},emits:[`zoomIn`,`zoomOut`,`fitView`,`interactionChange`],setup(t,{emit:r}){let{nodesDraggable:a,nodesConnectable:o,elementsSelectable:s,setInteractive:c,zoomIn:l,zoomOut:u,fitView:d,viewport:f,minZoom:m,maxZoom:h}=Oe(),g=n(()=>a.value||o.value||s.value),_=n(()=>f.value.zoom<=m.value),v=n(()=>f.value.zoom>=h.value);function y(){l(),r(`zoomIn`)}function b(){u(),r(`zoomOut`)}function x(){d(t.fitViewParams),r(`fitView`)}function ee(){c(!g.value),r(`interactionChange`,!g.value)}return(t,n)=>(S(),D(e(F),{class:`vue-flow__controls`,position:t.position},{default:w(()=>[k(t.$slots,`top`),t.showZoom?(S(),p(C,{key:0},[k(t.$slots,`control-zoom-in`,{},()=>[i(Be,{class:`vue-flow__controls-zoomin`,disabled:v.value,onClick:y},{default:w(()=>[k(t.$slots,`icon-zoom-in`,{},()=>[(S(),D(O(e(R))))])]),_:3},8,[`disabled`])]),k(t.$slots,`control-zoom-out`,{},()=>[i(Be,{class:`vue-flow__controls-zoomout`,disabled:_.value,onClick:b},{default:w(()=>[k(t.$slots,`icon-zoom-out`,{},()=>[(S(),D(O(e(qe))))])]),_:3},8,[`disabled`])])],64)):A(``,!0),t.showFitView?k(t.$slots,`control-fit-view`,{key:1},()=>[i(Be,{class:`vue-flow__controls-fitview`,onClick:x},{default:w(()=>[k(t.$slots,`icon-fit-view`,{},()=>[(S(),D(O(e(Ze))))])]),_:3})]):A(``,!0),t.showInteractive?k(t.$slots,`control-interactive`,{key:2},()=>[t.showInteractive?(S(),D(Be,{key:0,class:`vue-flow__controls-interactive`,onClick:ee},{default:w(()=>[g.value?k(t.$slots,`icon-unlock`,{key:0},()=>[(S(),D(O(e(H))))]):A(``,!0),g.value?A(``,!0):k(t.$slots,`icon-lock`,{key:1},()=>[(S(),D(O(e(tt))))])]),_:3})):A(``,!0)]):A(``,!0),k(t.$slots,`default`)]),_:3},8,[`position`]))}}),rt={value:()=>{}};function U(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new it(n)}function it(e){this._=e}function at(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}it.prototype=U.prototype={constructor:it,on:function(e,t){var n=this._,r=at(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=ot(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=st(n[i],e.name,t);else if(t==null)for(i in n)n[i]=st(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new it(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function ot(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function st(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=rt,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var ct=`http://www.w3.org/1999/xhtml`,lt={svg:`http://www.w3.org/2000/svg`,xhtml:ct,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function ut(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),lt.hasOwnProperty(t)?{space:lt[t],local:e}:e}function dt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ct&&t.documentElement.namespaceURI===ct?t.createElement(e):t.createElementNS(n,e)}}function ft(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pt(e){var t=ut(e);return(t.local?ft:dt)(t)}function mt(){}function ht(e){return e==null?mt:function(){return this.querySelector(e)}}function gt(e){typeof e!=`function`&&(e=ht(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new q(r,this._parents)}function _t(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function vt(){return[]}function yt(e){return e==null?vt:function(){return this.querySelectorAll(e)}}function bt(e){return function(){return _t(e.apply(this,arguments))}}function xt(e){e=typeof e==`function`?bt(e):yt(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new q(r,i)}function St(e){return function(){return this.matches(e)}}function Ct(e){return function(t){return t.matches(e)}}var wt=Array.prototype.find;function Tt(e){return function(){return wt.call(this.children,e)}}function W(){return this.firstElementChild}function Et(e){return this.select(e==null?W:Tt(typeof e==`function`?e:Ct(e)))}var Dt=Array.prototype.filter;function G(){return Array.from(this.children)}function Ot(e){return function(){return Dt.call(this.children,e)}}function kt(e){return this.selectAll(e==null?G:Ot(typeof e==`function`?e:Ct(e)))}function At(e){typeof e!=`function`&&(e=St(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new q(r,this._parents)}function jt(e){return Array(e.length)}function Mt(){return new q(this._enter||this._groups.map(jt),this._parents)}function Nt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Nt.prototype={constructor:Nt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Pt(e){return function(){return e}}function Ft(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Nt(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function It(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Nt(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Lt(e){return e.__data__}function Rt(e,t){if(!arguments.length)return Array.from(this,Lt);var n=t?It:Ft,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Pt(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=zt(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new q(o,r),o._enter=s,o._exit=c,o}function zt(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Bt(){return new q(this._exit||this._groups.map(jt),this._parents)}function Vt(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Ht(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new q(s,this._parents)}function K(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Ut(e){e||=Wt;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new q(i,this._parents).order()}function Wt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Gt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Kt(){return Array.from(this)}function qt(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Jt(){let e=0;for(let t of this)++e;return e}function Yt(){return!this.node()}function Xt(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Zt(e){return function(){this.removeAttribute(e)}}function Qt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $t(e,t){return function(){this.setAttribute(e,t)}}function en(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function tn(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function nn(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function rn(e,t){var n=ut(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Qt:Zt:typeof t==`function`?n.local?nn:tn:n.local?en:$t)(n,t))}function an(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function on(e){return function(){this.style.removeProperty(e)}}function sn(e,t,n){return function(){this.style.setProperty(e,t,n)}}function cn(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function ln(e,t,n){return arguments.length>1?this.each((t==null?on:typeof t==`function`?cn:sn)(e,t,n??``)):un(this.node(),e)}function un(e,t){return e.style.getPropertyValue(t)||an(e).getComputedStyle(e,null).getPropertyValue(t)}function dn(e){return function(){delete this[e]}}function fn(e,t){return function(){this[e]=t}}function pn(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mn(e,t){return arguments.length>1?this.each((t==null?dn:typeof t==`function`?pn:fn)(e,t)):this.node()[e]}function hn(e){return e.trim().split(/^|\s+/)}function gn(e){return e.classList||new _n(e)}function _n(e){this._node=e,this._names=hn(e.getAttribute(`class`)||``)}_n.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function vn(e,t){for(var n=gn(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function yn(e,t){for(var n=gn(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function bn(e){return function(){vn(this,e)}}function xn(e){return function(){yn(this,e)}}function Sn(e,t){return function(){(t.apply(this,arguments)?vn:yn)(this,e)}}function Cn(e,t){var n=hn(e+``);if(arguments.length<2){for(var r=gn(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Sn:t?bn:xn)(n,t))}function wn(){this.textContent=``}function Tn(e){return function(){this.textContent=e}}function En(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Dn(e){return arguments.length?this.each(e==null?wn:(typeof e==`function`?En:Tn)(e)):this.node().textContent}function On(){this.innerHTML=``}function kn(e){return function(){this.innerHTML=e}}function An(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function jn(e){return arguments.length?this.each(e==null?On:(typeof e==`function`?An:kn)(e)):this.node().innerHTML}function Mn(){this.nextSibling&&this.parentNode.appendChild(this)}function Nn(){return this.each(Mn)}function Pn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fn(){return this.each(Pn)}function In(e){var t=typeof e==`function`?e:pt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ln(){return null}function Rn(e,t){var n=typeof e==`function`?e:pt(e),r=t==null?Ln:typeof t==`function`?t:ht(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function zn(){var e=this.parentNode;e&&e.removeChild(this)}function Bn(){return this.each(zn)}function Vn(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hn(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Un(e){return this.select(e?Hn:Vn)}function Wn(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Gn(e){return function(t){e.call(this,t,this.__data__)}}function Kn(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function qn(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Jn(e,t,n){return function(){var r=this.__on,i,a=Gn(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Yn(e,t,n){var r=Kn(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?Jn:qn,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function Xn(e,t,n){var r=an(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Zn(e,t){return function(){return Xn(this,e,t)}}function Qn(e,t){return function(){return Xn(this,e,t.apply(this,arguments))}}function $n(e,t){return this.each((typeof t==`function`?Qn:Zn)(e,t))}function*er(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var tr=[null];function q(e,t){this._groups=e,this._parents=t}function nr(){return new q([[document.documentElement]],tr)}function rr(){return this}q.prototype=nr.prototype={constructor:q,select:gt,selectAll:xt,selectChild:Et,selectChildren:kt,filter:At,data:Rt,enter:Mt,exit:Bt,join:Vt,merge:Ht,selection:rr,order:K,sort:Ut,call:Gt,nodes:Kt,node:qt,size:Jt,empty:Yt,each:Xt,attr:rn,style:ln,property:mn,classed:Cn,text:Dn,html:jn,raise:Nn,lower:Fn,append:In,insert:Rn,remove:Bn,clone:Un,datum:Wn,on:Yn,dispatch:$n,[Symbol.iterator]:er};function ir(e){return typeof e==`string`?new q([[document.querySelector(e)]],[document.documentElement]):new q([[e]],tr)}function ar(e){let t;for(;t=e.sourceEvent;)e=t;return e}function or(e,t){if(e=ar(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var sr={capture:!0,passive:!1};function cr(e){e.preventDefault(),e.stopImmediatePropagation()}function lr(e){var t=e.document.documentElement,n=ir(e).on(`dragstart.drag`,cr,sr);`onselectstart`in t?n.on(`selectstart.drag`,cr,sr):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function ur(e,t){var n=e.document.documentElement,r=ir(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,cr,sr),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function dr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function fr(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function pr(){}var mr=.7,hr=1/mr,gr=`\\s*([+-]?\\d+)\\s*`,_r=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,J=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,vr=/^#([0-9a-f]{3,8})$/,yr=RegExp(`^rgb\\(${gr},${gr},${gr}\\)$`),br=RegExp(`^rgb\\(${J},${J},${J}\\)$`),xr=RegExp(`^rgba\\(${gr},${gr},${gr},${_r}\\)$`),Sr=RegExp(`^rgba\\(${J},${J},${J},${_r}\\)$`),Cr=RegExp(`^hsl\\(${_r},${J},${J}\\)$`),wr=RegExp(`^hsla\\(${_r},${J},${J},${_r}\\)$`),Tr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};dr(pr,Ar,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Er,formatHex:Er,formatHex8:Dr,formatHsl:Or,formatRgb:kr,toString:kr});function Er(){return this.rgb().formatHex()}function Dr(){return this.rgb().formatHex8()}function Or(){return Hr(this).formatHsl()}function kr(){return this.rgb().formatRgb()}function Ar(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=vr.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jr(t):n===3?new Y(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Mr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Mr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=yr.exec(e))?new Y(t[1],t[2],t[3],1):(t=br.exec(e))?new Y(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xr.exec(e))?Mr(t[1],t[2],t[3],t[4]):(t=Sr.exec(e))?Mr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Cr.exec(e))?Vr(t[1],t[2]/100,t[3]/100,1):(t=wr.exec(e))?Vr(t[1],t[2]/100,t[3]/100,t[4]):Tr.hasOwnProperty(e)?jr(Tr[e]):e===`transparent`?new Y(NaN,NaN,NaN,0):null}function jr(e){return new Y(e>>16&255,e>>8&255,e&255,1)}function Mr(e,t,n,r){return r<=0&&(e=t=n=NaN),new Y(e,t,n,r)}function Nr(e){return e instanceof pr||(e=Ar(e)),e?(e=e.rgb(),new Y(e.r,e.g,e.b,e.opacity)):new Y}function Pr(e,t,n,r){return arguments.length===1?Nr(e):new Y(e,t,n,r??1)}function Y(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}dr(Y,Pr,fr(pr,{brighter(e){return e=e==null?hr:hr**+e,new Y(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?mr:mr**+e,new Y(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Y(zr(this.r),zr(this.g),zr(this.b),Rr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Fr,formatHex:Fr,formatHex8:Ir,formatRgb:Lr,toString:Lr}));function Fr(){return`#${Br(this.r)}${Br(this.g)}${Br(this.b)}`}function Ir(){return`#${Br(this.r)}${Br(this.g)}${Br(this.b)}${Br((isNaN(this.opacity)?1:this.opacity)*255)}`}function Lr(){let e=Rr(this.opacity);return`${e===1?`rgb(`:`rgba(`}${zr(this.r)}, ${zr(this.g)}, ${zr(this.b)}${e===1?`)`:`, ${e})`}`}function Rr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function zr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Br(e){return e=zr(e),(e<16?`0`:``)+e.toString(16)}function Vr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new X(e,t,n,r)}function Hr(e){if(e instanceof X)return new X(e.h,e.s,e.l,e.opacity);if(e instanceof pr||(e=Ar(e)),!e)return new X;if(e instanceof X)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new X(o,s,c,e.opacity)}function Ur(e,t,n,r){return arguments.length===1?Hr(e):new X(e,t,n,r??1)}function X(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}dr(X,Ur,fr(pr,{brighter(e){return e=e==null?hr:hr**+e,new X(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?mr:mr**+e,new X(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Y(Kr(e>=240?e-240:e+120,i,r),Kr(e,i,r),Kr(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new X(Wr(this.h),Gr(this.s),Gr(this.l),Rr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Rr(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Wr(this.h)}, ${Gr(this.s)*100}%, ${Gr(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Wr(e){return e=(e||0)%360,e<0?e+360:e}function Gr(e){return Math.max(0,Math.min(1,e||0))}function Kr(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var qr=e=>()=>e;function Jr(e,t){return function(n){return e+n*t}}function Yr(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Xr(e){return(e=+e)==1?Zr:function(t,n){return n-t?Yr(t,n,e):qr(isNaN(t)?n:t)}}function Zr(e,t){var n=t-e;return n?Jr(e,n):qr(isNaN(e)?t:e)}var Qr=function e(t){var n=Xr(t);function r(e,t){var r=n((e=Pr(e)).r,(t=Pr(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Zr(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r}(1);function $r(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var ei=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ti=new RegExp(ei.source,`g`);function ni(e){return function(){return e}}function ri(e){return function(t){return e(t)+``}}function ii(e,t){var n=ei.lastIndex=ti.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=ei.exec(e))&&(i=ti.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:$r(r,i)})),n=ti.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?ri(c[0].x):ni(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var ai=180/Math.PI,oi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function si(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*ai,skewX:Math.atan(c)*ai,scaleX:o,scaleY:s}}var ci;function li(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?oi:si(t.a,t.b,t.c,t.d,t.e,t.f)}function ui(e){return e==null||(ci||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),ci.setAttribute(`transform`,e),!(e=ci.transform.baseVal.consolidate()))?oi:(e=e.matrix,si(e.a,e.b,e.c,e.d,e.e,e.f))}function di(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:$r(e,i)},{i:c-2,x:$r(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:$r(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:$r(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:$r(e,n)},{i:s-2,x:$r(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var fi=di(li,`px, `,`px)`,`deg)`),pi=di(ui,`, `,`)`,`)`),mi=1e-12;function hi(e){return((e=Math.exp(e))+1/e)/2}function gi(e){return((e=Math.exp(e))-1/e)/2}function _i(e){return((e=Math.exp(2*e))-1)/(e+1)}var vi=function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<mi)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=hi(y),c=s/(n*g)*(i*_i(t*r+y)-gi(y));return[a+c*d,o+c*f,s*i/hi(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i}(Math.SQRT2,2,4),yi=0,bi=0,xi=0,Si=1e3,Ci,wi,Ti=0,Ei=0,Di=0,Oi=typeof performance==`object`&&performance.now?performance:Date,ki=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ai(){return Ei||=(ki(ji),Oi.now()+Di)}function ji(){Ei=0}function Mi(){this._call=this._time=this._next=null}Mi.prototype=Ni.prototype={constructor:Mi,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?Ai():+n)+(t==null?0:+t),!this._next&&wi!==this&&(wi?wi._next=this:Ci=this,wi=this),this._call=e,this._time=n,Ri()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ri())}};function Ni(e,t,n){var r=new Mi;return r.restart(e,t,n),r}function Pi(){Ai(),++yi;for(var e=Ci,t;e;)(t=Ei-e._time)>=0&&e._call.call(void 0,t),e=e._next;--yi}function Fi(){Ei=(Ti=Oi.now())+Di,yi=bi=0;try{Pi()}finally{yi=0,Li(),Ei=0}}function Ii(){var e=Oi.now(),t=e-Ti;t>Si&&(Di-=t,Ti=e)}function Li(){for(var e,t=Ci,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ci=n);wi=e,Ri(r)}function Ri(e){yi||(bi&&=clearTimeout(bi),e-Ei>24?(e<1/0&&(bi=setTimeout(Fi,e-Oi.now()-Di)),xi&&=clearInterval(xi)):(xi||=(Ti=Oi.now(),setInterval(Ii,Si)),yi=1,ki(Fi)))}function zi(e,t,n){var r=new Mi;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Bi=U(`start`,`end`,`cancel`,`interrupt`),Vi=[],Hi=0,Ui=1,Wi=2,Gi=3,Ki=4,qi=5,Ji=6;function Yi(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Zi(e,n,{name:t,index:r,group:i,on:Bi,tween:Vi,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Hi})}function Xi(e,t){var n=Q(e,t);if(n.state>Hi)throw Error(`too late; already scheduled`);return n}function Z(e,t){var n=Q(e,t);if(n.state>Gi)throw Error(`too late; already running`);return n}function Q(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Zi(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Ni(a,0,n.time);function a(e){n.state=Ui,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==Ui)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===Gi)return zi(o);f.state===Ki?(f.state=Ji,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=Ji,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(zi(function(){n.state===Gi&&(n.state=Ki,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=Wi,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===Wi){for(n.state=Gi,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=qi,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===qi&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=Ji,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Qi(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>Wi&&r.state<qi,r.state=Ji,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function $i(e){return this.each(function(){Qi(this,e)})}function ea(e,t){var n,r;return function(){var i=Z(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function ta(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=Z(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function na(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=Q(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?ea:ta)(n,e,t))}function ra(e,t,n){var r=e._id;return e.each(function(){var e=Z(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return Q(e,r).value[t]}}function ia(e,t){var n;return(typeof t==`number`?$r:t instanceof Ar?Qr:(n=Ar(t))?(t=n,Qr):ii)(e,t)}function aa(e){return function(){this.removeAttribute(e)}}function oa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sa(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function ca(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function la(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function ua(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function da(e,t){var n=ut(e),r=n===`transform`?pi:ia;return this.attrTween(e,typeof t==`function`?(n.local?ua:la)(n,r,ra(this,`attr.`+e,t)):t==null?(n.local?oa:aa)(n):(n.local?ca:sa)(n,r,t))}function fa(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function pa(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ma(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&pa(e,i)),n}return i._value=t,i}function ha(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&fa(e,i)),n}return i._value=t,i}function ga(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=ut(e);return this.tween(n,(r.local?ma:ha)(r,t))}function _a(e,t){return function(){Xi(this,e).delay=+t.apply(this,arguments)}}function va(e,t){return t=+t,function(){Xi(this,e).delay=t}}function ya(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?_a:va)(t,e)):Q(this.node(),t).delay}function ba(e,t){return function(){Z(this,e).duration=+t.apply(this,arguments)}}function xa(e,t){return t=+t,function(){Z(this,e).duration=t}}function Sa(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?ba:xa)(t,e)):Q(this.node(),t).duration}function Ca(e,t){if(typeof t!=`function`)throw Error();return function(){Z(this,e).ease=t}}function wa(e){var t=this._id;return arguments.length?this.each(Ca(t,e)):Q(this.node(),t).ease}function Ta(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();Z(this,e).ease=n}}function Ea(e){if(typeof e!=`function`)throw Error();return this.each(Ta(this._id,e))}function Da(e){typeof e!=`function`&&(e=St(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new no(r,this._parents,this._name,this._id)}function Oa(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new no(o,this._parents,this._name,this._id)}function ka(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function Aa(e,t,n){var r,i,a=ka(t)?Xi:Z;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function ja(e,t){var n=this._id;return arguments.length<2?Q(this.node(),n).on.on(e):this.each(Aa(n,e,t))}function Ma(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Na(){return this.on(`end.remove`,Ma(this._id))}function Pa(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=ht(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Yi(l[f],t,n,f,l,Q(u,n)));return new no(a,this._parents,t,n)}function Fa(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=yt(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=Q(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Yi(p,t,n,h,f,m);a.push(f),o.push(u)}return new no(a,o,t,n)}var Ia=nr.prototype.constructor;function La(){return new Ia(this._groups,this._parents)}function Ra(e,t){var n,r,i;return function(){var a=un(this,e),o=(this.style.removeProperty(e),un(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function za(e){return function(){this.style.removeProperty(e)}}function Ba(e,t,n){var r,i=n+``,a;return function(){var o=un(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Va(e,t,n){var r,i,a;return function(){var o=un(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),un(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Ha(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=Z(this,e),l=c.on,u=c.value[a]==null?s||=za(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Ua(e,t,n){var r=(e+=``)==`transform`?fi:ia;return t==null?this.styleTween(e,Ra(e,r)).on(`end.style.`+e,za(e)):typeof t==`function`?this.styleTween(e,Va(e,r,ra(this,`style.`+e,t))).each(Ha(this._id,e)):this.styleTween(e,Ba(e,r,t),n).on(`end.style.`+e,null)}function Wa(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Ga(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Wa(e,a,n)),r}return a._value=t,a}function Ka(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Ga(e,t,n??``))}function qa(e){return function(){this.textContent=e}}function Ja(e){return function(){var t=e(this);this.textContent=t??``}}function Ya(e){return this.tween(`text`,typeof e==`function`?Ja(ra(this,`text`,e)):qa(e==null?``:e+``))}function Xa(e){return function(t){this.textContent=e.call(this,t)}}function Za(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Xa(r)),t}return r._value=e,r}function Qa(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Za(e))}function $a(){for(var e=this._name,t=this._id,n=ro(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=Q(c,t);Yi(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new no(r,this._parents,e,n)}function eo(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=Z(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var to=0;function no(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ro(){return++to}var io=nr.prototype;no.prototype={constructor:no,select:Pa,selectAll:Fa,selectChild:io.selectChild,selectChildren:io.selectChildren,filter:Da,merge:Oa,selection:La,transition:$a,call:io.call,nodes:io.nodes,node:io.node,size:io.size,empty:io.empty,each:io.each,on:ja,attr:da,attrTween:ga,style:Ua,styleTween:Ka,text:Ya,textTween:Qa,remove:Na,tween:na,delay:ya,duration:Sa,ease:wa,easeVarying:Ea,end:eo,[Symbol.iterator]:io[Symbol.iterator]};function ao(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var oo={time:null,delay:0,duration:250,ease:ao};function so(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function co(e){var t,n;e instanceof no?(t=e._id,e=e._name):(t=ro(),(n=oo).time=Ai(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Yi(c,e,t,l,o,n||so(c,t));return new no(r,this._parents,e,t)}nr.prototype.interrupt=$i,nr.prototype.transition=co;var lo=e=>()=>e;function uo(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function $(e,t,n){this.k=e,this.x=t,this.y=n}$.prototype={constructor:$,scale:function(e){return e===1?this:new $(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var fo=new $(1,0,0);$.prototype;function po(e){e.stopImmediatePropagation()}function mo(e){e.preventDefault(),e.stopImmediatePropagation()}function ho(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function go(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function _o(){return this.__zoom||fo}function vo(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yo(){return navigator.maxTouchPoints||`ontouchstart`in this}function bo(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function xo(){var e=ho,t=go,n=bo,r=vo,i=yo,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=vi,l=U(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,_o).on(`wheel.zoom`,C,{passive:!1}).on(`mousedown.zoom`,w).on(`dblclick.zoom`,T).filter(i).on(`touchstart.zoom`,te).on(`touchmove.zoom`,E).on(`touchend.zoom touchcancel.zoom`,D).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,_o),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(fo.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new $(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new $(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new $(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new ee(e,t)}function ee(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}ee.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=ir(this.that).datum();l.call(e,this.that,new uo(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function C(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=or(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Qi(this),s.start();mo(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function w(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=ir(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=or(t,i),l=t.clientX,u=t.clientY;lr(t.view),po(t),a.mouse=[c,this.__zoom.invert(c)],Qi(this),a.start();function d(e){if(mo(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=or(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),ur(e.view,a.moved),mo(e),a.event(e).end()}}function T(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=or(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);mo(r),s>0?ir(this).transition().duration(s).call(x,d,c,r):ir(this).call(_.transform,d,c,r)}}function te(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(po(t),s=0;s<i;++s)c=r[s],l=or(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Qi(this),a.start())}}function E(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(mo(e),s=0;s<a;++s)c=i[s],l=or(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function D(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(po(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=or(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=ir(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:lo(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:lo(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:lo(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:lo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var So=Symbol(`MiniMapSlots`),Co=[`id`,`x`,`y`,`rx`,`ry`,`width`,`height`,`fill`,`stroke`,`stroke-width`,`shape-rendering`],wo=x({name:`MiniMapNode`,compatConfig:{MODE:3},inheritAttrs:!1,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:[`click`,`dblclick`,`mouseenter`,`mousemove`,`mouseleave`],setup(t,{emit:r}){let i=t,a=s(So),o=l(),c=n(()=>o.style??{});function u(e){r(`click`,e)}function d(e){r(`dblclick`,e)}function f(e){r(`mouseenter`,e)}function m(e){r(`mousemove`,e)}function h(e){r(`mouseleave`,e)}return(t,n)=>!t.hidden&&t.dimensions.width!==0&&t.dimensions.height!==0?(S(),p(C,{key:0},[e(a)[`node-${i.type}`]?(S(),D(O(e(a)[`node-${i.type}`]),te(_({key:0},{...i,...t.$attrs})),null,16)):(S(),p(`rect`,_({key:1,id:t.id},t.$attrs,{class:[`vue-flow__minimap-node`,{selected:t.selected,dragging:t.dragging}],x:t.position.x,y:t.position.y,rx:t.borderRadius,ry:t.borderRadius,width:t.dimensions.width,height:t.dimensions.height,fill:t.color||c.value.background||c.value.backgroundColor,stroke:t.strokeColor,"stroke-width":t.strokeWidth,"shape-rendering":t.shapeRendering,onClick:u,onDblclick:d,onMouseenter:f,onMousemove:m,onMouseleave:h}),null,16,Co))],64)):A(``,!0)}}),To=[`width`,`height`,`viewBox`,`aria-labelledby`],Eo=[`id`],Do=[`d`,`fill`,`stroke`,`stroke-width`],Oo=x({name:`MiniMap`,compatConfig:{MODE:3},props:{nodeColor:{type:[String,Function],default:`#e2e2e2`},nodeStrokeColor:{type:[String,Function],default:`transparent`},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:`rgb(240, 240, 240, 0.6)`},maskStrokeColor:{default:`none`},maskStrokeWidth:{default:1},position:{default:`bottom-right`},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:`Vue Flow mini map`},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:[`click`,`nodeClick`,`nodeDblclick`,`nodeMouseenter`,`nodeMousemove`,`nodeMouseleave`],setup(r,{emit:i}){let a=c(),o=l(),{id:s,edges:d,viewport:h,translateExtent:_,dimensions:v,emits:x,d3Selection:te,d3Zoom:E,getNodesInitialized:O}=Oe(),k=t();b(So,a);let ne=n(()=>r.width??o.style?.width??200),re=n(()=>r.height??o.style?.height??150),ie=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`,ae=y(()=>typeof r.nodeColor==`string`?()=>r.nodeColor:r.nodeColor),oe=y(()=>typeof r.nodeStrokeColor==`string`?()=>r.nodeStrokeColor:r.nodeStrokeColor),se=y(()=>typeof r.nodeClassName==`string`?()=>r.nodeClassName:typeof r.nodeClassName==`function`?r.nodeClassName:()=>``),ce=y(()=>Me(O.value.filter(e=>!e.hidden))),le=y(()=>({x:-h.value.x/h.value.zoom,y:-h.value.y/h.value.zoom,width:v.value.width/h.value.zoom,height:v.value.height/h.value.zoom})),j=y(()=>O.value&&O.value.length?De(ce.value,le.value):le.value),M=y(()=>{let e=j.value.width/ne.value,t=j.value.height/re.value;return Math.max(e,t)}),N=y(()=>{let e=M.value*ne.value,t=M.value*re.value,n=r.offsetScale*M.value;return{offset:n,x:j.value.x-(e-j.value.width)/2-n,y:j.value.y-(t-j.value.height)/2-n,width:e+n*2,height:t+n*2}}),ue=y(()=>!N.value.x||!N.value.y?``:`
2
- M${N.value.x-N.value.offset},${N.value.y-N.value.offset}
3
- h${N.value.width+N.value.offset*2}
4
- v${N.value.height+N.value.offset*2}
5
- h${-N.value.width-N.value.offset*2}z
6
- M${le.value.x+r.maskBorderRadius},${le.value.y}
7
- h${le.value.width-2*r.maskBorderRadius}
8
- a${r.maskBorderRadius},${r.maskBorderRadius} 0 0 1 ${r.maskBorderRadius},${r.maskBorderRadius}
9
- v${le.value.height-2*r.maskBorderRadius}
10
- a${r.maskBorderRadius},${r.maskBorderRadius} 0 0 1 -${r.maskBorderRadius},${r.maskBorderRadius}
11
- h${-(le.value.width-2*r.maskBorderRadius)}
12
- a${r.maskBorderRadius},${r.maskBorderRadius} 0 0 1 -${r.maskBorderRadius},-${r.maskBorderRadius}
13
- v${-(le.value.height-2*r.maskBorderRadius)}
14
- a${r.maskBorderRadius},${r.maskBorderRadius} 0 0 1 ${r.maskBorderRadius},-${r.maskBorderRadius}z`);u(e=>{if(k.value){let t=ir(k.value),n=xo().wheelDelta(e=>Ae(e)*(r.zoomStep/10)).on(`zoom`,r.pannable?e=>{if(e.sourceEvent.type!==`mousemove`||!te.value||!E.value)return;let t=M.value*Math.max(1,h.value.zoom)*(r.inversePan?-1:1),n={x:h.value.x-e.sourceEvent.movementX*t,y:h.value.y-e.sourceEvent.movementY*t},i=[[0,0],[v.value.width,v.value.height]],a=fo.translate(n.x,n.y).scale(h.value.zoom),o=E.value.constrain()(a,i,_.value);E.value.transform(te.value,o)}:()=>{}).on(`zoom.wheel`,r.zoomable?e=>{if(e.sourceEvent.type!==`wheel`||!te.value||!E.value)return;let t=e.sourceEvent.ctrlKey&&ke()?10:1,n=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*r.zoomStep,i=h.value.zoom*2**(n*t);E.value.scaleTo(te.value,i)}:()=>{});t.call(n),e(()=>{t.on(`zoom`,null)})}},{flush:`post`});function P(e){let[t,n]=or(e);i(`click`,{event:e,position:{x:t,y:n}})}function de(e,t){let n={event:e,node:t,connectedEdges:Fe([t],d.value)};x.miniMapNodeClick(n),i(`nodeClick`,n)}function fe(e,t){let n={event:e,node:t,connectedEdges:Fe([t],d.value)};x.miniMapNodeDoubleClick(n),i(`nodeDblclick`,n)}function pe(e,t){let n={event:e,node:t,connectedEdges:Fe([t],d.value)};x.miniMapNodeMouseEnter(n),i(`nodeMouseenter`,n)}function me(e,t){let n={event:e,node:t,connectedEdges:Fe([t],d.value)};x.miniMapNodeMouseMove(n),i(`nodeMousemove`,n)}function he(e,t){let n={event:e,node:t,connectedEdges:Fe([t],d.value)};x.miniMapNodeMouseLeave(n),i(`nodeMouseleave`,n)}return(t,n)=>(S(),D(e(F),{position:t.position,class:g([`vue-flow__minimap`,{pannable:t.pannable,zoomable:t.zoomable}])},{default:w(()=>[(S(),p(`svg`,{ref_key:`el`,ref:k,width:ne.value,height:re.value,viewBox:[N.value.x,N.value.y,N.value.width,N.value.height].join(` `),role:`img`,"aria-labelledby":`vue-flow__minimap-${e(s)}`,onClick:P},[t.ariaLabel?(S(),p(`title`,{key:0,id:`vue-flow__minimap-${e(s)}`},T(t.ariaLabel),9,Eo)):A(``,!0),(S(!0),p(C,null,m(e(O),n=>(S(),D(wo,{id:n.id,key:n.id,f:``,position:n.computedPosition,dimensions:n.dimensions,selected:n.selected,dragging:n.dragging,style:ee(n.style),class:g(se.value(n)),color:ae.value(n),"border-radius":t.nodeBorderRadius,"stroke-color":oe.value(n),"stroke-width":t.nodeStrokeWidth,"shape-rendering":e(ie),type:n.type,hidden:n.hidden,onClick:e=>de(e,n),onDblclick:e=>fe(e,n),onMouseenter:e=>pe(e,n),onMousemove:e=>me(e,n),onMouseleave:e=>he(e,n)},null,8,[`id`,`position`,`dimensions`,`selected`,`dragging`,`style`,`class`,`color`,`border-radius`,`stroke-color`,`stroke-width`,`shape-rendering`,`type`,`hidden`,`onClick`,`onDblclick`,`onMouseenter`,`onMousemove`,`onMouseleave`]))),128)),f(`path`,{class:`vue-flow__minimap-mask`,d:ue.value,fill:t.maskColor,stroke:t.maskStrokeColor,"stroke-width":t.maskStrokeWidth,"fill-rule":`evenodd`},null,8,Do)],8,To))]),_:1},8,[`position`,`class`]))}}),ko={group:`Group`,node:`Node`,role:`Role`,leader:`Leader`};function Ao(e){let{locale:t}=fe();function n(n){let r=(typeof e==`function`?e():e.value)?.labels?.[n];if(!r)return ko[n];let i=t.value;return r[i]??r[i.split(`-`)[0]]??ko[n]}return y(()=>({group:n(`group`),node:n(`node`),role:n(`role`),leader:n(`leader`)}))}var jo={class:`scenario-node-editor`},Mo={class:`form-row`},No={class:`form-group`},Po={class:`form-label`,for:`scennode-label`},Fo={key:0,class:`form-group`},Io={class:`form-label`,for:`scennode-role`},Lo={key:0,class:`role-preview`},Ro={class:`role-preview__label`},zo={class:`role-preview__text`},Bo={class:`form-row`},Vo={class:`form-group`},Ho={class:`form-label`,for:`scennode-group`},Uo={key:0,class:`form-group`},Wo={class:`form-label`,for:`scennode-parent`},Go={class:`form-row`},Ko={class:`form-group`},qo={class:`form-label`,for:`scennode-aicli`},Jo={class:`form-group`},Yo={class:`form-label`,for:`scennode-model`},Xo={key:1,class:`form-note`},Zo={class:`inline-check`},Qo={for:`canAddNode`},$o={class:`inline-check`},es={for:`injectParentOutputs`},ts={key:0,class:`form-group`},ns={class:`form-label`,for:`scennode-ancestors`},rs={class:`inline-check`},is={for:`isLeader`},as={class:`form-note`},os={key:2,class:`form-group`},ss={class:`form-label`,for:`scennode-question`},cs={key:3,class:`form-group`},ls={class:`form-label`,for:`scennode-prompt`},us=de(x({__name:`ScenarioNodeEditor`,props:{node:{},groups:{},nodes:{},leaderId:{},preset:{},traversalMode:{}},emits:[`update`,`delete`,`set-leader`],setup(n,{emit:r}){let s=n,{t:c}=fe(),{claudeCodeAvailable:l,codexAvailable:u}=me(ve()),d=r;function m(e){return e===`codex`?``:`sonnet`}let h=t({...s.node,aiCli:s.node.aiCli??`claude-code`,model:s.node.model??m(s.node.aiCli),injectParentOutputs:s.node.injectParentOutputs??!1,injectedAncestorIds:s.node.injectedAncestorIds??[]});function g(e){return{...e,aiCli:e.aiCli??`claude-code`,model:e.model??m(e.aiCli),injectParentOutputs:e.injectParentOutputs??!1,injectedAncestorIds:e.injectedAncestorIds??[]}}let _=g(s.node);o(()=>s.node,e=>{_=g(e),h.value=g(e)},{deep:!0}),o(h,e=>{let t={};e.label!==_.label&&(t.label=e.label),e.role!==_.role&&(t.role=e.role),e.groupId!==_.groupId&&(t.groupId=e.groupId),JSON.stringify(e.parentIds)!==JSON.stringify(_.parentIds)&&(t.parentIds=e.parentIds),e.prompt!==_.prompt&&(t.prompt=e.prompt),e.question!==_.question&&(t.question=e.question),e.canAddNode!==_.canAddNode&&(t.canAddNode=e.canAddNode),e.aiCli!==_.aiCli&&(t.aiCli=e.aiCli),e.model!==_.model&&(t.model=e.model),e.injectParentOutputs!==_.injectParentOutputs&&(t.injectParentOutputs=e.injectParentOutputs),JSON.stringify(e.injectedAncestorIds)!==JSON.stringify(_.injectedAncestorIds)&&(t.injectedAncestorIds=e.injectedAncestorIds),Object.keys(t).length>0&&d(`update`,t)},{deep:!0});let v=y(()=>s.preset?.roles.length?s.preset.roles.map(e=>({label:e.name,value:e.id})):[]),b=y(()=>[{label:`Claude Code${l.value?``:` — non installé`}`,value:`claude-code`,disabled:!l.value},{label:`Codex (OpenAI)${u.value?``:` — non installé`}`,value:`codex`,disabled:!u.value}]),x=y(()=>h.value.aiCli===`codex`?[]:[{label:c(`scenarioNodeEditor.modelHaiku`),value:`haiku`},{label:c(`scenarioNodeEditor.modelSonnet`),value:`sonnet`},{label:c(`scenarioNodeEditor.modelOpus`),value:`opus`}]);o(()=>h.value.aiCli,(e,t)=>{if(e===t)return;let n={"claude-code":`sonnet`,codex:``};h.value.model=n[e]??`sonnet`});let ee=y(()=>s.groups.map(e=>({label:e.name,value:e.id}))),w=y(()=>s.nodes.filter(e=>e.id!==s.node.id).map(e=>({label:e.label||e.id,value:e.id}))),te=y(()=>s.traversalMode===`topological`);o(()=>h.value.parentIds,()=>{let e=new Map(s.nodes.map(e=>[e.id,e])),t=new Set,n=[...h.value.parentIds];for(;n.length>0;){let r=n.shift();if(!t.has(r)){t.add(r);let i=e.get(r);i&&n.push(...i.parentIds)}}h.value.injectedAncestorIds=(h.value.injectedAncestorIds??[]).filter(e=>t.has(e))});let E=y(()=>{let e=new Map(s.nodes.map(e=>[e.id,e])),t=new Set,n=[...s.node.parentIds??[]];for(;n.length>0;){let r=n.shift();if(!t.has(r)){t.add(r);let i=e.get(r);i&&n.push(...i.parentIds)}}return s.nodes.filter(e=>t.has(e.id)).map(e=>({label:e.label||e.id,value:e.id}))}),O=y(()=>s.node.id===s.leaderId);y(()=>!O.value);let k=y(()=>!O.value),ne=Ao(()=>s.preset),re=y(()=>s.preset?.roles.find(e=>e.id===h.value.role));return(t,n)=>(S(),p(`div`,jo,[f(`div`,Mo,[f(`div`,No,[f(`label`,Po,T(e(c)(`scenarioNodeEditor.label`)),1),i(e(se),{id:`scennode-label`,modelValue:h.value.label,"onUpdate:modelValue":n[0]||=e=>h.value.label=e,class:`w-full`,size:`small`,placeholder:`${e(ne).node} name`},null,8,[`modelValue`,`placeholder`])]),v.value.length?(S(),p(`div`,Fo,[f(`label`,Io,T(e(ne).role),1),i(e(j),{"input-id":`scennode-role`,modelValue:h.value.role,"onUpdate:modelValue":n[1]||=e=>h.value.role=e,options:v.value,"option-label":`label`,"option-value":`value`,class:`w-full`,size:`small`},null,8,[`modelValue`,`options`])])):A(``,!0)]),re.value?.systemPrompt?(S(),p(`div`,Lo,[f(`span`,Ro,T(e(c)(`scenarioNodeEditor.systemPrompt`)),1),f(`p`,zo,T(re.value.systemPrompt),1)])):A(``,!0),f(`div`,Bo,[f(`div`,Vo,[f(`label`,Ho,T(e(ne).group),1),i(e(j),{"input-id":`scennode-group`,modelValue:h.value.groupId,"onUpdate:modelValue":n[2]||=e=>h.value.groupId=e,options:ee.value,"option-label":`label`,"option-value":`value`,placeholder:`Select a ${e(ne).group.toLowerCase()}`,class:`w-full`,size:`small`},null,8,[`modelValue`,`options`,`placeholder`])]),k.value?(S(),p(`div`,Uo,[f(`label`,Wo,T(e(c)(`scenarioNodeEditor.reportsTo`)),1),i(e(j),{"input-id":`scennode-parent`,"model-value":h.value.parentIds[0]??null,options:w.value,"option-label":`label`,"option-value":`value`,placeholder:e(c)(`scenarioNodeEditor.noParent`),"show-clear":!0,class:`w-full`,size:`small`,"onUpdate:modelValue":n[3]||=e=>{h.value.parentIds=e?[e,...h.value.parentIds.slice(1)]:h.value.parentIds.slice(1)}},null,8,[`model-value`,`options`,`placeholder`])])):A(``,!0)]),h.value.type===`ask`?A(``,!0):(S(),p(C,{key:1},[f(`div`,Go,[f(`div`,Ko,[f(`label`,qo,T(e(c)(`scenarioNodeEditor.aiRunner`)),1),i(e(j),{"input-id":`scennode-aicli`,modelValue:h.value.aiCli,"onUpdate:modelValue":n[4]||=e=>h.value.aiCli=e,options:b.value,"option-label":`label`,"option-value":`value`,"option-disabled":`disabled`,class:`w-full`,size:`small`},null,8,[`modelValue`,`options`])]),f(`div`,Jo,[f(`label`,Yo,T(e(c)(`scenarioNodeEditor.model`)),1),h.value.aiCli===`codex`?(S(),p(`small`,Xo,T(e(c)(`scenarioNodeEditor.modelAuto`)),1)):(S(),D(e(j),{key:0,"input-id":`scennode-model`,modelValue:h.value.model,"onUpdate:modelValue":n[5]||=e=>h.value.model=e,options:x.value,"option-label":`label`,"option-value":`value`,class:`w-full`,size:`small`},null,8,[`modelValue`,`options`]))])]),f(`div`,Zo,[i(e(ce),{modelValue:h.value.canAddNode,"onUpdate:modelValue":n[6]||=e=>h.value.canAddNode=e,binary:``,"input-id":`canAddNode`},null,8,[`modelValue`]),f(`label`,Qo,T(e(c)(`scenarioNodeEditor.canSpawnNodes`)),1)]),te.value&&!O.value?(S(),p(C,{key:0},[f(`div`,$o,[i(e(ce),{modelValue:h.value.injectParentOutputs,"onUpdate:modelValue":n[7]||=e=>h.value.injectParentOutputs=e,binary:``,"input-id":`injectParentOutputs`},null,8,[`modelValue`]),f(`label`,es,T(e(c)(`scenarioNodeEditor.injectParentOutputs`)),1)]),E.value.length>0?(S(),p(`div`,ts,[f(`label`,ns,T(e(c)(`scenarioNodeEditor.injectedAncestorIds`)),1),i(e(N),{"input-id":`scennode-ancestors`,modelValue:h.value.injectedAncestorIds,"onUpdate:modelValue":n[8]||=e=>h.value.injectedAncestorIds=e,options:E.value,"option-label":`label`,"option-value":`value`,placeholder:e(c)(`scenarioNodeEditor.injectedAncestorIdsPlaceholder`),filter:``,class:`w-full`,size:`small`},null,8,[`modelValue`,`options`,`placeholder`])])):A(``,!0)],64)):A(``,!0)],64)),f(`div`,rs,[i(e(ce),{"model-value":O.value,binary:``,"input-id":`isLeader`,disabled:O.value,"onUpdate:modelValue":n[9]||=e=>d(`set-leader`,s.node.id)},null,8,[`model-value`,`disabled`]),f(`label`,is,[a(T(e(ne).leader)+` `,1),f(`span`,as,T(e(c)(`scenarioNodeEditor.entryPoint`)),1)])]),h.value.type===`ask`?(S(),p(`div`,os,[f(`label`,ss,T(e(c)(`scenarioNodeEditor.question`)),1),i(e(pe),{id:`scennode-question`,modelValue:h.value.question,"onUpdate:modelValue":n[10]||=e=>h.value.question=e,rows:`4`,class:`w-full`,style:{resize:`none`},placeholder:e(c)(`scenarioNodeEditor.questionPlaceholder`)},null,8,[`modelValue`,`placeholder`])])):(S(),p(`div`,cs,[f(`label`,ls,T(e(c)(`scenarioNodeEditor.prompt`)),1),i(e(pe),{id:`scennode-prompt`,modelValue:h.value.prompt,"onUpdate:modelValue":n[11]||=e=>h.value.prompt=e,rows:`8`,class:`w-full`,style:{resize:`none`}},null,8,[`modelValue`])]))]))}}),[[`__scopeId`,`data-v-2f0b3467`]]),ds={class:`scenario-editor`},fs={class:`scenario-editor__toolbar`},ps={class:`scenario-editor__toolbar-row scenario-editor__toolbar-row--primary`},ms={class:`scenario-editor__icon-input`},hs={class:`scenario-editor__toolbar-row scenario-editor__toolbar-row--secondary`},gs={class:`ti ti-help-circle scenario-editor__traversal-help`},_s={class:`add-node-popover`},vs={class:`add-node-popover__item-text`},ys={class:`add-node-popover__item-label`},bs={class:`add-node-popover__item-desc`},xs={class:`add-node-popover__item-text`},Ss={class:`add-node-popover__item-label`},Cs={class:`add-node-popover__item-desc`},ws={class:`scenario-editor__content`},Ts={key:0,class:`scenario-editor__ai-panel`},Es={class:`scenario-editor__ai-panel-header`},Ds={key:0,class:`scenario-editor__ai-provider`},Os={for:`scened-ai-provider`,class:`scenario-editor__ai-provider-label`},ks={key:1,class:`scenario-editor__ai-no-provider`},As=[`innerHTML`],js={class:`scenario-editor__ai-hint`},Ms={key:2,class:`scenario-editor__ai-stream`},Ns={class:`scenario-editor__ai-stream-label`},Ps={key:0,class:`ti ti-spin ti-loader-2`},Fs={key:1,class:`ti ti-check`,style:{color:`var(--r-green-500)`}},Is={key:2,class:`ti ti-alert-triangle`,style:{color:`var(--r-orange-500)`}},Ls={class:`scenario-editor__ai-stream-text`},Rs={key:3,class:`scenario-editor__ai-error`},zs={key:0,class:`scenario-editor__panel scenario-editor__panel--editor`},Bs={class:`detail-header`},Vs={class:`detail-header__title`},Hs={class:`detail-body`},Us={class:`detail-field`},Ws={for:`scened-group-name`,class:`detail-label`},Gs={class:`detail-field`},Ks={for:`scened-group-desc`,class:`detail-label`},qs={class:`detail-field`},Js={for:`scened-group-color`,class:`detail-label`},Ys={class:`detail-color-row`},Xs={class:`detail-footer`},Zs={key:0,class:`detail-footer`},Qs={class:`switch-dialog__intro`},$s={class:`inline-check`,style:{"margin-top":`1rem`,gap:`0.6rem`}},ec={for:`dontShowAgain`,style:{"font-size":`0.85rem`,cursor:`pointer`}},tc={class:`switch-dialog__intro`},nc={class:`switch-dialog__intro`},rc={class:`switch-dialog__links`},ic={class:`switch-dialog__node`},ac={class:`switch-dialog__node`},oc={class:`add-node-form`},sc={for:`scened-add-node-group`,class:`add-node-label`},cc={class:`export-json`},lc={key:0,class:`import-error`},uc={style:{margin:`0 0 1rem`}},dc=`runeya:hierarchical-multi-parent-notice-dismissed`,fc=`scenario-flow`,pc=160,mc=48,hc=24,gc=32,_c=60,vc=10,yc=de(x({__name:`ScenarioEditorPage`,setup(n){let{t:o}=fe(),s=ge(),c=he(),l=le(),u=t(!1),b=t([]),x=t(localStorage.getItem(dc)===`true`),ee=t(!1),O=t(!1),k=be(),{setCenter:N,updateNode:de,getSelectedNodes:me,getSelectedEdges:ve,removeSelectedElements:De,fitView:ke,viewport:Ae}=Oe(fc);function Me(e){if(e.key!==`Delete`&&e.key!==`Backspace`)return;let t=e.target;if(t.tagName!==`INPUT`&&t.tagName!==`TEXTAREA`){if(G.value){let e=G.value;for(let t of B.value){let n=t.parentIds.findIndex(n=>`e-${n}-${t.id}`===e);if(n!==-1){xt(t.id,{parentIds:t.parentIds.filter((e,t)=>t!==n)});break}}G.value=void 0;return}for(let e of me.value)z.value.some(t=>t.id===e.id)?mt(e.id):B.value.some(t=>t.id===e.id)&&bt(e.id)}}let Ne=y(()=>s.params.id),Fe=y(()=>!Ne.value),F=t(`New scenario`),Re=t(``),ze=t(``),I=t(``),L=t(`hierarchical`),Be=t(void 0),Ve=t(!1),He=t([]),Ue=y(()=>He.value.find(e=>e.id===Be.value)),R=Ao(Ue),We=t();function Ge(e){We.value?.toggle(e)}function Ke(e){We.value?.hide(),gt(e)}async function qe(){try{He.value=await xe.scenario.listPresets.query()}catch{}}let Je=t(!1),Ye=t(void 0),Xe=t(0);function Ze(e){Be.value=e;let t=He.value.find(t=>t.id===e);t?.defaultTraversalMode&&(L.value=t.defaultTraversalMode),t?.initialData?(z.value=[...t.initialData.groups],B.value=[...t.initialData.nodes],I.value=t.initialData.leaderId,V.value=void 0,H.value=void 0):e||(z.value=[],B.value=[],I.value=``,V.value=void 0,H.value=void 0)}function Qe(){return B.value.length>0||z.value.length>0}function $e(e){let t=e?He.value.find(t=>t.id===e):void 0;(!e||t?.initialData)&&Qe()?(Ye.value=e,Je.value=!0):Ze(e)}function et(){Je.value=!1,Ze(Ye.value),Ye.value=void 0}function tt(){Je.value=!1,Ye.value=void 0,Xe.value++}let z=t([]),B=t([]),V=t(),H=t(),rt=t(!1),U=t(null),it=t(`ai`),at=y(()=>{let e=new Map;if(!V.value)return e;let t=V.value,n=B.value.find(e=>e.id===t);if(!n)return e;let r=B.value.filter(e=>(e.parentIds??[]).includes(t)||(n.parentIds??[]).includes(e.id)),i=new Map;for(let e of r){let t=e.groupId??null;i.has(t)||i.set(t,[]),i.get(t).push(e)}for(let t of i.values())t.length<=1||[...t].sort((e,t)=>e.position.x-t.position.x).forEach((t,n)=>e.set(t.id,-n*15));return e}),ot=y(()=>{let e=V.value?(()=>{let e=V.value,t=B.value.find(t=>t.id===e),n=B.value.filter(n=>(n.parentIds??[]).includes(e)||(t?.parentIds??[]).includes(n.id)).map(e=>e.id);return new Set([e,...n])})():null,t=e?new Set(B.value.filter(t=>e.has(t.id)&&t.groupId).map(e=>e.groupId)):null,n=H.value??null,r=n?new Set(B.value.filter(e=>e.groupId===n).map(e=>e.id)):null,i=z.value.map(e=>{let r=t&&!t.has(e.id),i=n&&e.id!==n,a=r||i,o=n===e.id;return{id:e.id,type:`group`,position:e.position,zIndex:o?500:1,style:{width:`${e.width}px`,height:`${e.height}px`,opacity:a?`0.25`:`1`,transition:`opacity 0.15s ease`},data:{label:e.name,color:e.color??void 0},draggable:!0,selectable:!0}}),a=new Map;for(let e of B.value)for(let t of e.parentIds??[]){let n=st(e.id)<st(t),r=a.get(t)??{hasUp:!1,hasDown:!1};n?r.hasUp=!0:r.hasDown=!0,a.set(t,r)}let o=B.value.map(t=>{let n=a.get(t.id)??{hasUp:!1,hasDown:!1},i=at.value.get(t.id)??0,o=e&&!e.has(t.id),s=r&&!r.has(t.id),c=o||s,l=r?.has(t.id);return{id:t.id,position:{x:t.position.x+i,y:t.position.y},zIndex:l?1500:1e3,style:c?{opacity:`0.25`,transition:`opacity 0.15s ease`}:{opacity:`1`,transition:`opacity 0.15s ease`},data:{label:t.label,isLeader:t.id===I.value,type:t.type,roleName:Ue.value?.roles.find(e=>e.id===t.role)?.name,showTopHandle:n.hasUp,showBottomHandle:n.hasDown||!n.hasUp},draggable:!0,selectable:!0,parentNode:t.groupId??void 0,extent:t.groupId?`parent`:void 0}});return[...i,...o]});function st(e){let t=B.value.find(t=>t.id===e);return t?t.groupId?(z.value.find(e=>e.id===t.groupId)?.position.y??0)+t.position.y:t.position.y:0}let ct=y(()=>{let e=new Map;for(let t of B.value)e.set(t.id,0);let t=new Map;for(let e of B.value)t.set(e.id,[]);for(let e of B.value)for(let n of e.parentIds??[])t.get(n)?.push(e.id);let n=new Set,r=[];function i(a){e.set(a,1),r.push(a);for(let o of t.get(a)??[])if(e.get(o)===1){let e=r.indexOf(o);for(let t=e;t<r.length-1;t++)n.add(`e-${r[t]}-${r[t+1]}`);n.add(`e-${a}-${o}`)}else e.get(o)===0&&i(o);r.pop(),e.set(a,2)}for(let t of B.value)e.get(t.id)===0&&i(t.id);return n}),lt=y(()=>{let e=[],t=L.value===`topological`;for(let n of B.value)for(let r of n.parentIds??[]){let i=`e-${r}-${n.id}`,a=G.value===i,o=!G.value&&!!V.value&&(V.value===r||V.value===n.id),s=a||o,c=ct.value.has(i),l=st(n.id)<st(r),u=B.value.find(e=>e.id===r)?.groupId??null,d=n.groupId??null,f=!!H.value&&u!==H.value&&d!==H.value||V.value&&!G.value&&!s||G.value&&!a;e.push({id:i,source:r,target:n.id,sourceHandle:l?`source-top`:`source-bottom`,type:`step`,zIndex:c?700:s?600:500,class:c?`edge--cycle`:void 0,animated:t,style:{stroke:c?`rgb(239,68,68)`:s?`rgb(168,85,247)`:`rgba(99,102,241,0.55)`,strokeWidth:c||s?3:2.5,opacity:f?.15:1,...t?{strokeDasharray:`5,3`}:{}}})}return e});y(()=>B.value.map(e=>({id:e.id,label:e.label||e.id})));function ut(){let e={id:`group-${Le().slice(0,8)}`,name:`Group ${z.value.length+1}`,position:{x:100*z.value.length,y:100*z.value.length},width:300,height:200};z.value=[...z.value,e]}let dt=t(!1),ft=t(null),pt=t(0);function mt(e){let t=B.value.filter(t=>t.groupId===e).length;if(t>0){ft.value=e,pt.value=t,dt.value=!0;return}ht(e)}function ht(e){let t=B.value.filter(t=>t.groupId===e).map(e=>e.id);B.value=B.value.filter(e=>!t.includes(e.id)).map(e=>({...e,parentIds:e.parentIds.filter(e=>!t.includes(e))})),z.value=z.value.filter(t=>t.id!==e),H.value===e&&(H.value=void 0),V.value&&t.includes(V.value)&&(V.value=void 0)}function gt(e=`ai`){if(!z.value.length){l.add({severity:`warn`,summary:o(`scenarioEditor.toast.noGroupsSummary`),detail:o(`scenarioEditor.toast.noGroupsDetail`),life:3e3});return}it.value=e,U.value=z.value[0]?.id??null,rt.value=!0}function _t(e){if(!e)return{x:100,y:100};let t=B.value.filter(t=>t.groupId===e);if(t.length===0)return{x:hc,y:56};let n=t.reduce((e,t)=>e.position.y>t.position.y?e:t);return{x:n.position.x,y:n.position.y+mc+vc}}function vt(e){if(!e)return;let t=z.value.find(t=>t.id===e);if(!t)return;let n=B.value.filter(t=>t.groupId===e);if(n.length===0)return;let r=Math.max(...n.map(e=>e.position.y+mc)),i=Math.max(...n.map(e=>e.position.x+pc)),a=r+hc,o=Math.max(t.width??200,i+hc),s=(t.position.y??0)+(t.height??0),c=(t.position.y??0)+a-s;if(W(e,{width:o,height:a}),c>0)for(let t of z.value)t.id!==e&&(t.position.y??0)>=s&&W(t.id,{position:{x:t.position.x,y:(t.position.y??0)+c}})}function yt(){if(!U.value){l.add({severity:`warn`,summary:o(`scenarioEditor.toast.groupRequiredSummary`),detail:o(`scenarioEditor.toast.groupRequiredDetail`),life:3e3});return}let e=`node-${Le().slice(0,8)}`,t={id:e,type:it.value,parentIds:[],groupId:U.value,label:``,role:`other`,prompt:``,question:``,autoGenerated:!0,canAddNode:!1,aiCli:`claude-code`,model:`sonnet`,position:_t(U.value),injectParentOutputs:!1,injectedAncestorIds:[]};B.value=[...B.value,t],B.value.length===1&&(I.value=e),vt(U.value),rt.value=!1,V.value=e,E(()=>updateNodeInternals(B.value.map(e=>e.id)))}function bt(e){if(e===I.value){l.add({severity:`warn`,summary:o(`scenarioEditor.toast.leaderSummary`),detail:o(`scenarioEditor.toast.leaderDetail`),life:3e3});return}let t=new Set(B.value.filter(t=>t.parentIds[0]===e).map(e=>e.id));B.value=B.value.filter(t=>t.id!==e).map(e=>t.has(e.id)?{...e,parentId:I.value}:e),V.value===e&&(V.value=void 0)}function xt(e,t){B.value=B.value.map(n=>n.id===e?{...n,...t}:n);let n=B.value.find(t=>t.id===e);if(n&&(`label`in t&&de(e,{data:{label:n.label,isLeader:n.id===I.value}}),`groupId`in t)){let n={x:50,y:50};de(e,{parentNode:t.groupId??void 0,extent:t.groupId?`parent`:void 0,position:n}),B.value=B.value.map(t=>t.id===e?{...t,position:n}:t)}}function St(e,t){W(e,{name:t}),de(e,{data:{label:t}})}function Ct(e,t,n){}function wt(e){for(let t of e)if(t.type===`remove`){let e=t.id?.split(`-`);if(!e||e.length<3)continue;for(let e of B.value){let n=e.parentIds??[],r=n.findIndex(n=>`e-${n}-${e.id}`===t.id);if(r!==-1){xt(e.id,{parentIds:n.filter((e,t)=>t!==r)});break}}}}function Tt(e){for(let t of e)t.type===`dimensions`&&t.dimensions&&z.value.find(e=>e.id===t.id)&&W(t.id,{width:t.dimensions.width,height:t.dimensions.height}),t.type===`position`&&t.position&&!t.dragging&&z.value.find(e=>e.id===t.id)&&W(t.id,{position:t.position}),t.type===`remove`&&B.value.some(e=>e.id===t.id)&&bt(t.id)}function W(e,t){z.value=z.value.map(n=>n.id===e?{...n,...t}:n)}function Et(e){let t=e.node.id,n=e.node.position,r=z.value.find(e=>e.id===t),i=B.value.find(e=>e.id===t);r?W(t,{position:n}):i&&(xt(t,{position:n}),Dt(t,n.y)),Nt({refit:!1})}function Dt(e,t){let n=B.value.find(t=>t.id===e);if(!n)return;let r=n.parentIds[0]??null,i=new Set(B.value.filter(e=>(e.parentIds[0]??null)===r).map(e=>e.id));if(i.size<=1)return;let a=B.value.filter(e=>i.has(e.id)).sort((n,r)=>(n.id===e?t:n.position.y)-(r.id===e?t:r.position.y)),o=B.value.map((e,t)=>({n:e,i:t})).filter(({n:e})=>i.has(e.id)).map(({i:e})=>e),s=[...B.value];o.forEach((e,t)=>{s[e]=a[t]}),B.value=s}let G=t();function Ot(e){let t=e.edge.id;G.value===t?(G.value=void 0,De({edges:[e.edge]})):G.value=t}function kt(e){let t=e.node.id;G.value=void 0,z.value.some(e=>e.id===t)?H.value===t?(H.value=void 0,De({nodes:[e.node]})):(H.value=t,V.value=void 0):B.value.some(e=>e.id===t)&&(V.value===t?(V.value=void 0,De({nodes:[e.node]})):(V.value=t,H.value=void 0))}function At(e){let t=e.target,n=e.source;if(n===t)return;let r=B.value.find(e=>e.id===t);if(!r)return;let i=r.parentIds??[];i.includes(n)||(L.value===`hierarchical`?(xt(t,{parentIds:[n]}),i.length>0&&!x.value&&(O.value=!1,ee.value=!0)):xt(t,{parentIds:[...i,n]}),E(()=>Nt({refit:!1})))}function jt(){O.value&&(x.value=!0,localStorage.setItem(dc,`true`)),ee.value=!1}function Mt(){B.value=B.value.map(e=>({...e,parentIds:e.parentIds.slice(0,1),injectParentOutputs:!1,injectedAncestorIds:[]}))}function Nt({refit:e=!0}={}){let t=new Map;for(let e of B.value)t.set(e.id,[]);for(let e of B.value)e.parentIds[0]&&t.has(e.parentIds[0])&&t.get(e.parentIds[0]).push(e.id);let n=new Map,r=0,i;function a(e,o){let s=B.value.find(t=>t.id===e).groupId??null;s!==i&&(i!==void 0&&(r+=hc),s!==null&&(r+=56),i=s),n.set(e,{x:o*_c,y:r}),r+=58;for(let n of t.get(e)??[])a(n,o+1)}let o=B.value.filter(e=>e.parentIds.length===0),s=o.length>0?o.map(e=>e.id):[I.value];for(let e of s)a(e,0),r+=34,i=void 0;for(let e of B.value){let t=n.get(e.id);t&&xt(e.id,{position:t})}for(let e of z.value){let t=B.value.filter(t=>t.groupId===e.id);if(t.length===0)continue;let r=t.map(e=>n.get(e.id)??e.position),i=Math.min(...r.map(e=>e.x))-hc,a=Math.min(...r.map(e=>e.y))-hc-gc,o=Math.max(...r.map(e=>e.x+pc))+hc,s=Math.max(...r.map(e=>e.y+mc))+hc;W(e.id,{position:{x:i,y:a},width:o-i,height:s-a});for(let e of t){let t=n.get(e.id);t&&xt(e.id,{position:{x:t.x-i,y:t.y-a}})}}e&&E(()=>ke({includeHiddenNodes:!1,padding:.1,maxZoom:Ae.value.zoom}))}function Pt(e){if(e===`hierarchical`){let e=B.value.filter(e=>e.parentIds.length>1).length;if(B.value.reduce((e,t)=>e+Math.max(0,t.parentIds.length-1),0),e>0){let e=new Map(B.value.map(e=>[e.id,e]));b.value=B.value.filter(e=>e.parentIds.length>1).flatMap(t=>t.parentIds.slice(1).map(n=>({from:e.get(n)?.label||n,to:t.label||t.id}))),u.value=!0;return}Mt()}L.value=e}function Ft(e){V.value&&xt(V.value,e)}function It(e){bt(e)}function Lt(){let e=new Set(B.value.map(e=>e.id));e.has(I.value)||(I.value=B.value[0]?.id??`leader`),B.value=B.value.map(t=>{if(t.id===I.value)return{...t,parentIds:[]};let n=(t.parentIds??[]).filter(t=>e.has(t));return n.length===0&&t.id!==I.value?{...t,parentIds:[I.value]}:n.length===(t.parentIds??[]).length?t:{...t,parentIds:n}})}async function Rt(){if(Fe.value)return;await k.fetchScenarios();let e=k.scenarios.find(e=>e.id===Ne.value);if(!e){l.add({severity:`error`,summary:o(`scenarioEditor.toast.notFoundSummary`),detail:o(`scenarioEditor.toast.notFoundDetail`),life:3e3}),c.push({name:`settings`,query:{section:`scenario`}});return}F.value=e.name,Re.value=e.icon??``,ze.value=e.description??``,I.value=e.leaderId,L.value=e.traversalMode??`hierarchical`,Be.value=e.presetId,Ve.value=e.isPublished??!1,z.value=[...e.groups],B.value=[...e.nodes]}async function zt(){if(!F.value.trim()){l.add({severity:`warn`,summary:o(`scenarioEditor.toast.validationSummary`),detail:o(`scenarioEditor.toast.nameRequired`),life:3e3});return}if(!B.value.length){l.add({severity:`warn`,summary:o(`scenarioEditor.toast.validationSummary`),detail:o(`scenarioEditor.toast.nodeRequired`),life:3e3});return}if(!B.value.some(e=>e.id===I.value)){l.add({severity:`warn`,summary:o(`scenarioEditor.toast.validationSummary`),detail:o(`scenarioEditor.toast.leaderRequired`),life:3e3});return}Lt();let e={name:F.value.trim(),icon:Re.value.trim()||void 0,description:ze.value.trim()||void 0,leaderId:I.value,traversalMode:L.value,presetId:Be.value,isPublished:Ve.value,groups:z.value,nodes:B.value};try{if(Fe.value){let t=await k.createScenario(e);l.add({severity:`success`,summary:o(`scenarioEditor.toast.createdSummary`),detail:o(`scenarioEditor.toast.createdDetail`),life:2500}),c.replace({name:`scenario-edit`,params:{id:t.id}})}else await k.updateScenario(Ne.value,e),l.add({severity:`success`,summary:o(`scenarioEditor.toast.savedSummary`),detail:o(`scenarioEditor.toast.savedDetail`),life:2500})}catch(e){l.add({severity:`error`,summary:`Error`,detail:e.message,life:3500})}}function Bt(){c.push({name:`settings`,query:{section:`scenario`}})}let Vt=t(!1),Ht=t(``),K=t(!1),Ut=t(``),Wt=t(``),Gt=t(1),Kt=t(null),qt=t(null),Jt=we({leaderId:Ce().max(128),groups:Se(Ee).max(100),nodes:Se(Te).max(500)}),Yt=t(null),Xt=null;function Zt(){Ht.value.trim()&&!K.value&&(Xt?.unsubscribe(),Ut.value=``,Yt.value=null,Wt.value=``,K.value=!0,Xt=xe.scenario.streamGenerateWithAI.subscribe({prompt:Ht.value.trim(),providerId:Kt.value??void 0,model:qt.value??void 0,current:z.value.length>0||B.value.length>0?{leaderId:I.value,groups:z.value,nodes:B.value}:void 0},{onData(e){if(e.type===`delta`)Ut.value+=e.text;else if(e.type===`done`){K.value=!1;let e=Ut.value.trim(),t=e.match(/```(?:json)?\s*([\s\S]*?)```/);t&&(e=t[1].trim());try{let t=Jt.parse(JSON.parse(e));Yt.value=t}catch{Wt.value=o(`scenarioEditor.toast.invalidJson`)}}},onError(e){K.value=!1,Wt.value=e.message??`Unknown error`},onComplete(){K.value=!1}}))}function Qt(){if(!Yt.value)return;let{leaderId:e,groups:t,nodes:n}=Yt.value;I.value=e,z.value=t,B.value=n,Yt.value=null,Ut.value=``,Ht.value=``,Vt.value=!1,l.add({severity:`success`,summary:o(`scenarioEditor.toast.appliedSummary`),detail:o(`scenarioEditor.toast.appliedDetail`),life:3e3})}let $t=t(!1),en=t(!1),tn=t(``),nn=t(``),rn=y(()=>JSON.stringify({name:F.value,description:ze.value||void 0,leaderId:I.value,groups:z.value,nodes:B.value},null,2));async function an(){await navigator.clipboard.writeText(rn.value),l.add({severity:`success`,summary:o(`scenarioEditor.toast.copiedSummary`),life:2e3})}let on=we({leaderId:Ce().max(128),groups:Se(Ee).max(100),nodes:Se(Te).max(500),name:Ce().max(200).optional(),description:Ce().max(2e3).optional()});function sn(){nn.value=``;try{let e=on.parse(JSON.parse(tn.value));e.name&&(F.value=e.name),e.description&&(ze.value=e.description),I.value=e.leaderId,z.value=e.groups,B.value=e.nodes,en.value=!1,l.add({severity:`success`,summary:o(`scenarioEditor.toast.importedSummary`),life:2e3})}catch(e){nn.value=e.message}}return v(()=>{Xt?.unsubscribe()}),h(async()=>{await Promise.all([Rt(),qe()])}),(t,n)=>{let s=r(`tooltip`);return S(),p(C,null,[f(`div`,ds,[f(`div`,fs,[f(`div`,ps,[i(e(P),{icon:`ti ti-arrow-left`,variant:`text`,rounded:``,onClick:Bt}),d((S(),p(`div`,ms,[f(`i`,{class:g(e(ye)(Re.value,`photo`)),style:{opacity:`0.5`}},null,2),i(e(se),{modelValue:Re.value,"onUpdate:modelValue":n[0]||=e=>Re.value=e,style:{width:`130px`,"font-size":`0.8rem`},placeholder:`ti-building`},null,8,[`modelValue`])])),[[s,e(o)(`scenarioEditor.iconHint`),void 0,{bottom:!0}]]),i(e(se),{modelValue:F.value,"onUpdate:modelValue":n[1]||=e=>F.value=e,class:`scenario-editor__name`,placeholder:e(o)(`scenarioEditor.placeholderName`)},null,8,[`modelValue`,`placeholder`]),i(e(se),{modelValue:ze.value,"onUpdate:modelValue":n[2]||=e=>ze.value=e,class:`scenario-editor__desc`,placeholder:e(o)(`scenarioEditor.placeholderDescription`)},null,8,[`modelValue`,`placeholder`]),n[40]||=f(`div`,{style:{flex:`1`}},null,-1),d(i(e(P),{icon:Ve.value?`ti ti-world`:`ti ti-lock`,severity:Ve.value?`success`:`secondary`,variant:`text`,rounded:``,onClick:n[3]||=e=>Ve.value=!Ve.value},null,8,[`icon`,`severity`]),[[s,Ve.value?e(o)(`scenarioEditor.tooltipUnpublish`):e(o)(`scenarioEditor.tooltipPublish`),void 0,{bottom:!0}]]),d(i(e(P),{icon:`ti ti-device-floppy`,onClick:zt},null,512),[[s,e(o)(`scenarioEditor.tooltipSave`),void 0,{bottom:!0}]])]),f(`div`,hs,[He.value.length>0?(S(),D(e(j),{key:Xe.value,"model-value":Be.value,options:[{label:e(o)(`scenarioEditor.noPreset`),value:void 0},...He.value.map(e=>({label:e.name,value:e.id}))],"option-label":`label`,"option-value":`value`,size:`small`,placeholder:e(o)(`scenarioEditor.noPreset`),class:`scenario-editor__preset-select`,"onUpdate:modelValue":$e},null,8,[`model-value`,`options`,`placeholder`])):A(``,!0),i(e(j),{"model-value":L.value,options:[{label:e(o)(`scenarioEditor.traversalHierarchical`),value:`hierarchical`},{label:e(o)(`scenarioEditor.traversalTopological`),value:`topological`}],"option-label":`label`,"option-value":`value`,size:`small`,disabled:Ue.value!=null&&Ue.value.canChangeTraversalMode===!1,class:`scenario-editor__traversal-select`,"onUpdate:modelValue":Pt},null,8,[`model-value`,`options`,`disabled`]),d(f(`i`,gs,null,512),[[s,{value:e(o)(`scenarioEditor.traversalHelp`),escape:!1},void 0,{bottom:!0}]]),n[43]||=f(`div`,{class:`scenario-editor__toolbar-sep`},null,-1),d(i(e(P),{title:e(R).group,icon:`ti ti-plus`,variant:`text`,size:`small`,severity:`secondary`,label:e(R).group,class:`scenario-editor__toolbar-btn`,onClick:ut},null,8,[`title`,`label`]),[[s,`${e(o)(`actions.add`)} ${e(R).group.toLowerCase()}`,void 0,{bottom:!0}]]),d(i(e(P),{title:e(R).node,icon:`ti ti-plus`,variant:`text`,size:`small`,severity:`secondary`,label:e(R).node,class:`scenario-editor__toolbar-btn`,onClick:Ge},null,8,[`title`,`label`]),[[s,`${e(o)(`actions.add`)} ${e(R).node.toLowerCase()}`,void 0,{bottom:!0}]]),i(e(oe),{ref_key:`addNodePopover`,ref:We},{default:w(()=>[f(`div`,_s,[f(`button`,{class:`add-node-popover__item`,onClick:n[4]||=e=>Ke(`ai`)},[n[41]||=f(`i`,{class:`ti ti-brain`,style:{"font-size":`1.1rem`}},null,-1),f(`div`,vs,[f(`span`,ys,`AI `+T(e(R).node),1),f(`span`,bs,T(e(o)(`scenarioEditor.aiNodeDesc`)),1)])]),f(`button`,{class:`add-node-popover__item`,onClick:n[5]||=e=>Ke(`ask`)},[n[42]||=f(`i`,{class:`ti ti-message`,style:{"font-size":`1.1rem`}},null,-1),f(`div`,xs,[f(`span`,Ss,`Ask `+T(e(R).node),1),f(`span`,Cs,T(e(o)(`scenarioEditor.askNodeDesc`)),1)])])])]),_:1},512),n[44]||=f(`div`,{style:{flex:`1`}},null,-1),d(i(e(P),{icon:`ti ti-sitemap`,variant:`text`,rounded:``,size:`small`,severity:`secondary`,onClick:Nt},null,512),[[s,e(o)(`scenarioEditor.tooltipAutoLayout`),void 0,{bottom:!0}]]),d(i(e(P),{icon:`ti ti-upload`,variant:`text`,rounded:``,size:`small`,severity:`secondary`,onClick:n[6]||=e=>{en.value=!0,tn.value=``,nn.value=``}},null,512),[[s,e(o)(`scenarioEditor.tooltipImport`),void 0,{bottom:!0}]]),d(i(e(P),{icon:`ti ti-download`,variant:`text`,rounded:``,size:`small`,severity:`secondary`,onClick:n[7]||=e=>$t.value=!0},null,512),[[s,e(o)(`scenarioEditor.tooltipExport`),void 0,{bottom:!0}]]),d(i(e(P),{icon:`ti ti-sparkles`,variant:`text`,rounded:``,size:`small`,severity:Vt.value?`contrast`:`secondary`,onClick:n[8]||=e=>Vt.value=!Vt.value},null,8,[`severity`]),[[s,Vt.value?e(o)(`scenarioEditor.tooltipCloseAI`):e(o)(`scenarioEditor.tooltipGenerateAI`),void 0,{bottom:!0}]])])]),f(`div`,ws,[Vt.value?(S(),p(`div`,Ts,[f(`div`,Es,[n[45]||=f(`i`,{class:`ti ti-sparkles`},null,-1),f(`span`,null,T(e(o)(`scenarioEditor.aiPanelTitle`)),1)]),Gt.value>0?(S(),p(`div`,Ds,[f(`label`,Os,T(e(o)(`scenarioEditor.aiProvider`)),1),i(_e,{"input-id":`scened-ai-provider`,modelValue:Kt.value,"onUpdate:modelValue":n[9]||=e=>Kt.value=e,model:qt.value,"onUpdate:model":n[10]||=e=>qt.value=e,"storage-key":`runeya.scenario.generateAi`,"hide-when-single":!1,placeholder:e(o)(`scenarioEditor.aiSelectProvider`),class:`w-full`,disabled:K.value,onLoaded:n[11]||=e=>Gt.value=e},null,8,[`modelValue`,`model`,`placeholder`,`disabled`])])):(S(),p(`div`,ks,[n[46]||=f(`i`,{class:`ti ti-alert-triangle`},null,-1),f(`span`,{innerHTML:e(o)(`scenarioEditor.aiNoProvider`)},null,8,As)])),i(e(pe),{modelValue:Ht.value,"onUpdate:modelValue":n[12]||=e=>Ht.value=e,placeholder:e(o)(`scenarioEditor.aiPromptPlaceholder`),rows:4,class:`scenario-editor__ai-textarea`,disabled:K.value,onKeydown:re(ie(Zt,[`ctrl`]),[`enter`])},null,8,[`modelValue`,`placeholder`,`disabled`,`onKeydown`]),i(e(P),{label:K.value?e(o)(`scenarioEditor.aiGenerating`):B.value.length>0?e(o)(`scenarioEditor.aiModify`):e(o)(`scenarioEditor.aiGenerate`),icon:`ti ti-sparkles`,loading:K.value,disabled:!Ht.value.trim(),class:`scenario-editor__ai-btn`,onClick:Zt},null,8,[`label`,`loading`,`disabled`]),f(`p`,js,T(e(o)(`scenarioEditor.aiHint`)),1),Ut.value||K.value?(S(),p(`div`,Ms,[f(`div`,Ns,[K.value?(S(),p(`i`,Ps)):Yt.value?(S(),p(`i`,Fs)):(S(),p(`i`,Is)),f(`span`,null,T(K.value?e(o)(`scenarioEditor.aiGenerating`):Yt.value?e(o)(`scenarioEditor.aiValidJson`):e(o)(`scenarioEditor.aiRawResponse`)),1)]),f(`pre`,Ls,T(Ut.value),1)])):A(``,!0),Wt.value?(S(),p(`div`,Rs,[n[47]||=f(`i`,{class:`ti ti-circle-x`},null,-1),a(` `+T(Wt.value),1)])):A(``,!0),Yt.value?(S(),D(e(P),{key:4,label:e(o)(`scenarioEditor.aiApply`),icon:`ti ti-check`,severity:`success`,class:`scenario-editor__ai-btn`,onClick:Qt},null,8,[`label`])):A(``,!0)])):A(``,!0),f(`div`,{class:`scenario-editor__canvas`,tabindex:`0`,onKeydown:Me},[i(e(je),{nodes:ot.value,edges:lt.value,"nodes-draggable":!0,"nodes-connectable":!0,"elements-selectable":!0,"delete-key-code":null,"fit-view-on-init":``,id:fc,class:`scenario-flow-canvas`,onNodeDragStop:Et,onNodeClick:kt,onEdgeClick:Ot,onPaneClick:n[13]||=e=>{V.value=void 0,H.value=void 0,G.value=void 0},onConnect:At,onNodesChange:Tt,onEdgesChange:wt},{"node-default":w(e=>[i(Pe,te(ne(e)),null,16)]),"node-group":w(e=>[i(Ie,_(e,{onUpdateLabel:St,onResizeEnd:Ct,onRemove:mt}),null,16)]),default:w(()=>[i(e(nt)),i(e(Oo))]),_:1},8,[`nodes`,`edges`])],32),i(ae,{name:`drawer`},{default:w(()=>[H.value||V.value?(S(),p(`div`,zs,[f(`div`,Bs,[f(`i`,{class:g([H.value?`ti ti-users`:`ti ti-brain`,`detail-header__icon`])},null,2),f(`span`,Vs,T(H.value?e(R).group:e(R).node),1),i(e(P),{icon:`ti ti-x`,variant:`text`,rounded:``,size:`small`,class:`detail-header__close`,onClick:n[14]||=e=>{H.value=void 0,V.value=void 0}})]),H.value&&z.value.find(e=>e.id===H.value)?(S(),p(C,{key:0},[f(`div`,Hs,[f(`div`,Us,[f(`label`,Ws,T(e(o)(`scenarioEditor.groupName`)),1),i(e(se),{id:`scened-group-name`,"model-value":z.value.find(e=>e.id===H.value).name,class:`w-full`,size:`small`,"onUpdate:modelValue":n[15]||=e=>W(H.value,{name:e})},null,8,[`model-value`])]),f(`div`,Gs,[f(`label`,Ks,T(e(o)(`scenarioEditor.groupDescription`)),1),i(e(pe),{id:`scened-group-desc`,"model-value":z.value.find(e=>e.id===H.value).description??``,class:`w-full`,placeholder:e(o)(`scenarioEditor.groupDescriptionPlaceholder`),rows:`3`,"auto-resize":``,style:{resize:`none`},"onUpdate:modelValue":n[16]||=e=>W(H.value,{description:e||void 0})},null,8,[`model-value`,`placeholder`])]),f(`div`,qs,[f(`label`,Js,T(e(o)(`scenarioEditor.groupAccentColor`)),1),f(`div`,Ys,[i(e(ue),{id:`scened-group-color`,"model-value":(z.value.find(e=>e.id===H.value).color??`#6366f1`).replace(/^#/,``),"onUpdate:modelValue":n[17]||=e=>W(H.value,{color:`#${e}`})},null,8,[`model-value`]),i(e(se),{"model-value":z.value.find(e=>e.id===H.value).color??``,placeholder:`#6366f1`,size:`small`,class:`detail-color-text`,"onUpdate:modelValue":n[18]||=e=>W(H.value,{color:e||void 0})},null,8,[`model-value`]),z.value.find(e=>e.id===H.value).color?d((S(),D(e(P),{key:0,icon:`ti ti-x`,variant:`text`,rounded:``,size:`small`,severity:`secondary`,onClick:n[19]||=e=>W(H.value,{color:void 0})},null,512)),[[s,e(o)(`scenarioEditor.groupResetColor`)]]):A(``,!0)])])]),f(`div`,Xs,[i(e(P),{label:`${e(o)(`actions.delete`)} ${e(R).group.toLowerCase()}`,icon:`ti ti-trash`,severity:`danger`,variant:`outlined`,size:`small`,class:`w-full`,onClick:n[20]||=e=>mt(H.value)},null,8,[`label`])])],64)):V.value&&B.value.find(e=>e.id===V.value)?(S(),p(C,{key:1},[(S(),D(us,{key:V.value,node:B.value.find(e=>e.id===V.value),groups:z.value,nodes:B.value,"leader-id":I.value,preset:Ue.value,"traversal-mode":L.value,onUpdate:Ft,onDelete:It,onSetLeader:n[21]||=e=>I.value=e},null,8,[`node`,`groups`,`nodes`,`leader-id`,`preset`,`traversal-mode`])),V.value===I.value?A(``,!0):(S(),p(`div`,Zs,[i(e(P),{label:`${e(o)(`actions.delete`)} ${e(R).node.toLowerCase()}`,icon:`ti ti-trash`,severity:`danger`,variant:`outlined`,size:`small`,class:`w-full`,onClick:n[22]||=e=>It(V.value)},null,8,[`label`])]))],64)):A(``,!0)])):A(``,!0)]),_:1})])]),i(e(M),{visible:ee.value,"onUpdate:visible":n[24]||=e=>ee.value=e,header:e(o)(`scenarioEditor.multiParentNoticeTitle`),modal:``,style:{width:`420px`}},{footer:w(()=>[i(e(P),{label:e(o)(`actions.ok`),onClick:jt},null,8,[`label`])]),default:w(()=>[f(`p`,Qs,T(e(o)(`scenarioEditor.multiParentNoticeMessage`)),1),f(`div`,$s,[i(e(ce),{modelValue:O.value,"onUpdate:modelValue":n[23]||=e=>O.value=e,binary:``,"input-id":`dontShowAgain`},null,8,[`modelValue`]),f(`label`,ec,T(e(o)(`scenarioEditor.dontShowAgain`)),1)])]),_:1},8,[`visible`,`header`]),i(e(M),{visible:dt.value,"onUpdate:visible":n[27]||=e=>dt.value=e,header:e(o)(`scenarioEditor.deleteGroupTitle`),modal:``,style:{width:`380px`}},{footer:w(()=>[i(e(P),{label:e(o)(`actions.cancel`),variant:`text`,onClick:n[25]||=e=>dt.value=!1},null,8,[`label`]),i(e(P),{label:e(o)(`actions.delete`),severity:`danger`,onClick:n[26]||=()=>{dt.value=!1,ht(ft.value)}},null,8,[`label`])]),default:w(()=>[f(`p`,tc,T(e(o)(`scenarioEditor.deleteGroupMessage`,{count:pt.value})),1)]),_:1},8,[`visible`,`header`]),i(e(M),{visible:u.value,"onUpdate:visible":n[30]||=e=>u.value=e,header:e(o)(`scenarioEditor.switchToHierarchicalTitle`),modal:``,style:{width:`400px`}},{footer:w(()=>[i(e(P),{label:e(o)(`actions.cancel`),variant:`text`,onClick:n[28]||=e=>u.value=!1},null,8,[`label`]),i(e(P),{label:e(o)(`actions.confirm`),severity:`danger`,onClick:n[29]||=()=>{u.value=!1,L.value=`hierarchical`,Mt()}},null,8,[`label`])]),default:w(()=>[f(`p`,nc,T(e(o)(`scenarioEditor.switchToHierarchicalMessage`)),1),f(`ul`,rc,[(S(!0),p(C,null,m(b.value,e=>(S(),p(`li`,{key:`${e.from}-${e.to}`},[f(`span`,ic,T(e.from),1),n[48]||=f(`i`,{class:`ti ti-arrow-right switch-dialog__arrow`},null,-1),f(`span`,ac,T(e.to),1)]))),128))])]),_:1},8,[`visible`,`header`]),i(e(M),{visible:rt.value,"onUpdate:visible":n[33]||=e=>rt.value=e,header:it.value===`ask`?`${e(o)(`actions.add`)} Ask ${e(R).node}`:`${e(o)(`actions.add`)} AI ${e(R).node}`,modal:``,style:{width:`360px`}},{footer:w(()=>[i(e(P),{label:e(o)(`actions.cancel`),severity:`secondary`,variant:`text`,onClick:n[32]||=e=>rt.value=!1},null,8,[`label`]),i(e(P),{label:e(o)(`actions.add`),icon:`ti ti-user-plus`,disabled:!U.value,onClick:yt},null,8,[`label`,`disabled`])]),default:w(()=>[f(`div`,oc,[f(`label`,sc,[a(T(e(R).group)+` `,1),n[49]||=f(`span`,{class:`required`},`*`,-1)]),i(e(j),{"input-id":`scened-add-node-group`,modelValue:U.value,"onUpdate:modelValue":n[31]||=e=>U.value=e,options:z.value.map(e=>({label:e.name,value:e.id})),"option-label":`label`,"option-value":`value`,placeholder:`${e(o)(`actions.add`)} ${e(R).group.toLowerCase()}`,class:`w-full`},null,8,[`modelValue`,`options`,`placeholder`])])]),_:1},8,[`visible`,`header`]),i(e(M),{visible:$t.value,"onUpdate:visible":n[35]||=e=>$t.value=e,header:e(o)(`scenarioEditor.exportHeader`),modal:``,"dismissable-mask":``,style:{width:`600px`}},{footer:w(()=>[i(e(P),{label:e(o)(`scenarioEditor.copyJson`),icon:`ti ti-copy`,onClick:an},null,8,[`label`]),i(e(P),{label:e(o)(`actions.close`),severity:`secondary`,variant:`text`,onClick:n[34]||=e=>$t.value=!1},null,8,[`label`])]),default:w(()=>[f(`pre`,cc,T(rn.value),1)]),_:1},8,[`visible`,`header`]),i(e(M),{visible:en.value,"onUpdate:visible":n[38]||=e=>en.value=e,header:e(o)(`scenarioEditor.importHeader`),modal:``,style:{width:`600px`}},{footer:w(()=>[i(e(P),{label:e(o)(`actions.cancel`),severity:`secondary`,variant:`text`,onClick:n[37]||=e=>en.value=!1},null,8,[`label`]),i(e(P),{label:e(o)(`actions.apply`),icon:`ti ti-check`,disabled:!tn.value.trim(),onClick:sn},null,8,[`label`,`disabled`])]),default:w(()=>[i(e(pe),{modelValue:tn.value,"onUpdate:modelValue":n[36]||=e=>tn.value=e,rows:`12`,class:`w-full`,placeholder:e(o)(`scenarioEditor.importPlaceholder`)},null,8,[`modelValue`,`placeholder`]),nn.value?(S(),p(`p`,lc,T(nn.value),1)):A(``,!0)]),_:1},8,[`visible`,`header`]),i(e(M),{visible:Je.value,"onUpdate:visible":n[39]||=e=>Je.value=e,header:e(o)(`scenarioEditor.applyPresetHeader`),modal:``,style:{width:`400px`}},{footer:w(()=>[i(e(P),{label:e(o)(`actions.cancel`),severity:`secondary`,variant:`text`,onClick:tt},null,8,[`label`]),i(e(P),{label:e(o)(`scenarioEditor.applyPresetConfirm`),icon:`ti ti-refresh`,severity:`warn`,onClick:et},null,8,[`label`])]),default:w(()=>[f(`p`,uc,T(e(o)(`scenarioEditor.applyPresetMessage`)),1)]),_:1},8,[`visible`,`header`])],64)}}}),[[`__scopeId`,`data-v-85fe37a4`]]);export{yc as default};
@@ -1 +0,0 @@
1
- .runeya-mark[data-v-26765fd2]{color:var(--r-primary);filter:drop-shadow(0 6px 14px color-mix(in srgb, var(--r-primary) 35%, transparent));display:block}.version-badge[data-v-f94beae8]{z-index:10;border:1px solid var(--r-border);background:var(--r-bg);color:var(--r-text-muted);opacity:.8;pointer-events:none;-webkit-user-select:none;user-select:none;border-radius:999px;padding:.2rem .55rem;font-size:.75rem;font-weight:500;line-height:1;position:fixed;bottom:1rem;right:1rem}
@@ -1 +0,0 @@
1
- import{C as e}from"./reactivity.esm-bundler-BQ9SB2vv.js";import{_ as t,b as n,ct as r,k as i,mt as a,rn as o,y as s}from"./runtime-core.esm-bundler-DujKY9QV.js";import{ft as c}from"./src-Ds4DOFJs.js";import{r as l}from"./trpc-BFA-mSM8.js";var u=[`width`,`height`],d=c(i({__name:`RuneyaMark`,props:{size:{default:40}},setup(e){return(r,i)=>(a(),n(`svg`,{class:`runeya-mark`,viewBox:`0 0 28 28`,width:e.size,height:e.size,"aria-hidden":`true`},[...i[0]||=[t(`rect`,{width:`28`,height:`28`,rx:`8`,fill:`currentColor`},null,-1),t(`path`,{d:`M7 20 L14 8 L21 20`,stroke:`white`,"stroke-width":`2.5`,fill:`none`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,-1),t(`path`,{d:`M10 16 L18 16`,stroke:`white`,"stroke-width":`2.5`,"stroke-linecap":`round`},null,-1)]],8,u))}}),[[`__scopeId`,`data-v-26765fd2`]]),f={key:0,class:`version-badge`,"data-testid":`version-badge`},p=c(i({__name:`VersionBadge`,setup(t){let i=e(``);return r(()=>{l.health.check.query().then(e=>{i.value=e.version}).catch(()=>{})}),(e,t)=>i.value?(a(),n(`span`,f,`v`+o(i.value),1)):s(``,!0)}}),[[`__scopeId`,`data-v-f94beae8`]]);export{d as n,p as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CXnyET_X.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/reactivity.esm-bundler-BQ9SB2vv.js","assets/runtime-core.esm-bundler-DujKY9QV.js","assets/floating-ui.dom-DWhsZyqT.js","assets/src-Ds4DOFJs.js","assets/src-CR9xphzo.css","assets/project-launch.store-cO8Wr508.js","assets/trpc-BFA-mSM8.js","assets/preload-helper-BZ1Pz5am.js","assets/i18n-m0G6Pfwe.js","assets/useApi-s_02lHjl-DZYO2tHU.js","assets/vue-router-fin80h5W.js","assets/scenario.store-B5uv1DSO.js","assets/project.store-CpUEwUgF.js","assets/error-DpF7X5iu.js","assets/use-polling-CEkhIY_9.js","assets/useAiChatDrawer-D_ofn8Eo.js","assets/settings-scope-CcYu-GYo.js","assets/dist-DoChtT9t.js","assets/schemas-68I2iCLF.js","assets/service.store-ve_P4_2O.js","assets/scenario-DOeZsRCE.css","assets/cloud-auth-D_am4FlK.js","assets/useProjectCatalog-1vLcCQlh.js","assets/cloud-session-ByODsQrA.js","assets/cloud-client-CmrptmtM.js","assets/AiChatModals-CVZ5ilmt.js","assets/editor.api-Bef3xeth.js","assets/editor-8AbsNvUX.css","assets/toggleHighContrast-Dqz1Qao1.js","assets/toggleHighContrast--ixms01u.css","assets/register-BLGIM2pN.js","assets/agent.store-CEmOZ8XE.js","assets/AiChatModals-EfRuvId7.css","assets/vue-draggable-plus-SmOauPHy.js","assets/editor.store-Be5P5Eur.js","assets/vue-draggable-plus-2Opxvs3C.css","assets/process-BWkHpZOM.js","assets/theme-CPaZfI9r.js","assets/index-Dsh11_J0.css"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-BZ1Pz5am.js";var t=`runeya:jwt`;function n(n){sessionStorage.setItem(t,n),e(async()=>{let{announceThemeToServer:e}=await import(`./index-CXnyET_X.js`).then(e=>e.t);return{announceThemeToServer:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40])).then(({announceThemeToServer:e})=>e())}function r(){return sessionStorage.getItem(t)}function i(){sessionStorage.removeItem(t)}var a=!1;function o(e){a=e}function s(){return r()!==null||a}async function c(){let e=await fetch(`/api/status`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)throw Error(`Failed to fetch server status`);return e.json()}async function l(e){let t=r(),n=await fetch(`/api/migrate-vault`,{method:`POST`,headers:{"Content-Type":`application/json`,...t?{Authorization:`Bearer ${t}`}:{}},body:JSON.stringify({masterPassword:e}),signal:AbortSignal.timeout(12e4)}),i=await n.json().catch(()=>null);if(!n.ok)throw Error(i?.error??`La migration a échoué`);return i}async function u(e){let t=await fetch(`/api/unlock`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({masterPassword:e}),signal:AbortSignal.timeout(3e4)});if(t.status===429)throw Error(`Trop de tentatives. Réessayez dans 15 minutes.`);if(t.status===401)throw Error(`Master password incorrect`);if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Erreur serveur`)}return(await t.json()).token}async function d(e,t){let n={masterPassword:e};t&&(n.encryptionKey=t);let r=await fetch(`/api/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n),signal:AbortSignal.timeout(3e4)});if(r.status===429)throw Error(`Trop de tentatives. Réessayez dans 15 minutes.`);if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`Erreur serveur`)}return(await r.json()).token}export{o as a,u as c,s as i,l,c as n,n as o,r,d as s,i as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/cloud-client-CmrptmtM.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/trpc-BFA-mSM8.js","assets/reactivity.esm-bundler-BQ9SB2vv.js","assets/runtime-core.esm-bundler-DujKY9QV.js","assets/preload-helper-BZ1Pz5am.js","assets/auth-BpxI0N26.js"])))=>i.map(i=>d[i]);
2
- import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{C as t}from"./reactivity.esm-bundler-BQ9SB2vv.js";import{Ht as n,g as r}from"./runtime-core.esm-bundler-DujKY9QV.js";import{n as i}from"./project-launch.store-cO8Wr508.js";import{r as a}from"./trpc-BFA-mSM8.js";import{t as o}from"./preload-helper-BZ1Pz5am.js";import{n as s}from"./project.store-CpUEwUgF.js";var c=e({listCloudOrganizations:()=>w,resolvedAccountId:()=>v,useCloudSession:()=>D}),l=t([]),u=t({}),d=t(!1),f=t(!1),p=t(null),m=t(null),h=!1;function g(e){return e?{id:e.userId,name:e.name,email:e.email,image:e.image}:null}var _=r(()=>l.value.find(e=>e.id===m.value)??null);async function v(){for(let e=0;b&&e<5;e++)await b;return _.value?.id??null}async function y(){d.value=!0;try{let e=await a.cloudAuth.accounts.query();l.value=e.accounts,u.value=e.orgAccounts;let t=l.value.filter(e=>!e.userId);if(t.length>0){await Promise.all(t.map(e=>a.cloudAuth.session.query({accountId:e.id}).catch(()=>null)));let e=await a.cloudAuth.accounts.query();l.value=e.accounts,u.value=e.orgAccounts}}catch{l.value=[],u.value={}}finally{d.value=!1,f.value=!0}}var b=null;async function x(){let e=p.value;if(!e){m.value=null;return}try{let{accountId:t}=await a.cloudAuth.accountForOrg.query({orgId:e});p.value===e&&(m.value=t)}catch{p.value===e&&(m.value=null)}}function S(){b=x().finally(()=>{b=null})}function C(){if(h)return;let e=s(),t=i();h=!0,n(()=>t.activeOrgId??e.currentProjectOrgId,e=>{p.value=e??null,S()},{immediate:!0})}async function w(){let{cloudClient:e}=await o(async()=>{let{cloudClient:e}=await import(`./cloud-client-CmrptmtM.js`).then(e=>e.i);return{cloudClient:e}},__vite__mapDeps([0,1,2,3,4,5,6]));!f.value&&!d.value&&await y();let t=0,n=await Promise.all(l.value.map(async n=>{try{let r=await e.organization.list(n.id);return r.error?(t++,[]):(r.data??[]).map(e=>({...e,accountId:n.id}))}catch{return t++,[]}}));if(t>0&&t===l.value.length)throw Error(`CLOUD_ORGS_UNREACHABLE`);let r=n.flat();return r.length>0&&a.cloudSync.rememberOrgAccounts.mutate({orgs:r.map(e=>({orgId:e.id,accountId:e.accountId}))}).then(()=>(S(),b)).catch(()=>{}),r}async function T(){let{url:e}=await a.cloudAuth.startLogin.mutate({returnTo:window.location.origin});window.location.href=e}async function E(e){let t=e??_.value?.id;t&&(await a.cloudAuth.signOut.mutate({accountId:t}),await y())}function D(){return!f.value&&!d.value&&y(),C(),{user:r(()=>g(_.value??void 0)),accounts:l,orgAccounts:u,currentAccount:_,loading:d,isLinked:r(()=>l.value.length>0),activeOrgId:r(()=>p.value),refresh:y,signIn:T,signOut:E}}export{w as n,D as r,c as t};