@cline/cli-linux-arm64 3.0.60 → 3.0.61

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 (125) hide show
  1. package/bin/cline +0 -0
  2. package/cline-hub/webview/assets/Chat-nhlJdFjI.js +342 -0
  3. package/cline-hub/webview/assets/abnfDiagram-N423BO3Z-CA3n4CVB.js +1 -0
  4. package/cline-hub/webview/assets/architectureDiagram-T3A2C74G-BGNrlwUL.js +36 -0
  5. package/cline-hub/webview/assets/badge-X4W3Q0cc.js +1 -0
  6. package/cline-hub/webview/assets/{blockDiagram-677ZJIJ3-CHD_J6RY.js → blockDiagram-VBNYF7ZC-CvIo5nET.js} +1 -1
  7. package/cline-hub/webview/assets/{c4Diagram-LMCZKHZV-ClmFYV3g.js → c4Diagram-5PPSVZJV-B91Sv2Na.js} +1 -1
  8. package/cline-hub/webview/assets/channel-Cn9dB4WD.js +1 -0
  9. package/cline-hub/webview/assets/{chunk-32BRIVSS-7roN4V45.js → chunk-2GRJ4B5K-u4MGLwtv.js} +1 -1
  10. package/cline-hub/webview/assets/{chunk-HOUHSVGY-B04R_umg.js → chunk-4I5QYGJK-0RNwvBrV.js} +1 -1
  11. package/cline-hub/webview/assets/{chunk-EX3LRPZG-Cy_TQpzv.js → chunk-5RXB4S5H-BHjkdRhh.js} +1 -1
  12. package/cline-hub/webview/assets/{chunk-MOJQB5TN-B_gKeTxM.js → chunk-6Q2QTUOP-CLgL8rxg.js} +1 -1
  13. package/cline-hub/webview/assets/{chunk-52WLFC77-DEfoFGdq.js → chunk-7Z6QIM7H-C6_Ywz3w.js} +1 -1
  14. package/cline-hub/webview/assets/{chunk-V7JOEXUC-BMNa01wQ.js → chunk-GF5L2VYU-iIVxDVKm.js} +1 -1
  15. package/cline-hub/webview/assets/chunk-I66GZJ75-DXqP3B91.js +126 -0
  16. package/cline-hub/webview/assets/{chunk-PUDLZKDR-C6jX_SVA.js → chunk-JQJVKLGR-CmK9TOTe.js} +2 -2
  17. package/cline-hub/webview/assets/{chunk-VR4S4FIN-NuklvPa4.js → chunk-KBJHAD2P-L-89C026.js} +1 -1
  18. package/cline-hub/webview/assets/{chunk-ICXQ74PX-BSKRMyFr.js → chunk-NSK5VX7P-D5026Kzu.js} +1 -1
  19. package/cline-hub/webview/assets/{chunk-ZGVPDNZ5-CeJ5hUbe.js → chunk-QR6OTTB3-DgKOIk7B.js} +1 -1
  20. package/cline-hub/webview/assets/{chunk-OGEWGWER-CR4zh_DV.js → chunk-UBXNYLIW-DzzRI8B_.js} +1 -1
  21. package/cline-hub/webview/assets/{chunk-C7G6YPKG-DBhUCKu7.js → chunk-W5SLKNZC-jIqX_Eb5.js} +1 -1
  22. package/cline-hub/webview/assets/{chunk-Q4XR5HBZ-DkRpWOkn.js → chunk-WRU74C26-BSENSjFs.js} +1 -1
  23. package/cline-hub/webview/assets/classDiagram-JCYQIIEL-BMEETwfQ.js +1 -0
  24. package/cline-hub/webview/assets/classDiagram-v2-OCEON4UE-BMEETwfQ.js +1 -0
  25. package/cline-hub/webview/assets/{cose-bilkent-JH36ORCC-0-dytQ64.js → cose-bilkent-JH36ORCC-DFv1GHTs.js} +1 -1
  26. package/cline-hub/webview/assets/cynefinDiagram-MW4NZA55-CIoeFR2b.js +62 -0
  27. package/cline-hub/webview/assets/{dagre-VKFMJZFB-C3zd729J.js → dagre-VZM6K2ZE-CXd9m4cA.js} +1 -1
  28. package/cline-hub/webview/assets/{diagram-OA4YK3LP-Bj--3hBp.js → diagram-7IWD3JNH-CgiYOAGC.js} +3 -3
  29. package/cline-hub/webview/assets/{diagram-FQU43EPY-vHaV1X0k.js → diagram-B4RE2ZJO-i1LZz3qn.js} +1 -1
  30. package/cline-hub/webview/assets/diagram-LBJQPF4R-GOvZ7wow.js +24 -0
  31. package/cline-hub/webview/assets/diagram-Q27KOJAE-C-x1hqFU.js +24 -0
  32. package/cline-hub/webview/assets/diagram-UB23O5K3-Ds1emBxU.js +41 -0
  33. package/cline-hub/webview/assets/ebnfDiagram-BXEA7PRR-Bmu-47tU.js +1 -0
  34. package/cline-hub/webview/assets/{erDiagram-Q63AITRT-BYUDNAG5.js → erDiagram-JOGREHBK--TO8WYZl.js} +1 -1
  35. package/cline-hub/webview/assets/extensions-view-SuauWCKD.js +1 -0
  36. package/cline-hub/webview/assets/flowDiagram-UKHOOZJN-epuPN-mi.js +1 -0
  37. package/cline-hub/webview/assets/{ganttDiagram-NO4QXBWP-XEhvpkHf.js → ganttDiagram-PKOTCBZU-BJMCqdx8.js} +1 -1
  38. package/cline-hub/webview/assets/{gitGraphDiagram-IHSO6WYX-2WUvHlRx.js → gitGraphDiagram-DS77QQ5N-CFngxqjY.js} +1 -1
  39. package/cline-hub/webview/assets/highlighted-body-KPVGNVTW-C38puTq_.js +1 -0
  40. package/cline-hub/webview/assets/index-BH5QAVsD.css +1 -0
  41. package/cline-hub/webview/assets/index-Lryt7pNP.js +10 -0
  42. package/cline-hub/webview/assets/infoDiagram-6WML65LV-HYF3E1dT.js +2 -0
  43. package/cline-hub/webview/assets/{ishikawaDiagram-FXEZZL3T-Bt1KHIH7.js → ishikawaDiagram-WSZJBQD7-BXMe4UcZ.js} +2 -2
  44. package/cline-hub/webview/assets/{journeyDiagram-5HDEW3XC-BVfSAExa.js → journeyDiagram-NVQOT4AX-CRKFmsae.js} +1 -1
  45. package/cline-hub/webview/assets/{kanban-definition-HUTT4EX6-CdFpXq3T.js → kanban-definition-27J2QSJJ-fGza5kV5.js} +4 -4
  46. package/cline-hub/webview/assets/label-CfYx7R2D.js +76 -0
  47. package/cline-hub/webview/assets/{line-Zi3iUihi.js → line-BImJQVif.js} +1 -1
  48. package/cline-hub/webview/assets/mermaid-HWGCJPDP-B2eHIVs6.js +1 -0
  49. package/cline-hub/webview/assets/{mermaid-layout-C2x7inlt.js → mermaid-layout-CGd-uY3x.js} +1 -1
  50. package/cline-hub/webview/assets/mermaid-markup-D01n6Kcj.js +259 -0
  51. package/cline-hub/webview/assets/mermaid-parser-B74RvNk1.js +3 -0
  52. package/cline-hub/webview/assets/mermaid-parser-ByV-ZOdd.js +1 -0
  53. package/cline-hub/webview/assets/mermaid-parser-C2jETkNP.js +2 -0
  54. package/cline-hub/webview/assets/mermaid-parser-C3SJa12Y.js +1 -0
  55. package/cline-hub/webview/assets/mermaid-parser-CFqrADy2.js +4 -0
  56. package/cline-hub/webview/assets/mermaid-parser-CiEp2wH6.js +1 -0
  57. package/cline-hub/webview/assets/{mermaid-parser-BICK3FdT.js → mermaid-parser-DHwB1DNv.js} +2 -2
  58. package/cline-hub/webview/assets/mermaid-parser-DgB__rYs.js +1 -0
  59. package/cline-hub/webview/assets/mermaid.core-CNhdxt2h.js +42 -0
  60. package/cline-hub/webview/assets/{mindmap-definition-LN4V7U3C-BivXsx29.js → mindmap-definition-FAOFIHXS-CSIdPH6Q.js} +1 -1
  61. package/cline-hub/webview/assets/pegDiagram-VL7TDLO6-C6mMcz9U.js +1 -0
  62. package/cline-hub/webview/assets/{pieDiagram-ENE6RG2P-DkDm2qZ7.js → pieDiagram-7S7Q4E2Y-_Em6O_U1.js} +2 -2
  63. package/cline-hub/webview/assets/{quadrantDiagram-ABIIQ3AL-oKoCSLjB.js → quadrantDiagram-CIZ2JOQS-DAUZ-M5i.js} +1 -1
  64. package/cline-hub/webview/assets/railroadDiagram-AXF67PYL-D-nONgIY.js +1 -0
  65. package/cline-hub/webview/assets/{requirementDiagram-TGXJPOKE-XKSjP20t.js → requirementDiagram-LRYGKXZP--TyKFbQR.js} +1 -1
  66. package/cline-hub/webview/assets/{sankeyDiagram-HTMAVEWB-Bj74CCDT.js → sankeyDiagram-W5VNT64P-D_L0wHGo.js} +1 -1
  67. package/cline-hub/webview/assets/{sequenceDiagram-DBY2YBRQ-D-rKANAQ.js → sequenceDiagram-SI44F4Z6-DQZqzwJM.js} +2 -2
  68. package/cline-hub/webview/assets/settings-view-D6D49OyW.js +1 -0
  69. package/cline-hub/webview/assets/stateDiagram-OKZ733FA-CRrKMpks.js +1 -0
  70. package/cline-hub/webview/assets/stateDiagram-v2-UEYNNEHI-gzRtUcKB.js +1 -0
  71. package/cline-hub/webview/assets/{swimlanes-5IMT3BWC-C3eLBK2s.js → swimlanes-SLNWSIFB-z7E3j6mU.js} +1 -1
  72. package/cline-hub/webview/assets/swimlanesDiagram-ULZ7WXOC-eylwAnWt.js +8 -0
  73. package/cline-hub/webview/assets/switch-DrjcFF6_.js +1 -0
  74. package/cline-hub/webview/assets/{timeline-definition-FHXFAJF6-B7v7GMSp.js → timeline-definition-Z64GVDOM-s7-rEymV.js} +1 -1
  75. package/cline-hub/webview/assets/{vennDiagram-L72KCM5P-CTNU0xJq.js → vennDiagram-T6HMQDX7-HuTwN2dY.js} +2 -2
  76. package/cline-hub/webview/assets/{vscode-2dRY2WFo.js → vscode-CFosRdBr.js} +1 -1
  77. package/cline-hub/webview/assets/{wardleyDiagram-EHGQE667-B1h41ZEX.js → wardleyDiagram-T6FBY63Y-BG9WRwXn.js} +2 -2
  78. package/cline-hub/webview/assets/{xychartDiagram-FW5EYKEG--ZLgcMtO.js → xychartDiagram-ELKLHX3M-C0kPny3I.js} +3 -3
  79. package/cline-hub/webview/assets/zap-BF3XOCN3.js +1 -0
  80. package/cline-hub/webview/index.html +3 -4
  81. package/package.json +1 -1
  82. package/cline-hub/webview/assets/Chat-D1yFEsnx.js +0 -201
  83. package/cline-hub/webview/assets/DialogTitle-BqajMDIm.js +0 -1
  84. package/cline-hub/webview/assets/abnfDiagram-VRR7QNED-Be9ivyLF.js +0 -1
  85. package/cline-hub/webview/assets/architectureDiagram-ZJ3FMSHR-BDsKCTs4.js +0 -36
  86. package/cline-hub/webview/assets/badge-6HhkS3z9.js +0 -1
  87. package/cline-hub/webview/assets/channel-BIC0YCzT.js +0 -1
  88. package/cline-hub/webview/assets/chunk-BO2N2NFS-BsZ82u-z.js +0 -131
  89. package/cline-hub/webview/assets/chunk-FWX5IMBZ-DO4vTS0i.js +0 -2
  90. package/cline-hub/webview/assets/chunk-VAUOI2AC-DC6y0Pon.js +0 -1
  91. package/cline-hub/webview/assets/chunk-WYO6CB5R-Ht1kfqSA.js +0 -126
  92. package/cline-hub/webview/assets/chunk-ZIRB5QZD-O39ZBUk3.js +0 -32
  93. package/cline-hub/webview/assets/classDiagram-OUVF2IWQ-Dsa9aGWZ.js +0 -1
  94. package/cline-hub/webview/assets/classDiagram-v2-EOCWNBFH-Dsa9aGWZ.js +0 -1
  95. package/cline-hub/webview/assets/cynefinDiagram-TSTJHNR4-CM3Cb0zD.js +0 -62
  96. package/cline-hub/webview/assets/desktop-client-BzJm9_zB.js +0 -1
  97. package/cline-hub/webview/assets/diagram-G47NLZAW-3CFUWxkm.js +0 -24
  98. package/cline-hub/webview/assets/diagram-NH7WQ7WH-knhXCIYS.js +0 -24
  99. package/cline-hub/webview/assets/diagram-WEI45ONY-CU1ul1cq.js +0 -41
  100. package/cline-hub/webview/assets/ebnfDiagram-CCIWWBDH-CO67IabF.js +0 -1
  101. package/cline-hub/webview/assets/extensions-view-CrNdCNmP.js +0 -1
  102. package/cline-hub/webview/assets/flowDiagram-23GEKE2U-DB8ijrFq.js +0 -1
  103. package/cline-hub/webview/assets/highlighted-body-OFNGDK62-D1t0OvrR.js +0 -1
  104. package/cline-hub/webview/assets/index-aYt5DmxH.js +0 -10
  105. package/cline-hub/webview/assets/index-eMmOF_mm.css +0 -1
  106. package/cline-hub/webview/assets/infoDiagram-FWYZ7A6U-BuLkUwbh.js +0 -2
  107. package/cline-hub/webview/assets/label-DySiNulg.js +0 -76
  108. package/cline-hub/webview/assets/mermaid-GHXKKRXX-Ckyoy2Mi.js +0 -1
  109. package/cline-hub/webview/assets/mermaid-markup-4KnljNms.js +0 -259
  110. package/cline-hub/webview/assets/mermaid-parser-B5dtuYEh.js +0 -2
  111. package/cline-hub/webview/assets/mermaid-parser-BYr1RLu9.js +0 -3
  112. package/cline-hub/webview/assets/mermaid-parser-Bd5X_psc.js +0 -1
  113. package/cline-hub/webview/assets/mermaid-parser-CUdSKy0R.js +0 -1
  114. package/cline-hub/webview/assets/mermaid-parser-DL14msmj.js +0 -1
  115. package/cline-hub/webview/assets/mermaid-parser-DMx__WIl.js +0 -1
  116. package/cline-hub/webview/assets/mermaid-parser-Dp5WGUCu.js +0 -1
  117. package/cline-hub/webview/assets/mermaid-parser-u_Yu50JG.js +0 -4
  118. package/cline-hub/webview/assets/mermaid.core-gn7g72XA.js +0 -11
  119. package/cline-hub/webview/assets/pegDiagram-2B236MQR-B3bct9eT.js +0 -1
  120. package/cline-hub/webview/assets/railroadDiagram-RFXS5EU6-vFIfQEnq.js +0 -1
  121. package/cline-hub/webview/assets/settings-view-snjUAWHF.js +0 -1
  122. package/cline-hub/webview/assets/stateDiagram-2N3HPSRC-B1gVQY9Z.js +0 -1
  123. package/cline-hub/webview/assets/stateDiagram-v2-6OUMAXLB-BAbYfZMc.js +0 -1
  124. package/cline-hub/webview/assets/swimlanesDiagram-G3AALYLV-BiyLi762.js +0 -8
  125. package/cline-hub/webview/assets/switch-CsW_9J9M.js +0 -1
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-BY_WSiz7.js";import{A as r,F as i,G as a,H as o,K as s,O as c,U as l,a as u,b as d,c as f,i as p,r as m,s as h,v as g,w as _,x as v,y,z as b}from"./chunk-WYO6CB5R-Ht1kfqSA.js";import{t as x}from"./dist-BDCdLWk4.js";import{g as S,p as C}from"./chunk-ICXQ74PX-BSKRMyFr.js";import{a as w,c as T,i as E,n as D,r as O,s as k}from"./chunk-32BRIVSS-7roN4V45.js";import{t as A}from"./chunk-2Q5K7J3B-C1jixKkw.js";import{n as j,t as M}from"./chunk-ZIRB5QZD-O39ZBUk3.js";var N=x(),P=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,2],r=[1,3],i=[1,4],a=[2,4],o=[1,9],s=[1,11],c=[1,12],l=[1,14],u=[1,15],d=[1,17],f=[1,18],p=[1,19],m=[1,25],h=[1,26],g=[1,27],_=[1,28],v=[1,29],y=[1,30],b=[1,31],x=[1,32],S=[1,33],C=[1,34],w=[1,35],T=[1,36],E=[1,37],D=[1,38],O=[1,39],k=[1,40],A=[1,42],j=[1,43],M=[1,44],N=[1,45],P=[1,46],F=[1,47],I=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],ee=[1,74],L=[1,80],R=[1,81],te=[1,82],ne=[1,83],z=[1,84],B=[1,85],V=[1,86],re=[1,87],H=[1,88],U=[1,89],W=[1,90],ie=[1,91],ae=[1,92],oe=[1,93],G=[1,94],se=[1,95],K=[1,96],ce=[1,97],le=[1,98],ue=[1,99],de=[1,100],fe=[1,101],pe=[1,102],me=[1,103],he=[1,104],ge=[1,105],_e=[2,78],ve=[4,5,17,51,53,54],ye=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],be=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],xe=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Ce=[5,52],q=[70,71,72,73],J=[1,151],we={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:`error`,4:`SPACE`,5:`NEWLINE`,6:`SD`,10:`INVALID`,14:`create`,15:`box`,16:`restOfLine`,17:`end`,19:`autonumber`,20:`NUM`,21:`off`,22:`activate`,24:`deactivate`,30:`title`,31:`legacy_title`,32:`acc_title`,33:`acc_title_value`,34:`acc_descr`,35:`acc_descr_value`,36:`acc_descr_multiline_value`,37:`loop`,38:`rect`,39:`opt`,40:`alt`,42:`par`,44:`par_over`,45:`critical`,47:`break`,48:`option`,49:`and`,50:`else`,51:`participant`,52:`AS`,53:`participant_actor`,54:`destroy`,56:`note`,59:`over`,61:`links`,62:`link`,63:`properties`,64:`details`,66:`,`,67:`left_of`,68:`right_of`,70:`+`,71:`-`,72:`()`,73:`ACTOR`,75:`CONFIG_START`,76:`CONFIG_CONTENT`,77:`CONFIG_END`,78:`SOLID_OPEN_ARROW`,79:`DOTTED_OPEN_ARROW`,80:`SOLID_ARROW`,81:`SOLID_ARROW_TOP`,82:`SOLID_ARROW_BOTTOM`,83:`STICK_ARROW_TOP`,84:`STICK_ARROW_BOTTOM`,85:`SOLID_ARROW_TOP_DOTTED`,86:`SOLID_ARROW_BOTTOM_DOTTED`,87:`STICK_ARROW_TOP_DOTTED`,88:`STICK_ARROW_BOTTOM_DOTTED`,89:`SOLID_ARROW_TOP_REVERSE`,90:`SOLID_ARROW_BOTTOM_REVERSE`,91:`STICK_ARROW_TOP_REVERSE`,92:`STICK_ARROW_BOTTOM_REVERSE`,93:`SOLID_ARROW_TOP_REVERSE_DOTTED`,94:`SOLID_ARROW_BOTTOM_REVERSE_DOTTED`,95:`STICK_ARROW_TOP_REVERSE_DOTTED`,96:`STICK_ARROW_BOTTOM_REVERSE_DOTTED`,97:`BIDIRECTIONAL_SOLID_ARROW`,98:`DOTTED_ARROW`,99:`BIDIRECTIONAL_DOTTED_ARROW`,100:`SOLID_CROSS`,101:`DOTTED_CROSS`,102:`SOLID_POINT`,103:`DOTTED_POINT`,104:`TXT`},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 3:return r.apply(a[s]),a[s];case 4:case 10:this.$=[];break;case 5:case 11:a[s-1].push(a[s]),this.$=a[s-1];break;case 6:case 7:case 12:case 13:this.$=a[s];break;case 8:case 9:case 14:this.$=[];break;case 16:a[s].type=`createParticipant`,this.$=a[s];break;case 17:a[s-1].unshift({type:`boxStart`,boxData:r.parseBoxData(a[s-2])}),a[s-1].push({type:`boxEnd`,boxText:a[s-2]}),this.$=a[s-1];break;case 19:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-2]),sequenceIndexStep:Number(a[s-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 20:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:`sequenceIndex`,sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 22:this.$={type:`sequenceIndex`,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 23:this.$={type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor};break;case 24:this.$={type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-1].actor};break;case 30:r.setDiagramTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 31:r.setDiagramTitle(a[s].substring(7)),this.$=a[s].substring(7);break;case 32:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 33:case 34:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 35:a[s-1].unshift({type:`loopStart`,loopText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.LOOP_START}),a[s-1].push({type:`loopEnd`,loopText:a[s-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[s-1];break;case 36:a[s-1].unshift({type:`rectStart`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_START}),a[s-1].push({type:`rectEnd`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[s-1];break;case 37:a[s-1].unshift({type:`optStart`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_START}),a[s-1].push({type:`optEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[s-1];break;case 38:a[s-1].unshift({type:`altStart`,altText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.ALT_START}),a[s-1].push({type:`altEnd`,signalType:r.LINETYPE.ALT_END}),this.$=a[s-1];break;case 39:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 40:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_OVER_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 41:a[s-1].unshift({type:`criticalStart`,criticalText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.CRITICAL_START}),a[s-1].push({type:`criticalEnd`,signalType:r.LINETYPE.CRITICAL_END}),this.$=a[s-1];break;case 42:a[s-1].unshift({type:`breakStart`,breakText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_START}),a[s-1].push({type:`breakEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[s-1];break;case 44:this.$=a[s-3].concat([{type:`option`,optionText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[s]]);break;case 46:this.$=a[s-3].concat([{type:`and`,parText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.PAR_AND},a[s]]);break;case 48:this.$=a[s-3].concat([{type:`else`,altText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.ALT_ELSE},a[s]]);break;case 49:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 50:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 51:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 52:case 57:a[s-1].draw=`actor`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 53:a[s-1].type=`destroyParticipant`,this.$=a[s-1];break;case 54:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 55:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 56:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 58:this.$=[a[s-1],{type:`addNote`,placement:a[s-2],actor:a[s-1].actor,text:a[s]}];break;case 59:a[s-2]=[].concat(a[s-1],a[s-1]).slice(0,2),a[s-2][0]=a[s-2][0].actor,a[s-2][1]=a[s-2][1].actor,this.$=[a[s-1],{type:`addNote`,placement:r.PLACEMENT.OVER,actor:a[s-2].slice(0,2),text:a[s]}];break;case 60:this.$=[a[s-1],{type:`addLinks`,actor:a[s-1].actor,text:a[s]}];break;case 61:this.$=[a[s-1],{type:`addALink`,actor:a[s-1].actor,text:a[s]}];break;case 62:this.$=[a[s-1],{type:`addProperties`,actor:a[s-1].actor,text:a[s]}];break;case 63:this.$=[a[s-1],{type:`addDetails`,actor:a[s-1].actor,text:a[s]}];break;case 66:this.$=[a[s-2],a[s]];break;case 67:this.$=a[s];break;case 68:this.$=r.PLACEMENT.LEFTOF;break;case 69:this.$=r.PLACEMENT.RIGHTOF;break;case 70:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0},{type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor}];break;case 71:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-4].actor}];break;case 72:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor}];break;case 73:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s],activate:!1,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-4].actor}];break;case 74:this.$=[a[s-5],a[s-1],{type:`addMessage`,from:a[s-5].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-5].actor}];break;case 75:this.$=[a[s-3],a[s-1],{type:`addMessage`,from:a[s-3].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s]}];break;case 76:this.$={type:`addParticipant`,actor:a[s-1],config:a[s]};break;case 77:this.$=a[s-1].trim();break;case 78:this.$={type:`addParticipant`,actor:a[s]};break;case 79:this.$=r.LINETYPE.SOLID_OPEN;break;case 80:this.$=r.LINETYPE.DOTTED_OPEN;break;case 81:this.$=r.LINETYPE.SOLID;break;case 82:this.$=r.LINETYPE.SOLID_TOP;break;case 83:this.$=r.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=r.LINETYPE.STICK_TOP;break;case 85:this.$=r.LINETYPE.STICK_BOTTOM;break;case 86:this.$=r.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=r.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=r.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=r.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=r.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=r.LINETYPE.DOTTED;break;case 100:this.$=r.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=r.LINETYPE.SOLID_CROSS;break;case 102:this.$=r.LINETYPE.DOTTED_CROSS;break;case 103:this.$=r.LINETYPE.SOLID_POINT;break;case 104:this.$=r.LINETYPE.DOTTED_POINT;break;case 105:this.$=r.parseMessage(a[s].trim().substring(1))}},`anonymous`),table:[{3:1,4:n,5:r,6:i},{1:[3]},{3:5,4:n,5:r,6:i},{3:6,4:n,5:r,6:i},t([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],a,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,5]),{9:48,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,15]),{13:49,51:D,53:O,54:k},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:F},{23:56,73:F},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},t(I,[2,30]),t(I,[2,31]),{33:[1,62]},{35:[1,63]},t(I,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:ee},{23:75,55:76,73:ee},{23:77,73:F},{69:78,72:[1,79],78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:F},{23:111,73:F},{23:112,73:F},{23:113,73:F},t([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],_e),t(I,[2,6]),t(I,[2,16]),t(ve,[2,10],{11:114}),t(I,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},t(I,[2,22]),{5:[1,118]},{5:[1,119]},t(I,[2,25]),t(I,[2,26]),t(I,[2,27]),t(I,[2,28]),t(I,[2,29]),t(I,[2,32]),t(I,[2,33]),t(ye,a,{7:120}),t(ye,a,{7:121}),t(ye,a,{7:122}),t(be,a,{41:123,7:124}),t(xe,a,{43:125,7:126}),t(xe,a,{7:126,43:127}),t(Se,a,{46:128,7:129}),t(ye,a,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},t(Ce,_e,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:F},{69:146,78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},t(q,[2,79]),t(q,[2,80]),t(q,[2,81]),t(q,[2,82]),t(q,[2,83]),t(q,[2,84]),t(q,[2,85]),t(q,[2,86]),t(q,[2,87]),t(q,[2,88]),t(q,[2,89]),t(q,[2,90]),t(q,[2,91]),t(q,[2,92]),t(q,[2,93]),t(q,[2,94]),t(q,[2,95]),t(q,[2,96]),t(q,[2,97]),t(q,[2,98]),t(q,[2,99]),t(q,[2,100]),t(q,[2,101]),t(q,[2,102]),t(q,[2,103]),t(q,[2,104]),{23:147,73:F},{23:149,60:148,73:F},{73:[2,68]},{73:[2,69]},{58:150,104:J},{58:152,104:J},{58:153,104:J},{58:154,104:J},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:D,53:O,54:k},{5:[1,160]},t(I,[2,20]),t(I,[2,21]),t(I,[2,23]),t(I,[2,24]),{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,161],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,162],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,163],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,164]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,47],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,50:[1,165],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,166]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,45],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,49:[1,167],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,168]},{17:[1,169]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,43],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,48:[1,170],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,171],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{16:[1,172]},t(I,[2,50]),{16:[1,173]},t(I,[2,55]),t(Ce,[2,76]),{76:[1,174]},{16:[1,175]},t(I,[2,52]),{16:[1,176]},t(I,[2,57]),t(I,[2,53]),{23:177,73:F},{23:178,73:F},{23:179,73:F},{58:180,104:J},{23:181,72:[1,182],73:F},{58:183,104:J},{58:184,104:J},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},t(I,[2,17]),t(ve,[2,11]),{13:186,51:D,53:O,54:k},t(ve,[2,13]),t(ve,[2,14]),t(I,[2,19]),t(I,[2,35]),t(I,[2,36]),t(I,[2,37]),t(I,[2,38]),{16:[1,187]},t(I,[2,39]),{16:[1,188]},t(I,[2,40]),t(I,[2,41]),{16:[1,189]},t(I,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:J},{58:196,104:J},{58:197,104:J},{5:[2,75]},{58:198,104:J},{23:199,73:F},{5:[2,58]},{5:[2,59]},{23:200,73:F},t(ve,[2,12]),t(be,a,{7:124,41:201}),t(xe,a,{7:126,43:202}),t(Se,a,{7:129,46:203}),t(I,[2,49]),t(I,[2,54]),t(Ce,[2,77]),t(I,[2,51]),t(I,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:J},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-BY_WSiz7.js";import{A as r,F as i,G as a,H as o,K as s,O as c,U as l,a as u,b as d,c as f,i as p,r as m,s as h,v as g,w as _,x as v,y,z as b}from"./chunk-I66GZJ75-DXqP3B91.js";import{t as x}from"./dist-BDCdLWk4.js";import{g as S,p as C}from"./chunk-NSK5VX7P-D5026Kzu.js";import{a as w,c as T,i as E,n as D,r as O,s as k}from"./chunk-2GRJ4B5K-u4MGLwtv.js";import{t as A}from"./chunk-2Q5K7J3B-C1jixKkw.js";import{n as j,r as M}from"./mermaid.core-CNhdxt2h.js";var N=x(),P=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,2],r=[1,3],i=[1,4],a=[2,4],o=[1,9],s=[1,11],c=[1,12],l=[1,14],u=[1,15],d=[1,17],f=[1,18],p=[1,19],m=[1,25],h=[1,26],g=[1,27],_=[1,28],v=[1,29],y=[1,30],b=[1,31],x=[1,32],S=[1,33],C=[1,34],w=[1,35],T=[1,36],E=[1,37],D=[1,38],O=[1,39],k=[1,40],A=[1,42],j=[1,43],M=[1,44],N=[1,45],P=[1,46],F=[1,47],I=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],ee=[1,74],L=[1,80],R=[1,81],te=[1,82],ne=[1,83],z=[1,84],B=[1,85],V=[1,86],re=[1,87],H=[1,88],U=[1,89],W=[1,90],ie=[1,91],ae=[1,92],oe=[1,93],G=[1,94],se=[1,95],K=[1,96],ce=[1,97],le=[1,98],ue=[1,99],de=[1,100],fe=[1,101],pe=[1,102],me=[1,103],he=[1,104],ge=[1,105],_e=[2,78],ve=[4,5,17,51,53,54],ye=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],be=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],xe=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Ce=[5,52],q=[70,71,72,73],J=[1,151],we={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:`error`,4:`SPACE`,5:`NEWLINE`,6:`SD`,10:`INVALID`,14:`create`,15:`box`,16:`restOfLine`,17:`end`,19:`autonumber`,20:`NUM`,21:`off`,22:`activate`,24:`deactivate`,30:`title`,31:`legacy_title`,32:`acc_title`,33:`acc_title_value`,34:`acc_descr`,35:`acc_descr_value`,36:`acc_descr_multiline_value`,37:`loop`,38:`rect`,39:`opt`,40:`alt`,42:`par`,44:`par_over`,45:`critical`,47:`break`,48:`option`,49:`and`,50:`else`,51:`participant`,52:`AS`,53:`participant_actor`,54:`destroy`,56:`note`,59:`over`,61:`links`,62:`link`,63:`properties`,64:`details`,66:`,`,67:`left_of`,68:`right_of`,70:`+`,71:`-`,72:`()`,73:`ACTOR`,75:`CONFIG_START`,76:`CONFIG_CONTENT`,77:`CONFIG_END`,78:`SOLID_OPEN_ARROW`,79:`DOTTED_OPEN_ARROW`,80:`SOLID_ARROW`,81:`SOLID_ARROW_TOP`,82:`SOLID_ARROW_BOTTOM`,83:`STICK_ARROW_TOP`,84:`STICK_ARROW_BOTTOM`,85:`SOLID_ARROW_TOP_DOTTED`,86:`SOLID_ARROW_BOTTOM_DOTTED`,87:`STICK_ARROW_TOP_DOTTED`,88:`STICK_ARROW_BOTTOM_DOTTED`,89:`SOLID_ARROW_TOP_REVERSE`,90:`SOLID_ARROW_BOTTOM_REVERSE`,91:`STICK_ARROW_TOP_REVERSE`,92:`STICK_ARROW_BOTTOM_REVERSE`,93:`SOLID_ARROW_TOP_REVERSE_DOTTED`,94:`SOLID_ARROW_BOTTOM_REVERSE_DOTTED`,95:`STICK_ARROW_TOP_REVERSE_DOTTED`,96:`STICK_ARROW_BOTTOM_REVERSE_DOTTED`,97:`BIDIRECTIONAL_SOLID_ARROW`,98:`DOTTED_ARROW`,99:`BIDIRECTIONAL_DOTTED_ARROW`,100:`SOLID_CROSS`,101:`DOTTED_CROSS`,102:`SOLID_POINT`,103:`DOTTED_POINT`,104:`TXT`},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 3:return r.apply(a[s]),a[s];case 4:case 10:this.$=[];break;case 5:case 11:a[s-1].push(a[s]),this.$=a[s-1];break;case 6:case 7:case 12:case 13:this.$=a[s];break;case 8:case 9:case 14:this.$=[];break;case 16:a[s].type=`createParticipant`,this.$=a[s];break;case 17:a[s-1].unshift({type:`boxStart`,boxData:r.parseBoxData(a[s-2])}),a[s-1].push({type:`boxEnd`,boxText:a[s-2]}),this.$=a[s-1];break;case 19:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-2]),sequenceIndexStep:Number(a[s-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 20:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:`sequenceIndex`,sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 22:this.$={type:`sequenceIndex`,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 23:this.$={type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor};break;case 24:this.$={type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-1].actor};break;case 30:r.setDiagramTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 31:r.setDiagramTitle(a[s].substring(7)),this.$=a[s].substring(7);break;case 32:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 33:case 34:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 35:a[s-1].unshift({type:`loopStart`,loopText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.LOOP_START}),a[s-1].push({type:`loopEnd`,loopText:a[s-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[s-1];break;case 36:a[s-1].unshift({type:`rectStart`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_START}),a[s-1].push({type:`rectEnd`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[s-1];break;case 37:a[s-1].unshift({type:`optStart`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_START}),a[s-1].push({type:`optEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[s-1];break;case 38:a[s-1].unshift({type:`altStart`,altText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.ALT_START}),a[s-1].push({type:`altEnd`,signalType:r.LINETYPE.ALT_END}),this.$=a[s-1];break;case 39:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 40:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_OVER_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 41:a[s-1].unshift({type:`criticalStart`,criticalText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.CRITICAL_START}),a[s-1].push({type:`criticalEnd`,signalType:r.LINETYPE.CRITICAL_END}),this.$=a[s-1];break;case 42:a[s-1].unshift({type:`breakStart`,breakText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_START}),a[s-1].push({type:`breakEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[s-1];break;case 44:this.$=a[s-3].concat([{type:`option`,optionText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[s]]);break;case 46:this.$=a[s-3].concat([{type:`and`,parText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.PAR_AND},a[s]]);break;case 48:this.$=a[s-3].concat([{type:`else`,altText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.ALT_ELSE},a[s]]);break;case 49:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 50:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 51:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 52:case 57:a[s-1].draw=`actor`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 53:a[s-1].type=`destroyParticipant`,this.$=a[s-1];break;case 54:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 55:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 56:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 58:this.$=[a[s-1],{type:`addNote`,placement:a[s-2],actor:a[s-1].actor,text:a[s]}];break;case 59:a[s-2]=[].concat(a[s-1],a[s-1]).slice(0,2),a[s-2][0]=a[s-2][0].actor,a[s-2][1]=a[s-2][1].actor,this.$=[a[s-1],{type:`addNote`,placement:r.PLACEMENT.OVER,actor:a[s-2].slice(0,2),text:a[s]}];break;case 60:this.$=[a[s-1],{type:`addLinks`,actor:a[s-1].actor,text:a[s]}];break;case 61:this.$=[a[s-1],{type:`addALink`,actor:a[s-1].actor,text:a[s]}];break;case 62:this.$=[a[s-1],{type:`addProperties`,actor:a[s-1].actor,text:a[s]}];break;case 63:this.$=[a[s-1],{type:`addDetails`,actor:a[s-1].actor,text:a[s]}];break;case 66:this.$=[a[s-2],a[s]];break;case 67:this.$=a[s];break;case 68:this.$=r.PLACEMENT.LEFTOF;break;case 69:this.$=r.PLACEMENT.RIGHTOF;break;case 70:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0},{type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor}];break;case 71:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-4].actor}];break;case 72:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor}];break;case 73:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s],activate:!1,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-4].actor}];break;case 74:this.$=[a[s-5],a[s-1],{type:`addMessage`,from:a[s-5].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-5].actor}];break;case 75:this.$=[a[s-3],a[s-1],{type:`addMessage`,from:a[s-3].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s]}];break;case 76:this.$={type:`addParticipant`,actor:a[s-1],config:a[s]};break;case 77:this.$=a[s-1].trim();break;case 78:this.$={type:`addParticipant`,actor:a[s]};break;case 79:this.$=r.LINETYPE.SOLID_OPEN;break;case 80:this.$=r.LINETYPE.DOTTED_OPEN;break;case 81:this.$=r.LINETYPE.SOLID;break;case 82:this.$=r.LINETYPE.SOLID_TOP;break;case 83:this.$=r.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=r.LINETYPE.STICK_TOP;break;case 85:this.$=r.LINETYPE.STICK_BOTTOM;break;case 86:this.$=r.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=r.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=r.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=r.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=r.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=r.LINETYPE.DOTTED;break;case 100:this.$=r.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=r.LINETYPE.SOLID_CROSS;break;case 102:this.$=r.LINETYPE.DOTTED_CROSS;break;case 103:this.$=r.LINETYPE.SOLID_POINT;break;case 104:this.$=r.LINETYPE.DOTTED_POINT;break;case 105:this.$=r.parseMessage(a[s].trim().substring(1))}},`anonymous`),table:[{3:1,4:n,5:r,6:i},{1:[3]},{3:5,4:n,5:r,6:i},{3:6,4:n,5:r,6:i},t([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],a,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,5]),{9:48,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,15]),{13:49,51:D,53:O,54:k},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:F},{23:56,73:F},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},t(I,[2,30]),t(I,[2,31]),{33:[1,62]},{35:[1,63]},t(I,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:ee},{23:75,55:76,73:ee},{23:77,73:F},{69:78,72:[1,79],78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:F},{23:111,73:F},{23:112,73:F},{23:113,73:F},t([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],_e),t(I,[2,6]),t(I,[2,16]),t(ve,[2,10],{11:114}),t(I,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},t(I,[2,22]),{5:[1,118]},{5:[1,119]},t(I,[2,25]),t(I,[2,26]),t(I,[2,27]),t(I,[2,28]),t(I,[2,29]),t(I,[2,32]),t(I,[2,33]),t(ye,a,{7:120}),t(ye,a,{7:121}),t(ye,a,{7:122}),t(be,a,{41:123,7:124}),t(xe,a,{43:125,7:126}),t(xe,a,{7:126,43:127}),t(Se,a,{46:128,7:129}),t(ye,a,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},t(Ce,_e,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:F},{69:146,78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},t(q,[2,79]),t(q,[2,80]),t(q,[2,81]),t(q,[2,82]),t(q,[2,83]),t(q,[2,84]),t(q,[2,85]),t(q,[2,86]),t(q,[2,87]),t(q,[2,88]),t(q,[2,89]),t(q,[2,90]),t(q,[2,91]),t(q,[2,92]),t(q,[2,93]),t(q,[2,94]),t(q,[2,95]),t(q,[2,96]),t(q,[2,97]),t(q,[2,98]),t(q,[2,99]),t(q,[2,100]),t(q,[2,101]),t(q,[2,102]),t(q,[2,103]),t(q,[2,104]),{23:147,73:F},{23:149,60:148,73:F},{73:[2,68]},{73:[2,69]},{58:150,104:J},{58:152,104:J},{58:153,104:J},{58:154,104:J},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:D,53:O,54:k},{5:[1,160]},t(I,[2,20]),t(I,[2,21]),t(I,[2,23]),t(I,[2,24]),{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,161],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,162],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,163],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,164]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,47],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,50:[1,165],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,166]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,45],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,49:[1,167],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,168]},{17:[1,169]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,43],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,48:[1,170],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,171],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{16:[1,172]},t(I,[2,50]),{16:[1,173]},t(I,[2,55]),t(Ce,[2,76]),{76:[1,174]},{16:[1,175]},t(I,[2,52]),{16:[1,176]},t(I,[2,57]),t(I,[2,53]),{23:177,73:F},{23:178,73:F},{23:179,73:F},{58:180,104:J},{23:181,72:[1,182],73:F},{58:183,104:J},{58:184,104:J},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},t(I,[2,17]),t(ve,[2,11]),{13:186,51:D,53:O,54:k},t(ve,[2,13]),t(ve,[2,14]),t(I,[2,19]),t(I,[2,35]),t(I,[2,36]),t(I,[2,37]),t(I,[2,38]),{16:[1,187]},t(I,[2,39]),{16:[1,188]},t(I,[2,40]),t(I,[2,41]),{16:[1,189]},t(I,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:J},{58:196,104:J},{58:197,104:J},{5:[2,75]},{58:198,104:J},{23:199,73:F},{5:[2,58]},{5:[2,59]},{23:200,73:F},t(ve,[2,12]),t(be,a,{7:124,41:201}),t(xe,a,{7:126,43:202}),t(Se,a,{7:129,46:203}),t(I,[2,49]),t(I,[2,54]),t(Ce,[2,77]),t(I,[2,51]),t(I,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:J},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};we.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -7,7 +7,7 @@ Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on l
7
7
  `)?i+`
8
8
  `:`{
9
9
  `+i+`
10
- }`,o=j(e,{schema:M})}r=o?.type??r,o?.alias&&(!n||n.text===t)&&(n={text:o.alias,wrap:n?.wrap,type:r});let s=this.state.records.actors.get(e);if(s){if(this.state.records.currentBox&&s.box&&this.state.records.currentBox!==s.box)throw Error(`A same participant should only be defined in one Box: ${s.name} can't be in '${s.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`);if(a=s.box?s.box:this.state.records.currentBox,s.box=a,s&&t===s.name&&n==null)return}if(n?.text??(n={text:t,type:r}),(r==null||n.text==null)&&(n={text:t,type:r}),this.state.records.actors.set(e,{box:a,name:t,description:n.text,wrap:n.wrap??this.autoWrap(),prevActor:this.state.records.prevActor,links:{},properties:{},actorCnt:null,rectData:null,type:r??`participant`}),this.state.records.prevActor){let t=this.state.records.actors.get(this.state.records.prevActor);t&&(t.nextActor=e)}this.state.records.currentBox&&this.state.records.currentBox.actorKeys.push(e),this.state.records.prevActor=e}activationCount(e){let t,n=0;if(!e)return 0;for(t=0;t<this.state.records.messages.length;t++)this.state.records.messages[t].type===this.LINETYPE.ACTIVE_START&&this.state.records.messages[t].from===e&&n++,this.state.records.messages[t].type===this.LINETYPE.ACTIVE_END&&this.state.records.messages[t].from===e&&n--;return n}addMessage(e,t,n,r){this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:e,to:t,message:n.text,wrap:n.wrap??this.autoWrap(),answer:r})}addSignal(e,t,n,r,i=!1,a){if(r===this.LINETYPE.ACTIVE_END&&this.activationCount(e??``)<1){let t=Error(`Trying to inactivate an inactive participant (`+e+`)`);throw t.hash={text:`->>-`,token:`->>-`,line:`1`,loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:[`'ACTIVE_PARTICIPANT'`]},t}return this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:e,to:t,message:n?.text??``,wrap:n?.wrap??this.autoWrap(),type:r,activate:i,centralConnection:a??0}),!0}hasAtLeastOneBox(){return this.state.records.boxes.length>0}hasAtLeastOneBoxWithTitle(){return this.state.records.boxes.some(e=>e.name)}getMessages(){return this.state.records.messages}getBoxes(){return this.state.records.boxes}getActors(){return this.state.records.actors}getCreatedActors(){return this.state.records.createdActors}getDestroyedActors(){return this.state.records.destroyedActors}getActor(e){return this.state.records.actors.get(e)}getActorKeys(){return[...this.state.records.actors.keys()]}enableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!0}disableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!1}showSequenceNumbers(){return this.state.records.sequenceNumbersEnabled}setWrap(e){this.state.records.wrapEnabled=e}extractWrap(e){if(e===void 0)return{};e=e.trim();let t=/^:?wrap:/.exec(e)!==null||/^:?nowrap:/.exec(e)===null&&void 0;return{cleanedText:(t===void 0?e:e.replace(/^:?(?:no)?wrap:/,``)).trim(),wrap:t}}autoWrap(){return this.state.records.wrapEnabled===void 0?v().sequence?.wrap??!1:this.state.records.wrapEnabled}clear(){this.state.reset(),u()}parseMessage(e){let n=e.trim(),{wrap:r,cleanedText:i}=this.extractWrap(n),a={text:i,wrap:r};return t.debug(`parseMessage: ${JSON.stringify(a)}`),a}parseBoxData(e){let t=/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(e),n=t?.[1]?t[1].trim():`transparent`,r=t?.[2]?t[2].trim():void 0;if(window?.CSS)window.CSS.supports(`color`,n)||(n=`transparent`,r=e.trim());else{let t=new Option().style;t.color=n,t.color!==n&&(n=`transparent`,r=e.trim())}let{wrap:i,cleanedText:a}=this.extractWrap(r);return{text:a?b(a,v()):void 0,color:n,wrap:i}}addNote(e,t,n){let r={actor:e,placement:t,message:n.text,wrap:n.wrap??this.autoWrap()},i=[].concat(e,e);this.state.records.notes.push(r),this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:i[0],to:i[1],message:n.text,wrap:n.wrap??this.autoWrap(),type:this.LINETYPE.NOTE,placement:t})}addLinks(e,n){let r=this.getActor(e);try{let e=b(n.text,v());e=e.replace(/&equals;/g,`=`),e=e.replace(/&amp;/g,`&`);let t=JSON.parse(e);this.insertLinks(r,t)}catch(e){t.error(`error while parsing actor link text`,e)}}addALink(e,n){let r=this.getActor(e);try{let e={},t=b(n.text,v()),i=t.indexOf(`@`);t=t.replace(/&equals;/g,`=`),t=t.replace(/&amp;/g,`&`);let a=t.slice(0,i-1).trim();e[a]=t.slice(i+1).trim(),this.insertLinks(r,e)}catch(e){t.error(`error while parsing actor link text`,e)}}insertLinks(e,t){if(e.links==null)e.links=t;else for(let n in t)e.links[n]=t[n]}addProperties(e,n){let r=this.getActor(e);try{let e=b(n.text,v()),t=JSON.parse(e);this.insertProperties(r,t)}catch(e){t.error(`error while parsing actor properties text`,e)}}insertProperties(e,t){if(e.properties==null)e.properties=t;else for(let n in t)e.properties[n]=t[n]}boxEnd(){this.state.records.currentBox=void 0}addDetails(e,n){let r=this.getActor(e),i=document.getElementById(n.text);try{let e=i.innerHTML,t=JSON.parse(e);t.properties&&this.insertProperties(r,t.properties),t.links&&this.insertLinks(r,t.links)}catch(e){t.error(`error while parsing actor details text`,e)}}getActorProperty(e,t){if(e?.properties!==void 0)return e.properties[t]}apply(e){if(Array.isArray(e))e.forEach(e=>{this.apply(e)});else switch(e.type){case`sequenceIndex`:this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:void 0,to:void 0,message:{start:e.sequenceIndex,step:e.sequenceIndexStep,visible:e.sequenceVisible},wrap:!1,type:e.signalType});break;case`addParticipant`:this.addActor(e.actor,e.actor,e.description,e.draw,e.config);break;case`createParticipant`:if(this.state.records.actors.has(e.actor))throw Error(`It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior`);this.state.records.lastCreated=e.actor,this.addActor(e.actor,e.actor,e.description,e.draw,e.config),this.state.records.createdActors.set(e.actor,this.state.records.messages.length);break;case`destroyParticipant`:this.state.records.lastDestroyed=e.actor,this.state.records.destroyedActors.set(e.actor,this.state.records.messages.length);break;case`activeStart`:this.addSignal(e.actor,void 0,void 0,e.signalType);break;case`centralConnection`:this.addSignal(e.actor,void 0,void 0,e.signalType);break;case`centralConnectionReverse`:this.addSignal(e.actor,void 0,void 0,e.signalType);break;case`activeEnd`:this.addSignal(e.actor,void 0,void 0,e.signalType);break;case`addNote`:this.addNote(e.actor,e.placement,e.text);break;case`addLinks`:this.addLinks(e.actor,e.text);break;case`addALink`:this.addALink(e.actor,e.text);break;case`addProperties`:this.addProperties(e.actor,e.text);break;case`addDetails`:this.addDetails(e.actor,e.text);break;case`addMessage`:if(this.state.records.lastCreated){if(e.to!==this.state.records.lastCreated)throw Error(`The created participant `+this.state.records.lastCreated.name+` does not have an associated creating message after its declaration. Please check the sequence diagram.`);this.state.records.lastCreated=void 0}else if(this.state.records.lastDestroyed){if(e.to!==this.state.records.lastDestroyed&&e.from!==this.state.records.lastDestroyed)throw Error(`The destroyed participant `+this.state.records.lastDestroyed.name+` does not have an associated destroying message after its declaration. Please check the sequence diagram.`);this.state.records.lastDestroyed=void 0}this.addSignal(e.from,e.to,e.msg,e.signalType,e.activate,e.centralConnection);break;case`boxStart`:this.addBox(e.boxData);break;case`boxEnd`:this.boxEnd();break;case`loopStart`:this.addSignal(void 0,void 0,e.loopText,e.signalType);break;case`loopEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`rectStart`:this.addSignal(void 0,void 0,e.color,e.signalType);break;case`rectEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`optStart`:this.addSignal(void 0,void 0,e.optText,e.signalType);break;case`optEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`altStart`:this.addSignal(void 0,void 0,e.altText,e.signalType);break;case`else`:this.addSignal(void 0,void 0,e.altText,e.signalType);break;case`altEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`setAccTitle`:l(e.text);break;case`parStart`:this.addSignal(void 0,void 0,e.parText,e.signalType);break;case`and`:this.addSignal(void 0,void 0,e.parText,e.signalType);break;case`parEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`criticalStart`:this.addSignal(void 0,void 0,e.criticalText,e.signalType);break;case`option`:this.addSignal(void 0,void 0,e.optionText,e.signalType);break;case`criticalEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`breakStart`:this.addSignal(void 0,void 0,e.breakText,e.signalType);break;case`breakEnd`:this.addSignal(void 0,void 0,void 0,e.signalType)}}getConfig(){return v().sequence}},ne=e(e=>{let t=e.dropShadow??`none`,{look:n}=v();return`.actor {
10
+ }`,o=M(e,{schema:j})}r=o?.type??r,o?.alias&&(!n||n.text===t)&&(n={text:o.alias,wrap:n?.wrap,type:r});let s=this.state.records.actors.get(e);if(s){if(this.state.records.currentBox&&s.box&&this.state.records.currentBox!==s.box)throw Error(`A same participant should only be defined in one Box: ${s.name} can't be in '${s.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`);if(a=s.box?s.box:this.state.records.currentBox,s.box=a,s&&t===s.name&&n==null)return}if(n?.text??(n={text:t,type:r}),(r==null||n.text==null)&&(n={text:t,type:r}),this.state.records.actors.set(e,{box:a,name:t,description:n.text,wrap:n.wrap??this.autoWrap(),prevActor:this.state.records.prevActor,links:{},properties:{},actorCnt:null,rectData:null,type:r??`participant`}),this.state.records.prevActor){let t=this.state.records.actors.get(this.state.records.prevActor);t&&(t.nextActor=e)}this.state.records.currentBox&&this.state.records.currentBox.actorKeys.push(e),this.state.records.prevActor=e}activationCount(e){let t,n=0;if(!e)return 0;for(t=0;t<this.state.records.messages.length;t++)this.state.records.messages[t].type===this.LINETYPE.ACTIVE_START&&this.state.records.messages[t].from===e&&n++,this.state.records.messages[t].type===this.LINETYPE.ACTIVE_END&&this.state.records.messages[t].from===e&&n--;return n}addMessage(e,t,n,r){this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:e,to:t,message:n.text,wrap:n.wrap??this.autoWrap(),answer:r})}addSignal(e,t,n,r,i=!1,a){if(r===this.LINETYPE.ACTIVE_END&&this.activationCount(e??``)<1){let t=Error(`Trying to inactivate an inactive participant (`+e+`)`);throw t.hash={text:`->>-`,token:`->>-`,line:`1`,loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:[`'ACTIVE_PARTICIPANT'`]},t}return this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:e,to:t,message:n?.text??``,wrap:n?.wrap??this.autoWrap(),type:r,activate:i,centralConnection:a??0}),!0}hasAtLeastOneBox(){return this.state.records.boxes.length>0}hasAtLeastOneBoxWithTitle(){return this.state.records.boxes.some(e=>e.name)}getMessages(){return this.state.records.messages}getBoxes(){return this.state.records.boxes}getActors(){return this.state.records.actors}getCreatedActors(){return this.state.records.createdActors}getDestroyedActors(){return this.state.records.destroyedActors}getActor(e){return this.state.records.actors.get(e)}getActorKeys(){return[...this.state.records.actors.keys()]}enableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!0}disableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!1}showSequenceNumbers(){return this.state.records.sequenceNumbersEnabled}setWrap(e){this.state.records.wrapEnabled=e}extractWrap(e){if(e===void 0)return{};e=e.trim();let t=/^:?wrap:/.exec(e)!==null||/^:?nowrap:/.exec(e)===null&&void 0;return{cleanedText:(t===void 0?e:e.replace(/^:?(?:no)?wrap:/,``)).trim(),wrap:t}}autoWrap(){return this.state.records.wrapEnabled===void 0?v().sequence?.wrap??!1:this.state.records.wrapEnabled}clear(){this.state.reset(),u()}parseMessage(e){let n=e.trim(),{wrap:r,cleanedText:i}=this.extractWrap(n),a={text:i,wrap:r};return t.debug(`parseMessage: ${JSON.stringify(a)}`),a}parseBoxData(e){let t=/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(e),n=t?.[1]?t[1].trim():`transparent`,r=t?.[2]?t[2].trim():void 0;if(window?.CSS)window.CSS.supports(`color`,n)||(n=`transparent`,r=e.trim());else{let t=new Option().style;t.color=n,t.color!==n&&(n=`transparent`,r=e.trim())}let{wrap:i,cleanedText:a}=this.extractWrap(r);return{text:a?b(a,v()):void 0,color:n,wrap:i}}addNote(e,t,n){let r={actor:e,placement:t,message:n.text,wrap:n.wrap??this.autoWrap()},i=[].concat(e,e);this.state.records.notes.push(r),this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:i[0],to:i[1],message:n.text,wrap:n.wrap??this.autoWrap(),type:this.LINETYPE.NOTE,placement:t})}addLinks(e,n){let r=this.getActor(e);try{let e=b(n.text,v());e=e.replace(/&equals;/g,`=`),e=e.replace(/&amp;/g,`&`);let t=JSON.parse(e);this.insertLinks(r,t)}catch(e){t.error(`error while parsing actor link text`,e)}}addALink(e,n){let r=this.getActor(e);try{let e={},t=b(n.text,v()),i=t.indexOf(`@`);t=t.replace(/&equals;/g,`=`),t=t.replace(/&amp;/g,`&`);let a=t.slice(0,i-1).trim();e[a]=t.slice(i+1).trim(),this.insertLinks(r,e)}catch(e){t.error(`error while parsing actor link text`,e)}}insertLinks(e,t){if(e.links==null)e.links=t;else for(let n in t)e.links[n]=t[n]}addProperties(e,n){let r=this.getActor(e);try{let e=b(n.text,v()),t=JSON.parse(e);this.insertProperties(r,t)}catch(e){t.error(`error while parsing actor properties text`,e)}}insertProperties(e,t){if(e.properties==null)e.properties=t;else for(let n in t)e.properties[n]=t[n]}boxEnd(){this.state.records.currentBox=void 0}addDetails(e,n){let r=this.getActor(e),i=document.getElementById(n.text);try{let e=i.innerHTML,t=JSON.parse(e);t.properties&&this.insertProperties(r,t.properties),t.links&&this.insertLinks(r,t.links)}catch(e){t.error(`error while parsing actor details text`,e)}}getActorProperty(e,t){if(e?.properties!==void 0)return e.properties[t]}apply(e){if(Array.isArray(e))e.forEach(e=>{this.apply(e)});else switch(e.type){case`sequenceIndex`:this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:void 0,to:void 0,message:{start:e.sequenceIndex,step:e.sequenceIndexStep,visible:e.sequenceVisible},wrap:!1,type:e.signalType});break;case`addParticipant`:this.addActor(e.actor,e.actor,e.description,e.draw,e.config);break;case`createParticipant`:if(this.state.records.actors.has(e.actor))throw Error(`It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior`);this.state.records.lastCreated=e.actor,this.addActor(e.actor,e.actor,e.description,e.draw,e.config),this.state.records.createdActors.set(e.actor,this.state.records.messages.length);break;case`destroyParticipant`:this.state.records.lastDestroyed=e.actor,this.state.records.destroyedActors.set(e.actor,this.state.records.messages.length);break;case`activeStart`:this.addSignal(e.actor,void 0,void 0,e.signalType);break;case`centralConnection`:this.addSignal(e.actor,void 0,void 0,e.signalType);break;case`centralConnectionReverse`:this.addSignal(e.actor,void 0,void 0,e.signalType);break;case`activeEnd`:this.addSignal(e.actor,void 0,void 0,e.signalType);break;case`addNote`:this.addNote(e.actor,e.placement,e.text);break;case`addLinks`:this.addLinks(e.actor,e.text);break;case`addALink`:this.addALink(e.actor,e.text);break;case`addProperties`:this.addProperties(e.actor,e.text);break;case`addDetails`:this.addDetails(e.actor,e.text);break;case`addMessage`:if(this.state.records.lastCreated){if(e.to!==this.state.records.lastCreated)throw Error(`The created participant `+this.state.records.lastCreated.name+` does not have an associated creating message after its declaration. Please check the sequence diagram.`);this.state.records.lastCreated=void 0}else if(this.state.records.lastDestroyed){if(e.to!==this.state.records.lastDestroyed&&e.from!==this.state.records.lastDestroyed)throw Error(`The destroyed participant `+this.state.records.lastDestroyed.name+` does not have an associated destroying message after its declaration. Please check the sequence diagram.`);this.state.records.lastDestroyed=void 0}this.addSignal(e.from,e.to,e.msg,e.signalType,e.activate,e.centralConnection);break;case`boxStart`:this.addBox(e.boxData);break;case`boxEnd`:this.boxEnd();break;case`loopStart`:this.addSignal(void 0,void 0,e.loopText,e.signalType);break;case`loopEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`rectStart`:this.addSignal(void 0,void 0,e.color,e.signalType);break;case`rectEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`optStart`:this.addSignal(void 0,void 0,e.optText,e.signalType);break;case`optEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`altStart`:this.addSignal(void 0,void 0,e.altText,e.signalType);break;case`else`:this.addSignal(void 0,void 0,e.altText,e.signalType);break;case`altEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`setAccTitle`:l(e.text);break;case`parStart`:this.addSignal(void 0,void 0,e.parText,e.signalType);break;case`and`:this.addSignal(void 0,void 0,e.parText,e.signalType);break;case`parEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`criticalStart`:this.addSignal(void 0,void 0,e.criticalText,e.signalType);break;case`option`:this.addSignal(void 0,void 0,e.optionText,e.signalType);break;case`criticalEnd`:this.addSignal(void 0,void 0,void 0,e.signalType);break;case`breakStart`:this.addSignal(void 0,void 0,e.breakText,e.signalType);break;case`breakEnd`:this.addSignal(void 0,void 0,void 0,e.signalType)}}getConfig(){return v().sequence}},ne=e(e=>{let t=e.dropShadow??`none`,{look:n}=v();return`.actor {
11
11
  stroke: ${e.actorBorder};
12
12
  fill: ${e.actorBkg};
13
13
  stroke-width: ${e.strokeWidth??1};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{a as t,i as n,r}from"./bundle-mjs-CyB9GzWm.js";import{$ as i,$n as a,B as o,Bn as s,Bt as c,C as l,Cn as u,Ct as d,Dn as f,Dt as p,E as m,Et as h,F as g,Ft as _,G as v,H as y,Hn as b,I as x,J as S,K as C,Kn as w,L as T,M as E,O as D,Ot as O,Q as k,R as A,Rt as j,S as M,Sn as N,Tn as P,U as F,V as ee,Vn as I,Vt as te,W as ne,Wn as re,Xn as ie,Xt as ae,Y as L,Z as R,Zn as oe,Zt as z,_ as se,_t as ce,an as B,ar as le,at as ue,b as de,bn as fe,c as V,cr as pe,d as me,dn as he,en as ge,er as _e,f as ve,fn as ye,fr as be,g as xe,gn as Se,h as Ce,j as we,k as Te,l as Ee,lr as De,m as Oe,mn as ke,nn as Ae,on as je,or as Me,p as Ne,pn as Pe,rr as Fe,sn as Ie,sr as Le,tn as Re,u as ze,un as H,v as Be,w as U,wn as Ve,wt as W,xn as He,y as Ue,yn as We,yt as Ge,z as G,zn as Ke}from"./vscode-CFosRdBr.js";import{A as qe,B as Je,C as Ye,D as Xe,E as Ze,G as Qe,H as $e,I as et,M as tt,O as nt,R as rt,S as it,T as at,U as ot,V as st,W as ct,_ as lt,a as ut,b as dt,c as ft,d as pt,f as mt,g as ht,h as gt,i as _t,j as vt,k as yt,l as bt,n as xt,p as St,r as Ct,s as wt,t as K,u as Tt,v as Et,w as Dt,x as Ot,y as q,z as kt}from"./label-CfYx7R2D.js";import{a as At,i as jt,n as Mt,r as Nt,t as J}from"./switch-DrjcFF6_.js";import{i as Pt,n as Ft,r as It,t as Lt}from"./zap-BF3XOCN3.js";import{N as Rt,P as zt,R as Bt,S as Vt,_ as Ht,a as Ut,b as Y,c as Wt,g as Gt,h as Kt,i as X,l as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt,v as $t,x as en,y as tn}from"./index-Lryt7pNP.js";var nn=A(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),rn=A(`building`,[[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M12 6h.01`,key:`1vi96p`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M16 6h.01`,key:`1x0f13`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M8 6h.01`,key:`1dz90k`}],[`path`,{d:`M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`,key:`cabbwy`}],[`rect`,{x:`4`,y:`2`,width:`16`,height:`20`,rx:`2`,key:`1uxh74`}]]),an=A(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),on=A(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),sn=A(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),cn=A(`credit-card`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),ln=A(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),un=A(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),dn=A(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),fn=A(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),pn=A(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),mn=A(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),hn=A(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),gn=A(`receipt`,[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]),Z=e(t(),1),_n=Z.createContext({disabled:!1});function vn(){return Z.useContext(_n)}var Q=r();function yn(e){let t=e instanceof Error?e.message:String(e);return t.includes(`unsupported desktop command: cline_account`)?Error(`The desktop sidecar is running an older build that does not support account commands. Restart the sidecar or reload the app, then try again.`):e instanceof Error?e:Error(t)}function bn(e){let t=e.toLowerCase();return t.includes(`no cline account auth token found`)||t.includes(`requires re-authentication`)||t.includes(`auth token`)||t.includes(`unauthorized`)}async function xn(){return await X.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchMe`})}async function Sn(){return await X.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchBalance`})}async function Cn(){return await X.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchUserOrganizations`})}async function wn(e){return await X.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchOrganizationBalance`,organizationId:e})}async function Tn(){return await X.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchUsageTransactions`})}async function En(e,t){return await X.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchOrganizationUsageTransactions`,organizationId:e,...t?.trim()?{memberId:t.trim()}:{}})}async function Dn(){return await X.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchPaymentTransactions`})}function On(){let[e,t]=(0,Z.useState)(`overview`),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)([]),[f,p]=(0,Z.useState)(!0),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)([]),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(!1),w=(0,Z.useRef)(0),[T,E]=(0,Z.useState)([]),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(!1),N=u.find(e=>e.active)??null,P=(0,Z.useCallback)(()=>{a(null),s(null),l(null),d([]),_([]),C(!1),x(null),E([]),M(!1),A(null)},[]),F=(0,Z.useCallback)(async()=>{p(!0),h(null);try{let[e,t,n]=await Promise.all([xn(),Sn(),Cn()]),r=n.find(e=>e.active)??null,i=r?await wn(r.organizationId):null;a(e),s(t),l(i),d(n)}catch(e){P();let t=yn(e).message;h(t)}finally{p(!1)}},[P]);(0,Z.useEffect)(()=>{F()},[F]);let ee=async()=>{r(`sign-in`),h(null);try{await X.invoke(`run_provider_oauth_login`,{provider:`cline`}),await F(),t(`overview`)}catch(e){let t=yn(e).message;h(t),P()}finally{r(null)}},I=async()=>{r(`sign-out`);try{await X.invoke(`save_provider_settings`,{provider:`cline`,api_key:``,settings:{auth:{accessToken:``,refreshToken:``,accountId:``}}}),P(),t(`overview`),h(`No Cline account auth token found`)}catch(e){let t=yn(e).message;h(t)}finally{r(null)}},te=(0,Z.useCallback)(async()=>{let e=w.current;y(!0),x(null);try{let t=N?await En(N.organizationId,N.memberId):await Tn();if(w.current!==e)return;_(t),C(!0)}catch(t){if(w.current!==e)return;let n=yn(t).message;x(n)}finally{w.current===e&&y(!1)}},[N]);(0,Z.useEffect)(()=>{w.current+=1,_([]),C(!1),x(null)},[N?.organizationId]),(0,Z.useEffect)(()=>{e===`usage`&&!S&&te()},[e,S,te]);let ne=(0,Z.useCallback)(async()=>{O(!0),A(null);try{let e=await Dn();E(e),M(!0)}catch(e){let t=yn(e).message;A(t)}finally{O(!1)}},[]);(0,Z.useEffect)(()=>{e===`billing`&&!j&&ne()},[e,j,ne]);let re=e=>new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`}),ie=e=>new Date(e).toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`}),ae=(e,t=2)=>new Intl.NumberFormat(`en-US`,{minimumFractionDigits:t,maximumFractionDigits:t}).format(e/1e6),L=N?c?.balance??o?.balance??null:o?.balance??null,R=[`overview`,`usage`,`billing`],oe=(e,t)=>(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 py-12 text-center`,children:[(0,Q.jsx)(on,{className:`h-8 w-8 text-destructive`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-md`,children:e}),(0,Q.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-2 rounded-lg border border-border px-3.5 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:[(0,Q.jsx)(It,{className:`h-4 w-4`}),`Retry`]})]}),z=()=>(0,Q.jsx)(`div`,{className:`rounded-lg border border-border bg-card p-6`,children:(0,Q.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col items-center gap-4 py-8 text-center`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,Q.jsx)(Bt,{className:`h-6 w-6`})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:`Sign in to Cline`}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`Connect your Cline account to review credits, usage, billing, and organization details from Cline Hub.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Q.jsxs)(U,{disabled:n!==null,onClick:()=>void ee(),type:`button`,children:[n===`sign-in`?(0,Q.jsx)(jt,{className:`h-4 w-4 animate-spin`}):(0,Q.jsx)(fn,{className:`h-4 w-4`}),n===`sign-in`?`Signing in`:`Sign in`]}),(0,Q.jsxs)(`a`,{className:`inline-flex h-9 items-center gap-2 rounded-lg border border-border px-3.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,href:`https://app.cline.bot`,rel:`noopener noreferrer`,target:`_blank`,children:[`Create account`,(0,Q.jsx)(Pt,{className:`h-4 w-4`})]})]})]})}),se=()=>(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Q.jsx)(jt,{className:`h-6 w-6 animate-spin text-muted-foreground`})});return(0,Q.jsxs)(Zt,{children:[(0,Q.jsx)(Wt,{description:`Review account, usage, billing, and organization details.`,title:`Account`}),(0,Q.jsx)(`div`,{className:`mb-6 flex items-center gap-0 border-b border-border`,children:R.map(n=>{let r=!i&&n!==`overview`;return(0,Q.jsxs)(`button`,{disabled:r,type:`button`,onClick:()=>t(n),className:G(`relative px-4 py-2.5 text-sm font-medium capitalize transition-colors`,e===n?`text-foreground`:`text-muted-foreground hover:text-foreground`,r&&`cursor-not-allowed opacity-45 hover:text-muted-foreground`),children:[n,e===n&&(0,Q.jsx)(`span`,{className:`absolute inset-x-0 -bottom-px h-0.5 bg-foreground`})]},n)})}),e===`overview`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[f&&se(),m&&(bn(m)?z():oe(m,F)),!f&&!m&&i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`rounded-lg border border-border p-5`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-primary/20 text-2xl font-bold text-primary`,children:i.displayName?.charAt(0)??i.email?.charAt(0)??`?`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:i.displayName||i.email}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:i.email}),(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Member since `,re(i.createdAt)]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Q.jsxs)(`a`,{href:`https://app.cline.bot/dashboard`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex h-8 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:[`Open dashboard`,(0,Q.jsx)(Pt,{className:`h-3.5 w-3.5`})]}),(0,Q.jsxs)(U,{className:`h-8 rounded-md px-2.5 text-xs`,disabled:n!==null,onClick:()=>void I(),type:`button`,variant:`outline`,children:[n===`sign-out`?(0,Q.jsx)(jt,{className:`h-3.5 w-3.5 animate-spin`}):(0,Q.jsx)(pn,{className:`h-3.5 w-3.5`}),n===`sign-out`?`Signing out`:`Sign out`]})]})]})}),L!==null&&(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(cn,{className:`h-5 w-5 text-primary`}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:N?`${N.name} Balance`:`Credits Balance`})]}),(0,Q.jsxs)(`a`,{href:`https://app.cline.bot/dashboard/organization?tab=credits&redirect=true`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:[(0,Q.jsx)(st,{className:`h-3.5 w-3.5`}),`Credit`]})]}),(0,Q.jsx)(`div`,{className:`flex items-baseline gap-2`,children:(0,Q.jsxs)(`span`,{className:`text-3xl font-bold text-foreground`,children:[`$`,ae(L)]})}),N&&o&&(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Personal account: `,ae(o.balance),` `,`credits`]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(rn,{className:`h-5 w-5 text-muted-foreground`}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Organizations`})]}),(0,Q.jsxs)(`a`,{href:`https://app.cline.bot/onboarding?step=1`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:[(0,Q.jsx)(st,{className:`h-3.5 w-3.5`}),`Create`]})]}),u.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No organizations yet.`}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border px-4 py-3 transition-colors hover:bg-accent/20`,children:[(0,Q.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-secondary text-sm font-bold text-foreground`,children:e.name.charAt(0)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e.name}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground capitalize`,children:e.roles.join(`, `)})]}),e.active&&(0,Q.jsx)(`span`,{className:`rounded-full bg-primary/20 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]},e.organizationId))})]})]})]}),e===`usage`&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-6 text-sm text-muted-foreground`,children:N?`Recent API usage and token consumption for ${N.name}.`:`Recent API usage and token consumption across all providers.`}),v&&se(),b&&oe(b,te),!v&&!b&&S&&(g.length===0?(0,Q.jsx)(`p`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No usage transactions yet.`}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_auto_auto] gap-4 border-b border-border bg-secondary/50 px-4 py-2.5 text-xs font-medium text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Model`}),(0,Q.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,Q.jsx)(`span`,{className:`text-right`,children:`Credits`}),(0,Q.jsx)(`span`,{className:`text-right`,children:`Time`})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border`,children:g.map(e=>(0,Q.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-3 text-sm transition-colors hover:bg-accent/20`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-foreground truncate`,children:e.aiModelName}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.aiInferenceProviderName})]}),(0,Q.jsx)(`div`,{className:`text-right text-muted-foreground`,children:e.totalTokens.toLocaleString()}),(0,Q.jsx)(`div`,{className:`text-right text-foreground font-medium`,children:ae(e.creditsUsed)}),(0,Q.jsxs)(`div`,{className:`text-right text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:re(e.createdAt)}),(0,Q.jsx)(`p`,{children:ie(e.createdAt)})]})]},e.id))})]}))]}),e===`billing`&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-6 text-sm text-muted-foreground`,children:`Payment history and credit purchases.`}),D&&se(),k&&oe(k,ne),!D&&!k&&j&&(T.length===0?(0,Q.jsx)(`p`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No payment transactions yet.`}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_auto] gap-4 border-b border-border bg-secondary/50 px-4 py-2.5 text-xs font-medium text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Date`}),(0,Q.jsx)(`span`,{className:`text-right`,children:`Amount`}),(0,Q.jsx)(`span`,{className:`text-right`,children:`Credits`})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border`,children:T.map(e=>(0,Q.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_auto] gap-4 px-4 py-3 text-sm transition-colors hover:bg-accent/20`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(gn,{className:`h-4 w-4 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:`text-foreground`,children:re(e.paidAt)})]}),(0,Q.jsxs)(`div`,{className:`text-right text-foreground font-medium`,children:[`$`,(e.amountCents/100).toFixed(2)]}),(0,Q.jsxs)(`div`,{className:`text-right text-primary font-medium`,children:[`+`,ae(e.credits)]})]},`${e.paidAt}-${e.amountCents}-${e.credits}`))})]}))]})]})}var kn=[`streaming`,`tools`,`reasoning`,`vision`,`prompt-cache`];function An({onBack:e,onSave:t,existingProviderIds:n}){let[r,i]=(0,Z.useState)({providerId:``,name:``,models:[],defaultModel:``,apiKey:``,baseUrl:``,modelsSourceUrl:``,headers:{},timeoutMs:``,capabilities:[`streaming`,`tools`]}),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),h=(0,Z.useMemo)(()=>r.providerId.trim().toLowerCase().replace(/\s+/g,`-`),[r.providerId]),_=n.includes(h),v=r.models.length>0,y=r.modelsSourceUrl.trim().length>0,b=h.length>0&&r.name.trim().length>0&&r.baseUrl.trim().length>0&&(v||y)&&!_,x=e=>{if((e.key===`Enter`||e.key===`,`)&&a.trim()){e.preventDefault();let t=a.trim().replace(/,/g,``);t&&!r.models.includes(t)&&i(e=>({...e,models:[...e.models,t],defaultModel:e.defaultModel||t})),o(``)}else e.key===`Backspace`&&!a&&r.models.length>0&&i(e=>({...e,models:e.models.slice(0,-1)}))},S=e=>{i(t=>{let n=t.models.filter(t=>t!==e);return{...t,models:n,defaultModel:t.defaultModel===e?n[0]??``:t.defaultModel}})},C=e=>{i(t=>({...t,capabilities:t.capabilities.includes(e)?t.capabilities.filter(t=>t!==e):[...t.capabilities,e]}))},w=()=>{i(e=>({...e,headers:{...e.headers,"":``}}))},T=(e,t,n)=>{let a=Object.entries(r.headers),o={};a.forEach(([e,r],i)=>{o[i===n?t:e]=r}),e!==t&&delete o[e],i(e=>({...e,headers:o}))},E=(e,t)=>{i(n=>({...n,headers:{...n.headers,[e]:t}}))},D=e=>{let t={...r.headers};delete t[e],i(e=>({...e,headers:t}))},O=async()=>{if(!(!b||d)){f(!0),m(null);try{await t({providerId:h,name:r.name.trim(),baseUrl:r.baseUrl.trim(),apiKey:r.apiKey.trim()||void 0,headers:Object.fromEntries(Object.entries(r.headers).map(([e,t])=>[e.trim(),t]).filter(([e])=>e.length>0)),timeoutMs:r.timeoutMs.trim().length>0?Number.parseInt(r.timeoutMs.trim(),10):void 0,models:r.models,defaultModelId:r.defaultModel||r.models[0],modelsSourceUrl:r.modelsSourceUrl.trim()||void 0,capabilities:r.capabilities.length>0?r.capabilities:void 0})}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}}};return(0,Q.jsxs)(Zt,{contentClassName:`max-w-4xl`,children:[(0,Q.jsx)(Wt,{description:`Add an OpenAI-compatible provider and choose its available models.`,title:`Add Provider`,actions:(0,Q.jsxs)(U,{onClick:e,variant:`secondary`,className:`rounded-md p-1.5 transition-colors`,"aria-label":`Back to providers`,children:[(0,Q.jsx)(nn,{className:`h-4 w-4`}),`Providers`]})}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(`h3`,{className:`mb-4 text-sm font-semibold text-foreground`,children:`OpenAI-Compatible Provider`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Provider ID`}),(0,Q.jsx)(`input`,{type:`text`,value:r.providerId,onChange:e=>i(t=>({...t,providerId:e.target.value})),placeholder:`my-provider`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:`Lowercase ID used in provider registry.`}),_?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:`This provider ID already exists.`}):null]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Provider Name`}),(0,Q.jsx)(`input`,{type:`text`,value:r.name,onChange:e=>i(t=>({...t,name:e.target.value})),placeholder:`My Provider`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`})]})]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(K,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Base URL`}),(0,Q.jsx)(`input`,{type:`url`,value:r.baseUrl,onChange:e=>i(t=>({...t,baseUrl:e.target.value})),placeholder:`https://api.example.com/v1`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(K,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Model Source URL (Optional)`}),(0,Q.jsx)(`input`,{type:`url`,value:r.modelsSourceUrl,onChange:e=>i(t=>({...t,modelsSourceUrl:e.target.value})),placeholder:`https://api.example.com/v1/models`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:"Supported JSON: OpenAI `/models` shape with a `data` array, or a direct model array."})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(K,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Models`}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 flex-wrap content-start gap-1.5 rounded-lg border border-border bg-input px-3 py-2 focus-within:ring-1 focus-within:ring-ring`,children:[r.models.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-2 py-1 text-xs font-medium text-primary`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e}),(0,Q.jsx)(U,{onClick:()=>S(e),className:`text-primary/60 hover:text-primary transition-colors`,"aria-label":`Remove ${e}`,children:(0,Q.jsx)(Je,{className:`h-3 w-3`})})]},e)),(0,Q.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:x,placeholder:r.models.length===0?`Type model ID and press Enter`:``,className:`min-w-35 flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none`})]}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:`Add at least one model or set a Model Source URL.`})]}),r.models.length>1?(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(K,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Default Model`}),(0,Q.jsx)(`select`,{value:r.defaultModel,onChange:e=>i(t=>({...t,defaultModel:e.target.value})),className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground outline-none focus:ring-1 focus:ring-ring`,children:r.models.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}):null,(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(K,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`API Key (Optional)`}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`input`,{type:s?`text`:`password`,value:r.apiKey,onChange:e=>i(t=>({...t,apiKey:e.target.value})),placeholder:`sk-...`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 pr-20 font-mono text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsxs)(`div`,{className:`absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-1`,children:[(0,Q.jsx)(U,{onClick:()=>c(!s),variant:`ghost`,className:`rounded-md p-1 transition-colors`,"aria-label":s?`Hide API key`:`Show API key`,children:s?(0,Q.jsx)(ln,{className:`h-4 w-4`}):(0,Q.jsx)(un,{className:`h-4 w-4`})}),(0,Q.jsx)(U,{onClick:()=>navigator.clipboard.writeText(r.apiKey),variant:`ghost`,className:`rounded-md p-1 transition-colors`,"aria-label":`Copy API key`,children:(0,Q.jsx)(At,{className:`h-4 w-4`})})]})]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(K,{className:`mb-3 block text-xs font-medium text-muted-foreground`,children:`Capabilities`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:kn.map(e=>(0,Q.jsx)(U,{onClick:()=>C(e),className:G(`rounded-lg border px-3 py-1.5 text-xs font-medium transition-all`,r.capabilities.includes(e)?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-card text-muted-foreground hover:border-muted-foreground/50 hover:text-foreground`),children:e.replace(/-/g,` `)},e))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border overflow-hidden`,children:[(0,Q.jsxs)(U,{onClick:()=>u(!l),className:`flex w-full items-center justify-between px-5 py-4 text-sm font-medium transition-colors text-foreground/40`,variant:`ghost`,children:[`Advanced Settings`,(0,Q.jsx)(ct,{className:G(`h-4 w-4 text-muted-foreground transition-transform`,l&&`rotate-180`)})]}),l?(0,Q.jsxs)(`div`,{className:`border-t border-border px-5 py-5 flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Timeout (ms)`}),(0,Q.jsx)(`input`,{type:`number`,value:r.timeoutMs,onChange:e=>i(t=>({...t,timeoutMs:e.target.value})),placeholder:`30000`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Custom Headers`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Object.entries(r.headers).map(([e,t],n)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,value:e,onChange:t=>T(e,t.target.value,n),placeholder:`Header name`,className:`flex-1 rounded-lg border border-border bg-input px-3 py-2 font-mono text-xs text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsx)(`input`,{type:`text`,value:t,onChange:t=>E(e,t.target.value),placeholder:`Value`,className:`flex-1 rounded-lg border border-border bg-input px-3 py-2 font-mono text-xs text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsx)(U,{onClick:()=>D(e),className:`rounded-md p-2 text-muted-foreground hover:text-destructive transition-colors`,"aria-label":`Remove header`,children:(0,Q.jsx)(g,{className:`h-4 w-4`})})]},e)),(0,Q.jsxs)(U,{onClick:w,className:`flex items-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors w-fit`,children:[(0,Q.jsx)(st,{className:`h-3 w-3`}),`Add Header`]})]})]})]}):null]}),p?(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,children:p}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-3 pt-2`,children:[(0,Q.jsx)(U,{onClick:e,className:`rounded-lg border border-border px-4 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:`Cancel`}),(0,Q.jsx)(U,{onClick:()=>void O(),disabled:!b||d,className:G(`rounded-lg px-4 py-2 text-sm font-medium transition-colors`,b&&!d?`bg-primary text-primary-foreground hover:bg-primary/90`:`bg-muted text-muted-foreground cursor-not-allowed`),children:d?`Saving...`:`Add Provider`})]})]})]})}function jn(e,t){return t.find(t=>t.id===e.type)?.name??e.type}function Mn(e){return e.botUsername?`@${e.botUsername}`:e.userName?e.userName:e.applicationId?e.applicationId:`pid ${e.pid}`}function Nn(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Pn(e){let t=e.label.toLowerCase(),n=`flag`in e?e.flag.toLowerCase():e.key.toLowerCase();return t.includes(`token`)||t.includes(`secret`)||t.includes(`key`)||n.includes(`token`)||n.includes(`secret`)||n.includes(`key`)}function Fn(e){return e.label.toLowerCase().includes(`json`)||e.flag.includes(`credentials`)}function In(e,t){let n=e.includeWhen;if(!n)return!0;let r=t[n.flag]??``;return!(n.equals!==void 0&&r!==n.equals||n.notEquals!==void 0&&r===n.notEquals)}function Ln(e){let t={};for(let n of e?.fields??[])n.initialValue&&(t[n.flag]=n.initialValue);return t}function Rn(e){let t=e[0];return{channelId:t?.id??``,values:Ln(t),securityEnabled:!1,securityValues:{}}}function zn(){let[e,t]=(0,Z.useState)([]),[n,r]=(0,Z.useState)([]),[i,a]=(0,Z.useState)(!0),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)({channelId:``,values:{},securityEnabled:!1,securityValues:{}}),[m,h]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(null),y=(0,Z.useMemo)(()=>e.find(e=>e.id===f.channelId),[e,f.channelId]),b=(0,Z.useMemo)(()=>{let e={...Ln(y),...f.values};return(y?.fields??[]).filter(t=>In(t,e))},[y,f.values]),x=(0,Z.useCallback)(e=>{t(e.available),r(e.active),p(t=>t.channelId?t:Rn(e.available))},[]),S=(0,Z.useCallback)(async()=>{a(!0),l(null);try{let e=await X.invoke(`list_connector_channels`);x(e)}catch(e){let t=e instanceof Error?e.message:String(e);l(t)}finally{a(!1)}},[x]);(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>{S()},0);return()=>window.clearTimeout(e)},[S]);let C=()=>{p(Rn(e)),h(null),d(!0)},w=(e,t)=>{p(n=>({...n,values:{...n.values,[e]:t}}))},T=(e,t)=>{p(n=>({...n,securityValues:{...n.securityValues,[e]:t}}))},E=async()=>{if(!y){h(`Choose a channel`);return}for(let e of y.fields)if(b.includes(e)&&e.required&&!f.values[e.flag]?.trim()){h(`${e.label} is required`);return}if(f.securityEnabled&&y.security){for(let e of y.security.fields)if(!f.securityValues[e.key]?.trim()){h(e.requiredMessage);return}}s(y.id),h(null),l(null);try{let e=await X.invoke(`start_connector_channel`,{channel:y.id,values:f.values,security:{enabled:f.securityEnabled,values:f.securityValues}});x(e),d(!1)}catch(e){let t=e instanceof Error?e.message:String(e);h(t)}finally{s(null)}},D=async e=>{s(e.type),l(null);try{let t=await X.invoke(`stop_connector_channel`,{channel:e.type});x(t),v(null)}catch(e){let t=e instanceof Error?e.message:String(e);l(t)}finally{s(null)}};return(0,Q.jsxs)(Zt,{children:[(0,Q.jsx)(Wt,{description:`${n.length} connected. Start and manage connector channels for Cline Hub.`,title:`Channels`,meta:(0,Q.jsx)(Ut,{children:`cline connect`}),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{disabled:i,onClick:()=>void S(),size:`sm`,type:`button`,variant:`outline`,children:(0,Q.jsx)(It,{className:G(`size-4`,i&&`animate-spin`)})}),(0,Q.jsxs)(U,{disabled:e.length===0,onClick:C,size:`sm`,type:`button`,children:[(0,Q.jsx)(st,{className:`size-4`}),`Add Channel`]})]})}),c?(0,Q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:c}):null,i?(0,Q.jsx)(Yt,{children:`Loading channels...`}):n.length===0?(0,Q.jsx)(Yt,{children:`No channels connected.`}):(0,Q.jsx)(`section`,{className:`overflow-hidden rounded-lg border bg-card`,children:(0,Q.jsx)(`div`,{className:`grid gap-2 p-2.5`,children:n.map(t=>(0,Q.jsxs)(`div`,{className:`grid gap-3 border bg-[color-mix(in_oklch,var(--background)_70%,var(--card))] p-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(ot,{className:`size-2 fill-emerald-300 text-emerald-300`}),(0,Q.jsx)(`p`,{className:`truncate text-[13px] font-semibold leading-tight`,children:jn(t,e)}),(0,Q.jsx)(`span`,{className:`rounded-md border bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:Mn(t)})]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`rounded-md border bg-background px-1.5 py-0.5`,children:[`pid=`,t.pid]}),(0,Q.jsx)(`span`,{className:`max-w-full break-all rounded-md border bg-background px-1.5 py-0.5`,title:t.hubUrl,children:t.hubUrl}),t.baseUrl?(0,Q.jsx)(`span`,{className:`max-w-full break-all rounded-md border bg-background px-1.5 py-0.5`,title:t.baseUrl,children:t.baseUrl}):null,(0,Q.jsx)(`span`,{className:`rounded-md border bg-background px-1.5 py-0.5`,children:Nn(t.startedAt)}),t.connectionMode?(0,Q.jsx)(`span`,{className:`rounded-md border bg-background px-1.5 py-0.5`,children:t.connectionMode}):null]})]}),(0,Q.jsxs)(U,{disabled:o===t.type,onClick:()=>v(t),size:`sm`,type:`button`,variant:`outline`,children:[(0,Q.jsx)(g,{className:`size-4`}),`Remove...`]})]},t.id))})}),(0,Q.jsx)(ft,{open:u,onOpenChange:d,children:(0,Q.jsxs)(bt,{className:`max-h-[86vh] overflow-y-auto sm:max-w-xl`,children:[(0,Q.jsxs)(mt,{children:[(0,Q.jsx)(St,{children:`Add Channel`}),(0,Q.jsx)(Tt,{children:`Start a connector channel for Cline Hub.`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(K,{children:`Channel`}),(0,Q.jsxs)(gt,{onValueChange:t=>{t&&p({channelId:t,values:Ln(e.find(e=>e.id===t)),securityEnabled:!1,securityValues:{}})},value:f.channelId,children:[(0,Q.jsx)(Et,{children:(0,Q.jsx)(q,{placeholder:`Select channel`})}),(0,Q.jsx)(ht,{children:e.map(e=>(0,Q.jsx)(lt,{value:e.id,children:e.name},e.id))})]})]}),b.map(e=>(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsxs)(K,{children:[e.label,e.required?(0,Q.jsx)(`span`,{className:`text-destructive`,children:` *`}):null]}),e.options?(0,Q.jsxs)(gt,{onValueChange:t=>{t&&w(e.flag,t)},value:f.values[e.flag]??e.initialValue??``,children:[(0,Q.jsx)(Et,{children:(0,Q.jsx)(q,{placeholder:e.placeholder})}),(0,Q.jsx)(ht,{children:e.options.map(e=>(0,Q.jsx)(lt,{value:e.value,children:e.label},e.value))})]}):Fn(e)?(0,Q.jsx)(wt,{onChange:t=>w(e.flag,t.target.value),placeholder:e.placeholder,rows:5,value:f.values[e.flag]??``}):(0,Q.jsx)(V,{onChange:t=>w(e.flag,t.target.value),placeholder:e.placeholder,type:Pn(e)?`password`:`text`,value:f.values[e.flag]??``})]},e.flag)),y?.security?(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-lg border p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(K,{className:`text-sm`,children:`Restrict access`}),(0,Q.jsx)(J,{checked:f.securityEnabled,onCheckedChange:e=>p(t=>({...t,securityEnabled:e}))})]}),f.securityEnabled?y.security.fields.map(e=>(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(K,{children:e.label}),(0,Q.jsx)(V,{onChange:t=>T(e.key,t.target.value),placeholder:e.placeholder,type:Pn(e)?`password`:`text`,value:f.securityValues[e.key]??``})]},e.key)):null]}):null,m?(0,Q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:m}):null]}),(0,Q.jsxs)(pt,{children:[(0,Q.jsx)(U,{disabled:o!==null,onClick:()=>d(!1),type:`button`,variant:`outline`,children:`Cancel`}),(0,Q.jsx)(U,{disabled:o!==null||!y,onClick:()=>void E(),type:`button`,children:o?`Starting...`:`Add Channel`})]})]})}),(0,Q.jsx)(Kt,{open:_!==null,onOpenChange:e=>{e||v(null)},children:(0,Q.jsxs)($t,{children:[(0,Q.jsxs)(en,{children:[(0,Q.jsx)(Vt,{children:`Remove Channel`}),(0,Q.jsxs)(tn,{children:[`Confirm that you want to stop the active`,` `,_?jn(_,e):`channel`,` `,`channel for `,_?Mn(_):``,`.`]})]}),(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(Ht,{disabled:o!==null,children:`Cancel`}),(0,Q.jsx)(Gt,{disabled:o!==null||!_,onClick:()=>{_&&D(_)},variant:`destructive`,children:`Remove`})]})]})})]})}function Bn(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function Vn(e){let t=Bn(e);if(t.length===0)return;let n={};for(let e of t){let t=e.indexOf(`=`);if(t<=0)continue;let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();r&&(n[r]=i)}return Object.keys(n).length>0?n:void 0}function Hn(e){return e?Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`, `):``}function Un(e){return e?Object.keys(e).map(e=>`${e}=[REDACTED]`).join(`, `):``}function Wn(e){return!e||Object.keys(e).length===0?[{id:crypto.randomUUID(),key:``,value:``}]:Object.entries(e).map(([e,t])=>({id:crypto.randomUUID(),key:e,value:t}))}function Gn(e){return{name:e?.name??``,previousName:e?.name??``,transportType:e?.transportType??`stdio`,command:e?.command??``,argsText:e?.args?.join(`, `)??``,cwd:e?.cwd??``,envEntries:Wn(e?.env),url:e?.url??``,headersText:Hn(e?.headers),disabled:e?.disabled??!1,metadataText:e?.metadata===void 0?``:JSON.stringify(e.metadata,null,2)}}function Kn(){let[e,t]=(0,Z.useState)([]),[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!0),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(`create`),[y,b]=(0,Z.useState)(()=>Gn()),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(null),T=(0,Z.useCallback)(e=>{t(e.servers),r(e.settingsPath),a(e.hasSettingsFile)},[]),E=(0,Z.useCallback)(async()=>{s(!0),d(null);try{let e=await X.invoke(`list_mcp_servers`);T(e)}catch(e){let t=e instanceof Error?e.message:String(e);d(t)}finally{s(!1)}},[T]);(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>{E()},0);return()=>window.clearTimeout(e)},[E]);let D=async(e,t)=>{p(e.name),d(null);try{let n=await X.invoke(`set_mcp_server_disabled`,{name:e.name,disabled:t});T(n)}catch(e){let t=e instanceof Error?e.message:String(e);d(t)}finally{p(null)}},O=async e=>{p(e.previousName??e.name),d(null);try{let t=await X.invoke(`upsert_mcp_server`,{input:e});T(t)}catch(e){let t=e instanceof Error?e.message:String(e);throw d(t),e}finally{p(null)}},k=async e=>{p(e),d(null);try{let t=await X.invoke(`delete_mcp_server`,{name:e});T(t)}catch(e){let t=e instanceof Error?e.message:String(e);d(t)}finally{p(null)}},A=(0,Z.useCallback)(e=>{let t=e.name.trim();if(!t)throw Error(`Server name is required.`);let n=e.envEntries.reduce((e,t)=>{let n=t.key.trim();return n&&(e[n]=t.value),e},{}),r=e.metadataText.trim(),i=r.length>0?JSON.parse(r):void 0;if(e.transportType===`stdio`){let r=e.command.trim();if(!r)throw Error(`Command is required for stdio transport.`);let a=Bn(e.argsText);return{name:t,previousName:e.previousName.trim()||void 0,transportType:e.transportType,command:r,args:a.length>0?a:void 0,cwd:e.cwd.trim()||void 0,env:Object.keys(n).length>0?n:void 0,disabled:e.disabled,metadata:i}}let a=e.url.trim();if(!a)throw Error(`URL is required for sse and streamableHttp transport.`);return{name:t,previousName:e.previousName.trim()||void 0,transportType:e.transportType,url:a,headers:Vn(e.headersText),disabled:e.disabled,metadata:i}},[]),j=()=>{v(`create`),b(Gn()),S(null),h(!0)},M=e=>{v(`edit`),b(Gn(e)),S(null),h(!0)},N=async()=>{S(null);try{let e=A(y);await O(e),h(!1)}catch(e){S(e instanceof Error?e.message:String(e))}},P=async()=>{l(!0),d(null);try{let e=await X.invoke(`open_mcp_settings_file`);e.trim().length>0&&(r(e),a(!0))}catch(e){let t=e instanceof Error?e.message:String(e);d(t)}finally{l(!1)}},F=(0,Z.useMemo)(()=>[...e].sort((e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase())),[e]),ee=(e,t,n)=>{b(r=>({...r,envEntries:r.envEntries.map(r=>r.id===e?{...r,[t]:n}:r)}))},I=()=>{b(e=>({...e,envEntries:[...e.envEntries,{id:crypto.randomUUID(),key:``,value:``}]}))},te=e=>{b(t=>({...t,envEntries:t.envEntries.length===1?[{id:crypto.randomUUID(),key:``,value:``}]:t.envEntries.filter(t=>t.id!==e)}))};return(0,Q.jsxs)(Zt,{children:[(0,Q.jsx)(Wt,{description:i?`Editing this list updates cline_mcp_settings.json.`:`No MCP settings file found yet. Add a server to create it.`,title:`MCP Servers`,meta:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ut,{children:`cline config mcp`}),(0,Q.jsx)(`span`,{className:`rounded-md border border-border bg-background px-2 py-0.5 text-xs text-muted-foreground`,children:`From settings file`})]}),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>void E(),disabled:o,children:(0,Q.jsx)(It,{className:G(`h-4 w-4`,o&&`animate-spin`)})}),(0,Q.jsxs)(U,{size:`sm`,onClick:j,children:[(0,Q.jsx)(st,{className:`h-4 w-4`}),`Add MCP Server`]})]})}),(0,Q.jsxs)(`div`,{className:`mb-1 flex flex-wrap items-center gap-2 text-sm text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`MCP settings path:`}),(0,Q.jsx)(U,{variant:`link`,className:`h-auto p-0 font-mono text-xs`,onClick:()=>void P(),disabled:c,children:n||`Open settings file`})]}),u&&(0,Q.jsx)(`div`,{className:`mb-4 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:u}),o?(0,Q.jsx)(`div`,{className:`rounded-lg border border-border px-5 py-4 text-sm text-muted-foreground`,children:`Loading MCP servers...`}):F.length===0?(0,Q.jsx)(`div`,{className:`rounded-lg border border-border px-5 py-4 text-sm text-muted-foreground`,children:`No MCP servers configured.`}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:F.map(e=>{let t=f===e.name;return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4 transition-colors hover:bg-accent/20`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(ot,{className:G(`h-2.5 w-2.5 shrink-0`,e.disabled?`fill-muted-foreground/40 text-muted-foreground/40`:`fill-primary text-primary`)}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.name}),(0,Q.jsx)(`span`,{className:`rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:e.transportType}),(0,Q.jsx)(`div`,{className:`flex-1`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(U,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit ${e.name}`,onClick:()=>M(e),disabled:t,children:(0,Q.jsx)(Rt,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(U,{variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e.name}`,onClick:()=>w(e),disabled:t,children:(0,Q.jsx)(g,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(J,{checked:!e.disabled,onCheckedChange:t=>D(e,!t),disabled:t,"aria-label":`Enable ${e.name}`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2.5 ml-5.5 flex flex-col gap-1 text-xs text-muted-foreground`,children:[e.command&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Command:`}),` `,e.command]}),e.args&&e.args.length>0&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Args:`}),` `,e.args.join(`, `)]}),e.cwd&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`CWD:`}),` `,e.cwd]}),e.url&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`URL:`}),` `,e.url]}),e.env&&Object.keys(e.env).length>0&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Env:`}),` `,Un(e.env)]}),e.headers&&Object.keys(e.headers).length>0&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Headers:`}),` `,Hn(e.headers)]})]})]},e.name)})}),(0,Q.jsx)(ft,{open:m,onOpenChange:e=>{h(e),e||S(null)},children:(0,Q.jsxs)(bt,{className:`max-h-[90vh] overflow-y-auto sm:max-w-2xl`,children:[(0,Q.jsxs)(mt,{children:[(0,Q.jsx)(St,{children:_===`edit`?`Edit MCP Server`:`Add MCP Server`}),(0,Q.jsxs)(Tt,{children:[`Update the MCP server stored in`,` `,(0,Q.jsx)(`code`,{className:`font-mono`,children:n||`cline_mcp_settings.json`}),`.`]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(K,{htmlFor:`mcp-name`,children:`Server name`}),(0,Q.jsx)(V,{id:`mcp-name`,value:y.name,onChange:e=>b(t=>({...t,name:e.target.value})),placeholder:`github`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(K,{children:`Transport type`}),(0,Q.jsxs)(gt,{value:y.transportType,onValueChange:e=>b(t=>({...t,transportType:e})),children:[(0,Q.jsx)(Et,{className:`w-full`,children:(0,Q.jsx)(q,{placeholder:`Select transport`})}),(0,Q.jsxs)(ht,{children:[(0,Q.jsx)(lt,{value:`stdio`,children:`stdio`}),(0,Q.jsx)(lt,{value:`sse`,children:`sse`}),(0,Q.jsx)(lt,{value:`streamableHttp`,children:`streamableHttp`})]})]})]}),y.transportType===`stdio`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(K,{htmlFor:`mcp-command`,children:`Command`}),(0,Q.jsx)(V,{id:`mcp-command`,value:y.command,onChange:e=>b(t=>({...t,command:e.target.value})),placeholder:`npx`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(K,{htmlFor:`mcp-args`,children:`Args`}),(0,Q.jsx)(wt,{id:`mcp-args`,value:y.argsText,onChange:e=>b(t=>({...t,argsText:e.target.value})),placeholder:`-y, @modelcontextprotocol/server-github`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(K,{htmlFor:`mcp-cwd`,children:`Working directory`}),(0,Q.jsx)(V,{id:`mcp-cwd`,value:y.cwd,onChange:e=>b(t=>({...t,cwd:e.target.value})),placeholder:`/path/to/project`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(K,{children:`Environment variables`}),(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:I,children:(0,Q.jsx)(st,{className:`h-3.5 w-3.5`})})]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:y.envEntries.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>te(e.id),"aria-label":`Remove env var ${e.key||`row`}`,children:(0,Q.jsx)(mn,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(V,{value:e.key,onChange:t=>ee(e.id,`key`,t.target.value),placeholder:`KEY`}),(0,Q.jsx)(V,{type:`password`,value:e.value,onChange:t=>ee(e.id,`value`,t.target.value),placeholder:`VALUE`})]},e.id))})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(K,{htmlFor:`mcp-url`,children:`Server URL`}),(0,Q.jsx)(V,{id:`mcp-url`,value:y.url,onChange:e=>b(t=>({...t,url:e.target.value})),placeholder:`https://example.com/mcp`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(K,{htmlFor:`mcp-headers`,children:`Headers`}),(0,Q.jsx)(wt,{id:`mcp-headers`,value:y.headersText,onChange:e=>b(t=>({...t,headersText:e.target.value})),placeholder:`Authorization=Bearer token`})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(K,{htmlFor:`mcp-metadata`,children:`Metadata JSON`}),(0,Q.jsx)(wt,{id:`mcp-metadata`,value:y.metadataText,onChange:e=>b(t=>({...t,metadataText:e.target.value})),placeholder:`{"key":"value"}`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Enabled`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Disable the server without removing it from settings.`})]}),(0,Q.jsx)(J,{checked:!y.disabled,onCheckedChange:e=>b(t=>({...t,disabled:!e})),"aria-label":`Enable MCP server`})]}),x?(0,Q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:x}):null]}),(0,Q.jsxs)(pt,{children:[(0,Q.jsx)(U,{variant:`outline`,onClick:()=>h(!1),disabled:f!==null,children:`Cancel`}),(0,Q.jsx)(U,{onClick:()=>void N(),disabled:f!==null,children:f===null?_===`edit`?`Save changes`:`Add server`:`Saving...`})]})]})}),(0,Q.jsx)(Kt,{open:C!==null,onOpenChange:e=>{e||w(null)},children:(0,Q.jsxs)($t,{children:[(0,Q.jsxs)(en,{children:[(0,Q.jsx)(Vt,{children:`Delete MCP Server`}),(0,Q.jsx)(tn,{children:C?`Delete MCP server "${C.name}" from settings?`:`Delete this MCP server from settings?`})]}),(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(Ht,{disabled:f!==null,children:`Cancel`}),(0,Q.jsx)(Gt,{disabled:f!==null||!C,onClick:()=>{C&&(k(C.name),w(null))},children:`Delete`})]})]})})]})}function qn(e){let t={...e.configValues??{}};e.apiKey!==void 0&&t.apiKey===void 0&&(t.apiKey=e.apiKey),e.baseUrl!==void 0&&t.baseUrl===void 0&&(t.baseUrl=e.baseUrl);for(let n of e.configFields??[])t[n.path]===void 0&&n.defaultValue!==void 0&&(t[n.path]=n.defaultValue);return t}function Jn(e){return e==null?``:String(e)}function Yn(e,t){if(e.type===`boolean`)return!!t;if(typeof t==`boolean`)return t;if(e.type===`select`){let n=e.options?.find(e=>String(e.value)===t);if(n)return n.value}let n=t.trim();if(n.length===0)return null;if(e.type===`number`){let e=Number(n);return Number.isFinite(e)?e:null}return n}function Xn({providers:e,onToggle:t,onConfigure:n,onAddProvider:r,selectedProviderId:i,variant:a=`page`}){let[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(``),u=e.filter(e=>e.enabled).length,d=c.trim().toLowerCase(),f=d?e.filter(e=>e.name.toLowerCase().includes(d)):e,p=a===`panel`;return(0,Q.jsx)(qt,{className:`h-full`,children:(0,Q.jsxs)(`div`,{className:G(`py-10 max-[720px]:px-4 max-[720px]:py-5`,p?`px-8`:`px-18 max-[1200px]:px-8`),children:[(0,Q.jsxs)(`div`,{className:G(`mb-8 flex items-start justify-between gap-6 max-[860px]:flex-col max-[860px]:items-stretch`,p?`max-w-none`:`max-w-[42rem]`),children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:G(`truncate font-semibold leading-[1.15] tracking-normal text-foreground`,p?`text-[24px]`:`text-[32px]`),children:`Model Providers`}),(0,Q.jsxs)(`p`,{className:`mt-3 text-[15px] leading-6 text-muted-foreground`,children:[`Configure model providers and choose which ones are available.`,` `,e.length,` available · `,u,` `,`enabled`]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 max-[860px]:justify-start`,children:[(0,Q.jsx)(U,{"aria-label":`Search providers`,className:`size-8 rounded-md`,onClick:()=>s(e=>!e),size:`icon-sm`,type:`button`,variant:o?`default`:`secondary`,children:(0,Q.jsx)(x,{className:`size-4`})}),(0,Q.jsxs)(U,{className:`h-8 rounded-md bg-foreground px-3 text-sm text-background hover:bg-foreground/90`,onClick:r,type:`button`,children:[(0,Q.jsx)(sn,{className:`size-4`}),`Add provider`]})]})]}),o?(0,Q.jsx)(`div`,{className:G(`mb-4`,p?`max-w-none`:`max-w-[42rem]`),children:(0,Q.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded border bg-background px-3`,children:[(0,Q.jsx)(x,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Q.jsx)(V,{"aria-label":`Search model providers`,autoFocus:!0,className:`h-7 border-0 bg-transparent px-0 text-sm`,onChange:e=>l(e.target.value),placeholder:`Search providers`,value:c})]})}):null,(0,Q.jsxs)(`div`,{className:G(`overflow-hidden`,p?`max-w-none`:`max-w-[42rem]`),children:[f.length===0?(0,Q.jsxs)(`div`,{className:`border-b px-2 py-6 text-[15px] text-muted-foreground`,children:[`No providers match "`,c.trim(),`".`]}):null,f.map(e=>(0,Q.jsxs)(`div`,{className:G(`flex min-h-11 items-center gap-4 border-b px-2 py-2 transition-colors hover:bg-accent/30`,i===e.id&&`bg-accent/45`),children:[(0,Q.jsxs)(`button`,{className:`flex min-w-0 flex-1 items-center gap-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>n(e.id),type:`button`,children:[(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[17px] font-semibold text-foreground`,children:e.name}),(0,Q.jsx)(`p`,{className:`shrink-0 text-[15px] text-muted-foreground`,children:e.models===null?`Models load on demand`:`${e.models} model${e.models===1?``:`s`}`})]}),(0,Q.jsx)(J,{"aria-label":`Toggle ${e.name}`,checked:e.enabled,onCheckedChange:()=>t(e.id)}),(0,Q.jsx)(`button`,{"aria-label":`Configure ${e.name}`,className:`grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>n(e.id),type:`button`,children:(0,Q.jsx)(an,{className:`size-4`})})]},e.id))]})]})})}function Zn({provider:e,onBack:t,onUpdate:n,onLoadModels:r,modelsLoading:i=!1,modelsError:a,onOAuthLogin:o,oauthLoginPending:s=!1,variant:c=`page`}){let[l,u]=(0,Z.useState)({}),[d,f]=(0,Z.useState)(()=>qn(e)),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),_=(0,Z.useRef)(void 0),v=e.configFields??[],y=Jn(d.apiKey),b=e.modelList??[],S=p?.providerId===e.id?p.value:``,C=h?.providerId===e.id?h.modelId:null,w=S.trim().toLowerCase(),T=w?b.filter(e=>e.name.toLowerCase().includes(w)||e.id.toLowerCase().includes(w)):b,E=c===`panel`;(0,Z.useEffect)(()=>()=>{_.current!==void 0&&window.clearTimeout(_.current)},[]);let D=(e,t)=>{let r=Yn(e,t),i={...d,[e.path]:r};f(i);let a={configValues:{[e.path]:r}};e.path===`apiKey`&&(a.apiKey=Jn(r)),e.path===`baseUrl`&&(a.baseUrl=Jn(r)),n(a)},O=t=>{typeof navigator>`u`||!navigator.clipboard?.writeText||navigator.clipboard.writeText(t).then(()=>{g({modelId:t,providerId:e.id}),_.current!==void 0&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>g(null),1600)})};return(0,Q.jsx)(qt,{className:`h-full`,children:(0,Q.jsxs)(`div`,{className:G(`py-10 max-[720px]:px-4 max-[720px]:py-5`,E?`px-6`:`px-18 max-[1200px]:px-8`),children:[(0,Q.jsxs)(`div`,{className:`mb-8 flex items-center gap-3`,children:[(0,Q.jsx)(U,{"aria-label":E?`Close provider details`:`Back to providers`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,onClick:t,variant:`ghost`,children:E?(0,Q.jsx)(Je,{className:`h-4 w-4`}):(0,Q.jsx)(nn,{className:`h-4 w-4`})}),(0,Q.jsx)(`h1`,{className:G(`truncate font-semibold leading-[1.15] tracking-normal text-foreground`,E?`text-[24px]`:`text-[32px]`),children:e.name})]}),v.length>0?(0,Q.jsx)(`section`,{className:G(`mb-8`,E?`max-w-none`:`max-w-[86rem]`),children:(0,Q.jsx)(`div`,{className:`flex flex-col`,children:v.map(e=>{let t=d[e.path],n=Jn(t),r=e.type===`password`||e.secret,i=l[e.path]??!1;return(0,Q.jsxs)(`div`,{className:`grid min-h-18 grid-cols-[minmax(12rem,0.55fr)_minmax(16rem,0.45fr)] items-center gap-6 border-b py-4 max-[900px]:grid-cols-1 max-[900px]:gap-3`,children:[(0,Q.jsxs)(`header`,{children:[(0,Q.jsx)(`h3`,{className:`text-[17px] font-semibold text-foreground`,children:e.label}),e.description?(0,Q.jsx)(`p`,{className:`mt-1 text-[15px] leading-relaxed text-muted-foreground`,children:e.description}):null]}),e.type===`boolean`?(0,Q.jsxs)(`div`,{className:`flex items-center justify-end`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.label}),(0,Q.jsx)(J,{checked:!!t,onCheckedChange:t=>D(e,t)})]}):e.type===`select`?(0,Q.jsxs)(`select`,{className:`h-9 w-full rounded border border-border bg-background px-3 text-sm text-foreground outline-none focus:ring-1 focus:ring-ring`,onChange:t=>D(e,t.target.value),value:n,children:[(0,Q.jsx)(`option`,{value:``,children:`Not set`}),e.options?.map(e=>(0,Q.jsx)(`option`,{value:String(e.value),children:e.label},String(e.value)))]}):(0,Q.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded border border-border bg-background px-3`,children:[e.type===`url`?(0,Q.jsx)(zt,{className:`h-4 w-4 shrink-0 text-muted-foreground`}):null,(0,Q.jsx)(V,{className:`h-7 flex-1 border-0 bg-transparent px-0 text-sm text-foreground outline-none placeholder:text-muted-foreground`,onBlur:()=>D(e,n),onChange:t=>f(n=>({...n,[e.path]:t.target.value})),placeholder:e.placeholder,spellCheck:!1,type:r&&!i?`password`:e.type===`number`?`number`:e.type===`url`?`url`:`text`,value:n}),r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{"aria-label":i?`Hide secret`:`Show secret`,className:`rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors`,onClick:()=>u(t=>({...t,[e.path]:!i})),variant:`ghost`,children:i?(0,Q.jsx)(ln,{className:`h-4 w-4`}):(0,Q.jsx)(un,{className:`h-4 w-4`})}),(0,Q.jsx)(U,{"aria-label":`Copy ${e.label}`,className:`rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors`,onClick:()=>navigator.clipboard.writeText(n),variant:`ghost`,children:(0,Q.jsx)(At,{className:`h-4 w-4`})})]}):null]})]},e.path)})})}):null,!y&&!e.oauthAccessTokenPresent&&o?(0,Q.jsx)(`div`,{className:`mb-8`,children:(0,Q.jsxs)(U,{className:`inline-flex items-center gap-2 w-full`,disabled:s,onClick:o,variant:`default`,children:[s?(0,Q.jsx)(jt,{className:`h-4 w-4 animate-spin`}):null,(0,Q.jsx)(`span`,{children:`Login via Browser`})]})}):null,e.oauthAccessTokenPresent?(0,Q.jsx)(`p`,{className:`mb-8 text-xs text-muted-foreground`,children:`OAuth is connected. Manual credentials remain available when this provider supports them.`}):null,(0,Q.jsxs)(`section`,{className:G(`overflow-hidden rounded-lg border`,E?`max-w-none`:`max-w-[46rem]`),children:[(0,Q.jsxs)(`div`,{className:`flex h-12 items-center justify-between bg-muted/40 px-4`,children:[(0,Q.jsx)(`h2`,{className:`text-[17px] font-medium text-muted-foreground`,children:`Models`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(x,{className:`size-4 text-muted-foreground`}),(0,Q.jsx)(U,{"aria-label":`Refresh models`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,disabled:i,onClick:r,variant:`ghost`,children:(0,Q.jsx)(It,{className:G(`size-3`,i&&`animate-spin`)})})]})]}),a?(0,Q.jsx)(`div`,{className:`rounded-lg border border-border px-4 py-8 text-center`,children:(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,children:a})}):b.length>0?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`mx-4 mt-4 flex items-center gap-2 rounded border border-border bg-background px-3 py-2`,children:[(0,Q.jsx)(x,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Q.jsx)(V,{"aria-label":`Search models`,className:`h-7 flex-1 border-0 text-sm text-foreground placeholder:text-muted-foreground`,onChange:t=>m({providerId:e.id,value:t.target.value}),placeholder:`Search models by name or ID`,spellCheck:!1,value:S})]}),T.length>0?(0,Q.jsx)(`div`,{className:`max-h-125 overflow-y-scroll border-t`,children:T.map(e=>(0,Q.jsxs)(`div`,{className:`group flex min-h-16 items-center gap-3 border-b px-4 py-3 transition-colors hover:bg-accent/30`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 font-mono`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 px-1 text-sm text-foreground`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),e.supportsAttachments&&(0,Q.jsx)(`div`,{title:`File Support`,children:(0,Q.jsx)(dn,{className:`h-3.5 w-3.5 text-muted-foreground`})}),e.supportsVision&&(0,Q.jsx)(`div`,{title:`Image Support`,children:(0,Q.jsx)($e,{className:`h-3.5 w-3.5 text-muted-foreground`})})]}),(0,Q.jsxs)(`button`,{"aria-label":`Copy model ID ${e.id}`,className:`mt-1 flex max-w-full items-center gap-1.5 px-1 text-left text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>O(e.id),title:`Copy model ID`,type:`button`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.id}),(0,Q.jsx)(At,{className:`size-3 shrink-0`}),C===e.id?(0,Q.jsx)(`span`,{className:`shrink-0 text-foreground`,children:`Copied`}):null]})]}),(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,Q.jsx)(U,{"aria-label":`Favorite ${e.name}`,className:`rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors`,variant:`ghost`,children:(0,Q.jsx)(Ft,{className:`h-3.5 w-3.5`})})})]},e.id))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-border px-4 py-8 text-center`,children:(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No models match "`,S.trim(),`".`]})})]}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-border px-4 py-8 text-center`,children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i?`Loading models...`:`No models available. Click refresh to load models.`})})]})]})})}function Qn(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}function $n(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":``}:{"data-unchecked":``}},...se}}var er=Z.createContext(void 0);function tr(){return Z.useContext(er)}var nr=Z.createContext(void 0);function rr(){let e=Z.useContext(nr);if(e===void 0)throw Error(le(14));return e}var ir=`data-parent`,ar=Z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:u,indeterminate:d=!1,inputRef:f,name:p,onCheckedChange:m,parent:h=!1,readOnly:g=!1,render:_,required:y=!1,uncheckedValue:b,value:x,nativeButton:S=!1,style:C,...w}=e,{clearErrors:T}=ve(),{disabled:O,name:k,setDirty:A,setFilled:j,setFocused:M,setTouched:N,state:F,validationMode:ee,validityData:I,validation:ne}=Ce(),ie=vn(),{labelId:ae,controlId:L,registerControlId:R,getDescriptionProps:oe}=me(),z=tr(),se=z?.allValues===void 0?void 0:z.parent,ce=se!==void 0,B=O||ie.disabled||z?.disabled||o,le=k??p,ue=x??le,de=v(),fe=v(),V=u||L;ce&&(h?V=fe:ue===void 0?V||=fe:V=`${se.id}-${ue}`);let he={};ce&&(h?he=se.getParentProps():ue!==void 0&&(he=se.getChildProps(ue)));let{checked:_e=n,indeterminate:ye=d,onCheckedChange:xe,...Se}=he,Te=z?.value,Oe=Z.useRef(null),ke=be(()=>Symbol()),Ae=Z.useRef(!1),{getButtonProps:je,buttonRef:Ne}=we({disabled:B,native:S}),Pe=z?.validation??ne,[Fe,Le]=l({controlled:ue!==void 0&&Te!==void 0&&!h?Te.includes(ue):_e,default:i,name:`Checkbox`,state:`checked`}),ze=ce?!!_e:Fe,Be=ce&&ye||d;Me(()=>{R!==De&&(Ae.current=!0,R(ke.current,V))},[V,R,ke]),Z.useEffect(()=>{let e=ke.current;return()=>{!Ae.current||R===De||(Ae.current=!1,R(e,void 0))}},[R,ke]),Ee(Oe,de,Fe,void 0,!z&&!B,p);let U=Z.useRef(null),Ve=Pe.registerInput,W=z?ue:void 0,He=Z.useCallback(e=>Ve(e,{controlRef:Oe,value:W}),[Ve,W]),Ue=Ie(f,U,h?void 0:He),We=Mt(a,ae,U,!S,V??void 0);Me(()=>{U.current&&(U.current.indeterminate=Be,Fe&&j(!0))},[Fe,Be,j]),D(Fe,()=>{z||(T(le),j(Fe),A(Fe!==I.initialValue),Pe.change(Fe))});let Ge=te({checked:Fe,disabled:B,form:s,name:h?void 0:le,id:S?void 0:V??void 0,required:y,ref:Ue,style:le?Re:ge,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(g){e.preventDefault();return}let t=e.currentTarget.checked,n=H(P,e.nativeEvent);if(m?.(t,n),!n.isCanceled&&(xe?.(t,n),!n.isCanceled&&(Le(t),ue!==void 0&&z!==void 0&&!h&&!ce))){let e=t?[...z.value,ue]:z.value.filter(e=>e!==ue);z.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){Oe.current?.focus()}},x===void 0?pe:{value:(z?Fe&&x:x)||``},oe,e=>Pe.getValidationProps(B,e));Z.useEffect(()=>{if(!se||ue===void 0)return;let e=se.disabledStatesRef.current;return e.set(ue,B),()=>{e.delete(ue)}},[se,B,ue]);let G=Z.useMemo(()=>({...F,checked:ze,disabled:B,readOnly:g,required:y,indeterminate:Be}),[F,ze,B,g,y,Be]),Ke=$n(G),qe=c(`span`,e,{state:G,ref:[Ne,Oe,t],props:[{id:S?V??void 0:de,role:`checkbox`,"aria-checked":Be?`mixed`:ze,"aria-readonly":g||void 0,"aria-required":y||void 0,"aria-labelledby":We,[ir]:h?``:void 0,onFocus(){B||M(!0)},onBlur(){let e=U.current;e&&(N(!0),M(!1),ee===`onBlur`&&Pe.commit(z?Te:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=U.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),re(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||Qn(t)?.click()})},onClick(e){if(g||B)return;e.preventDefault();let t=U.current;t&&E(t,e)}},w,Se,je,oe,e=>Pe.getValidationProps(B,e)],stateAttributesMapping:Ke});return(0,Q.jsxs)(nr.Provider,{value:G,children:[qe,!Fe&&!z&&le&&!h&&b!==void 0&&(0,Q.jsx)(`input`,{type:`hidden`,form:s,name:le,value:b,disabled:B}),(0,Q.jsx)(`input`,{...Ge,suppressHydrationWarning:!0})]})}),or=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=rr(),l=s.checked||s.indeterminate,{mounted:u,transitionStatus:d,setMounted:f}=Ge(l),p=Z.useRef(null),m={...s,transitionStatus:d};ce({open:l,ref:p,onComplete(){l||f(!1)}});let h={...$n(s),...R},g=a||u,_=c(`span`,e,{ref:[t,p],state:m,stateAttributesMapping:h,props:o});return g?_:null});function sr({className:e,...t}){return(0,Q.jsx)(ar,{"data-slot":`checkbox`,className:G(`peer relative flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,Q.jsx)(or,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,Q.jsx)(T,{})})})}function cr(e,t,n,r,i,a,o,s,c,l=2){let u=ae(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return z(n.current,u)?void 0:u}var lr=Z.createContext(void 0),ur=Z.createContext(void 0),dr=Z.createContext(void 0),fr=Z.createContext(!1),pr=Z.createContext(``);function mr(){let e=Z.useContext(lr);if(!e)throw Error(le(22));return e}function hr(){let e=Z.useContext(ur);if(!e)throw Error(le(23));return e}function gr(){let e=Z.useContext(dr);if(!e)throw Error(le(24));return e}function _r(){return Z.useContext(pr)}function vr(){return Z.useContext(fr)}var $={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?it(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>Ze(t,e,n)):Ze(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function yr(e){return e==null?void 0:`${e}-popup`}function br(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}function xr(e){return Array.isArray(e)?e.map(e=>xr(e)).join(`,`):e==null?``:String(e)}var Sr=new Map;function Cr(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${xr(e.locale)}|${JSON.stringify(t)}`,r=Sr.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=Dt(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=Dt(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=Dt(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return Sr.set(n,a),a}var wr=Cr;function Tr(e,t=!1){let{overflowY:n}=I(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var Er=Symbol(`none`),Dr={value:Er,index:-1};function Or(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:a,onSelectedValueChange:o,defaultInputValue:c,inputValue:g,open:_,defaultOpen:v=!1,selectionMode:y,onItemHighlighted:x,name:S,form:C,disabled:T=!1,readOnly:E=!1,required:O=!1,inputRef:k,grid:A=!1,items:j,filteredItems:M,filter:F,openOnInputClick:ee=!0,autoHighlight:I=!1,keepHighlight:re=!1,highlightItemOnHover:ie=!0,loopFocus:ae=!0,itemToStringLabel:L,itemToStringValue:R,isItemEqualToValue:oe=Xe,virtualized:z=!1,inline:se=!1,fillInputOnItemPress:le=!0,modal:de=!1,limit:V=-1,autoComplete:me=`list`,formAutoComplete:_e,locale:ye,submitOnItemClick:xe=!1}=e,{clearErrors:Se}=ve(),{setDirty:we,validityData:Te,setFilled:Oe,name:ke,disabled:Ae,setTouched:Ne,setFocused:Pe,validationMode:Fe,validation:Be}=Ce(),U=ne(),Ve=ze({id:t}),Ue=wr({locale:ye}),[We,G]=Z.useState(!1),[Je,$e]=Z.useState(null),et=Z.useRef([]),nt=Z.useRef([]),rt=Z.useRef(null),it=Z.useRef(null),ot=Z.useRef(null),st=Z.useRef(null),ct=Z.useRef(null),lt=Z.useRef(!0),ut=Z.useRef(!1),dt=Z.useRef(null),ft=Z.useRef(null),pt=Z.useRef(null),mt=Z.useRef(Dr),ht=Z.useRef(null),gt=Z.useRef([]),_t=Z.useRef(null),bt=Ae||T,xt=ke??S,St=y===`multiple`,Ct=y===`single`,wt=g!==void 0||c!==void 0,K=j!==void 0,Tt=M!==void 0,Et;Et=I===`always`?`always`:I?`input-change`:!1;let[q,kt]=l({controlled:a,default:St?r??Le:r,name:`Combobox`,state:`selectedValue`}),At=Z.useMemo(()=>F===null?()=>!0:F===void 0?br(Ue,L):F,[F,Ue,L]),jt=be(()=>wt?c??``:Ct?Dt(q,L):``).current,[Mt,Nt]=l({controlled:g,default:jt,name:`Combobox`,state:`inputValue`}),[J,Pt]=l({controlled:_,default:v,name:`Combobox`,state:`open`}),Ft=Ye(j),It=Je??String(Mt).trim(),Lt=Ct?Dt(q,L):``,Rt=Ct&&!We&&It!==``&&Lt.length===It.length&&Ue.contains(Lt,It),zt=Rt?``:It,Bt=K&&Tt&&Rt,Vt=Z.useMemo(()=>j?Ft?j.flatMap(e=>e.items):j:Le,[j,Ft]),Ht=Z.useMemo(()=>{if(M&&!Bt)return M;if(!j)return Le;if(Ft){let e=j,t=[],n=0;for(let r of e){if(V>-1&&n>=V)break;let e=V>-1?V-n:1/0,i=zt===``?r.items.slice(0,e):[];if(zt!==``)for(let t of r.items){if(i.length>=e)break;At(t,zt,L)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(zt===``)return V>-1?Vt.slice(0,V):Vt;let e=[];for(let t of Vt){if(V>-1&&e.length>=V)break;At(t,zt,L)&&e.push(t)}return e},[M,Bt,j,Ft,zt,V,At,L,Vt]),Ut=Z.useMemo(()=>Ft?Ht.flatMap(e=>e.items):Ht,[Ht,Ft]),Y=be(()=>{let e=null;return se&&J&&K&&y!==`none`&&(e=yt(Ut,q,oe,St)),new d({id:Ve,labelId:void 0,selectedValue:q,open:J,items:j,selectionMode:y,listRef:et,labelsRef:nt,popupRef:rt,emptyRef:ct,inputRef:it,startDismissRef:ot,endDismissRef:st,keyboardActiveRef:lt,chipsContainerRef:dt,clearRef:ft,valuesRef:gt,pointerDownItemRef:_t,selectionEventRef:pt,name:xt,form:C,disabled:bt,readOnly:E,required:O,grid:A,virtualized:z,openOnInputClick:ee,itemToStringLabel:L,isItemEqualToValue:oe,modal:de,autoHighlight:Et,submitOnItemClick:xe,hasInputValue:wt,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:se,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:pe,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:y===`none`,onOpenChangeComplete:De,setOpen:De,setInputValue:De,setSelectedValue:De,setIndices:De,handleSelection:De,forceMount:De,requestSubmit:De})}).current,Wt=y===`none`?Mt:q,Gt=Z.useMemo(()=>y===`none`?Wt:Array.isArray(q)?q.map(e=>at(e,R)):at(q,R),[Wt,R,y,q]),Kt=B(x),X=B(n),qt=W(Y,$.activeIndex),Jt=W(Y,$.selectedIndex),Yt=W(Y,$.positionerElement),Xt=W(Y,$.listElement),Zt=W(Y,$.triggerElement),Qt=W(Y,$.inputElement),$t=W(Y,$.inputGroupElement),en=W(Y,$.inline),tn=W(Y,$.inputInsidePopup),nn=W(Y,$.inputOwnsFormValue),rn=je(Zt),{mounted:an,setMounted:on,transitionStatus:sn}=Ge(J),{openMethod:cn,triggerProps:ln}=m(J),un=B(()=>Gt);Ee(tn?rn:it,Ve,Wt,un,!bt,S);let dn=B(()=>{j?nt.current=Ut.map(e=>Dt(e,L)):Y.set(`forceMounted`,!0)}),fn=B((e,t,n)=>{if(t===-1){if(mt.current===Dr)return;mt.current=Dr}else mt.current={value:e,index:t};Kt(e,he(n,void 0,{index:t}))}),pn=B(e=>{Y.update(e);let t=e.activeIndex;if(t===void 0)return;let n=e.type||`none`;t===null?fn(void 0,-1,n):fn(gt.current[t],t,n)}),mn=B((t,n)=>{if(ut.current=n.reason===fe,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){J&&Je!==null&&$e(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&G(!0),ht.current={hasQuery:e};let n=Y.state.listElement;if(!Y.state.virtualized&&n){let e=rt.current;for(let t of b(n.firstElementChild??n)){if(!w(t)||(e?!Ke(e,t):t.getAttribute(`role`)===`dialog`))break;if(Tr(t)){t.scrollTop=0;break}}}e&&Et&&Y.state.activeIndex==null&&(J||en)&&Y.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&Y.state.inputInsidePopup&&(ht.current={hasQuery:!1,selection:!0});Nt(t)}}),hn=B((t,n)=>{if(J!==t&&(n.reason===`escape-key`&&K&&Ut.length===0&&!ct.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&tn&&!en&&Je!==null&&(G(!1),$e(null),Mt!==``&&n.reason!==`input-change`&&mn(``,H(fe,n.event))),!t&&We&&(Ct?(en||$e(It),It===``&&G(!1)):St&&(en||$e(It),tn&&pn({activeIndex:null}),(!tn||en)&&mn(``,H(fe,n.event)))),Pt(t),!t&&tn&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(Ne(!0),Pe(!1),Fe===`onBlur`)))){let e=y===`none`?Mt:q;Be.commit(e)}}),gn=B((e,t)=>{o?.(e,t),!t.isCanceled&&(kt(e),(y===`none`&&rt.current&&le||Ct&&!Y.state.inputInsidePopup)&&mn(Dt(e,L),H(t.reason,t.event)))}),_n=B((e,t)=>{let n=s(e),r=pt.current??e;pt.current=null;let i=H(N,r),a=n?.closest(`a`)?.getAttribute(`href`);if(a){a.startsWith(`#`)&&hn(!1,i);return}if(St){let e=Array.isArray(q)?q:[],n=vt(e,t,oe)?qe(e,t,oe):[...e,t];if(gn(n,i),i.isCanceled||!(it.current&&it.current.value.trim()!==``))return;Y.state.inputInsidePopup?mn(``,H(fe,i.event)):hn(!1,i)}else{if(gn(t,i),i.isCanceled)return;hn(!1,i)}}),vn=B(()=>{let e=Be.inputRef.current?.form??Y.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),yn=B(()=>{if(on(!1),X?.(!1),G(!1),$e(null),pn(y===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),St&&it.current&&it.current.value!==``&&!ut.current&&mn(``,H(fe)),Ct){if(Y.state.inputInsidePopup)it.current&&it.current.value!==``&&mn(``,H(fe));else{let e=Dt(q,L);it.current&&it.current.value!==e&&mn(e,H(e===``?fe:P))}}}),bn=Z.useMemo(()=>en&&Yt?{current:Yt.closest(`[role="dialog"]`)}:rt,[en,Yt]);ce({enabled:!e.actionsRef,open:J,ref:bn,onComplete(){J||yn()}}),Z.useImperativeHandle(e.actionsRef,()=>({unmount:yn}),[yn]),Me(function(){if(J||(_t.current=null,y===`none`))return;let e=K?Vt:gt.current;pn({selectedIndex:yt(e,q,oe,St)})},[J,q,y,St,K,Vt,oe,pn]),Me(()=>{j&&(gt.current=Ut,et.current.length=Ut.length)},[j,Ut]),Me(()=>{let e=ht.current;if(e){let t=J||en||Y.state.positionerElement?.hidden===!1;if(e.hasQuery)Et&&t&&Y.set(`activeIndex`,0),ht.current=null;else if(String(Mt).trim()===``&&(ht.current=null,t)){let t=e.selection;Et===`always`&&!t&&Y.state.selectionMode===`none`&&Y.set(`activeIndex`,0),queueMicrotask(()=>{if(!Y.state.open&&!Y.state.inline||it.current&&it.current.value.trim()!==``)return;let e=Y.state.selectedValue,n=Y.state.selectionMode===`multiple`,r=n&&Array.isArray(e)?e[e.length-1]:e,i=Y.state.selectionMode!==`none`&&r!=null;if(i||t){let t=K||Tt?Ut:gt.current;Y.set(`activeIndex`,i?yt(t,e,Y.state.isItemEqualToValue,n):null)}else Et===`always`&&Y.set(`activeIndex`,0)})}}if(!J&&!en)return;let t=K||Tt?Ut:gt.current,n=Y.state.activeIndex;if(n==null){if(Et===`always`&&t.length>0){Y.set(`activeIndex`,0);return}fn(void 0,-1,P);return}if(n>=t.length){fn(void 0,-1,P),Y.set(`activeIndex`,null);return}let r=t[n],i=mt.current.value,a=i!==Er&&Ze(r,i,Y.state.isItemEqualToValue);(mt.current.index!==n||!a)&&fn(r,n,P)},[qt,Et,fn,Tt,K,Ut,en,J,Y,Mt]),Me(()=>{if(y===`none`){Oe(String(Mt)!==``);return}Oe(St?Array.isArray(q)&&q.length>0:q!=null)},[Oe,y,Mt,q,St]),Z.useEffect(()=>{K&&Et&&Ut.length===0&&pn({activeIndex:null})},[K,Et,Ut.length,pn]);function xn(e){let t=Te.initialValue;return Array.isArray(e)&&Array.isArray(t)?!Ot(e,t,(e,t)=>Ze(e,t,oe)):e!==t}D(It,()=>{!J||It===``||It===String(jt)||G(!0)});function Sn(){let e=Dt(q,L);Mt!==e&&mn(e,H(P))}D(q,()=>{y!==`none`&&(Se(xt),we(xn(q)),Be.change(q),Ct&&!wt&&!tn&&Sn())}),D(Mt,()=>{y===`none`&&(Se(xt),we(Mt!==Te.initialValue),Be.change(Mt))}),D(j,()=>{!Ct||wt||tn||We||Sn()});let Cn=Qe({open:en?!0:J,onOpenChange:hn,elements:{reference:tn?Zt:Qt,floating:Yt}}),wn=A?`grid`:`listbox`,Tn=J||en,En=Tn?`true`:`false`,Dn=Z.useMemo(()=>{let e=Qt?.tagName===`INPUT`,t=Qt==null||e,n=t||Tn,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=En,r[`aria-haspopup`]=wn,r[`aria-controls`]=Tn?Xt?.id:void 0,r[`aria-autocomplete`]=me),{reference:r,floating:{role:`presentation`}}},[Qt,Tn,En,wn,Xt?.id,me]),On=p(Cn,{enabled:!E&&!bt&&ee,event:`mousedown-only`,toggle:!1,touchOpenDelay:tn?0:100,reason:He}),kn=h(Cn,{enabled:!E&&!bt&&!en,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:en?!0:void 0,outsidePress(e){let t=s(e);return!Ke(Zt,t)&&!Ke(ft.current,t)&&!Ke(dt.current,t)&&!Ke($t,t)}}),An=i(Cn,{enabled:!E&&!bt,id:Ve,listRef:et,activeIndex:qt,selectedIndex:Jt,virtual:!0,loopFocus:ae,allowEscape:ae&&!Et,focusItemOnOpen:We||y===`none`&&!Et?!1:`auto`,focusItemOnHover:ie,resetOnPointerLeave:!re,orientation:A?`horizontal`:void 0,rtl:U===`rtl`,disabledIndices:Le,grid:A?cr:void 0,onNavigate(e,t){!t&&!J||sn===`ending`||pn(t?{activeIndex:e,type:lt.current?u:f}:{activeIndex:e})}}),jn=Z.useMemo(()=>te(An.reference,{onKeyDown(e){A&&Y.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},kn.reference,On.reference,Dn.reference),[An.reference,kn.reference,On.reference,Dn.reference,A,Y]),Mn=Z.useMemo(()=>te(ue,kn.floating),[kn.floating]),Nn=Z.useMemo(()=>te(An.floating,Dn.floating),[An.floating,Dn.floating]),Pn=Z.useMemo(()=>{let e=An.item;return e?{...e,onFocus:void 0}:pe},[An.item]);tt(()=>{Y.update({inline:se,popupProps:Mn,listProps:Nn,inputProps:jn,triggerProps:ln,itemProps:Pn,setOpen:hn,setInputValue:mn,setSelectedValue:gn,setIndices:pn,handleSelection:_n,forceMount:dn,requestSubmit:vn,onOpenChangeComplete:X})}),Me(()=>{Y.update({id:Ve,selectedValue:q,open:J,mounted:an,transitionStatus:sn,items:j,inline:se,popupProps:Mn,listProps:Nn,inputProps:jn,triggerProps:ln,openMethod:cn,itemProps:Pn,selectionMode:y,name:xt,form:C,disabled:bt,readOnly:E,required:O,grid:A,virtualized:z,openOnInputClick:ee,itemToStringLabel:L,modal:de,autoHighlight:Et,isItemEqualToValue:oe,submitOnItemClick:xe,hasInputValue:wt,inputOwnsFormValue:y===`none`&&(se||!Y.state.inputInsidePopup)})},[Y,Ve,q,J,an,sn,j,Mn,Nn,jn,Pn,cn,ln,y,xt,bt,E,O,A,z,ee,L,de,oe,xe,wt,se,Et,C]);let Fn=Ie(k,Be.inputRef),In=Z.useMemo(()=>({query:It,hasItems:K,filteredItems:Ht,flatFilteredItems:Ut}),[It,K,Ht,Ut]),Ln=Z.useMemo(()=>Array.isArray(Wt)?``:at(Wt,R),[Wt,R]),Rn=St&&Array.isArray(q)&&q.length>0,zn=St||y===`none`&&nn?void 0:xt,Bn=Z.useMemo(()=>!St||!Array.isArray(q)||!xt?null:q.map(e=>{let t=at(e,R);return(0,Q.jsx)(`input`,{type:`hidden`,form:C,name:xt,value:t,disabled:bt},t)}),[St,q,C,xt,R,bt]),Vn=(0,Q.jsxs)(Z.Fragment,{children:[e.children,(0,Q.jsx)(`input`,{...Be.getValidationProps(bt,{onFocus(){if(tn){Zt?.focus();return}(it.current||Zt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||bt||E)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=H(P,e.nativeEvent),i=()=>gt.current.findIndex(e=>at(e,R).toLowerCase()===n||Dt(e,L).toLowerCase()===n);function a(){if(St)return;if(y===`none`){mn(t,r);return}let e=i();e===-1&&(e=gt.current.findIndex((e,t)=>{let r=nt.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:gt.current[e];a!=null&&gn?.(a,r)}Ct&&(dn(),j&&i()===-1&&Y.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:Ve&&zn==null?`${Ve}-hidden-input`:void 0,form:C,name:zn,autoComplete:_e,disabled:bt,required:O&&!Rn,readOnly:E,value:Ln,ref:Fn,style:zn?Re:ge,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Bn]});return(0,Q.jsx)(lr.Provider,{value:Y,children:(0,Q.jsx)(ur.Provider,{value:Cn,children:(0,Q.jsx)(fr.Provider,{value:K,children:(0,Q.jsx)(dr.Provider,{value:In,children:(0,Q.jsx)(pr.Provider,{value:Mt,children:Vn})})})})})}var kr={...S,...se,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null};function Ar(e){let t=W(e,$.mounted),n=W(e,$.popupSide),r=W(e,$.positionerElement);return t&&r?n:null}function jr(){return gr().filteredItems.length===0}function Mr(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function Nr(e,t){let n=e>=t-1?t-2:e;return n>=0?n:void 0}function Pr(e,t,n){let r=e.state.listRef.current[t];r&&(e.state.selectionEventRef.current=n,r.click(),e.state.selectionEventRef.current=null)}var Fr=Z.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:l,...u}=e,{state:d,disabled:f,setTouched:m,setFocused:h,validationMode:g,validation:_}=Ce(),{labelId:v}=me(),y=mr(),b=W(y,$.selectionMode),x=W(y,$.disabled),S=W(y,$.readOnly),C=W(y,$.required),w=W(y,$.positionerElement),T=W(y,$.listElement),E=W(y,$.popupId),D=W(y,$.triggerProps),O=W(y,$.inputInsidePopup),A=W(y,$.id),j=W(y,$.labelId),M=W(y,$.open),N=W(y,$.selectedValue),F=W(y,$.activeIndex),ee=W(y,$.selectedIndex),I=W(y,$.hasSelectedValue),te=hr(),ne=_r(),re=Fe(),ae=f||x||a,L=jr(),R=Ar(y);ze({id:O?o:void 0});let oe=O?o??A:o,z=dt(v,j),se;M&&O?se=E??yr(A):M&&(se=T?.id);let ce=Z.useRef(``);function le(e){ce.current=e.pointerType}let{reference:ue}=k(te,{enabled:!M&&!S&&!x&&b===`single`,listRef:y.state.labelsRef,activeIndex:F,selectedIndex:ee,onMatch(e){let t=y.state.valuesRef.current[e];t!==void 0&&y.state.setSelectedValue(t,H(P))}}),{reference:de}=p(te,{enabled:!S&&!x,event:`mousedown`}),{buttonRef:fe,getButtonProps:V}=we({native:i,disabled:ae}),pe={...d,open:M,disabled:ae,popupSide:R,listEmpty:L,placeholder:b!==`none`&&!I},he=B(e=>{y.set(`triggerElement`,e)});return c(`button`,e,{ref:[t,fe,he],state:pe,props:[D,de,ue,{id:oe,tabIndex:O?0:-1,role:O?`combobox`:void 0,"aria-expanded":M,"aria-haspopup":O?`dialog`:`listbox`,"aria-controls":se,"aria-required":O&&C||void 0,"aria-labelledby":z,onPointerDown:le,onPointerEnter:le,onFocus(){h(!0),!(ae||S)&&re.start(0,y.state.forceMount)},onBlur(e){if(!Ke(w,e.relatedTarget)&&(m(!0),h(!1),g===`onBlur`)){let e=b===`none`?ne:N;_.commit(e)}},onMouseDown(e){if(ae||S||(O||te.set(`domReferenceElement`,e.currentTarget),y.state.forceMount(),ce.current!==`touch`&&(y.state.inputRef.current?.focus(),O||e.preventDefault()),M))return;let t=Ae(e.currentTarget);function n(e){let t=y.state.triggerElement;if(!t)return;let n=s(e),r=y.state.positionerElement,i=y.state.listElement;Ke(t,n)||Ke(r,n)||Ke(i,n)||Be(e,t)||y.state.setOpen(!1,H(ye,e))}O&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){S||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(ie(e),y.state.setOpen(!0,H(Ve,e.nativeEvent)),y.state.inputRef.current?.focus())}},_.getValidationProps(ae,u),V],stateAttributesMapping:kr})}),Ir=Z.createContext(void 0);function Lr(){return Z.useContext(Ir)}var Rr=Z.createContext(void 0);function zr(e){let t=Z.useContext(Rr);if(t===void 0&&!e)throw Error(le(21));return t}var Br=Z.forwardRef(function(e,t){let n=mr(),{buttonRef:r,getButtonProps:i}=we({native:!1}),a=Ie(t,r);function o(e){n.state.setOpen(!1,H(ke,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,Q.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:Re})}),Vr=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:o,style:s,...l}=e,{state:d,disabled:p,setTouched:m,setFocused:h,validationMode:g,validation:_}=Ce(),{labelId:y}=me(),b=Lr(),x=!!zr(!0),S=mr(),C=_r(),w=ne(),T=W(S,$.required),E=W(S,$.disabled),D=W(S,$.readOnly),O=W(S,$.name),k=W(S,$.form),A=W(S,$.selectionMode),j=W(S,$.autoHighlight),M=W(S,$.inputProps),N=W(S,$.triggerProps),F=W(S,$.open),ee=W(S,$.mounted),I=W(S,$.selectedValue),te=W(S,$.id),re=W(S,$.inline),ae=W(S,$.modal),L=!!j,R=Ar(S),z=p||E||i,se=jr(),ce=x||re,le=!ce||ae,ue=v(o??(ce?void 0:te)),de=x?xe:d,[V,pe]=Z.useState(null),he=Z.useRef(!1),ge=Z.useRef(null),_e=Z.useRef(!1),ve=A===`none`&&!x,ye=B(e=>{let t=x||S.state.inline;t&&!S.state.hasInputValue&&S.state.setInputValue(``,H(P)),S.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:ve})}),be=x?l:_.getValidationProps(z,l);function we(){S.state.setIndices({activeIndex:null,selectedIndex:null,type:S.state.keyboardActiveRef.current?u:f})}function Te(){S.state.keyboardActiveRef.current=!1}let Ee={...de,open:F,disabled:z,readOnly:D,popupSide:R,listEmpty:se};function De(e){if(!b)return;let t,{highlightedChipIndex:n}=b,r=b.chipsRef.current.length,[i,a]=Mr(w);return n===void 0?(e.key===i&&(e.currentTarget.selectionStart??0)===0&&I.length>0&&(e.preventDefault(),t=r>0?r-1:void 0),t):(e.key===i?(e.preventDefault(),t=n>0?n-1:void 0):e.key===a?(e.preventDefault(),t=n<r-1?n+1:void 0):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),t=Nr(n,I.length),we()),t)}let ke=c(`input`,e,{state:Ee,ref:[t,S.state.inputRef,ye],props:[M,N,{value:V??C,"aria-readonly":D||void 0,"aria-required":T||void 0,"aria-labelledby":y,disabled:z,readOnly:D,required:A===`none`?T:void 0,form:k,...ve&&O&&{name:O},id:ue,onFocus(){if(h(!0),!re||!_e.current)return;_e.current=!1;let e=ge.current;e==null||!Object.hasOwn(S.state.valuesRef.current,e)||S.state.setIndices({activeIndex:e})},onBlur(){m(!0),h(!1);let e=S.state.activeIndex;if(re&&e!==null&&j!==`always`&&(ge.current=e,_e.current=!0,S.state.setIndices({activeIndex:null})),g===`onBlur`){let e=A===`none`?C:I;_.commit(e)}},onCompositionStart(e){a||(he.current=!0,pe(e.currentTarget.value))},onCompositionEnd(e){he.current=!1;let t=e.currentTarget.value;pe(null),S.state.setInputValue(t,H(We,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=he.current||!r;function a(e){D||z||!e||!i||(S.state.setOpen(!0,H(We,t)),L||we())}if(he.current){let n=e.currentTarget.value;pe(n),n===``&&!S.state.openOnInputClick&&!S.state.inputInsidePopup&&S.state.setOpen(!1,H(fe,t));let r=n.trim(),i=L&&r!==``;a(r),F&&S.state.activeIndex!==null&&!i&&we();return}let o=H(We,t);if(S.state.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=H(fe,t);s&&!S.state.inputInsidePopup&&(A===`single`&&S.state.setSelectedValue(null,c),S.state.openOnInputClick||S.state.setOpen(!1,c)),a(e.currentTarget.value.trim()),F&&S.state.activeIndex!==null&&!L&&we()},onKeyDown(e){if(z||D||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;S.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=w===`rtl`;if(e.key===`Home`){ie(e);let n=oe&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){ie(e);let i=oe&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!ee&&e.key===`Escape`){let t=A===`multiple`&&Array.isArray(I)?I.length===0:I===null,n=H(Se,e.nativeEvent),r=A===`multiple`?[]:null;S.state.setInputValue(``,n),S.state.setSelectedValue(r,n),!t&&!S.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(b&&e.key===`Backspace`&&t.value===``&&b.highlightedChipIndex===void 0&&Array.isArray(I)&&I.length>0){let t=b.chipsRef.current.length,n=t>0?t-1:I.length-1,r=I.filter((e,t)=>t!==n);we(),S.state.setSelectedValue(r,H(P,e.nativeEvent));return}let i=b?.highlightedChipIndex!==void 0,a=De(e);if(b?.setHighlightedChipIndex(a),a===void 0?i&&S.state.inputRef.current?.focus():b?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&F){let t=S.state.activeIndex,n=e.nativeEvent;if(t===null){if(re)return;S.state.setOpen(!1,H(P,n));return}ie(e),Pr(S,t,n)}},onPointerMove:Te,onPointerDown:Te},be],stateAttributesMapping:kr}),Ae=x?(0,Q.jsx)(Oe.Provider,{value:Ne,children:ke}):ke;return(0,Q.jsxs)(Z.Fragment,{children:[F&&le&&(0,Q.jsx)(Br,{ref:S.state.startDismissRef}),Ae]})}),Hr={...R,...L},Ur=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,keepMounted:o=!1,style:s,...l}=e,{disabled:d}=Ce(),p=mr(),m=W(p,$.selectionMode),h=W(p,$.disabled),g=W(p,$.readOnly),_=W(p,$.open),v=W(p,$.selectedValue),y=W(p,$.hasSelectionChips),b=_r(),x=!1;x=m===`none`?b!==``:m===`single`?v!=null:y;let S=d||h||i,{buttonRef:C,getButtonProps:w}=we({native:a,disabled:S}),{mounted:T,transitionStatus:E,setMounted:D}=Ge(x),O={disabled:S,visible:x,open:_,transitionStatus:E};ce({open:x,ref:p.state.clearRef,onComplete(){x||D(!1)}});let k=c(`button`,e,{state:O,ref:[t,C,p.state.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(S||g)return;let t=p.state.keyboardActiveRef.current?u:f;p.state.setInputValue(``,H(Pe,e.nativeEvent)),m===`none`?p.state.setIndices({activeIndex:null,type:t}):(p.state.setSelectedValue(Array.isArray(v)?[]:null,H(Pe,e.nativeEvent)),p.state.setIndices({activeIndex:null,selectedIndex:null,type:t})),p.state.inputRef.current?.focus()}},l,w],stateAttributesMapping:Hr});return o||T?k:null}),Wr=Z.createContext(null);function Gr(){return Z.useContext(Wr)}function Kr(e){let{children:t}=e,{filteredItems:n}=gr(),r=Gr(),i=r?r.items:n;return(0,Q.jsx)(Z.Fragment,{children:i.map(t)})}var qr=Z.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,l=mr(),u=hr(),d=!!zr(!0),{filteredItems:f,hasItems:p}=gr(),m=W(l,$.selectionMode),h=W(l,$.grid),g=W(l,$.listProps),_=W(l,$.virtualized),v=W(l,$.forceMounted),y=m===`multiple`,b=f.length===0,x=B(e=>{l.set(`positionerElement`,e)}),S=B(e=>{l.set(`listElement`,e)}),C=Z.useMemo(()=>typeof o==`function`?n||=(0,Q.jsx)(Kr,{children:o}):o,[o]),w={empty:b},T=u.useState(`floatingId`),E=c(`div`,e,{state:w,ref:[t,S,d?null:x],props:[g,{children:C,tabIndex:-1,id:T,role:h?`grid`:`listbox`,"aria-multiselectable":y?`true`:void 0,onKeyDown(e){if(!(l.state.disabled||l.state.readOnly)&&e.key===`Enter`){let t=l.state.activeIndex;if(t==null)return;ie(e),Pr(l,t,e.nativeEvent)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},s]});if(_)return E;let D=p&&!v?void 0:l.state.labelsRef;return(0,Q.jsx)(de,{elementsRef:l.state.listRef,labelsRef:D,children:E})}),Jr=`⁠`;function Yr(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function Xr(){let e=Fe(),t=Z.useRef(null);return Z.useEffect(()=>{if(_e)return;let n=t.current;if(n==null)return;let r=Yr(n);if(r==null)return;let i=r.data,a=`${i}${Jr}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var Zr=Z.createContext(void 0);function Qr(){let e=Z.useContext(Zr);if(e===void 0)throw Error(le(20));return e}var $r=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=mr(),a=W(i,$.mounted),o=W(i,$.forceMounted);return a||n||o?(0,Q.jsx)(Zr.Provider,{value:n,children:(0,Q.jsx)(_,{ref:t,...r})}):null}),ei=Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=j,style:_,...v}=e,y=mr(),b=hr(),x=Qr(),S=W(y,$.modal),C=W(y,$.open),w=W(y,$.mounted),T=W(y,$.openMethod),E=W(y,$.positionerElement),D=W(y,$.triggerElement),O=W(y,$.inputElement),k=W(y,$.inputGroupElement),A=W(y,$.inputInsidePopup),M=W(y,$.transitionStatus),N=jr(),P=F({anchor:i??(A?D:k??O),floatingRootContext:b,positionMethod:a,mounted:w,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:x,collisionAvoidance:g,lazyFlip:!0});Ue(C&&S,T===`touch`,E,D);let I={open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,empty:N};Me(()=>{y.set(`popupSide`,P.side)},[y,P.side]);let te=B(e=>{y.set(`positionerElement`,e)}),ne=ee(e,I,{styles:P.positionerStyles,transitionStatus:M,props:v,refs:[t,te],hidden:!w,inert:!C});return(0,Q.jsxs)(Rr.Provider,{value:P,children:[w&&S&&(0,Q.jsx)(Te,{inert:o(!C),cutout:k??O??D}),ne]})}),ti={...C,...R},ni=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...l}=e,u=mr(),d=zr(),f=hr(),p=W(u,$.mounted),m=W(u,$.open),h=W(u,$.openMethod),g=W(u,$.popupProps),_=W(u,$.transitionStatus),v=W(u,$.inputInsidePopup),b=W(u,$.inputElement),x=W(u,$.modal),S=W(u,$.id),C=jr(),w=l.id??(v?yr(S):void 0);Me(()=>(u.set(`popupId`,u.state.popupRef.current?.id||w),()=>{u.set(`popupId`,void 0)}),[u,w]),ce({open:m,ref:u.state.popupRef,onComplete(){m&&u.state.onOpenChangeComplete(!0)}});let T={open:m,side:d.side,align:d.align,anchorHidden:d.anchorHidden,transitionStatus:_,empty:C},E=c(`div`,e,{state:T,ref:[t,u.state.popupRef],props:[g,{id:w,role:v?`dialog`:`presentation`,onFocus(e){let t=s(e.nativeEvent);h!==`touch`&&(Ke(u.state.listElement,t)||t===e.currentTarget)&&u.state.inputRef.current?.focus()}},y(_),l],stateAttributesMapping:ti}),D=a===void 0?v?e=>e===`touch`?u.state.popupRef.current:b:!1:a,k;k=o??(v?void 0:!1);let A=!v||x;return(0,Q.jsx)(O,{context:f,disabled:!p,modal:A,openInteractionType:h,initialFocus:D,returnFocus:k,getInsideElements:()=>[u.state.startDismissRef.current,u.state.endDismissRef.current],children:(0,Q.jsxs)(Z.Fragment,{children:[E,A&&(0,Q.jsx)(Br,{ref:u.state.endDismissRef})]})})}),ri=Z.createContext(void 0);function ii(){let e=Z.useContext(ri);if(!e)throw Error(le(19));return e}var ai=Z.createContext(!1);function oi(){return Z.useContext(ai)}var si=e(n(),1);function ci(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:l=null,index:u,disabled:d=!1,nativeButton:f=!1,...p}=t,m=Z.useRef(null),h=M({guess:!0,index:u,textRef:m}),g=mr(),_=oi(),v=vr(),y=W(g,$.selectionMode),b=W(g,$.disabled),x=W(g,$.readOnly),S=W(g,$.isItemEqualToValue),C=b||d,w=y!==`none`,T=u??i??h.index,E=T!==-1,D=W(g,$.id),O=W(g,$.isActive,T),k=W(g,$.isSelected,l),A=W(g,$.itemProps),j=Z.useRef(null),N=D!=null&&E?`${D}-${T}`:void 0,P=k&&w;Me(()=>{if(!(E&&(r||u!=null)))return;let e=g.state.listRef.current;return e[T]=j.current,()=>{delete e[T]}},[E,r,T,u,g]),Me(()=>{if(!E||v)return;let e=g.state.valuesRef.current;return e[T]=l,()=>{delete e[T]}},[E,v,T,l,g]),Me(()=>{if(!E||v)return;let e=g.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;Ze(l,t,S)&&g.set(`selectedIndex`,T)},[E,v,g,T,l,S]);let{getButtonProps:F,buttonRef:ee}=we({disabled:C,focusableWhenDisabled:!0,native:f,composite:!0}),I={disabled:C,selected:P,highlighted:O};function te(e){function t(){g.state.handleSelection(e,l)}g.state.submitOnItemClick?(si.flushSync(t),g.state.requestSubmit()):t()}let ne={id:N,role:_?`gridcell`:`option`,"aria-selected":w?P:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(g.state.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){C||x||te(e.nativeEvent)},onMouseUp(e){let t=g.state.pointerDownItemRef.current===e.currentTarget;g.state.pointerDownItemRef.current=null,!(C||x||e.button!==0||t||!O)&&te(e.nativeEvent)}},re=c(`div`,t,{ref:[ee,n,h.ref,j],state:I,props:[A,ne,p,F]}),ie=Z.useMemo(()=>({selected:P,textRef:m}),[P,m]);return(0,Q.jsx)(ri.Provider,{value:ie,children:re})}function li(e){let{componentProps:t,forwardedRef:n}=e,r=mr(),i=W(r,$.isItemEqualToValue),{flatFilteredItems:a}=gr(),o=nt(a,t.value??null,i);return(0,Q.jsx)(ci,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:o})}var ui=Z.memo(Z.forwardRef(function(e,t){let n=mr(),r=W(n,$.virtualized);return r&&e.index==null?(0,Q.jsx)(li,{componentProps:e,forwardedRef:t}):(0,Q.jsx)(ci,{componentProps:e,forwardedRef:t,virtualized:r,indexFromFilter:void 0})})),di=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=gr(),l=mr(),u=Xr(),d=s.length===0?a:null;return c(`div`,e,{ref:[t,l.state.emptyRef,u],props:[{children:d,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function fi(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,Q.jsx)(Or,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var pi=Z.forwardRef(function(e,t){let{selected:n}=ii();return e.keepMounted||n?(0,Q.jsx)(mi,{...e,ref:t}):null}),mi=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=ii(),l=Z.useRef(null),{transitionStatus:u,setMounted:d}=Ge(s),f=c(`span`,e,{ref:[t,l],state:{selected:s,transitionStatus:u},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:R});return ce({open:s,ref:l,onComplete(){s||d(!1)}}),f})),hi=fi;function gi({className:e,children:t,...n}){return(0,Q.jsxs)(Fr,{"data-slot":`combobox-trigger`,className:G(`cursor-pointer data-disabled:cursor-not-allowed [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,Q.jsx)(ct,{className:`pointer-events-none size-4 text-muted-foreground`})]})}function _i({className:e,...t}){return(0,Q.jsx)(Ur,{"data-slot":`combobox-clear`,render:(0,Q.jsx)(_t,{variant:`ghost`,size:`icon-xs`}),className:G(e),...t,children:(0,Q.jsx)(Je,{className:`pointer-events-none`})})}function vi({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return(0,Q.jsxs)(xt,{className:G(`w-auto`,e),children:[(0,Q.jsx)(Vr,{render:(0,Q.jsx)(ut,{disabled:n}),...a}),(0,Q.jsxs)(Ct,{align:`inline-end`,children:[r&&(0,Q.jsx)(_t,{size:`icon-xs`,variant:`ghost`,render:(0,Q.jsx)(gi,{}),"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:n}),i&&(0,Q.jsx)(_i,{disabled:n})]}),t]})}function yi({className:e,side:t=`bottom`,sideOffset:n=6,align:r=`start`,alignOffset:i=0,anchor:a,...o}){return(0,Q.jsx)($r,{children:(0,Q.jsx)(ei,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:`pointer-events-auto isolate z-[60]`,children:(0,Q.jsx)(ni,{"data-slot":`combobox-content`,"data-chips":!!a,className:G(`group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o})})})}function bi({className:e,...t}){return(0,Q.jsx)(qr,{"data-slot":`combobox-list`,className:G(`no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0`,e),...t})}function xi({className:e,children:t,...n}){return(0,Q.jsxs)(ui,{"data-slot":`combobox-item`,className:G(`relative flex w-full cursor-pointer items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,Q.jsx)(pi,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,Q.jsx)(T,{className:`pointer-events-none`})})]})}function Si({className:e,...t}){return(0,Q.jsx)(di,{"data-slot":`combobox-empty`,className:G(`hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex`,e),...t})}var Ci=`cline.code.model-selection.v1`;function wi(e){return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([e,t])=>typeof e==`string`&&typeof t==`string`&&t.trim().length>0))}function Ti(e){let t={lastProvider:``,lastModelByProvider:{}};if(!e)return t;try{let n=JSON.parse(e);if(!n||typeof n!=`object`||Array.isArray(n))return t;let r=n;return`lastProvider`in r||`lastModelByProvider`in r?{lastProvider:typeof r.lastProvider==`string`?r.lastProvider.trim():``,lastModelByProvider:wi(r.lastModelByProvider)}:{lastProvider:``,lastModelByProvider:wi(n)}}catch{return t}}function Ei(){return typeof window>`u`?{lastProvider:``,lastModelByProvider:{}}:Ti(window.localStorage.getItem(Ci))}var Di={openai:`openai-native`,google:`gemini`};function Oi(e){let t=e.trim();return t?Di[t]??t:``}function ki(e){return(e??[]).filter(e=>et({operation:e.operation,modalities:{input:e.inputModalities,output:e.outputModalities}})).map(e=>e.id)}function Ai(e){return(e??[]).filter(e=>e.supportsReasoning&&et({operation:e.operation,modalities:{input:e.inputModalities,output:e.outputModalities}})).map(e=>e.id)}function ji(e){return{providers:e,enabledProviderIds:e.filter(e=>e.enabled&&ki(e.modelList).length>0).map(e=>e.id),providerModels:Object.fromEntries(e.map(e=>[e.id,ki(e.modelList)])),providerReasoningModels:Object.fromEntries(e.map(e=>[e.id,Ai(e.modelList)]))}}async function Mi(){return ji((await X.invoke(`list_provider_catalog`)).providers??[])}async function Ni(e){return(await X.invoke(`list_provider_models`,{provider:e})).models??[]}var Pi=3e4,Fi=null;async function Ii(){let e=await X.invoke(`list_routine_schedules`);return{schedules:e.schedules??[],activeExecutions:e.activeExecutions??[],upcomingRuns:e.upcomingRuns??[],lastExecutions:e.lastExecutions??[]}}var Li={cline:[rt],anthropic:[`claude-sonnet-4-6`],"openai-native":[`gpt-5.3-codex`],openrouter:[`anthropic/claude-sonnet-4.6`],gemini:[`gemini-2.5-pro`]},Ri=[{label:`Mon`,value:`MON`},{label:`Tue`,value:`TUE`},{label:`Wed`,value:`WED`},{label:`Thu`,value:`THU`},{label:`Fri`,value:`FRI`},{label:`Sat`,value:`SAT`},{label:`Sun`,value:`SUN`}];function zi(e){if(e==null)return`-`;if(typeof e==`number`){if(!Number.isFinite(e))return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?`-`:t.toLocaleString()}let t=e.trim();if(t.length===0)return`-`;let n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleString()}function Bi(e){let t=e.metadata?.[kt];return typeof t==`number`&&Number.isFinite(t)?t:void 0}function Vi(e){let t=e.modelSelection?.providerId?.trim()||e.provider?.trim(),n=e.modelSelection?.modelId?.trim()||e.model?.trim();return t&&n?`${t}/${n}`:n||t||`-`}function Hi(e){return{provider:e.modelSelection?.providerId?.trim()||e.provider?.trim()||`cline`,model:e.modelSelection?.modelId?.trim()||e.model?.trim()||`anthropic/claude-sonnet-5`}}function Ui(e){if(!e)return`-`;let t=e.status?.trim()||`unknown`,n=zi(e.endedAt??e.startedAt??e.triggeredAt);return n===`-`?t:`${t} at ${n}`}function Wi(e){return typeof e==`string`?e.trim():``}function Gi(e){let t=Wi(e);if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<=0))return n}function Ki(e){if(typeof e!=`string`)return;let t=e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}function qi(e){let t=new Set(e);return Ri.map(e=>e.value).filter(e=>t.has(e))}function Ji(e,t,n){let r=qi(e);if(r.length===0)return``;let i=Number.parseInt(t,10),a=Number.parseInt(n,10),o=Number.isFinite(i)?Math.min(Math.max(i,0),23):9,s=Number.isFinite(a)?Math.min(Math.max(a,0),59):0;return r.length===Ri.length?`${s} ${o} * * *`:`${s} ${o} * * ${r.join(`,`)}`}function Yi(e){let t=e?.trim().toUpperCase();if(!t||t===`*`)return Ri.map(e=>e.value);let n=new Set;for(let e of t.split(`,`)){let t=e.trim();if(!t)continue;let r=/^([A-Z]{3})-([A-Z]{3})$/.exec(t);if(r){let e=Ri.findIndex(e=>e.value===r[1]),t=Ri.findIndex(e=>e.value===r[2]);if(e>=0&&t>=e)for(let r=e;r<=t;r+=1)n.add(Ri[r].value);continue}Ri.some(e=>e.value===t)&&n.add(t)}return qi([...n])}function Xi(e){let t=e.trim().split(/\s+/),n=Number.parseInt(t[0]??``,10),r=Number.parseInt(t[1]??``,10),i=Yi(t[4]);return{scheduleHour:Number.isInteger(r)&&r>=0&&r<=23?String(r):`9`,scheduleMinute:Number.isInteger(n)&&n>=0&&n<=59?String(n):`0`,scheduleDays:i.length>0?i:[`MON`,`TUE`,`WED`,`THU`,`FRI`]}}function Zi(){let[e,t]=(0,Z.useState)(()=>Fi?.schedules??[]),[n,r]=(0,Z.useState)(()=>Fi?.activeExecutions??[]),[i,a]=(0,Z.useState)(()=>Fi?.upcomingRuns??[]),[o,s]=(0,Z.useState)(()=>Fi?.lastExecutions??[]),[c,l]=(0,Z.useState)(()=>!Fi),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(Li),[D,O]=(0,Z.useState)(()=>Object.keys(Li)),[k]=(0,Z.useState)(()=>Ei()),A=Oi(k.lastProvider),[j,M]=(0,Z.useState)({name:``,scheduleHour:`9`,scheduleMinute:`0`,scheduleDays:[`MON`,`TUE`,`WED`,`THU`,`FRI`],prompt:`Review PRs opened yesterday and summarize issues.`,provider:`cline`,model:rt,workspaceRoot:``,systemPrompt:``,timeoutSeconds:``,tags:``,enabled:!0}),N=(0,Z.useMemo)(()=>{if(D.length===0)return T;let e={};for(let t of D)e[t]=T[t]??[];return e},[D,T]),P=(0,Z.useMemo)(()=>Object.keys(N),[N]),F=(0,Z.useMemo)(()=>N[j.provider]??[],[j.provider,N]),ee=(0,Z.useMemo)(()=>Ji(j.scheduleDays,j.scheduleHour,j.scheduleMinute),[j.scheduleDays,j.scheduleHour,j.scheduleMinute]);(0,Z.useEffect)(()=>{let e=!1;async function t(){try{let t=await Mi();if(e)return;E(t.providerModels),O(e=>{let n=new Set(t.enabledProviderIds),r=Oi(j.provider);r&&n.add(r);for(let r of e)r in t.providerModels&&n.add(r);return Array.from(n)})}catch{}}return t(),()=>{e=!0}},[j.provider]),(0,Z.useEffect)(()=>{let e=Oi(j.provider);if(!e||(T[e]??[]).length>0)return;let t=!1;async function n(){try{let n=await Ni(e);if(t||n.length===0)return;E(t=>({...t,[e]:n.map(e=>e.id)})),O(t=>t.includes(e)?t:[...t,e])}catch{}}return n(),()=>{t=!0}},[j.provider,T]),(0,Z.useEffect)(()=>{if(P.length===0)return;let e=null,t=Oi(j.provider);if(P.includes(t)){let n=N[t]??[];if(n.length===0||n.includes(j.model))return;let r=k.lastModelByProvider[t]??k.lastModelByProvider[k.lastProvider];e={provider:t,model:r&&n.includes(r)?r:n[0]}}else{let t=A&&P.includes(A)?A:P[0],n=N[t]??[],r=k.lastModelByProvider[t]??k.lastModelByProvider[k.lastProvider];e={provider:t,model:r&&n.includes(r)?r:n[0]??``}}let n=window.setTimeout(()=>{M(t=>({...t,...e}))},0);return()=>window.clearTimeout(n)},[P,j.model,j.provider,k.lastModelByProvider,k.lastProvider,A,N]);let I=(0,Z.useCallback)(async e=>{let n=Date.now();if(!e?.force&&Fi&&n-Fi.fetchedAt<Pi){t(Fi.schedules),r(Fi.activeExecutions),a(Fi.upcomingRuns),s(Fi.lastExecutions),d(null),l(!1);return}e?.showLoading!==!1&&l(!0),d(null);try{let e=await Ii(),i=e.schedules,o=e.activeExecutions,c=e.upcomingRuns,l=e.lastExecutions;t(i),r(o),a(c),s(l),Fi={schedules:i,activeExecutions:o,upcomingRuns:c,lastExecutions:l,fetchedAt:n}}catch(e){let t=e instanceof Error?e.message:String(e);d(t)}finally{l(!1)}},[]);(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>{I()},0);return()=>window.clearTimeout(e)},[I]);let te=async(e,t)=>{p(e.scheduleId),d(null);try{t?await X.invoke(`resume_routine_schedule`,{schedule_id:e.scheduleId}):await X.invoke(`pause_routine_schedule`,{schedule_id:e.scheduleId}),await I({force:!0,showLoading:!1})}catch(e){let t=e instanceof Error?e.message:String(e);d(t)}finally{p(null)}},ne=async e=>{p(e),d(null);try{await X.invoke(`trigger_routine_schedule`,{schedule_id:e}),await I({force:!0,showLoading:!1}),window.setTimeout(()=>{I({force:!0,showLoading:!1})},1e3)}catch(e){let t=e instanceof Error?e.message:String(e);d(t)}finally{p(null)}},re=async e=>{p(e),d(null);try{await X.invoke(`delete_routine_schedule`,{schedule_id:e}),h(null),await I({force:!0,showLoading:!1})}catch(e){let t=e instanceof Error?e.message:String(e);d(t)}finally{p(null)}},ie=async()=>{b(null),d(null),w(null);let e={workspaceRoot:``,cwd:``};try{e=await X.invoke(`get_process_context`)}catch{}let t=A&&P.includes(A)?A:P[0]??`cline`,n=N[t]??[],r=k.lastModelByProvider[t]??k.lastModelByProvider[k.lastProvider],i=r&&n.includes(r)?r:n[0]??j.model;M({name:``,scheduleHour:`9`,scheduleMinute:`0`,scheduleDays:[`MON`,`TUE`,`WED`,`THU`,`FRI`],prompt:`Review PRs opened yesterday and summarize issues.`,provider:t,model:i,workspaceRoot:e.workspaceRoot||e.cwd,systemPrompt:``,timeoutSeconds:``,tags:``,enabled:!0}),v(!0)},ae=e=>{if(e.cronPattern===`0`)return;let{provider:t,model:n}=Hi(e),r=Xi(e.cronPattern);b(e),d(null),w(null),O(e=>e.includes(t)?e:[...e,t]),E(e=>e[t]?.includes(n)?e:{...e,[t]:[...e[t]??[],n]}),M({name:e.name,...r,prompt:e.prompt,provider:t,model:n,workspaceRoot:e.workspaceRoot??``,systemPrompt:e.systemPrompt??``,timeoutSeconds:typeof e.timeoutSeconds==`number`?String(e.timeoutSeconds):``,tags:e.tags?.join(`,`)??``,enabled:e.enabled}),v(!0)},L=async()=>{let e=Wi(j.name);if(!e){w(`Routine name is required.`);return}let t=Ji(j.scheduleDays,j.scheduleHour,j.scheduleMinute);if(!t){w(`Select at least one day and a valid time.`);return}let n=Wi(j.prompt);if(!n){w(`Prompt is required.`);return}let r=Wi(j.workspaceRoot);if(!r){w(`Workspace root is required.`);return}w(null),S(!0);try{let i=Oi(Wi(j.provider))||P[0]||`cline`,a=Wi(j.model)||(N[i]??[])[0]||`anthropic/claude-sonnet-5`,o=Wi(j.systemPrompt),s=Gi(j.timeoutSeconds),c=Ki(j.tags),l=y?`update_routine_schedule`:`create_routine_schedule`;await X.invoke(l,{...y?{schedule_id:y.scheduleId}:void 0,name:e,cron_pattern:t,prompt:n,provider:i,model:a,mode:y?.mode??`yolo`,workspace_root:r,cwd:y?y.cwd??null:r,system_prompt:y?o||null:o||void 0,timeout_seconds:y?s??null:s,max_parallel:1,enabled:j.enabled,tags:c??[]}),await I({force:!0,showLoading:!1}),v(!1),b(null)}catch(e){let t=e instanceof Error?e.message:String(e);w(t)}finally{S(!1)}},R=(0,Z.useMemo)(()=>{let e=new Map;for(let t of n)t.scheduleId&&(e.has(t.scheduleId)||e.set(t.scheduleId,t));return e},[n]),oe=(0,Z.useMemo)(()=>{let e=new Map;for(let t of o)t.scheduleId&&(e.has(t.scheduleId)||e.set(t.scheduleId,t));return e},[o]),z=(0,Z.useMemo)(()=>[...e].sort((e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase())),[e]);return(0,Q.jsxs)(Zt,{children:[(0,Q.jsx)(Wt,{description:`Scheduled jobs are run through the hub.`,title:`Schedules`,meta:(0,Q.jsx)(Ut,{children:`cline schedule`}),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>void I(),disabled:c,children:(0,Q.jsx)(It,{className:G(`h-4 w-4`,c&&`animate-spin`)})}),(0,Q.jsxs)(U,{size:`sm`,onClick:()=>void ie(),children:[(0,Q.jsx)(st,{className:`h-4 w-4`}),`New Schedule`]})]})}),u&&(0,Q.jsx)(`div`,{className:`mb-4 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:u}),c?(0,Q.jsx)(Yt,{children:`Loading schedules...`}):z.length===0?(0,Q.jsx)(Yt,{children:`No schedules found. Create a schedule to run routines on a recurring basis.`}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:z.map(e=>{let t=f===e.scheduleId,n=R.get(e.scheduleId),r=oe.get(e.scheduleId),a=i.find(t=>t.scheduleId===e.scheduleId);return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4 transition-colors hover:bg-accent/20`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(ot,{className:G(`h-2.5 w-2.5 shrink-0`,e.enabled?`fill-primary text-primary`:`fill-muted-foreground/40 text-muted-foreground/40`)}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.name}),(0,Q.jsx)(`span`,{className:`rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:e.mode}),(0,Q.jsx)(`span`,{className:`rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:e.cronPattern===`0`?`Once · ${zi(Bi(e))}`:e.cronPattern}),(0,Q.jsx)(`div`,{className:`flex-1`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(U,{variant:`ghost`,size:`icon-sm`,"aria-label":`View ${e.name}`,onClick:()=>{window.alert(JSON.stringify(e,null,2))},children:(0,Q.jsx)(un,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(U,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit ${e.name}`,onClick:()=>ae(e),disabled:t||e.cronPattern===`0`,children:(0,Q.jsx)(Rt,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(U,{variant:`ghost`,size:`icon-sm`,"aria-label":`Run ${e.name} now`,onClick:()=>void ne(e.scheduleId),disabled:t,children:(0,Q.jsx)(Lt,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(U,{variant:`ghost`,size:`icon-sm`,"aria-label":e.enabled?`Pause ${e.name}`:`Resume ${e.name}`,onClick:()=>void te(e,!e.enabled),disabled:t,children:e.enabled?(0,Q.jsx)(hn,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(Nt,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(U,{variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e.name}`,onClick:()=>h(e),disabled:t,children:(0,Q.jsx)(g,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(J,{checked:e.enabled,onCheckedChange:t=>void te(e,t),disabled:t,"aria-label":`Enable ${e.name}`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2.5 ml-5.5 flex flex-col gap-1 text-xs text-muted-foreground`,children:[(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`ID:`}),` `,e.scheduleId]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Prompt:`}),` `,e.prompt]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Model:`}),` `,Vi(e)]}),e.workspaceRoot&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Workspace:`}),` `,e.workspaceRoot]}),e.cwd&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`CWD:`}),` `,e.cwd]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Last run:`}),` `,zi(e.lastRunAt)]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Last result:`}),` `,Ui(r)]}),r?.sessionId&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Last session:`}),` `,r.sessionId]}),r?.errorMessage&&(0,Q.jsxs)(`p`,{className:`text-destructive`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Last error:`}),` `,r.errorMessage]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Next run:`}),` `,zi(e.nextRunAt||a?.nextRunAt)]}),n&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Active:`}),` `,n.executionId,` since`,` `,zi(n.startedAt)]}),e.tags&&e.tags.length>0&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Tags:`}),` `,e.tags.join(`, `)]})]})]},e.scheduleId)})}),(0,Q.jsx)(Kt,{open:!!m,onOpenChange:e=>{e||h(null)},children:(0,Q.jsxs)($t,{children:[(0,Q.jsxs)(en,{children:[(0,Q.jsx)(Vt,{children:`Delete Routine`}),(0,Q.jsxs)(tn,{children:[`This will delete "`,m?.name??`this routine`,`" and remove future scheduled runs.`]})]}),(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(Ht,{disabled:m?f===m.scheduleId:!1,children:`Cancel`}),(0,Q.jsx)(Gt,{disabled:!m||f===m.scheduleId,onClick:()=>{m&&re(m.scheduleId)},variant:`destructive`,children:`Delete`})]})]})}),(0,Q.jsx)(ft,{open:_,onOpenChange:e=>{v(e),e||(w(null),b(null))},children:(0,Q.jsxs)(bt,{className:`max-h-[90vh] overflow-y-auto sm:max-w-2xl`,children:[(0,Q.jsxs)(mt,{children:[(0,Q.jsx)(St,{children:`Schedule`}),(0,Q.jsx)(Tt,{children:y?`Update this scheduler routine.`:`Create a scheduler routine.`})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(K,{htmlFor:`routine-name`,children:`Name`}),(0,Q.jsx)(V,{id:`routine-name`,value:j.name,onChange:e=>M(t=>({...t,name:e.target.value})),placeholder:`Daily code review`})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2 space-y-3`,children:[(0,Q.jsx)(K,{children:`Schedule`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 rounded-md border border-border p-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{htmlFor:`routine-hour`,children:`Hour`}),(0,Q.jsxs)(gt,{value:j.scheduleHour,onValueChange:e=>M(t=>({...t,scheduleHour:e??t.scheduleHour})),children:[(0,Q.jsx)(Et,{className:`w-full`,id:`routine-hour`,children:(0,Q.jsx)(q,{placeholder:`Hour`})}),(0,Q.jsx)(ht,{children:Array.from({length:24},(e,t)=>t).map(e=>(0,Q.jsx)(lt,{value:`${e}`,children:e.toString().padStart(2,`0`)},`hour-${e}`))})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{htmlFor:`routine-minute`,children:`Minute`}),(0,Q.jsxs)(gt,{value:j.scheduleMinute,onValueChange:e=>M(t=>({...t,scheduleMinute:e??t.scheduleMinute})),children:[(0,Q.jsx)(Et,{className:`w-full`,id:`routine-minute`,children:(0,Q.jsx)(q,{placeholder:`Minute`})}),(0,Q.jsx)(ht,{children:Array.from({length:60},(e,t)=>t).map(e=>(0,Q.jsx)(lt,{value:`${e}`,children:e.toString().padStart(2,`0`)},`minute-${e}`))})]})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(K,{children:`Days of week`}),(0,Q.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 sm:grid-cols-4`,children:Ri.map(e=>{let t=`routine-day-${e.value.toLowerCase()}`,n=j.scheduleDays.includes(e.value);return(0,Q.jsxs)(K,{className:`flex items-center gap-2 rounded-md border border-border px-2 py-1.5 text-sm`,htmlFor:t,children:[(0,Q.jsx)(sr,{checked:n,id:t,onCheckedChange:t=>M(n=>{let r=new Set(n.scheduleDays);return t===!0?r.add(e.value):r.delete(e.value),{...n,scheduleDays:qi([...r])}})}),e.label]},e.value)})})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2 rounded-md border border-border bg-muted/30 px-2 py-1.5 text-xs text-muted-foreground`,children:[`Cron:`,` `,(0,Q.jsx)(`span`,{className:`font-mono text-foreground`,children:ee||`Select one or more days`})]})]})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(K,{htmlFor:`routine-prompt`,children:`Prompt`}),(0,Q.jsx)(wt,{id:`routine-prompt`,value:j.prompt,onChange:e=>M(t=>({...t,prompt:e.target.value})),rows:4})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{children:`Provider`}),(0,Q.jsxs)(hi,{items:P,onValueChange:e=>{if(!e)return;let t=N[e]??[],n=k.lastModelByProvider[e],r=n&&t.includes(n)?n:t[0]??``;M(t=>({...t,provider:e,model:r}))},value:j.provider,children:[(0,Q.jsx)(vi,{className:`h-9 w-full`,readOnly:!0,showClear:!1,showTrigger:!0}),(0,Q.jsxs)(yi,{children:[(0,Q.jsx)(Si,{children:`No providers found.`}),(0,Q.jsx)(bi,{children:e=>(0,Q.jsx)(xi,{value:e,children:e},e)})]})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{children:`Model`}),(0,Q.jsxs)(hi,{items:F,onValueChange:e=>{e&&M(t=>({...t,model:e}))},value:j.model,children:[(0,Q.jsx)(vi,{className:`h-9 w-full`,readOnly:!0,showClear:!1,showTrigger:!0}),(0,Q.jsxs)(yi,{children:[(0,Q.jsx)(Si,{children:`No models found.`}),(0,Q.jsx)(bi,{children:e=>(0,Q.jsx)(xi,{value:e,children:e},e)})]})]})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(K,{htmlFor:`routine-workspace`,children:`Workspace root`}),(0,Q.jsx)(V,{id:`routine-workspace`,value:j.workspaceRoot,onChange:e=>M(t=>({...t,workspaceRoot:e.target.value}))})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(K,{htmlFor:`routine-system-prompt`,children:`System prompt (optional)`}),(0,Q.jsx)(wt,{id:`routine-system-prompt`,value:j.systemPrompt,onChange:e=>M(t=>({...t,systemPrompt:e.target.value})),rows:3})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{htmlFor:`routine-timeout`,children:`Timeout seconds (optional)`}),(0,Q.jsx)(V,{id:`routine-timeout`,value:j.timeoutSeconds,onChange:e=>M(t=>({...t,timeoutSeconds:e.target.value})),placeholder:`3600`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{htmlFor:`routine-tags`,children:`Tags (comma-separated, optional)`}),(0,Q.jsx)(V,{id:`routine-tags`,value:j.tags,onChange:e=>M(t=>({...t,tags:e.target.value})),placeholder:`automation,review`})]})]}),C&&(0,Q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:C}),(0,Q.jsxs)(pt,{children:[(0,Q.jsx)(U,{variant:`outline`,onClick:()=>v(!1),disabled:x,children:`Cancel`}),(0,Q.jsx)(U,{onClick:()=>void L(),disabled:x,children:x?y?`Saving...`:`Creating...`:y?`Save Changes`:`Create Schedule`})]})]})})]})}function Qi(e,t,n){let r=t.split(`.`).filter(Boolean);if(r.length===0)return;let i=e;for(let e of r.slice(0,-1)){let t=i[e];(!t||typeof t!=`object`||Array.isArray(t))&&(i[e]={}),i=i[e]}let a=r.at(-1);a&&(i[a]=n)}function $i(e){let t={};for(let[n,r]of Object.entries(e))Qi(t,n,r);return t}var ea=[`General`,`Providers`,`MCP`,`Channels`,`Schedules`,`Account`],ta=6e4,na=null;function ra({chrome:e=`full`,initialSection:t=`General`,onClose:n,onNavigateSection:r}){let[i,a]=(0,Z.useState)(t),[o,s]=(0,Z.useState)(!0),[c,l]=(0,Z.useState)(()=>na?.providers??[]),[u,d]=(0,Z.useState)(()=>!na),[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)({}),[g,_]=(0,Z.useState)({}),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(!1),w=(0,Z.useCallback)(e=>{l(t=>{let n=typeof e==`function`?e(t):e;return na={providers:n,fetchedAt:Date.now()},n})},[]),T=(0,Z.useCallback)(async()=>{if(na&&Date.now()-na.fetchedAt<ta){l(na.providers),d(!1),p(null);return}d(!0),p(null);try{let e=await X.invoke(`list_provider_catalog`);w(e.providers)}catch(e){let t=e instanceof Error?e.message:String(e);p(t),l([])}finally{d(!1)}},[w]);(0,Z.useEffect)(()=>{if(i!==`Providers`)return;let e=window.setTimeout(()=>{T()},0);return()=>window.clearTimeout(e)},[i,T]);let E=(0,Z.useCallback)(async(e,t)=>{try{await X.invoke(`save_provider_settings`,{provider:e,enabled:t.enabled,api_key:t.apiKey,base_url:t.baseUrl,settings:t.configValues?$i(t.configValues):void 0})}catch(t){let n=t instanceof Error?t.message:String(t);window.alert(`Failed to save provider settings for ${e}: ${n}`)}},[]),D=(0,Z.useCallback)(e=>{w(t=>t.map(t=>{if(t.id!==e)return t;let n=!t.enabled;return E(e,{enabled:n}),{...t,enabled:n}}))},[E,w]),O=(0,Z.useCallback)((e,t)=>{w(n=>n.map(n=>n.id===e?{...n,...t,configValues:t.configValues?{...n.configValues??{},...t.configValues}:n.configValues}:n)),E(e,{apiKey:t.apiKey,baseUrl:t.baseUrl,configValues:t.configValues})},[E,w]),k=(0,Z.useCallback)(async e=>{h(t=>({...t,[e]:!0})),_(t=>({...t,[e]:null}));try{let t=await X.invoke(`list_provider_models`,{provider:e});w(n=>n.map(n=>n.id===e?{...n,modelList:t.models,models:t.models.length}:n))}catch(t){let n=t instanceof Error?t.message:String(t);_(t=>({...t,[e]:n}))}finally{h(t=>({...t,[e]:!1}))}},[w]),A=c.filter(e=>e.enabled),j=b?c.find(e=>e.id===b)??null:null,M=e=>e.capabilities?.includes(`oauth`)??!1,N=async e=>{y(e);try{let t=await X.invoke(`run_provider_oauth_login`,{provider:e});w(n=>n.map(n=>n.id===e?{...n,enabled:!0,oauthAccessTokenPresent:t.accessToken.trim().length>0}:n)),x(e)}catch(t){let n=t instanceof Error?t.message:String(t);window.alert(`Failed to sign in to ${e}: ${n}`)}finally{y(null)}},P=e=>{a(`Providers`),r?.(`Providers`),x(e)};(0,Z.useEffect)(()=>{if(!b)return;let e=c.find(e=>e.id===b);if(!e||(e.modelList?.length??0)>0)return;let t=window.setTimeout(()=>{k(b)},0);return()=>window.clearTimeout(t)},[k,c,b]);let F=()=>{r?.(`Providers`),x(null),C(!1)},ee=(0,Z.useCallback)(async e=>{await X.invoke(`add_provider`,{provider_id:e.providerId,name:e.name,base_url:e.baseUrl,api_key:e.apiKey,headers:e.headers,timeout_ms:e.timeoutMs,models:e.models,default_model_id:e.defaultModelId,models_source_url:e.modelsSourceUrl,capabilities:e.capabilities}),await T(),C(!1),x(e.providerId)},[T]),I=()=>{r?.(`Providers`),x(null),C(!0)},te=e=>{a(e),r?.(e),x(null),C(!1)},ne=S?(0,Q.jsx)(An,{existingProviderIds:c.map(e=>e.id),onBack:F,onSave:ee}):u?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading providers...`})}):f?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsxs)(`p`,{className:`max-w-xl px-4 text-center text-sm text-destructive`,children:[`Failed to load providers: `,f]})}):j?(0,Q.jsxs)(`div`,{className:`grid h-full grid-cols-[minmax(24rem,0.95fr)_minmax(28rem,1.05fr)] overflow-hidden max-[1100px]:grid-cols-1 max-[1100px]:grid-rows-[minmax(24rem,0.9fr)_minmax(26rem,1fr)]`,children:[(0,Q.jsx)(Xn,{onAddProvider:I,onConfigure:P,onToggle:D,providers:c,selectedProviderId:j.id,variant:`panel`}),(0,Q.jsx)(`aside`,{className:`min-h-0 overflow-hidden border-l bg-background max-[1100px]:border-l-0 max-[1100px]:border-t`,children:(0,Q.jsx)(Zn,{modelsError:g[j.id]??null,modelsLoading:m[j.id]??!1,oauthLoginPending:v===j.id,onBack:F,onLoadModels:()=>void k(j.id),onOAuthLogin:M(j)?()=>void N(j.id):void 0,onUpdate:e=>O(j.id,e),provider:j,variant:`panel`})})]}):(0,Q.jsx)(Xn,{onAddProvider:I,onConfigure:P,onToggle:D,providers:c}),re=i===`Providers`?ne:i===`MCP`?(0,Q.jsx)(Kn,{}):i===`Channels`?(0,Q.jsx)(zn,{}):i===`Schedules`?(0,Q.jsx)(Zi,{}):i===`Account`?(0,Q.jsx)(On,{}):i===`General`?(0,Q.jsx)(ia,{}):(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[i,` settings coming soon.`]})});return e===`content`?(0,Q.jsx)(`div`,{className:`h-full overflow-hidden bg-background`,children:re}):(0,Q.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-background`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border px-6 py-3`,children:[(0,Q.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:`Settings`}),(0,Q.jsx)(U,{"aria-label":`Close settings`,className:`justify-start`,onClick:n,variant:`ghost`,children:(0,Q.jsx)(Je,{className:`size-3`})})]}),(0,Q.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,Q.jsx)(`nav`,{className:`w-56 shrink-0 border-r border-border`,children:(0,Q.jsx)(qt,{className:`h-full`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5 p-3`,children:ea.map(e=>e===`Providers`?(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(U,{className:G(`flex w-full items-center justify-between rounded-md px-3 py-2 text-sm transition-colors`,i===`Providers`?`bg-accent text-accent-foreground font-medium`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),onClick:()=>{te(`Providers`),s(e=>!e)},variant:`ghost`,children:[(0,Q.jsx)(`span`,{children:`Providers`}),o?(0,Q.jsx)(ct,{className:`size-3`}):(0,Q.jsx)(an,{className:`size-3`})]}),o&&(0,Q.jsx)(`div`,{className:`ml-3 mt-0.5 flex flex-col gap-0.5 border-l border-border pl-2`,children:A.map(e=>(0,Q.jsx)(U,{className:G(`justify-start`,b===e.id?`bg-accent/80 text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/30`),disabled:v===e.id,onClick:()=>P(e.id),variant:`ghost`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]},e):(0,Q.jsx)(U,{className:G(`justify-start`,i===e&&!b?`bg-accent text-accent-foreground font-medium`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),onClick:()=>{te(e)},variant:`ghost`,children:e},e))})})}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:re})]})]})}function ia(){let[e,t]=(0,Z.useState)(()=>typeof window>`u`?`light`:Qt()??Jt()),[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(!0),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(!0),[f,p]=(0,Z.useState)(!0),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),v=(0,Z.useCallback)(async()=>{a(!0),l(null),p(!0),_(null);try{let e=await X.invoke(`get_global_settings`);r(e.telemetryOptOut),d(e.autoUpdateEnabled)}catch(e){let t=e instanceof Error?e.message:String(e);l(t),_(t)}finally{a(!1),p(!1)}},[]);(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>{v()},0);return()=>window.clearTimeout(e)},[v]);let y=async e=>{let t=n;r(e),s(!0),l(null);try{let t=await X.invoke(`set_telemetry_opt_out`,{telemetry_opt_out:e});r(t.telemetryOptOut)}catch(e){let n=e instanceof Error?e.message:String(e);r(t),l(n)}finally{s(!1)}},b=async e=>{let t=u;d(e),h(!0),_(null);try{let t=await X.invoke(`set_auto_update_enabled`,{auto_update_enabled:e});d(t.autoUpdateEnabled)}catch(e){let n=e instanceof Error?e.message:String(e);d(t),_(n)}finally{h(!1)}};return(0,Q.jsxs)(Zt,{children:[(0,Q.jsx)(Wt,{description:`Manage Hub preferences for this browser and CLI environment.`,title:`Settings`}),(0,Q.jsxs)(`section`,{className:`max-w-[86rem]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-20 items-center justify-between gap-5 border-b max-[720px]:flex-col max-[720px]:items-stretch max-[720px]:py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[17px] font-semibold text-foreground`,children:`Dark mode`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[15px] text-muted-foreground`,children:`Keep the Hub interface in dark mode on this browser.`})]}),(0,Q.jsx)(J,{"aria-label":`Dark mode`,checked:e===`dark`,onCheckedChange:e=>{t(Xt(e?`dark`:`light`)),window.dispatchEvent(new Event(`cline-hub-theme-change`))}})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-20 items-center justify-between gap-5 border-b max-[720px]:flex-col max-[720px]:items-stretch max-[720px]:py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[17px] font-semibold text-foreground`,children:`Auto update`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[15px] text-muted-foreground`,children:`Automatically install CLI updates on startup.`}),g?(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-destructive`,children:[`Failed to update auto update setting: `,g]}):null]}),(0,Q.jsx)(J,{"aria-label":`Auto update`,checked:u,disabled:f||m,onCheckedChange:e=>void b(e)})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-20 items-center justify-between gap-5 border-b max-[720px]:flex-col max-[720px]:items-stretch max-[720px]:py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[17px] font-semibold text-foreground`,children:`Telemetry`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[15px] text-muted-foreground`,children:`Enable error and usage report to help us improve Cline.`}),c?(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-destructive`,children:[`Failed to update telemetry setting: `,c]}):null]}),(0,Q.jsx)(J,{"aria-label":`Telemetry`,checked:!n,disabled:i||o,onCheckedChange:e=>void y(!e)})]})]})]})}export{ra as SettingsView};
@@ -0,0 +1 @@
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-BY_WSiz7.js";import{O as r,c as i,s as a,x as o}from"./chunk-I66GZJ75-DXqP3B91.js";import{et as s,g as c}from"./chunk-NSK5VX7P-D5026Kzu.js";import{t as l}from"./line-BImJQVif.js";import"./chunk-4I5QYGJK-0RNwvBrV.js";import"./chunk-WRU74C26-BSENSjFs.js";import{i as u,t as d}from"./mermaid-layout-BadlRzDJ.js";import"./chunk-7BUUIJ7U-Bb538aSH.js";import"./chunk-UBXNYLIW-DzzRI8B_.js";import"./chunk-2GRJ4B5K-u4MGLwtv.js";import"./chunk-XXDRQBXY-DR-hrsFH.js";import"./chunk-KBJHAD2P-L-89C026.js";import"./chunk-W5SLKNZC-jIqX_Eb5.js";import"./chunk-QR6OTTB3-DgKOIk7B.js";import"./chunk-7Z6QIM7H-C6_Ywz3w.js";import{i as f,n as p,t as m}from"./chunk-5RXB4S5H-BHjkdRhh.js";import"./mermaid.core-CNhdxt2h.js";var h=e(e=>e.append(`circle`).attr(`class`,`start-state`).attr(`r`,o().state.sizeUnit).attr(`cx`,o().state.padding+o().state.sizeUnit).attr(`cy`,o().state.padding+o().state.sizeUnit),`drawStartState`),g=e(e=>e.append(`line`).style(`stroke`,`grey`).style(`stroke-dasharray`,`3`).attr(`x1`,o().state.textHeight).attr(`class`,`divider`).attr(`x2`,o().state.textHeight*2).attr(`y1`,0).attr(`y2`,0),`drawDivider`),_=e((e,t)=>{let n=e.append(`text`).attr(`x`,2*o().state.padding).attr(`y`,o().state.textHeight+2*o().state.padding).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(t.id),r=n.node().getBBox();return e.insert(`rect`,`:first-child`).attr(`x`,o().state.padding).attr(`y`,o().state.padding).attr(`width`,r.width+2*o().state.padding).attr(`height`,r.height+2*o().state.padding).attr(`rx`,o().state.radius),n},`drawSimpleState`),v=e((t,n)=>{let r=e(function(e,t,n){let r=e.append(`tspan`).attr(`x`,2*o().state.padding).text(t);n||r.attr(`dy`,o().state.textHeight)},`addTspan`),i=t.append(`text`).attr(`x`,2*o().state.padding).attr(`y`,o().state.textHeight+1.3*o().state.padding).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(n.descriptions[0]).node().getBBox(),a=i.height,s=t.append(`text`).attr(`x`,o().state.padding).attr(`y`,a+o().state.padding*.4+o().state.dividerMargin+o().state.textHeight).attr(`class`,`state-description`),c=!0,l=!0;n.descriptions.forEach(function(e){c||(r(s,e,l),l=!1),c=!1});let u=t.append(`line`).attr(`x1`,o().state.padding).attr(`y1`,o().state.padding+a+o().state.dividerMargin/2).attr(`y2`,o().state.padding+a+o().state.dividerMargin/2).attr(`class`,`descr-divider`),d=s.node().getBBox(),f=Math.max(d.width,i.width);return u.attr(`x2`,f+3*o().state.padding),t.insert(`rect`,`:first-child`).attr(`x`,o().state.padding).attr(`y`,o().state.padding).attr(`width`,f+2*o().state.padding).attr(`height`,d.height+a+2*o().state.padding).attr(`rx`,o().state.radius),t},`drawDescrState`),y=e((e,t,n)=>{let r=o().state.padding,i=2*o().state.padding,a=e.node().getBBox(),s=a.width,c=a.x,l=e.append(`text`).attr(`x`,0).attr(`y`,o().state.titleShift).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(t.id),u=l.node().getBBox().width+i,d=Math.max(u,s);d===s&&(d+=i);let f,p=e.node().getBBox();t.doc,f=c-r,u>s&&(f=(s-d)/2+r),Math.abs(c-p.x)<r&&u>s&&(f=c-(u-s)/2);let m=1-o().state.textHeight;return e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,m).attr(`class`,n?`alt-composit`:`composit`).attr(`width`,d).attr(`height`,p.height+o().state.textHeight+o().state.titleShift+1).attr(`rx`,`0`),l.attr(`x`,f+r),u<=s&&l.attr(`x`,c+(d-i)/2-u/2+r),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,o().state.titleShift-o().state.textHeight-o().state.padding).attr(`width`,d).attr(`height`,o().state.textHeight*3).attr(`rx`,o().state.radius),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,o().state.titleShift-o().state.textHeight-o().state.padding).attr(`width`,d).attr(`height`,p.height+3+2*o().state.textHeight).attr(`rx`,o().state.radius),e},`addTitleAndBox`),b=e(e=>(e.append(`circle`).attr(`class`,`end-state-outer`).attr(`r`,o().state.sizeUnit+o().state.miniPadding).attr(`cx`,o().state.padding+o().state.sizeUnit+o().state.miniPadding).attr(`cy`,o().state.padding+o().state.sizeUnit+o().state.miniPadding),e.append(`circle`).attr(`class`,`end-state-inner`).attr(`r`,o().state.sizeUnit).attr(`cx`,o().state.padding+o().state.sizeUnit+2).attr(`cy`,o().state.padding+o().state.sizeUnit+2)),`drawEndState`),x=e((e,t)=>{let n=o().state.forkWidth,r=o().state.forkHeight;if(t.parentId){let e=n;n=r,r=e}return e.append(`rect`).style(`stroke`,`black`).style(`fill`,`black`).attr(`width`,n).attr(`height`,r).attr(`x`,o().state.padding).attr(`y`,o().state.padding)},`drawForkJoinState`),S=e((e,t,n,r)=>{let i=0,s=r.append(`text`);s.style(`text-anchor`,`start`),s.attr(`class`,`noteText`);let c=e.replace(/\r\n/g,`<br/>`);c=c.replace(/\n/g,`<br/>`);let l=c.split(a.lineBreakRegex),u=1.25*o().state.noteMargin;for(let e of l){let r=e.trim();if(r.length>0){let e=s.append(`tspan`);if(e.text(r),u===0){let t=e.node().getBBox();u+=t.height}i+=u,e.attr(`x`,t+o().state.noteMargin),e.attr(`y`,n+i+1.25*o().state.noteMargin)}}return{textWidth:s.node().getBBox().width,textHeight:i}},`_drawLongText`),C=e((e,t)=>{t.attr(`class`,`state-note`);let n=t.append(`rect`).attr(`x`,0).attr(`y`,o().state.padding),{textWidth:r,textHeight:i}=S(e,0,0,t.append(`g`));return n.attr(`height`,i+2*o().state.noteMargin),n.attr(`width`,r+o().state.noteMargin*2),n},`drawNote`),w=e(function(e,t){let n=t.id,r={id:n,label:t.id,width:0,height:0},i=e.append(`g`).attr(`id`,n).attr(`class`,`stateGroup`);t.type===`start`&&h(i),t.type===`end`&&b(i),(t.type===`fork`||t.type===`join`)&&x(i,t),t.type===`note`&&C(t.note.text,i),t.type===`divider`&&g(i),t.type==="default"&&t.descriptions.length===0&&_(i,t),t.type==="default"&&t.descriptions.length>0&&v(i,t);let a=i.node().getBBox();return r.width=a.width+2*o().state.padding,r.height=a.height+2*o().state.padding,r},`drawState`),T=0,E=e(function(n,i,u){let d=e(function(e){switch(e){case m.relationType.AGGREGATION:return`aggregation`;case m.relationType.EXTENSION:return`extension`;case m.relationType.COMPOSITION:return`composition`;case m.relationType.DEPENDENCY:return`dependency`}},`getRelationType`);i.points=i.points.filter(e=>!Number.isNaN(e.y));let f=i.points,p=l().x(function(e){return e.x}).y(function(e){return e.y}).curve(s),h=n.append(`path`).attr(`d`,p(f)).attr(`id`,`edge`+T).attr(`class`,`transition`),g=``;if(o().state.arrowMarkerAbsolute&&(g=r(!0)),h.attr(`marker-end`,`url(`+g+`#`+d(m.relationType.DEPENDENCY)+`End)`),u.title!==void 0){let e=n.append(`g`).attr(`class`,`stateLabel`),{x:r,y:s}=c.calcLabelPosition(i.points),l=a.getRows(u.title),d=0,f=[],p=0,m=0;for(let n=0;n<=l.length;n++){let i=e.append(`text`).attr(`text-anchor`,`middle`).text(l[n]).attr(`x`,r).attr(`y`,s+d),a=i.node().getBBox();p=Math.max(p,a.width),m=Math.min(m,a.x),t.info(a.x,r,s+d),d===0&&(d=i.node().getBBox().height,t.info(`Title height`,d,s)),f.push(i)}let h=d*l.length;if(l.length>1){let e=(l.length-1)*d*.5;f.forEach((t,n)=>t.attr(`y`,s+n*d-e)),h=d*l.length}let g=e.node().getBBox();e.insert(`rect`,`:first-child`).attr(`class`,`box`).attr(`x`,r-p/2-o().state.padding/2).attr(`y`,s-h/2-o().state.padding/2-3.5).attr(`width`,p+o().state.padding).attr(`height`,h+o().state.padding),t.info(g)}T++},`drawEdge`),D,O={},k=e(function(){},`setConf`),A=e(function(e){e.append(`defs`).append(`marker`).attr(`id`,`dependencyEnd`).attr(`refX`,19).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L9,13 L14,7 L9,1 Z`)},`insertMarkers`),j=e(function(e,r,a,s){D=o().state;let c=o().securityLevel,l;c===`sandbox`&&(l=n(`#i`+r));let u=n(c===`sandbox`?l.nodes()[0].contentDocument.body:`body`),d=c===`sandbox`?l.nodes()[0].contentDocument:document;t.debug(`Rendering diagram `+e);let f=u.select(`[id='${r}']`);A(f),N(s.db.getRootDoc(),f.append(`g`).attr(`id`,r+`-root`),void 0,!1,u,d,s);let p=D.padding,m=f.node().getBBox(),h=m.width+p*2,g=m.height+p*2,_=h*1.75;i(f,g,_,D.useMaxWidth),f.attr(`viewBox`,`${m.x-D.padding} ${m.y-D.padding} `+h+` `+g)},`draw`),M=e(e=>e?e.length*D.fontSizeFactor:1,`getLabelWidth`),N=e((e,n,r,i,o,s,c)=>{let l=new u({compound:!0,multigraph:!0}),f,p=!0;for(f=0;f<e.length;f++)if(e[f].stmt===`relation`){p=!1;break}r?l.setGraph({rankdir:`LR`,multigraph:!0,compound:!0,ranker:`tight-tree`,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,isMultiGraph:!0}):l.setGraph({rankdir:`TB`,multigraph:!0,compound:!0,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,ranker:`tight-tree`,isMultiGraph:!0}),l.setDefaultEdgeLabel(function(){return{}});let m=c.db.getStates(),h=c.db.getRelations(),g=Object.keys(m);for(let e of g){let t=m[e];r&&(t.parentId=r);let a;if(t.doc){let e=n.append(`g`).attr(`id`,t.id).attr(`class`,`stateGroup`);a=N(t.doc,e,t.id,!i,o,s,c);{e=y(e,t,i);let n=e.node().getBBox();a.width=n.width,a.height=n.height+D.padding/2,O[t.id]={y:D.compositTitleSize}}}else a=w(n,t,l);if(t.note){let e=w(n,{descriptions:[],id:t.id+`-note`,note:t.note,type:`note`},l);t.note.position===`left of`?(l.setNode(a.id+`-note`,e),l.setNode(a.id,a)):(l.setNode(a.id,a),l.setNode(a.id+`-note`,e)),l.setParent(a.id,a.id+`-group`),l.setParent(a.id+`-note`,a.id+`-group`)}else l.setNode(a.id,a)}t.debug(`Count=`,l.nodeCount(),l);let _=0;h.forEach(function(e){_++,t.debug(`Setting edge`,e),l.setEdge(e.id1,e.id2,{relation:e,width:M(e.title),height:D.labelHeight*a.getRows(e.title).length,labelpos:`c`},`id`+_)}),d(l),t.debug(`Graph after layout`,l.nodes());let v=n.node();l.nodes().forEach(function(e){e!==void 0&&l.node(e)!==void 0?(t.warn(`Node `+e+`: `+JSON.stringify(l.node(e))),o.select(`#`+v.id+` #`+e).attr(`transform`,`translate(`+(l.node(e).x-l.node(e).width/2)+`,`+(l.node(e).y+(O[e]?O[e].y:0)-l.node(e).height/2)+` )`),o.select(`#`+v.id+` #`+e).attr(`data-x-shift`,l.node(e).x-l.node(e).width/2),s.querySelectorAll(`#`+v.id+` #`+e+` .divider`).forEach(e=>{let t=e.parentElement,n=0,r=0;t&&(t.parentElement&&(n=t.parentElement.getBBox().width),r=parseInt(t.getAttribute(`data-x-shift`),10),Number.isNaN(r)&&(r=0)),e.setAttribute(`x1`,0-r+8),e.setAttribute(`x2`,n-r-8)})):t.debug(`No Node `+e+`: `+JSON.stringify(l.node(e)))});let b=v.getBBox();l.edges().forEach(function(e){e!==void 0&&l.edge(e)!==void 0&&(t.debug(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(l.edge(e))),E(n,l.edge(e),l.edge(e).relation))}),b=v.getBBox();let x={id:r||`root`,label:r||`root`,width:0,height:0};return x.width=b.width+2*D.padding,x.height=b.height+2*D.padding,t.debug(`Doc rendered`,x,l),x},`renderDoc`),P={parser:p,get db(){return new m(1)},renderer:{setConf:k,draw:j},styles:f,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{P as diagram};
@@ -0,0 +1 @@
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-BY_WSiz7.js";import"./chunk-I66GZJ75-DXqP3B91.js";import"./chunk-NSK5VX7P-D5026Kzu.js";import"./chunk-4I5QYGJK-0RNwvBrV.js";import"./chunk-WRU74C26-BSENSjFs.js";import"./chunk-7BUUIJ7U-Bb538aSH.js";import"./chunk-UBXNYLIW-DzzRI8B_.js";import"./chunk-2GRJ4B5K-u4MGLwtv.js";import"./chunk-XXDRQBXY-DR-hrsFH.js";import"./chunk-KBJHAD2P-L-89C026.js";import"./chunk-W5SLKNZC-jIqX_Eb5.js";import"./chunk-QR6OTTB3-DgKOIk7B.js";import"./chunk-7Z6QIM7H-C6_Ywz3w.js";import{i as t,n,r,t as i}from"./chunk-5RXB4S5H-BHjkdRhh.js";import"./mermaid.core-CNhdxt2h.js";var a={parser:n,get db(){return new i(2)},renderer:r,styles:t,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};