@nextclaw/ui 0.27.0 → 0.27.2

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 (320) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/.vite/manifest.json +1246 -1175
  3. package/dist/assets/{abnfDiagram-VRR7QNED-DmeCRAkd.js → abnfDiagram-VRR7QNED-BT0_ycaq.js} +1 -1
  4. package/dist/assets/account-panel-svU9I6E6.js +1 -0
  5. package/dist/assets/agents-CtI89gpb.js +1 -0
  6. package/dist/assets/agents-DWygCmAK.js +1 -0
  7. package/dist/assets/{aiden0z-pptx-renderer.es-ChX5DHqP.js → aiden0z-pptx-renderer.es-ClCaf_Wh.js} +1 -1
  8. package/dist/assets/api-CI6_8Qt1.js +20 -0
  9. package/dist/assets/app-presenter-provider-_UK6sArj.js +28 -0
  10. package/dist/assets/appearance-settings-page-BhedtMx9.js +1 -0
  11. package/dist/assets/apps-C4c4NXqB.js +1 -0
  12. package/dist/assets/{arc-Cu6Ols44.js → arc-cmSdpq1Z.js} +1 -1
  13. package/dist/assets/architecture-TIHT7OUA-BImoGh10.js +1 -0
  14. package/dist/assets/{architectureDiagram-ZJ3FMSHR-DrNB0eLE.js → architectureDiagram-ZJ3FMSHR-aYglVeoS.js} +1 -1
  15. package/dist/assets/{blockDiagram-677ZJIJ3-08rHt6DJ.js → blockDiagram-677ZJIJ3-Di_PBl5q.js} +1 -1
  16. package/dist/assets/{book-open-ClbJmmxP.js → book-open-i_BjUBqL.js} +1 -1
  17. package/dist/assets/{c4Diagram-LMCZKHZV-CCVgRG-u.js → c4Diagram-LMCZKHZV-CfuxybOL.js} +1 -1
  18. package/dist/assets/{card-BdC01NFF.js → card-DokH7OBp.js} +1 -1
  19. package/dist/assets/channel-BDQry0ob.js +1 -0
  20. package/dist/assets/{channels-list-page-BrIvJlop.js → channels-list-page-B7G9lHUm.js} +2 -2
  21. package/dist/assets/chunk-2Q5K7J3B-DkgSFfIy.js +1 -0
  22. package/dist/assets/{chunk-32BRIVSS-BeCaI-JN.js → chunk-32BRIVSS-CCGc4qg4.js} +1 -1
  23. package/dist/assets/{chunk-52WLFC77-ZXIcYPYs.js → chunk-52WLFC77-aJoxU2Ow.js} +1 -1
  24. package/dist/assets/{chunk-5FCAYU7R-DDwTPcy8.js → chunk-5FCAYU7R-CGwtZSax.js} +1 -1
  25. package/dist/assets/{chunk-5HE753X5-WygrMYPL.js → chunk-5HE753X5-DqaMSMeS.js} +1 -1
  26. package/dist/assets/{chunk-5JV3BV7I-o8T3KZgk.js → chunk-5JV3BV7I-DnabINcd.js} +1 -1
  27. package/dist/assets/{chunk-5TONJI2A-BKFbUT7J.js → chunk-5TONJI2A-BhpKv1k2.js} +1 -1
  28. package/dist/assets/{chunk-5VM5RSS4-DYxCRV86.js → chunk-5VM5RSS4-DvkRPit_.js} +1 -1
  29. package/dist/assets/{chunk-7BUUIJ7U-CvSeJlKZ.js → chunk-7BUUIJ7U-CgDQOLnC.js} +1 -1
  30. package/dist/assets/{chunk-BIQX33UG-BhH3RHCY.js → chunk-BIQX33UG-9FEv5b7T.js} +1 -1
  31. package/dist/assets/{chunk-C7G6YPKG-BTL0-xL3.js → chunk-C7G6YPKG-CNGFAFYL.js} +1 -1
  32. package/dist/assets/{chunk-CQNSW5MT-DWAU4QaD.js → chunk-CQNSW5MT-DovTZx0M.js} +1 -1
  33. package/dist/assets/{chunk-CYSBUYHQ-B7ZBMXTx.js → chunk-CYSBUYHQ-DpLEgYa1.js} +1 -1
  34. package/dist/assets/{chunk-EMLP6XTP-D92HvnHE.js → chunk-EMLP6XTP-D4NuN01W.js} +1 -1
  35. package/dist/assets/{chunk-EX3LRPZG-DfOGKwW8.js → chunk-EX3LRPZG-D8Jf4kc2.js} +1 -1
  36. package/dist/assets/{chunk-FWX5IMBZ-DUuJUrXJ.js → chunk-FWX5IMBZ-BdHymAs0.js} +2 -2
  37. package/dist/assets/{chunk-HOUHSVGY-i3MDyUY5.js → chunk-HOUHSVGY-Dd_Ycn9Z.js} +1 -1
  38. package/dist/assets/{chunk-ICXQ74PX-F_pmNX6t.js → chunk-ICXQ74PX-BRPUu3ff.js} +1 -1
  39. package/dist/assets/{chunk-JG7HCLWE-DygOelrU.js → chunk-JG7HCLWE-DnCasQja.js} +1 -1
  40. package/dist/assets/{chunk-JWPE2WC7-BpiZMeRl.js → chunk-JWPE2WC7-C3CkbEj1.js} +1 -1
  41. package/dist/assets/{chunk-MOJQB5TN-CV10sB1I.js → chunk-MOJQB5TN-Pi--K4-1.js} +1 -1
  42. package/dist/assets/{chunk-MOZMSUNE-Cf1WZNm0.js → chunk-MOZMSUNE-3VTspvlh.js} +1 -1
  43. package/dist/assets/{chunk-OGEWGWER-DuSw54VR.js → chunk-OGEWGWER-BetLLyJt.js} +1 -1
  44. package/dist/assets/{chunk-OSBZ3O6U-_rt_XKSZ.js → chunk-OSBZ3O6U-D1VcupAj.js} +1 -1
  45. package/dist/assets/{chunk-PUDLZKDR-BFPaAGNW.js → chunk-PUDLZKDR-Cy4G8SjV.js} +1 -1
  46. package/dist/assets/{chunk-Q4XR5HBZ-GE0v_E5y.js → chunk-Q4XR5HBZ-UYxXzi7_.js} +1 -1
  47. package/dist/assets/{chunk-QBLGF6JB-BK_FpnlJ.js → chunk-QBLGF6JB-CHiGeRY1.js} +1 -1
  48. package/dist/assets/{chunk-R7FJI6CG-CpYh6rGo.js → chunk-R7FJI6CG-C5kVJus8.js} +1 -1
  49. package/dist/assets/{chunk-RYQCIY6F-htnxL_Cl.js → chunk-RYQCIY6F-C6cuuEBn.js} +1 -1
  50. package/dist/assets/{chunk-U6XO7XAA-wDbE4BZ7.js → chunk-U6XO7XAA-CM0EK7Y0.js} +1 -1
  51. package/dist/assets/{chunk-V7JOEXUC-DDRSVFTB.js → chunk-V7JOEXUC-DWJZIsME.js} +1 -1
  52. package/dist/assets/chunk-VAUOI2AC-CsTIB8qD.js +1 -0
  53. package/dist/assets/{chunk-VR4S4FIN-COdhHR1o.js → chunk-VR4S4FIN-CY5KYeEi.js} +1 -1
  54. package/dist/assets/{chunk-WYO6CB5R-DPDGhyF6.js → chunk-WYO6CB5R-B30N3ZP8.js} +3 -3
  55. package/dist/assets/chunk-XXDRQBXY-DK6dz0Q3.js +1 -0
  56. package/dist/assets/{chunk-YOTPTUD7-D8ir9Nx5.js → chunk-YOTPTUD7-CBu82JpO.js} +1 -1
  57. package/dist/assets/{chunk-ZGVPDNZ5-BuNKD836.js → chunk-ZGVPDNZ5-BN5NX5qA.js} +1 -1
  58. package/dist/assets/{chunk-ZIRB5QZD-DyHzq8jH.js → chunk-ZIRB5QZD-DcDXK29L.js} +1 -1
  59. package/dist/assets/{circle-dashed-nDaMRmP-.js → circle-dashed-Cx8CIEbg.js} +1 -1
  60. package/dist/assets/classDiagram-OUVF2IWQ-BYygHCrp.js +1 -0
  61. package/dist/assets/classDiagram-v2-EOCWNBFH-BgQ0XKYz.js +1 -0
  62. package/dist/assets/{client-DlFB5dW5.js → client-CUJUci3r.js} +1 -1
  63. package/dist/assets/{config-split-page-C06fU9OQ.js → config-split-page-hY1xug28.js} +1 -1
  64. package/dist/assets/{confirm-dialog-DpcmlXhd.js → confirm-dialog-B-ejV666.js} +1 -1
  65. package/dist/assets/{context-menu-DKIEaY7f.js → context-menu-dGVv8klA.js} +9 -9
  66. package/dist/assets/{cose-bilkent-JH36ORCC-B1I1_P6a.js → cose-bilkent-JH36ORCC-CmeJVoTw.js} +1 -1
  67. package/dist/assets/{createLucideIcon-Lnt-4LMC.js → createLucideIcon-reFMl-W-.js} +1 -1
  68. package/dist/assets/cron-DkYSmE-f.js +1 -0
  69. package/dist/assets/cynefin-VYW2F7L2-DKbotNWS.js +1 -0
  70. package/dist/assets/{cynefinDiagram-TSTJHNR4-DcOnhnCo.js → cynefinDiagram-TSTJHNR4-DGOUMgPP.js} +1 -1
  71. package/dist/assets/{dagre-nSYhf9yY.js → dagre-CMxSkbJJ.js} +1 -1
  72. package/dist/assets/{dagre-VKFMJZFB-hAX89lg3.js → dagre-VKFMJZFB-3YUBEXwo.js} +1 -1
  73. package/dist/assets/{desktop-capabilities-page-DPORyZAu.js → desktop-capabilities-page-CYJTQ3nC.js} +1 -1
  74. package/dist/assets/{desktop-update-config-BMTeWZmn.js → desktop-update-config-guKAozXO.js} +1 -1
  75. package/dist/assets/{diagram-FQU43EPY-C1mRMD2k.js → diagram-FQU43EPY-Br1g--ww.js} +1 -1
  76. package/dist/assets/{diagram-G47NLZAW-D2XBn5al.js → diagram-G47NLZAW-D1wJCBgr.js} +1 -1
  77. package/dist/assets/{diagram-NH7WQ7WH-3LmRsmkC.js → diagram-NH7WQ7WH-Cgg2auLH.js} +1 -1
  78. package/dist/assets/{diagram-OA4YK3LP-CFWn-osC.js → diagram-OA4YK3LP-R-wHiWqh.js} +1 -1
  79. package/dist/assets/{diagram-WEI45ONY-BqNRbUvU.js → diagram-WEI45ONY-CsNnKV0P.js} +1 -1
  80. package/dist/assets/{dialog-BNXSPMX_.js → dialog-DLOwdjT1.js} +1 -1
  81. package/dist/assets/{dist-Cuiqqp1O.js → dist-ZaFFmAGl.js} +1 -1
  82. package/dist/assets/doc-browser-B0zg0EXA.js +1 -0
  83. package/dist/assets/doc-browser-context-CTmOmuqa.js +1 -0
  84. package/dist/assets/{docx-preview-CunAATyC.js → docx-preview-kPn_EtAr.js} +1 -1
  85. package/dist/assets/{download-f_sPcoLZ.js → download-DovI3Yvf.js} +1 -1
  86. package/dist/assets/{ebnfDiagram-CCIWWBDH-CYb8IwqD.js → ebnfDiagram-CCIWWBDH-DCyhIPdi.js} +1 -1
  87. package/dist/assets/{erDiagram-Q63AITRT-H47mUoeK.js → erDiagram-Q63AITRT-D0ZJYAUf.js} +1 -1
  88. package/dist/assets/eventmodeling-45OFAUF4-SIhbIFIw.js +1 -0
  89. package/dist/assets/{extensions-B-0xQz3L.js → extensions-BZ3qrM8M.js} +1 -1
  90. package/dist/assets/{external-link-CbVlnlNy.js → external-link-DUD3AbsF.js} +1 -1
  91. package/dist/assets/flowDiagram-23GEKE2U-DdAjkU7I.js +1 -0
  92. package/dist/assets/{form-actions-BoTqELHB.js → form-actions-B8VniHts.js} +1 -1
  93. package/dist/assets/{ganttDiagram-NO4QXBWP-hSX45zfV.js → ganttDiagram-NO4QXBWP-CiXDcXZD.js} +1 -1
  94. package/dist/assets/gitGraph-TEB2WS4Q-DnMNpESZ.js +1 -0
  95. package/dist/assets/{gitGraphDiagram-IHSO6WYX-Br0UW2qg.js → gitGraphDiagram-IHSO6WYX-BSiIV48S.js} +1 -1
  96. package/dist/assets/{i18n-B0V5NkFj.js → i18n-IGQbjBqS.js} +2 -2
  97. package/dist/assets/inbox-CJBCLB1X.js +1 -0
  98. package/dist/assets/{inbox-Bna8iUy0.js → inbox-ClAG7SI_.js} +1 -1
  99. package/dist/assets/info-DKCQHKI2-BSm-69p_.js +1 -0
  100. package/dist/assets/{infoDiagram-FWYZ7A6U-DQmP_67w.js → infoDiagram-FWYZ7A6U-CCIgBCVq.js} +1 -1
  101. package/dist/assets/{ishikawaDiagram-FXEZZL3T-BHAV2oes.js → ishikawaDiagram-FXEZZL3T-nQ_baN5u.js} +1 -1
  102. package/dist/assets/{journeyDiagram-5HDEW3XC-CFHax4_d.js → journeyDiagram-5HDEW3XC-ABueIPzj.js} +1 -1
  103. package/dist/assets/{kanban-definition-HUTT4EX6-B4ZA9rp5.js → kanban-definition-HUTT4EX6-8FKS3fmQ.js} +1 -1
  104. package/dist/assets/katex-DPgHtix3.js +1 -0
  105. package/dist/assets/keyboard-shortcuts-settings-page-B5oxyPS2.js +1 -0
  106. package/dist/assets/{line-BboM0HLF.js → line-Biw8iEUz.js} +1 -1
  107. package/dist/assets/{linear-4K_M1oYM.js → linear-D7CWUHTF.js} +1 -1
  108. package/dist/assets/login-page-BxSMwUsc.js +1 -0
  109. package/dist/assets/{login-page-JNr5JCEw.js → login-page-DYaozpzz.js} +1 -1
  110. package/dist/assets/main-D_zmSVS1.css +1 -0
  111. package/dist/assets/main-gFUvLF57.js +2 -0
  112. package/dist/assets/main-i18n-catalog.config-itg3Gvzp.js +1 -0
  113. package/dist/assets/{map-26GpO1wn.js → map-CDu47gTf.js} +1 -1
  114. package/dist/assets/marketplace-DsAf_rnt.js +1 -0
  115. package/dist/assets/mcp-marketplace-page-BqUz09cj.js +1 -0
  116. package/dist/assets/{mermaid-parser.core-BTJFnvRC.js → mermaid-parser.core-Cc9wjl82.js} +2 -2
  117. package/dist/assets/{mermaid.core-B7ufoXgq.js → mermaid.core-GWlaVWz1.js} +3 -3
  118. package/dist/assets/{mindmap-definition-LN4V7U3C-BHyru6KE.js → mindmap-definition-LN4V7U3C-oqnKsz-R.js} +1 -1
  119. package/dist/assets/{model-config-page-C-wbM6Fe.js → model-config-page-Cduyz2Hy.js} +1 -1
  120. package/dist/assets/{navigation-link-DFLSVIut.js → navigation-link-D-JSWFxj.js} +1 -1
  121. package/dist/assets/{ordinal-BqFe2ePF.js → ordinal-DImbxqBz.js} +1 -1
  122. package/dist/assets/packet-7NZHBO7P-1YQvC6mT.js +1 -0
  123. package/dist/assets/panel-app-i18n-catalog.config-BfLHr1tc.js +1 -0
  124. package/dist/assets/panel-apps-Bg5Fzm3T.js +1 -0
  125. package/dist/assets/panelStandalone-oHxbXvYt.js +2 -0
  126. package/dist/assets/{pegDiagram-2B236MQR-PVTatU5j.js → pegDiagram-2B236MQR-DYAB8CEz.js} +1 -1
  127. package/dist/assets/pie-RZYD4A2V-BGoNOSwu.js +1 -0
  128. package/dist/assets/{pieDiagram-ENE6RG2P-CGc-QCc7.js → pieDiagram-ENE6RG2P-DGsH0Kk5.js} +1 -1
  129. package/dist/assets/plus-DUdl68Eo.js +1 -0
  130. package/dist/assets/{privacy-settings-page-CPdEiouE.js → privacy-settings-page-DG9E8N-F.js} +1 -1
  131. package/dist/assets/projects-DvHyoKIF.js +1 -0
  132. package/dist/assets/{provider-models-XRArsply.js → provider-models-COzjYl29.js} +1 -1
  133. package/dist/assets/{provider-scoped-model-input-C8JI-hus.js → provider-scoped-model-input-Cvy74uj8.js} +1 -1
  134. package/dist/assets/{providers-config-page-fyMlVgvq.js → providers-config-page-7rCwVnhh.js} +1 -1
  135. package/dist/assets/{puzzle-Bk3ud1KI.js → puzzle-C5Wfpjk_.js} +1 -1
  136. package/dist/assets/{pwa-Cx6Fnox4.js → pwa-CAg_9zFs.js} +1 -1
  137. package/dist/assets/{quadrantDiagram-ABIIQ3AL-DGL36riv.js → quadrantDiagram-ABIIQ3AL-BegGcT3l.js} +1 -1
  138. package/dist/assets/radar-I7S5WNFK-uPku9RRq.js +1 -0
  139. package/dist/assets/railroad-3IZDKUUU-DHnmbuIo.js +1 -0
  140. package/dist/assets/railroad-abnf-AHOZXSZD-DiZs--Iw.js +1 -0
  141. package/dist/assets/railroad-ebnf-EBAXGLYW-Nr53gnNE.js +1 -0
  142. package/dist/assets/railroad-peg-LSFZ7HO6-Cm_PuwJS.js +1 -0
  143. package/dist/assets/{railroadDiagram-RFXS5EU6-CyNwvhSb.js → railroadDiagram-RFXS5EU6-B3yJ2yxE.js} +1 -1
  144. package/dist/assets/{refresh-cw-Ca2napNx.js → refresh-cw-OhwaPDn1.js} +1 -1
  145. package/dist/assets/remote-Dhr4K1oK.js +1 -0
  146. package/dist/assets/{requirementDiagram-TGXJPOKE-C31NMKJ0.js → requirementDiagram-TGXJPOKE-DtEyoEXG.js} +1 -1
  147. package/dist/assets/{rotate-cw-DXg7sNUE.js → rotate-cw-aBponvp7.js} +1 -1
  148. package/dist/assets/runtime-config-page-FI2pk3HH.js +1 -0
  149. package/dist/assets/{sankeyDiagram-HTMAVEWB-CwrQ_7PA.js → sankeyDiagram-HTMAVEWB-h9AYS2UB.js} +1 -1
  150. package/dist/assets/{save-DNigywZ9.js → save-394QCMXn.js} +1 -1
  151. package/dist/assets/{search-U9C0oTQJ.js → search-BG2qAlNZ.js} +1 -1
  152. package/dist/assets/{search-config-page-Bdx_RR1q.js → search-config-page-D4LeiB9y.js} +1 -1
  153. package/dist/assets/{secrets-config-page-CvMIcsfJ.js → secrets-config-page-BzGcr5Vw.js} +2 -2
  154. package/dist/assets/security-config-vD_V0BQF.js +1 -0
  155. package/dist/assets/{select-DxwDeKUR.js → select-xUXYV0Gr.js} +1 -1
  156. package/dist/assets/{sequenceDiagram-DBY2YBRQ-EFD482_y.js → sequenceDiagram-DBY2YBRQ-D-uxCkob.js} +1 -1
  157. package/dist/assets/service-apps-panel-BTqXn0pg.js +1 -0
  158. package/dist/assets/{settings-2-BrBUdRoY.js → settings-2-CWOGRRaA.js} +1 -1
  159. package/dist/assets/{sizeCapture-X5ZJPWSS-TDvULTE1.js → sizeCapture-X5ZJPWSS-DBzZytQo.js} +1 -1
  160. package/dist/assets/{src-CI2AvEMj.js → src-zrGbZsfc.js} +1 -1
  161. package/dist/assets/{stateDiagram-2N3HPSRC-JdPsIYHo.js → stateDiagram-2N3HPSRC-DyDy7AHq.js} +1 -1
  162. package/dist/assets/stateDiagram-v2-6OUMAXLB-CtkpO6aA.js +1 -0
  163. package/dist/assets/{status-dot-BbGsrkIX.js → status-dot-CYifnSnt.js} +1 -1
  164. package/dist/assets/{swimlanes-5IMT3BWC-BnxpKeK_.js → swimlanes-5IMT3BWC-BzOduS38.js} +2 -2
  165. package/dist/assets/swimlanesDiagram-G3AALYLV-BSdi6mvi.js +8 -0
  166. package/dist/assets/{tag-chip-BDbxcf6P.js → tag-chip-CjM6lyeh.js} +1 -1
  167. package/dist/assets/theme-provider-BToFZGZG.js +1 -0
  168. package/dist/assets/{timeline-definition-FHXFAJF6-2IL22-uC.js → timeline-definition-FHXFAJF6-CmgnEF2t.js} +1 -1
  169. package/dist/assets/{trash-2-DwSkRfeB.js → trash-2-DvJ6duOW.js} +1 -1
  170. package/dist/assets/treeView-QDETBFTQ-DBoqypPR.js +1 -0
  171. package/dist/assets/treemap-6X3UGDF4-BMeL3P0q.js +1 -0
  172. package/dist/assets/use-config-COusaY5p.js +1 -0
  173. package/dist/assets/{use-desktop-capabilities-D7odgaTB.js → use-desktop-capabilities-B-u6ojjW.js} +1 -1
  174. package/dist/assets/{use-viewport-layout-BANU5E1t.js → use-viewport-layout-IKKGpjzF.js} +1 -1
  175. package/dist/assets/{vennDiagram-L72KCM5P-Cjf6n5Va.js → vennDiagram-L72KCM5P-DwS7D2kg.js} +1 -1
  176. package/dist/assets/wardley-OPB4EBWU-Dqxe7zN6.js +1 -0
  177. package/dist/assets/{wardleyDiagram-EHGQE667-yv4qKbBO.js → wardleyDiagram-EHGQE667-B4X8OOL4.js} +1 -1
  178. package/dist/assets/{x-BqGj6_Vq.js → x-E9VB4HQx.js} +1 -1
  179. package/dist/assets/{xychartDiagram-FW5EYKEG-Bmp8Ck8X.js → xychartDiagram-FW5EYKEG-BjRQ_0nx.js} +1 -1
  180. package/dist/index.html +41 -40
  181. package/dist/panel-standalone.html +16 -16
  182. package/package.json +6 -6
  183. package/src/features/agents/components/__tests__/agents-page.test.tsx +8 -5
  184. package/src/features/agents/components/agent-details-dialog.tsx +19 -15
  185. package/src/features/agents/components/agents-page.tsx +27 -38
  186. package/src/features/app-data/components/app-retained-data-section.tsx +2 -2
  187. package/src/features/apps/components/app-marketplace-catalog.tsx +5 -5
  188. package/src/features/apps/components/app-marketplace-detail.tsx +11 -2
  189. package/src/features/apps/components/app-packages-panel.tsx +4 -4
  190. package/src/features/apps/components/apps-panel.tsx +3 -1
  191. package/src/features/chat/components/providers/chat-runtime.provider.tsx +1 -1
  192. package/src/features/chat/features/conversation/components/__tests__/session-conversation-area.test.tsx +0 -1
  193. package/src/features/chat/features/conversation/components/__tests__/session-conversation-input.streaming.test.tsx +13 -2
  194. package/src/features/chat/features/conversation/components/session-conversation-area.tsx +8 -1
  195. package/src/features/chat/features/conversation/components/session-conversation-input-top-slot.tsx +44 -0
  196. package/src/features/chat/features/conversation/components/session-conversation-input.tsx +4 -38
  197. package/src/features/chat/features/conversation/hooks/__tests__/use-session-conversation-controller.test.tsx +127 -10
  198. package/src/features/chat/features/conversation/hooks/__tests__/use-session-conversation-input-state.test.tsx +12 -2
  199. package/src/features/chat/features/conversation/hooks/use-session-conversation-controller.ts +88 -73
  200. package/src/features/chat/features/conversation/hooks/use-session-conversation-input-query.ts +5 -15
  201. package/src/features/chat/features/conversation/hooks/use-session-conversation-input-state.ts +53 -13
  202. package/src/features/chat/features/conversation/hooks/use-session-submission-recovery.ts +83 -0
  203. package/src/features/chat/features/conversation/types/session-conversation-input.types.ts +38 -0
  204. package/src/features/chat/features/input/utils/__tests__/ncp-chat-input-availability.utils.test.ts +1 -29
  205. package/src/features/chat/features/input/utils/ncp-chat-input-availability.utils.ts +1 -8
  206. package/src/features/chat/features/message/components/__tests__/chat-message-list-skill-preview.container.test.tsx +14 -1
  207. package/src/features/chat/features/message/hooks/use-chat-inline-token-actions.ts +7 -2
  208. package/src/features/chat/features/session/utils/__tests__/chat-session-route.utils.test.ts +26 -0
  209. package/src/features/chat/features/session/utils/chat-session-preference-governance.utils.ts +14 -8
  210. package/src/features/chat/features/session/utils/chat-session-route.utils.ts +9 -12
  211. package/src/features/chat/features/workspace/components/__tests__/chat-session-workspace-file-preview.selection.test.tsx +14 -2
  212. package/src/features/chat/features/workspace/components/__tests__/session-cron-job-content.test.tsx +5 -1
  213. package/src/features/chat/features/workspace/components/chat-session-workspace-file-preview.tsx +1 -1
  214. package/src/features/chat/features/workspace/components/session-cron-job-content.tsx +6 -22
  215. package/src/features/chat/index.ts +1 -0
  216. package/src/features/chat/pages/__tests__/ncp-chat-page.test.ts +37 -47
  217. package/src/features/chat/pages/ncp-chat-page.tsx +3 -3
  218. package/src/features/chat/stores/__tests__/chat-composer-draft.store.test.ts +67 -1
  219. package/src/features/chat/stores/chat-composer-draft.store.ts +230 -29
  220. package/src/features/cron/components/__tests__/cron-config.test.tsx +8 -2
  221. package/src/features/cron/components/cron-config.tsx +6 -17
  222. package/src/features/cron/components/cron-job-detail-dialog.tsx +10 -9
  223. package/src/features/cron/components/cron-job-resource.tsx +51 -0
  224. package/src/features/cron/index.ts +1 -0
  225. package/src/features/inbox/pages/inbox-page.tsx +8 -5
  226. package/src/features/marketplace/components/__tests__/marketplace-page-detail.test.tsx +1 -0
  227. package/src/features/marketplace/components/__tests__/marketplace-page.test.tsx +1 -0
  228. package/src/features/marketplace/components/mcp/__tests__/mcp-marketplace-page.test.tsx +2 -0
  229. package/src/features/marketplace/components/mcp/mcp-marketplace-card.tsx +2 -2
  230. package/src/features/marketplace/components/mcp/mcp-marketplace-page.tsx +23 -1
  231. package/src/features/marketplace/hooks/use-marketplace-item-detail.ts +11 -0
  232. package/src/features/panel-apps/index.ts +1 -0
  233. package/src/features/projects/components/work/project-work-item-drawer.tsx +7 -10
  234. package/src/features/projects/pages/project-home-page.tsx +18 -23
  235. package/src/features/projects/pages/projects-page.test.tsx +4 -1
  236. package/src/features/right-panel-resources/components/__tests__/system-object-resource.test.tsx +74 -6
  237. package/src/features/right-panel-resources/components/native-object-resource.tsx +134 -0
  238. package/src/features/right-panel-resources/components/page-resource-icon.tsx +1 -1
  239. package/src/features/right-panel-resources/components/system-object-resource.tsx +66 -1
  240. package/src/features/right-panel-resources/components/workspace-file-resource.tsx +9 -0
  241. package/src/features/right-panel-resources/configs/right-panel-resource-routes.config.ts +11 -21
  242. package/src/features/right-panel-resources/managers/__tests__/page-resource.manager.test.ts +14 -4
  243. package/src/features/right-panel-resources/managers/page-resource.manager.ts +38 -21
  244. package/src/features/right-panel-resources/utils/__tests__/right-panel-resource-route-resolver.utils.test.ts +12 -0
  245. package/src/features/service-apps/components/service-apps-panel.tsx +5 -2
  246. package/src/shared/components/doc-browser/__tests__/doc-browser-context.test.tsx +16 -0
  247. package/src/shared/components/doc-browser/__tests__/doc-browser.test.tsx +2 -2
  248. package/src/shared/components/doc-browser/__tests__/resource-link-interceptor.test.tsx +29 -1
  249. package/src/shared/components/doc-browser/stores/doc-browser.store.ts +13 -7
  250. package/src/shared/components/doc-browser/utils/doc-browser-url.utils.ts +2 -1
  251. package/src/shared/components/ui/skeleton.tsx +16 -2
  252. package/src/shared/lib/i18n/locales/en-US/chat.json +8 -0
  253. package/src/shared/lib/i18n/locales/zh-CN/chat.json +8 -0
  254. package/src/shared/lib/transport/__tests__/local-transport.service.test.ts +24 -0
  255. package/src/shared/lib/transport/local-transport.service.ts +8 -6
  256. package/dist/assets/account-panel-BYxGT4m4.js +0 -1
  257. package/dist/assets/api-CG22BskB.js +0 -20
  258. package/dist/assets/app-presenter-provider-CJFjhVYI.js +0 -28
  259. package/dist/assets/appearance-settings-page-BcXr0vHp.js +0 -1
  260. package/dist/assets/architecture-TIHT7OUA-CLjV_xu4.js +0 -1
  261. package/dist/assets/channel-BgpbPyEH.js +0 -1
  262. package/dist/assets/chunk-2Q5K7J3B-DjhMPqAC.js +0 -1
  263. package/dist/assets/chunk-VAUOI2AC-GYimZYx9.js +0 -1
  264. package/dist/assets/chunk-XXDRQBXY-KKCf0HV5.js +0 -1
  265. package/dist/assets/classDiagram-OUVF2IWQ-iRMPRR8M.js +0 -1
  266. package/dist/assets/classDiagram-v2-EOCWNBFH-BguFy_wj.js +0 -1
  267. package/dist/assets/cynefin-VYW2F7L2-CtbjXuCW.js +0 -1
  268. package/dist/assets/doc-browser-CDEapjmj.js +0 -1
  269. package/dist/assets/doc-browser-context-0QDWYorh.js +0 -1
  270. package/dist/assets/eventmodeling-45OFAUF4-Djd6id_u.js +0 -1
  271. package/dist/assets/flowDiagram-23GEKE2U-DUrsM_ZL.js +0 -1
  272. package/dist/assets/gitGraph-TEB2WS4Q-CU6P_2Cm.js +0 -1
  273. package/dist/assets/info-DKCQHKI2-Bj2P_7RC.js +0 -1
  274. package/dist/assets/katex-BprZ-Wwb.js +0 -1
  275. package/dist/assets/keyboard-shortcuts-settings-page-BluWKrSo.js +0 -1
  276. package/dist/assets/login-page-BMHW0Hh0.js +0 -1
  277. package/dist/assets/main-BCX_Untx.css +0 -1
  278. package/dist/assets/main-C5kbmGUV.js +0 -2
  279. package/dist/assets/main-i18n-catalog.config-DO4wNT7T.js +0 -1
  280. package/dist/assets/mcp-marketplace-page-CV-PHKTN.js +0 -1
  281. package/dist/assets/packet-7NZHBO7P-ti5ge2jr.js +0 -1
  282. package/dist/assets/panel-app-i18n-catalog.config-Bo52dPuF.js +0 -1
  283. package/dist/assets/panelStandalone-PuuMF65O.js +0 -2
  284. package/dist/assets/pie-RZYD4A2V-Bnep8TyV.js +0 -1
  285. package/dist/assets/plus-CywSlIbG.js +0 -1
  286. package/dist/assets/projects-D_cd_t4G.js +0 -1
  287. package/dist/assets/radar-I7S5WNFK-BYg-icAP.js +0 -1
  288. package/dist/assets/railroad-3IZDKUUU-_CHO-Fi1.js +0 -1
  289. package/dist/assets/railroad-abnf-AHOZXSZD-hbQDevHe.js +0 -1
  290. package/dist/assets/railroad-ebnf-EBAXGLYW-v4RZkOfi.js +0 -1
  291. package/dist/assets/railroad-peg-LSFZ7HO6-bC9BqkI5.js +0 -1
  292. package/dist/assets/remote-D5MBQNZE.js +0 -1
  293. package/dist/assets/runtime-config-page--ivCxBT4.js +0 -1
  294. package/dist/assets/security-config-CQmMqQ8v.js +0 -1
  295. package/dist/assets/service-apps-panel-CiYO1Be4.js +0 -1
  296. package/dist/assets/stateDiagram-v2-6OUMAXLB-4_aAQfB_.js +0 -1
  297. package/dist/assets/swimlanesDiagram-G3AALYLV-wCqfwsw-.js +0 -8
  298. package/dist/assets/theme-provider-D98XGa-c.js +0 -1
  299. package/dist/assets/treeView-QDETBFTQ-BAyOb14Z.js +0 -1
  300. package/dist/assets/treemap-6X3UGDF4-DgPDM0zS.js +0 -1
  301. package/dist/assets/use-config-D3cNzk2k.js +0 -1
  302. package/dist/assets/wardley-OPB4EBWU-eCElh8z5.js +0 -1
  303. /package/dist/assets/{array-DstOKG9P.js → array-DsNX3jRj.js} +0 -0
  304. /package/dist/assets/{chunk-KEIR6QF5-0TA8nwgf.js → chunk-KEIR6QF5-BOAXXeyv.js} +0 -0
  305. /package/dist/assets/{chunk-Y2CYZVJY-rfGCG6pM.js → chunk-Y2CYZVJY-CHjSjwoV.js} +0 -0
  306. /package/dist/assets/{config-hints-BfGoD7-o.js → config-hints-CaB3I7KP.js} +0 -0
  307. /package/dist/assets/{cytoscape.esm-DdIcNEda.js → cytoscape.esm-j4J9a91l.js} +0 -0
  308. /package/dist/assets/{defaultLocale-CzXix2iJ.js → defaultLocale-Bmxjp-V_.js} +0 -0
  309. /package/dist/assets/{dist-D5dwMwKA.js → dist-DwLj1Wg5.js} +0 -0
  310. /package/dist/assets/{graphlib-BKOe0eFe.js → graphlib-CC0HTn1v.js} +0 -0
  311. /package/dist/assets/{host-capabilities-CnSVTaot.js → host-capabilities-B107nwS3.js} +0 -0
  312. /package/dist/assets/{init-OCFb3zgY.js → init-Biz9Rus1.js} +0 -0
  313. /package/dist/assets/{jszip.min-B2uhSxvV.js → jszip.min-DQvBVV_R.js} +0 -0
  314. /package/dist/assets/{katex-dBrYsE7B.js → katex-BzT-4KBu.js} +0 -0
  315. /package/dist/assets/{middleware-CAXxl-af.js → middleware-B--6mAUM.js} +0 -0
  316. /package/dist/assets/{navigation-history-CzErJuPG.js → navigation-history-CCnxsAKR.js} +0 -0
  317. /package/dist/assets/{panel-app-CSQmm_7E.js → panel-app-BBTg0tVp.js} +0 -0
  318. /package/dist/assets/{path-T5eoIRSJ.js → path-4azsBPZv.js} +0 -0
  319. /package/dist/assets/{rough.esm-DmGXmZEB.js → rough.esm-w1lBArN6.js} +0 -0
  320. /package/dist/assets/{xlsx-CoYacou7.js → xlsx--SB9KlFl.js} +0 -0
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{Gt as t,_n as n,cr as r,yr as i}from"./api-CG22BskB.js";import{t as a}from"./createLucideIcon-Lnt-4LMC.js";import{B as o}from"./dist-Cuiqqp1O.js";import{s}from"./i18n-B0V5NkFj.js";import{_ as c,f as l,h as u,i as d,m as f,p,r as m}from"./provider-models-XRArsply.js";import{a as h,i as g,n as _,r as v,t as y}from"./select-DxwDeKUR.js";var b=a(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),x=e(i(),1),S=r(),C=c(`15rem`);function w(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function T({id:e,value:r,onChange:i,options:a,disabled:s=!1,placeholder:c,className:l,inputClassName:d,emptyText:m,createText:h,toggleLabel:g,maxItems:_=1/0,onEnter:v}){let[y,T]=(0,x.useState)(!1),E=(0,x.useRef)(null);(0,x.useEffect)(()=>{s&&y&&T(!1)},[s,y]);let D=(0,x.useMemo)(()=>w(a),[a]),O=r.trim().toLowerCase(),k=(0,x.useMemo)(()=>{let e=D.map((e,t)=>({option:e,index:t}));O.length>0&&e.sort((e,t)=>{let n=e.option.toLowerCase(),r=t.option.toLowerCase(),i=n===O?0:n.startsWith(O)?1:n.includes(O)?2:3,a=r===O?0:r.startsWith(O)?1:r.includes(O)?2:3;return i===a?e.index-t.index:i-a});let t=e.map(e=>e.option);return Number.isFinite(_)?t.slice(0,Math.max(1,_)):t},[D,O,_]),A=r.trim().length>0&&D.some(e=>e===r.trim()),j=()=>T(!1);return(0,S.jsxs)(p,{open:y&&!s,onOpenChange:e=>T(!s&&e),children:[(0,S.jsx)(f,{asChild:!0,children:(0,S.jsxs)(`div`,{ref:E,className:n(`relative`,l),children:[(0,S.jsx)(t,{id:e,value:r,disabled:s,onFocus:()=>{s||T(!0)},onChange:e=>{i(e.target.value),!y&&!s&&T(!0)},onKeyDown:e=>{e.key===`Enter`&&(v&&(e.preventDefault(),v()),j())},placeholder:c,className:n(`pr-10`,d)}),(0,S.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>T(e=>!e),disabled:s,className:n(`absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center`,s?`cursor-not-allowed text-gray-300`:`text-gray-400 hover:text-gray-600`),"aria-label":g,children:(0,S.jsx)(b,{className:`h-4 w-4`})})]})}),(0,S.jsx)(u,{align:`start`,className:`flex w-[var(--radix-popover-trigger-width)] min-w-[12rem] flex-col overflow-hidden rounded-xl border border-gray-200 p-0 shadow-lg`,onInteractOutside:e=>{e.target instanceof Node&&E.current?.contains(e.target)&&e.preventDefault()},onOpenAutoFocus:e=>e.preventDefault(),style:{maxHeight:C},children:(0,S.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto py-1`,children:[!A&&r.trim().length>0&&(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{i(r.trim()),j()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[var(--interaction-hover)]`,children:[(0,S.jsx)(o,{className:`h-4 w-4 text-transparent`}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:h.replace(`{value}`,r.trim())})]}),k.map(e=>(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{i(e),j()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[var(--interaction-hover)]`,children:[(0,S.jsx)(o,{className:n(`h-4 w-4`,e===r.trim()?`text-primary`:`text-transparent`)}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:e})]},e)),k.length===0&&r.trim().length===0&&(0,S.jsx)(`div`,{className:`px-3 py-2 text-sm text-gray-500`,children:m})]})})]})}var E=`provider/model`;function D(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function O({id:e,value:n,onChange:r,providerCatalog:i,disabled:a=!1,providerPlaceholder:o,modelPlaceholder:c,className:u}){let[f,p]=(0,x.useState)(``),[b,C]=(0,x.useState)(``),w=i.length>0,O=c??E,k=(0,x.useMemo)(()=>new Map(i.map(e=>[e.name,e])),[i]),A=k.get(f),j=(0,x.useMemo)(()=>A?.aliases??[],[A]),M=(0,x.useMemo)(()=>D(A?.models??[]),[A]);return(0,x.useEffect)(()=>{let e=n.trim();if(!w){p(``),C(e);return}if(!e){C(``),p(e=>k.has(e)?e:``);return}let t=d(e,i)??``,r=k.get(t)?.aliases??[];p(t),C(t?l(e,r):e)},[w,i,k,n]),w?(0,S.jsxs)(`div`,{className:u,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,S.jsx)(`div`,{className:`sm:w-[38%] sm:min-w-[170px]`,children:(0,S.jsxs)(y,{value:f,onValueChange:e=>{let t=D(k.get(e)?.models??[])[0]??``;if(p(e),C(t),!t){r(``);return}r(m(k.get(e)?.prefix??e,t))},disabled:a,children:[(0,S.jsx)(g,{className:`h-10 w-full rounded-xl`,children:(0,S.jsx)(h,{placeholder:o??s(`providersSelectPlaceholder`)})}),(0,S.jsx)(_,{children:i.map(e=>(0,S.jsx)(v,{value:e.name,children:e.displayName},e.name))})]})}),(0,S.jsx)(`span`,{className:`hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex`,children:`/`}),(0,S.jsx)(T,{id:e,value:b,onChange:e=>{if(!A){let t=e.trim();C(t),r(t);return}let t=l(e,j);C(t),r(t?m(A.prefix,t):``)},options:M,disabled:a||!f,placeholder:O,className:`sm:flex-1`,inputClassName:`h-10 rounded-xl`,emptyText:s(`modelPickerNoOptions`),createText:s(`modelPickerUseCustom`),toggleLabel:s(`modelPickerToggleOptions`)},f)]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:s(`modelInputCustomHint`)})]}):(0,S.jsxs)(`div`,{className:u,children:[(0,S.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 px-4 py-3`,children:[(0,S.jsx)(`p`,{className:`text-sm font-semibold text-amber-950`,children:s(`providersEmptyTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-900`,children:s(`providersEmptyDescription`)})]}),(0,S.jsx)(t,{id:e,value:n,disabled:a,onChange:e=>r(e.target.value),placeholder:O,className:`mt-3 h-10 rounded-xl`}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:s(`modelInputCustomHint`)})]})}export{O as t};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{Gt as t,_n as n,ur as r,xr as i}from"./api-CI6_8Qt1.js";import{t as a}from"./createLucideIcon-reFMl-W-.js";import{B as o}from"./dist-ZaFFmAGl.js";import{s}from"./i18n-IGQbjBqS.js";import{_ as c,f as l,h as u,i as d,m as f,p,r as m}from"./provider-models-COzjYl29.js";import{a as h,i as g,n as _,r as v,t as y}from"./select-xUXYV0Gr.js";var b=a(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),x=e(i(),1),S=r(),C=c(`15rem`);function w(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function T({id:e,value:r,onChange:i,options:a,disabled:s=!1,placeholder:c,className:l,inputClassName:d,emptyText:m,createText:h,toggleLabel:g,maxItems:_=1/0,onEnter:v}){let[y,T]=(0,x.useState)(!1),E=(0,x.useRef)(null);(0,x.useEffect)(()=>{s&&y&&T(!1)},[s,y]);let D=(0,x.useMemo)(()=>w(a),[a]),O=r.trim().toLowerCase(),k=(0,x.useMemo)(()=>{let e=D.map((e,t)=>({option:e,index:t}));O.length>0&&e.sort((e,t)=>{let n=e.option.toLowerCase(),r=t.option.toLowerCase(),i=n===O?0:n.startsWith(O)?1:n.includes(O)?2:3,a=r===O?0:r.startsWith(O)?1:r.includes(O)?2:3;return i===a?e.index-t.index:i-a});let t=e.map(e=>e.option);return Number.isFinite(_)?t.slice(0,Math.max(1,_)):t},[D,O,_]),A=r.trim().length>0&&D.some(e=>e===r.trim()),j=()=>T(!1);return(0,S.jsxs)(p,{open:y&&!s,onOpenChange:e=>T(!s&&e),children:[(0,S.jsx)(f,{asChild:!0,children:(0,S.jsxs)(`div`,{ref:E,className:n(`relative`,l),children:[(0,S.jsx)(t,{id:e,value:r,disabled:s,onFocus:()=>{s||T(!0)},onChange:e=>{i(e.target.value),!y&&!s&&T(!0)},onKeyDown:e=>{e.key===`Enter`&&(v&&(e.preventDefault(),v()),j())},placeholder:c,className:n(`pr-10`,d)}),(0,S.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>T(e=>!e),disabled:s,className:n(`absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center`,s?`cursor-not-allowed text-gray-300`:`text-gray-400 hover:text-gray-600`),"aria-label":g,children:(0,S.jsx)(b,{className:`h-4 w-4`})})]})}),(0,S.jsx)(u,{align:`start`,className:`flex w-[var(--radix-popover-trigger-width)] min-w-[12rem] flex-col overflow-hidden rounded-xl border border-gray-200 p-0 shadow-lg`,onInteractOutside:e=>{e.target instanceof Node&&E.current?.contains(e.target)&&e.preventDefault()},onOpenAutoFocus:e=>e.preventDefault(),style:{maxHeight:C},children:(0,S.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto py-1`,children:[!A&&r.trim().length>0&&(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{i(r.trim()),j()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[var(--interaction-hover)]`,children:[(0,S.jsx)(o,{className:`h-4 w-4 text-transparent`}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:h.replace(`{value}`,r.trim())})]}),k.map(e=>(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{i(e),j()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[var(--interaction-hover)]`,children:[(0,S.jsx)(o,{className:n(`h-4 w-4`,e===r.trim()?`text-primary`:`text-transparent`)}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:e})]},e)),k.length===0&&r.trim().length===0&&(0,S.jsx)(`div`,{className:`px-3 py-2 text-sm text-gray-500`,children:m})]})})]})}var E=`provider/model`;function D(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function O({id:e,value:n,onChange:r,providerCatalog:i,disabled:a=!1,providerPlaceholder:o,modelPlaceholder:c,className:u}){let[f,p]=(0,x.useState)(``),[b,C]=(0,x.useState)(``),w=i.length>0,O=c??E,k=(0,x.useMemo)(()=>new Map(i.map(e=>[e.name,e])),[i]),A=k.get(f),j=(0,x.useMemo)(()=>A?.aliases??[],[A]),M=(0,x.useMemo)(()=>D(A?.models??[]),[A]);return(0,x.useEffect)(()=>{let e=n.trim();if(!w){p(``),C(e);return}if(!e){C(``),p(e=>k.has(e)?e:``);return}let t=d(e,i)??``,r=k.get(t)?.aliases??[];p(t),C(t?l(e,r):e)},[w,i,k,n]),w?(0,S.jsxs)(`div`,{className:u,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,S.jsx)(`div`,{className:`sm:w-[38%] sm:min-w-[170px]`,children:(0,S.jsxs)(y,{value:f,onValueChange:e=>{let t=D(k.get(e)?.models??[])[0]??``;if(p(e),C(t),!t){r(``);return}r(m(k.get(e)?.prefix??e,t))},disabled:a,children:[(0,S.jsx)(g,{className:`h-10 w-full rounded-xl`,children:(0,S.jsx)(h,{placeholder:o??s(`providersSelectPlaceholder`)})}),(0,S.jsx)(_,{children:i.map(e=>(0,S.jsx)(v,{value:e.name,children:e.displayName},e.name))})]})}),(0,S.jsx)(`span`,{className:`hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex`,children:`/`}),(0,S.jsx)(T,{id:e,value:b,onChange:e=>{if(!A){let t=e.trim();C(t),r(t);return}let t=l(e,j);C(t),r(t?m(A.prefix,t):``)},options:M,disabled:a||!f,placeholder:O,className:`sm:flex-1`,inputClassName:`h-10 rounded-xl`,emptyText:s(`modelPickerNoOptions`),createText:s(`modelPickerUseCustom`),toggleLabel:s(`modelPickerToggleOptions`)},f)]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:s(`modelInputCustomHint`)})]}):(0,S.jsxs)(`div`,{className:u,children:[(0,S.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 px-4 py-3`,children:[(0,S.jsx)(`p`,{className:`text-sm font-semibold text-amber-950`,children:s(`providersEmptyTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-900`,children:s(`providersEmptyDescription`)})]}),(0,S.jsx)(t,{id:e,value:n,disabled:a,onChange:e=>r(e.target.value),placeholder:O,className:`mt-3 h-10 rounded-xl`}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:s(`modelInputCustomHint`)})]})}export{O as t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{Gt as t,Jn as n,Ut as r,Wt as i,Yt as a,Zt as o,_n as s,cr as c,hn as l,sr as u,yr as d}from"./api-CG22BskB.js";import{t as f}from"./createLucideIcon-Lnt-4LMC.js";import{g as p,h as m,lt as h,mt as g,pt as _,q as v}from"./context-menu-DKIEaY7f.js";import{t as y}from"./search-U9C0oTQJ.js";import{z as b}from"./dist-Cuiqqp1O.js";import{n as x}from"./inbox-Bna8iUy0.js";import{i as S,t as C}from"./x-BqGj6_Vq.js";import{i as w,t as T}from"./use-viewport-layout-BANU5E1t.js";import{t as E}from"./plus-CywSlIbG.js";import{t as D}from"./refresh-cw-Ca2napNx.js";import{t as O}from"./settings-2-BrBUdRoY.js";import{t as k}from"./trash-2-DwSkRfeB.js";import{l as A,s as j}from"./i18n-B0V5NkFj.js";import{a as M,c as N,g as P,h as F,l as I,o as L,p as R,t as z}from"./provider-models-XRArsply.js";import{n as B,t as V}from"./status-dot-BbGsrkIX.js";import{t as H}from"./confirm-dialog-DpcmlXhd.js";import{t as ee}from"./host-capabilities-CnSVTaot.js";import{a as U,i as W,n as G,r as K,t as q}from"./select-DxwDeKUR.js";import{a as J,c as te,d as ne,f as re,h as ie,i as ae,l as oe,m as se,o as ce,p as le,r as ue,y as de}from"./use-config-D3cNzk2k.js";import{t as fe}from"./form-actions-BoTqELHB.js";import{t as pe}from"./config-hints-BfGoD7-o.js";import{a as me,c as he,i as ge,l as _e,n as ve,o as ye,r as be,s as xe}from"./config-split-page-C06fU9OQ.js";var Se=f(`CircleDotDashed`,[[`path`,{d:`M10.1 2.18a9.93 9.93 0 0 1 3.8 0`,key:`1qdqn0`}],[`path`,{d:`M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7`,key:`1bq7p6`}],[`path`,{d:`M21.82 10.1a9.93 9.93 0 0 1 0 3.8`,key:`1rlaqf`}],[`path`,{d:`M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69`,key:`1xk03u`}],[`path`,{d:`M13.9 21.82a9.94 9.94 0 0 1-3.8 0`,key:`l7re25`}],[`path`,{d:`M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7`,key:`1v18p6`}],[`path`,{d:`M2.18 13.9a9.93 9.93 0 0 1 0-3.8`,key:`xdo6bj`}],[`path`,{d:`M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69`,key:`1jjmaz`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Ce=f(`EyeOff`,[[`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`}]]),Y=e(d(),1),we={providerId:``,providerType:null,isBuiltInType:!1,isCustom:!0,enabled:!0,displayName:``,apiKeySet:!1,apiKeyMasked:void 0,apiBase:null,extraHeaders:null,wireApi:null,models:[],modelConfig:{}};function X(e){if(!e)return null;let t=Object.entries(e).map(([e,t])=>[e.trim(),t]).filter(([e])=>e.length>0);return t.length===0?null:Object.fromEntries(t)}function Te(e,t){let n=X(e),r=X(t);if(n===null&&r===null)return!0;if(!n||!r)return!1;let i=Object.entries(n).sort(([e],[t])=>e.localeCompare(t)),a=Object.entries(r).sort(([e],[t])=>e.localeCompare(t));return i.length===a.length?i.every(([e,t],n)=>e===a[n][0]&&t===a[n][1]):!1}function Z(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function Ee(e,t){let n=e.trim();if(!n||!t.trim())return n;let r=`${t.trim()}/`;return n.startsWith(r)?n.slice(r.length):n}function Q(e,t){let n=e.trim();if(!n)return``;for(let e of t){let t=e.trim();t&&(n=Ee(n,t))}return n.trim()}function De(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function Oe(e,t){return Z(t)}function ke(e,t){return Z(e).map(e=>{let n=e.trim();return!n||n.startsWith(`${t}/`)?n:`${t}/${n}`})}function Ae(e,t){let n=new Set(t.map(e=>e.trim()).filter(Boolean)),r={};for(let[t,i]of Object.entries(e)){if(!n.has(t))continue;let e={},a=N(i.thinking?.supported);if(a.length>0){let t=I(i.thinking?.default);e.thinking=t&&a.includes(t)?{supported:a,default:t}:{supported:a}}i.vision===!0&&(e.vision=!0),(e.thinking||e.vision===!0)&&(r[t]=e)}return r}function je(e,t,n){return{...L(e,n),...L(t,n)}}function Me(e,t){let n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let i=0;i<n.length;i+=1){let a=n[i];if(a!==r[i])return!1;let o=e[a],s=t[a];if(!o||!s||!De([...o.thinking?.supported??[]].sort(),[...s.thinking?.supported??[]].sort())||(o.thinking?.default??null)!==(s.thinking?.default??null)||(o.vision??!1)!==(s.vision??!1))return!1}return!0}function Ne(e){return e.providerName?e.apiKey.trim().length>0||e.apiBase.trim()!==e.currentApiBase.trim()||!Te(e.extraHeaders,e.currentHeaders)||e.supportsWireApi&&e.wireApi!==e.currentWireApi||!De(e.models,e.currentEditableModels)||!Me(e.modelConfig,e.currentModelConfig)||e.providerDisplayName.trim()!==e.effectiveDisplayName:!1}function Pe(e){let t={},n=e.apiKey.trim(),r=e.apiBase.trim(),i=X(e.extraHeaders),a=e.providerDisplayName.trim();return a!==e.effectiveDisplayName&&(t.displayName=a.length>0?a:null),n.length>0&&(t.apiKey=n),r!==e.currentApiBase.trim()&&(t.apiBase=r.length>0&&r!==e.defaultApiBase?r:null),Te(i,e.currentHeaders)||(t.extraHeaders=i),e.supportsWireApi&&e.wireApi!==e.currentWireApi&&(t.wireApi=e.wireApi),De(e.models,e.currentEditableModels)||(t.models=ke(e.models,e.providerName??``)),Me(e.modelConfig,e.currentModelConfig)||(t.modelConfig=Ae(e.modelConfig,e.models)),t}function Fe(e){let t=Q(e.models.find(e=>e.trim().length>0)??``,e.providerModelAliases),n={...Ie(e),model:t||null};return e.supportsWireApi&&(n.wireApi=e.wireApi),n}function Ie(e){let t={apiBase:e.apiBase.trim(),extraHeaders:X(e.extraHeaders)};return e.apiKey.trim().length>0&&(t.apiKey=e.apiKey.trim()),t}function Le(e){return j(e===`off`?`chatThinkingLevelOff`:e===`minimal`?`chatThinkingLevelMinimal`:e===`low`?`chatThinkingLevelLow`:e===`medium`?`chatThinkingLevelMedium`:e===`high`?`chatThinkingLevelHigh`:e===`adaptive`?`chatThinkingLevelAdaptive`:`chatThinkingLevelXhigh`)}function Re(e){let{providerName:t,methods:n,defaultMethodId:r,language:i}=e;if(n.length===0)return``;let a=new Map;for(let e of n){let t=e.id.trim();t&&a.set(t.toLowerCase(),t)}let o=(...e)=>{for(let t of e){let e=a.get(t.toLowerCase());if(e)return e}},s=r?.trim();if(t===`minimax-portal`){if(i===`zh`)return o(`cn`,`china-mainland`)??o(s??``)??n[0]?.id??``;if(i===`en`)return o(`global`,`intl`,`international`)??o(s??``)??n[0]?.id??``}if(s){let e=o(s);if(e)return e}return i===`zh`?o(`cn`)??n[0]?.id??``:i===`en`?o(`global`)??n[0]?.id??``:n[0]?.id??``}function ze(e){let{required:t,hasDefault:n,optionCount:r}=e;return t&&n&&r>1&&r<=3}function Be(e,t,n){let r=Q(t,n);return r?e.includes(r)?{models:e,draft:``}:{models:[...e,r],draft:``}:{models:e,draft:t}}function Ve(e,t,n){let r=[...e],i=new Set(e);for(let e of t){let t=Q(e,n);t&&!i.has(t)&&(i.add(t),r.push(t))}return{models:r,addedCount:r.length-e.length}}function He(e,t,n){return Ve(e,t,n).models.slice(e.length)}function Ue(e,t,n){let r={...t};return delete r[n],{models:e.filter(e=>e!==n),modelConfig:r}}function We(e,t,n){let r=e[t],i=r?.thinking?.supported??[],a=i.includes(n)?i.filter(e=>e!==n):z.filter(e=>e===n||i.includes(e)),o=r?.thinking?.default&&a.includes(r.thinking.default)?r.thinking.default:void 0,s={...r,thinking:a.length>0?o?{supported:a,default:o}:{supported:a}:void 0},c={...e};return s.thinking||s.vision===!0?c[t]=s:delete c[t],c}function Ge(e,t,n){let r=e[t],i=r?.thinking;return!i||i.supported.length===0||n&&!i.supported.includes(n)?e:{...e,[t]:{...r,thinking:n?{supported:i.supported,default:n}:{supported:i.supported}}}}function Ke(e,t,n){let r={...e[t],vision:n?!0:void 0},i={...e};return r.thinking||r.vision===!0?i[t]=r:delete i[t],i}function qe(e){let{providerName:t,providerSpec:n,language:r}=e,i=n?.auth,a=i?.methods??[];return{providerAuth:i,providerAuthMethodOptions:a.map(e=>({value:e.id,label:e.label?.[r]||e.label?.en||e.id})),providerAuthMethods:a,preferredAuthMethodId:Re({providerName:n?.providerType??t,methods:a,defaultMethodId:i?.defaultMethodId,language:r}),shouldUseAuthMethodPills:ze({required:i?.kind===`device_code`,hasDefault:!!i?.defaultMethodId?.trim(),optionCount:a.length})}}function Je(e,t){let n=!!e?.supportsWireApi||t,r=(e?.wireApiOptions||[`auto`,`chat`,`responses`]).map(e=>({value:e,label:j(e===`chat`?`wireApiChat`:e===`responses`?`wireApiResponses`:`wireApiAuto`)}));return{shouldUseWireApiPills:ze({required:n,hasDefault:typeof e?.defaultWireApi==`string`&&e.defaultWireApi.length>0,optionCount:r.length}),supportsWireApi:n,wireApiSelectOptions:r}}function Ye(e){let{providerName:t,providersView:n,templatesView:r,schema:i,language:a}=e,o=t?n?.providers[t]:null,s=r?.providerTemplates.find(e=>e.providerType===o?.providerType),c=o??we,l=i?.uiHints,u=!!o?.isCustom,d=t?pe(`providers.${t}.apiKey`,l):void 0,f=t?pe(`providers.${t}.apiBase`,l):void 0,p=t?pe(`providers.${t}.extraHeaders`,l):void 0,m=t?pe(`providers.${t}.wireApi`,l):void 0,h=s?.displayName||o?.displayName||t||``,g=(c.displayName||``).trim()||h,_=c.enabled!==!1,v=u||s?.supportsModelDiscovery===!0,y=Z([s?.modelPrefix||s?.providerType||``,t||``]),b=s?.defaultApiBase||``,x=c.apiBase||b,S=X(c.extraHeaders||null),C=c.wireApi||s?.defaultWireApi||`auto`,w=Oe(Z((s?.defaultModels??[]).map(e=>Q(e,y))),Z((c.models??[]).map(e=>Q(e,y)))),T=Ae(je(s?.modelConfig,c.modelConfig,y),w),E=s?.apiBaseHelp?.[a]||s?.apiBaseHelp?.en||f?.help||j(`providerApiBaseHelp`),D=qe({providerName:t,providerSpec:s,language:a}),O=Je(s,u);return{apiBaseHelpText:E,apiBaseHint:f,apiKeyHint:d,currentApiBase:x,currentEditableModels:w,currentEnabled:_,currentHeaders:S,currentModelConfig:T,currentWireApi:C,defaultApiBase:b,defaultDisplayName:h,effectiveDisplayName:g,extraHeadersHint:p,...D,providerConfig:o,providerModelAliases:y,resolvedProviderConfig:c,supportsModelDiscovery:v,wireApiHint:m,...O}}function Xe(e){let{providerName:t,providerAuth:r,resolvedAuthMethodId:i}=e,a=u(),o=se(),s=oe(),c=te(),[l,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(``),g=(0,Y.useRef)(null),_=(0,Y.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),v=(0,Y.useCallback)((e,r)=>{_(),g.current=window.setTimeout(()=>{(async()=>{if(t)try{let i=await s.mutateAsync({provider:t,data:{sessionId:e}});if(i.status===`pending`){h(j(`providerAuthWaitingBrowser`)),v(e,i.nextPollMs??r);return}if(i.status===`authorized`){p(null),_(),h(j(`providerAuthCompleted`)),n.success(j(`providerAuthCompleted`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]});return}p(null),_(),h(i.message||`Authorization ${i.status}.`),n.error(i.message||`Authorization ${i.status}.`)}catch(e){p(null),_();let t=e instanceof Error?e.message:String(e);h(t),n.error(`Authorization failed: ${t}`)}})()},Math.max(1e3,r))},[_,s,t,a]),y=(0,Y.useCallback)(async()=>{if(!(!t||r?.kind!==`device_code`))try{d(t),h(``);let e=await o.mutateAsync({provider:t,data:i?{methodId:i}:{}});if(!e.sessionId||!e.verificationUri)throw Error(j(`providerAuthStartFailed`));p(e.sessionId),h(`${j(`providerAuthOpenPrompt`)}${e.userCode}${j(`providerAuthOpenPromptSuffix`)}`),await ee.openExternalUrl(e.verificationUri),v(e.sessionId,e.intervalMs)}catch(e){let t=e instanceof Error?e.message:String(e);p(null),_(),h(t),n.error(`${j(`providerAuthStartFailed`)}: ${t}`)}},[_,r?.kind,t,i,v,o]),b=(0,Y.useCallback)(async()=>{if(!(!t||r?.kind!==`device_code`))try{d(t),_(),p(null);let e=await c.mutateAsync({provider:t});h(`${j(`providerAuthImportStatusPrefix`)}${e.expiresAt?` (expires: ${e.expiresAt})`:``}`),n.success(j(`providerAuthImportSuccess`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]})}catch(e){let t=e instanceof Error?e.message:String(e);h(t),n.error(`${j(`providerAuthImportFailed`)}: ${t}`)}},[_,c,r?.kind,t,a]);return(0,Y.useEffect)(()=>{_()},[_,t]),(0,Y.useEffect)(()=>()=>_(),[_]),{authSessionId:l===t?f:null,authStatusMessage:l===t?m:``,importAuthFromCli:b,importPending:c.isPending,startAuth:y,startPending:o.isPending}}function Ze(e){let{providerName:t,apiKey:r,apiKeyRequired:i,apiKeySet:a,apiBase:o,extraHeaders:s,supportsWireApi:c,wireApi:u,models:d,providerModelAliases:f}=e,p=ie(),m=ce(),h=(0,Y.useMemo)(()=>JSON.stringify({providerName:t,apiKey:r,apiBase:o,extraHeaders:s}),[o,r,s,t]),[g,_]=(0,Y.useState)(null),v=(0,Y.useCallback)(async()=>{if(t)try{let e=await p.mutateAsync({provider:t,data:Fe({apiKey:r,apiBase:o,extraHeaders:s,supportsWireApi:c,wireApi:u,models:d,providerModelAliases:f})});if(e.success){n.success(`${j(`providerTestConnectionSuccess`)} (${e.latencyMs}ms)`);return}let i=[`provider=${e.provider}`,`latency=${e.latencyMs}ms`];e.model&&i.push(`model=${e.model}`),n.error(`${j(`providerTestConnectionFailed`)}: ${e.message} | ${i.join(` | `)}`)}catch(e){let t=e instanceof Error?e.message:String(e);n.error(`${j(`providerTestConnectionFailed`)}: ${t}`)}},[o,r,s,d,f,t,c,p,u]);return{discoverModels:(0,Y.useCallback)(async()=>{if(!t)return null;if(i&&!r.trim()&&!a)return n.error(j(`providerModelsApiKeyRequired`)),null;try{let e=await m.mutateAsync({provider:t,data:Ie({apiKey:r,apiBase:o,extraHeaders:s})});return _({key:h,models:e.models}),n.success(j(`providerModelsFetchSuccess`)),e.models}catch(e){if(e instanceof l&&(e.details?.upstreamStatus===401||e.details?.upstreamStatus===403))return n.error(j(`providerModelsAuthorizationFailed`)),null;let t=e instanceof Error?e.message:String(e);return n.error(`${j(`providerModelsFetchFailed`)}: ${t}`),null}},[o,r,i,a,m,h,s,t]),fetchedModels:g?.key===h?g.models:[],isDiscoveringModels:m.isPending,isTestPending:p.isPending,testConnection:v}}var $=c();function Qe({value:e,onChange:n,className:r}){let i=e?Object.entries(e):[],o=(e,t,r)=>{let a=[...i];a[e]=[t,r],n(Object.fromEntries(a))},c=()=>{n({...e,"":``})},l=e=>{let t=i.filter((t,n)=>n!==e);n(Object.fromEntries(t))};return(0,$.jsxs)(`div`,{className:s(`space-y-2`,r),children:[i.map(([e,n],r)=>(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(t,{type:`text`,value:e,onChange:e=>o(r,e.target.value,n),placeholder:j(`headerName`),className:`flex-1`}),(0,$.jsx)(t,{type:`text`,value:n,onChange:t=>o(r,e,t.target.value),placeholder:j(`headerValue`),className:`flex-1`}),(0,$.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>l(r),children:(0,$.jsx)(k,{className:`h-4 w-4 text-red-500`})})]},r)),(0,$.jsxs)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:[(0,$.jsx)(E,{className:`h-4 w-4 mr-2`}),j(`add`)]})]})}function $e(e){let{value:t,onChange:n,options:r}=e;return(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let r=e.value===t;return(0,$.jsx)(`button`,{type:`button`,onClick:()=>n(e.value),"aria-pressed":r,className:`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors ${r?`border-[var(--interaction-selection-border)] bg-[var(--interaction-selection)] text-foreground`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-[var(--interaction-hover)] hover:text-foreground`}`,children:e.label},e.value)})})}function et(e){let{showAdvanced:t,onShowAdvancedChange:n,supportsWireApi:r,wireApiLabel:a,wireApi:o,onWireApiChange:s,shouldUseWireApiPills:c,wireApiSelectOptions:l,extraHeadersLabel:u,extraHeaders:d,onExtraHeadersChange:f}=e;return(0,$.jsxs)(`div`,{className:`border-t border-border/70 pt-4`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center justify-between text-sm text-muted-foreground transition-colors hover:text-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(O,{className:`h-3.5 w-3.5`}),j(`providerAdvancedSettings`)]}),(0,$.jsx)(b,{className:`h-4 w-4 transition-transform ${t?`rotate-180`:``}`})]}),t?(0,$.jsxs)(`div`,{className:`mt-4 space-y-5`,children:[r?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(i,{htmlFor:`wireApi`,className:`text-sm font-medium text-foreground`,children:a}),c?(0,$.jsx)($e,{value:o,onChange:e=>s(e),options:l}):(0,$.jsxs)(q,{value:o,onValueChange:e=>s(e),children:[(0,$.jsx)(W,{className:`rounded-xl`,children:(0,$.jsx)(U,{})}),(0,$.jsx)(G,{children:l.map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))})]})]}):null,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(i,{className:`text-sm font-medium text-foreground`,children:u}),(0,$.jsx)(Qe,{value:d,onChange:f}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerExtraHeadersHelpShort`)})]})]}):null]})}function tt({isSet:e,className:n,value:r,onChange:i,placeholder:o,...c}){let[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),p=typeof r==`string`&&r.length>0;return(0,$.jsxs)(`div`,{className:`relative`,children:[e&&!p&&!d?(0,$.jsx)(`div`,{onClick:()=>f(!0),className:s(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-500 cursor-text items-center pr-12`,n),children:`••••••••••••`}):(0,$.jsx)(t,{type:l?`text`:`password`,className:s(`pr-12`,n),value:r,onChange:i,onBlur:()=>{p||f(!1)},placeholder:o,autoFocus:d,...c}),(0,$.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex gap-1`,children:(e||p)&&(0,$.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>u(!l),children:l?(0,$.jsx)(Ce,{className:`h-4 w-4`}):(0,$.jsx)(x,{className:`h-4 w-4`})})})]})}function nt(e){let{apiKey:t,apiKeyRequired:n,apiKeySet:r,apiKeyPlaceholder:o,providerAuth:s,providerAuthNote:c,providerAuthMethodOptions:l,providerAuthMethodsCount:u,selectedAuthMethodHint:d,shouldUseAuthMethodPills:f,resolvedAuthMethodId:p,onAuthMethodChange:m,onStartProviderAuth:h,onImportProviderAuthFromCli:g,startPending:_,importPending:v,authSessionId:y,authStatusMessage:b,onApiKeyChange:x}=e,S=n?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(i,{htmlFor:`apiKey`,className:`text-sm font-medium text-foreground`,children:j(`apiKey`)}),(0,$.jsx)(tt,{id:`apiKey`,value:t,isSet:r,onChange:e=>x(e.target.value),placeholder:o,className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`leaveBlankToKeepUnchanged`)})]}):null;return s?.kind===`device_code`?(0,$.jsxs)($.Fragment,{children:[S,(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-muted/45 p-3`,children:[(0,$.jsx)(i,{className:`text-sm font-medium text-foreground`,children:s.displayName||j(`providerAuthSectionTitle`)}),c?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}):null,u>1?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(i,{className:`text-xs font-medium text-foreground`,children:j(`providerAuthMethodLabel`)}),f?(0,$.jsx)($e,{value:p,onChange:m,options:l}):(0,$.jsxs)(q,{value:p,onValueChange:m,children:[(0,$.jsx)(W,{className:`h-8 rounded-lg`,children:(0,$.jsx)(U,{placeholder:j(`providerAuthMethodPlaceholder`)})}),(0,$.jsx)(G,{children:l.map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))})]}),d?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d}):null]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:h,disabled:_||!!y,children:j(_?`providerAuthStarting`:y?`providerAuthAuthorizing`:`providerAuthAuthorizeInBrowser`)}),s.supportsCliImport?(0,$.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:g,disabled:v,children:j(v?`providerAuthImporting`:`providerAuthImportFromCli`)}):null,y?(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[j(`providerAuthSessionLabel`),`: `,y.slice(0,8),`…`]}):null]}),b?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b}):null]})]}):S}function rt(e){let{providerName:t,models:n,aliases:r,fetchedModels:i=[],onModelsChange:a}=e,o=ne({pollWhileRefreshing:!0,refreshOnMount:!0}),s=t?o.data?.providers[t]:void 0,c=i.length>0?`fetched`:`background`,l=(0,Y.useMemo)(()=>He(n,c===`fetched`?i:s?.models??[],r),[r,s?.models,i,n,c]);return{addSuggestedModels:(0,Y.useCallback)(e=>{let t=Ve(n,e,r);t.addedCount>0&&a(t.models)},[r,n,a]),hasSuggestionError:!!(s?.lastError&&!s.fetchedAt),isCheckingSuggestions:!!(t&&(o.isLoading||o.data?.refreshing&&!s)),suggestedModels:l,suggestionSource:c}}function it(e){let{models:t,modelConfig:n,onModelsChange:a,onRemoveModel:o,onToggleModelThinkingLevel:s,onSetModelThinkingDefault:c,onSetModelVision:l,thinkingLevels:u,formatThinkingLevelLabel:d}=e,[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(()=>new Set),g=(0,Y.useMemo)(()=>t.filter(e=>m.has(e)),[t,m]),_=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=()=>{p(!1),h(new Set)};return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`flex min-h-7 flex-wrap items-center justify-end gap-2`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mr-auto text-xs text-muted-foreground`,children:j(`providerModelsSuggestionsSelected`).replace(`{count}`,String(g.length))}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-primary hover:text-primary/80`,onClick:()=>h(g.length===t.length?new Set:new Set(t)),children:j(g.length===t.length?`providerModelsClearSelection`:`providerModelsSelectAll`)}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:v,children:j(`cancel`)}),(0,$.jsxs)(`button`,{type:`button`,disabled:g.length===0,className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/15 disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>{g.length!==0&&(a(t.filter(e=>!m.has(e))),v())},children:[(0,$.jsx)(k,{className:`h-3 w-3`}),j(`providerModelsRemoveSelected`)]})]}):(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:()=>p(!0),children:[(0,$.jsx)(k,{className:`h-3 w-3`}),j(`providerModelsBulkRemove`)]})}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>{if(f)return(0,$.jsxs)(`label`,{className:`inline-flex max-w-full cursor-pointer items-center gap-2 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5 hover:bg-[var(--interaction-hover)]`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:m.has(e),onChange:()=>_(e),"aria-label":j(`providerModelsSuggestionSelect`).replace(`{model}`,e),className:`h-3.5 w-3.5 shrink-0 accent-primary`}),(0,$.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e})]},e);let t=n[e],a=t?.thinking,p=a?.supported??[],h=a?.default??null,g=t?.vision===!0;return(0,$.jsxs)(`div`,{className:`group inline-flex max-w-full items-center gap-1 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5`,children:[(0,$.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e}),(0,$.jsxs)(R,{children:[(0,$.jsx)(P,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-[var(--interaction-hover)] hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":j(`providerModelThinkingTitle`),title:j(`providerModelThinkingTitle`),children:(0,$.jsx)(O,{className:`h-3 w-3`})})}),(0,$.jsxs)(F,{className:`w-80 space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-muted/50 px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:j(`providerModelVisionTitle`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerModelVisionHint`)})]}),(0,$.jsx)(r,{checked:g,onCheckedChange:t=>l(e,t)})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:j(`providerModelThinkingTitle`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerModelThinkingHint`)})]}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u.map(t=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(e,t),className:`rounded-full border px-2.5 py-1 text-xs font-medium transition-colors ${p.includes(t)?`border-[var(--interaction-selection-border)] bg-[var(--interaction-selection)] text-foreground`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-[var(--interaction-hover)] hover:text-foreground`}`,children:d(t)},t))}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(i,{className:`text-xs font-medium text-foreground`,children:j(`providerModelThinkingDefault`)}),(0,$.jsxs)(q,{value:h??`__none__`,onValueChange:t=>c(e,t===`__none__`?null:t),disabled:p.length===0,children:[(0,$.jsx)(W,{className:`h-8 rounded-lg text-xs`,children:(0,$.jsx)(U,{})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(K,{value:`__none__`,children:j(`providerModelThinkingDefaultNone`)}),p.map(e=>(0,$.jsx)(K,{value:e,children:d(e)},e))]})]}),p.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerModelThinkingNoSupported`)}):null]})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-[var(--interaction-hover)] hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":j(`remove`),children:(0,$.jsx)(C,{className:`h-3 w-3`})})]},e)})}),f?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerModelsRemoveSaveHint`)}):null]})}var at=20,ot=50,st=50;function ct(e){let{expanded:n,fetchedTotal:r,models:i,source:a,onExpandedChange:o,onAddModels:s}=e,[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(()=>new Set),f=(0,Y.useMemo)(()=>{let e=c.trim().toLowerCase();return e?i.filter(t=>t.toLowerCase().includes(e)):i},[i,c]),p=f.slice(0,st),m=(0,Y.useMemo)(()=>i.filter(e=>u.has(e)),[i,u]),h=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},_=e=>{e.length!==0&&(s(e),l(``),d(new Set))},b=a===`fetched`?`providerModelsFetchedSuggestionsSummary`:`providerModelsSuggestionsSummary`;return a===`fetched`&&i.length===0?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/35 px-3 py-2 text-xs text-muted-foreground`,role:`status`,children:[(0,$.jsx)(v,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{children:j(`providerModelsFetchedAllConfigured`).replace(`{count}`,String(r))})]}):(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted/35 p-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:()=>o(!n),children:[(0,$.jsx)(v,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:j(b).replace(`{count}`,String(i.length))}),(0,$.jsx)(g,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${n?`rotate-90`:``}`})]}),i.length<=ot?(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-lg px-2 py-1.5 text-xs font-medium text-primary transition-colors hover:bg-[var(--interaction-hover)]`,onClick:()=>_(i),children:j(`providerModelsSuggestionsAddAll`)}):null]}),n?(0,$.jsxs)(`div`,{className:`px-1 pb-1`,children:[i.length>at?(0,$.jsxs)(`div`,{className:`relative px-2 pb-1 pt-1.5`,children:[(0,$.jsx)(y,{className:`pointer-events-none absolute left-4 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(t,{value:c,onChange:e=>l(e.target.value),placeholder:j(`providerModelsSuggestionsSearchPlaceholder`),className:`h-8 rounded-lg pl-8 text-xs`})]}):null,(0,$.jsxs)(`div`,{className:`custom-scrollbar max-h-44 overflow-y-auto`,children:[p.map(e=>(0,$.jsxs)(`label`,{className:`grid min-w-0 cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-[var(--interaction-hover)]`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:u.has(e),onChange:()=>h(e),"aria-label":j(`providerModelsSuggestionSelect`).replace(`{model}`,e),className:`h-3.5 w-3.5 shrink-0 accent-primary`}),(0,$.jsx)(`span`,{className:`block min-w-0 truncate text-xs text-foreground`,title:e,children:e})]},e)),f.length===0?(0,$.jsx)(`p`,{className:`px-2 py-4 text-center text-xs text-muted-foreground`,children:j(`providerModelsSuggestionsSearchEmpty`)}):null]}),f.length>p.length?(0,$.jsx)(`p`,{className:`px-2 pt-1 text-[11px] text-muted-foreground`,children:j(`providerModelsSuggestionsShowing`).replace(`{visible}`,String(p.length)).replace(`{count}`,String(f.length))}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pt-1.5`,children:[(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:j(`providerModelsSuggestionsSelected`).replace(`{count}`,String(m.length))}),(0,$.jsx)(`button`,{type:`button`,disabled:m.length===0,className:`shrink-0 rounded-md bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary transition-colors hover:bg-[var(--interaction-hover)] disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>_(m),children:j(`providerModelsSuggestionsAddSelected`)})]}),(0,$.jsx)(`p`,{className:`px-2 pb-1 pt-1 text-[11px] text-muted-foreground`,children:j(`providerModelsSuggestionsSaveHint`)})]}):null]})}function lt({hasFetchedCatalog:e,hasSuggestionError:t,supportsModelDiscovery:n}){return!n||!t||e?null:(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:[(0,$.jsx)(_,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),j(`providerModelsSuggestionsFailed`)]})}function ut(e){let{providerName:n,providerModelAliases:r,models:o,modelConfig:s,modelDraft:c,showModelInput:l,onModelDraftChange:u,onShowModelInputChange:d,onAddModel:f,onModelsChange:p,supportsModelDiscovery:m,onDiscoverModels:h,isDiscoveringModels:g,fetchedModels:_,onRemoveModel:v,onToggleModelThinkingLevel:y,onSetModelThinkingDefault:b,onSetModelVision:x,thinkingLevels:w,formatThinkingLevelLabel:T}=e,[O,k]=(0,Y.useState)(!1),A=(0,Y.useRef)(null),{addSuggestedModels:M,hasSuggestionError:N,isCheckingSuggestions:P,suggestedModels:F,suggestionSource:I}=rt({providerName:n,models:o,aliases:r,fetchedModels:_,onModelsChange:p}),L=async()=>{await h()&&(k(!0),window.requestAnimationFrame(()=>{let e=A.current;e?.scrollIntoView?.({behavior:`smooth`,block:`center`}),e?.focus({preventScroll:!0})}))},R=_.length>0;return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(i,{className:`text-sm font-medium text-foreground`,children:j(`providerModelsTitle`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[m?(0,$.jsxs)(`button`,{type:`button`,onClick:L,disabled:g,className:`flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:text-primary/80 disabled:cursor-wait disabled:opacity-60`,children:[(0,$.jsx)(D,{className:`h-3 w-3 ${g?`animate-spin`:``}`}),j(g?`providerModelsFetching`:`providerModelsFetch`)]}):null,l?null:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(!0),className:`flex items-center gap-1 text-xs font-medium text-primary hover:text-primary/80`,children:[(0,$.jsx)(E,{className:`h-3 w-3`}),j(`providerAddModel`)]})]})]}),l?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(t,{value:c,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f()),e.key===`Escape`&&(d(!1),u(``))},placeholder:j(`providerModelInputPlaceholder`),className:`flex-1 rounded-xl`,autoFocus:!0}),(0,$.jsx)(a,{type:`button`,size:`sm`,onClick:f,disabled:c.trim().length===0,children:j(`add`)}),(0,$.jsx)(a,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{d(!1),u(``)},children:(0,$.jsx)(C,{className:`h-4 w-4`})})]}):null,(0,$.jsx)(lt,{hasFetchedCatalog:R,hasSuggestionError:N,supportsModelDiscovery:m}),m&&P&&!R?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/35 px-3 py-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(S,{className:`h-3.5 w-3.5 animate-spin`}),j(`providerModelsSuggestionsChecking`)]}):m&&(F.length>0||R)?(0,$.jsx)(`div`,{ref:A,tabIndex:-1,"aria-live":`polite`,className:`scroll-m-4 outline-none`,children:(0,$.jsx)(ct,{expanded:O,fetchedTotal:_.length,models:F,source:I,onExpandedChange:k,onAddModels:M})}):null,o.length===0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted/35 px-4 py-6 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:j(`providerModelsEmptyShort`)}),l?null:(0,$.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:`mt-2 text-sm font-medium text-primary hover:text-primary/80`,children:j(`providerAddFirstModel`)})]}):(0,$.jsx)(it,{models:o,modelConfig:s,onModelsChange:p,onRemoveModel:v,onToggleModelThinkingLevel:y,onSetModelThinkingDefault:b,onSetModelVision:x,thinkingLevels:w,formatThinkingLevelLabel:T})]})}function dt({apiKeyRequired:e=!0,apiKeySet:t,className:n,enabled:r}){if(!r)return(0,$.jsx)(V,{status:`inactive`,label:j(`disabled`),className:n});let i=!e||t;return(0,$.jsx)(V,{status:i?`ready`:`setup`,label:j(i?`statusReady`:`statusSetup`),className:n})}function ft(e){let{context:n,language:r,providerTitle:o,providerDisplayName:s,apiKey:c,apiBase:l,extraHeaders:u,wireApi:d,models:f,modelConfig:p,modelDraft:m,showAdvanced:h,showModelInput:g,resolvedAuthMethodId:_,authSessionId:v,authStatusMessage:y,hasChanges:b,isDeletePending:x,isUpdatePending:S,connectivity:C,startPending:w,importPending:T,onProviderDisplayNameChange:E,onApiKeyChange:D,onApiBaseChange:O,onAuthMethodChange:A,onStartProviderAuth:M,onImportProviderAuthFromCli:N,onModelDraftChange:P,onShowModelInputChange:F,onAddModel:I,onModelsChange:L,onRemoveModel:R,onToggleModelThinkingLevel:B,onSetModelThinkingDefault:V,onSetModelVision:H,onShowAdvancedChange:ee,onWireApiChange:U,onExtraHeadersChange:W,onDeleteProvider:G,onSubmit:K,onTestConnection:q}=e,J=n.providerAuthMethods.find(e=>e.id===_);return(0,$.jsxs)(ve,{children:[(0,$.jsx)(he,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`truncate text-lg font-semibold text-foreground`,children:o}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:G,disabled:x,className:`text-muted-foreground/70 transition-colors hover:text-red-500`,title:j(`providerDelete`),children:(0,$.jsx)(k,{className:`h-4 w-4`})}),(0,$.jsx)(dt,{enabled:n.currentEnabled,apiKeyRequired:n.resolvedProviderConfig.apiKeyRequired,apiKeySet:n.resolvedProviderConfig.apiKeySet})]})]})}),(0,$.jsxs)(`form`,{onSubmit:K,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(ye,{className:`space-y-4 px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(i,{htmlFor:`providerDisplayName`,className:`text-sm font-medium text-foreground`,children:j(`providerDisplayName`)}),(0,$.jsx)(t,{id:`providerDisplayName`,type:`text`,value:s,onChange:e=>E(e.target.value),placeholder:n.defaultDisplayName||j(`providerDisplayNamePlaceholder`),className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerDisplayNameHelpShort`)})]}),(0,$.jsx)(nt,{apiKey:c,apiKeyRequired:n.resolvedProviderConfig.apiKeyRequired!==!1,apiKeySet:n.resolvedProviderConfig.apiKeySet,apiKeyPlaceholder:n.apiKeyHint?.placeholder??j(`enterApiKey`),providerAuth:n.providerAuth,providerAuthNote:n.providerAuth?.note?.[r]||n.providerAuth?.note?.en||n.providerAuth?.displayName||``,providerAuthMethodOptions:n.providerAuthMethodOptions,providerAuthMethodsCount:n.providerAuthMethods.length,selectedAuthMethodHint:J?.hint?.[r]||J?.hint?.en||``,shouldUseAuthMethodPills:n.shouldUseAuthMethodPills,resolvedAuthMethodId:_,onAuthMethodChange:A,onStartProviderAuth:M,onImportProviderAuthFromCli:N,startPending:w,importPending:T,authSessionId:v,authStatusMessage:y,onApiKeyChange:D}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(i,{htmlFor:`apiBase`,className:`text-sm font-medium text-foreground`,children:j(`apiBase`)}),(0,$.jsx)(t,{id:`apiBase`,type:`text`,value:l,onChange:e=>O(e.target.value),placeholder:n.defaultApiBase||n.apiBaseHint?.placeholder||`https://api.example.com`,className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.apiBaseHelpText})]}),(0,$.jsx)(ut,{providerName:n.providerConfig?.providerId??``,providerModelAliases:n.providerModelAliases,models:f,modelConfig:p,modelDraft:m,showModelInput:g,onModelDraftChange:P,onShowModelInputChange:F,onAddModel:I,onModelsChange:L,supportsModelDiscovery:n.supportsModelDiscovery,onDiscoverModels:C.discoverModels,isDiscoveringModels:C.isDiscoveringModels,fetchedModels:C.fetchedModels,onRemoveModel:R,onToggleModelThinkingLevel:B,onSetModelThinkingDefault:V,onSetModelVision:H,thinkingLevels:z,formatThinkingLevelLabel:Le},n.providerConfig?.providerId),(0,$.jsx)(et,{showAdvanced:h,onShowAdvancedChange:ee,supportsWireApi:n.supportsWireApi,wireApiLabel:j(`wireApi`),wireApi:d,onWireApiChange:U,shouldUseWireApiPills:n.shouldUseWireApiPills,wireApiSelectOptions:n.wireApiSelectOptions,extraHeadersLabel:j(`extraHeaders`),extraHeaders:u,onExtraHeadersChange:W})]}),(0,$.jsx)(xe,{children:(0,$.jsxs)(fe,{align:`between`,children:[(0,$.jsxs)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:q,disabled:C.isTestPending,children:[(0,$.jsx)(Se,{className:`mr-1.5 h-3.5 w-3.5`}),C.isTestPending?j(`providerTestingConnection`):j(`providerTestConnection`)]}),(0,$.jsx)(a,{type:`submit`,size:`sm`,disabled:S||!b,children:j(S?`saving`:b?`save`:`unchanged`)})]})})]})]})}function pt({providerName:e,onProviderDeleted:t}){let{data:n}=le(),{data:r}=re(),{data:i}=ue(),a=A(),o=(0,Y.useMemo)(()=>Ye({providerName:e,providersView:n,templatesView:r,schema:i,language:a}),[a,e,n,i,r]);if(!e||!o.providerConfig)return(0,$.jsx)(be,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:j(`providersSelectTitle`)}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:j(`providersSelectDescription`)})]})});let s=JSON.stringify({providerConfig:o.providerConfig,currentApiBase:o.currentApiBase,currentEditableModels:o.currentEditableModels,currentModelConfig:o.currentModelConfig,currentWireApi:o.currentWireApi,effectiveDisplayName:o.effectiveDisplayName,preferredAuthMethodId:o.preferredAuthMethodId});return(0,$.jsx)(mt,{providerName:e,onProviderDeleted:t,context:o,language:a},s)}function mt({providerName:e,onProviderDeleted:t,context:n,language:r}){let i=de(),a=J(),{currentApiBase:o,currentEditableModels:s,currentHeaders:c,currentModelConfig:l,currentWireApi:u,defaultApiBase:d,effectiveDisplayName:f,providerAuth:p,providerAuthMethods:m,providerModelAliases:h,resolvedProviderConfig:g,preferredAuthMethodId:_,supportsWireApi:v}=n,[y,b]=(0,Y.useState)(``),[x,S]=(0,Y.useState)(o),[C,w]=(0,Y.useState)(g.extraHeaders||null),[T,E]=(0,Y.useState)(u),[D,O]=(0,Y.useState)(s),[k,A]=(0,Y.useState)(l),[M,N]=(0,Y.useState)(``),[P,F]=(0,Y.useState)(f),[I,L]=(0,Y.useState)(!1),[R,z]=(0,Y.useState)(!1),[B,V]=(0,Y.useState)(_),H=Ze({providerName:e,apiKey:y,apiKeyRequired:g.apiKeyRequired!==!1,apiKeySet:g.apiKeySet,apiBase:x,extraHeaders:C,supportsWireApi:v,wireApi:T,models:D,providerModelAliases:h}),ee=P.trim()||f||e||j(`providersSelectPlaceholder`),U=(0,Y.useMemo)(()=>{if(!m.length)return``;let e=B.trim();return e&&m.some(t=>t.id===e)?e:_||m[0]?.id||``},[B,_,m]),{authSessionId:W,authStatusMessage:G,importAuthFromCli:K,importPending:q,startAuth:te,startPending:ne}=Xe({providerName:e,providerAuth:p,resolvedAuthMethodId:U}),re=(0,Y.useMemo)(()=>Ne({providerName:e,apiKey:y,apiBase:x,currentApiBase:o,extraHeaders:C,currentHeaders:c,supportsWireApi:v,wireApi:T,currentWireApi:u,models:D,currentEditableModels:s,modelConfig:k,currentModelConfig:l,providerDisplayName:P,effectiveDisplayName:f}),[e,y,x,o,C,c,v,T,u,D,s,k,l,P,f]),ie=e=>{O(e),A(t=>Ae(t,e))};return(0,$.jsx)(ft,{context:n,language:r,providerTitle:ee,providerDisplayName:P,apiKey:y,apiBase:x,extraHeaders:C,wireApi:T,models:D,modelConfig:k,modelDraft:M,showAdvanced:I,showModelInput:R,resolvedAuthMethodId:U,authSessionId:W,authStatusMessage:G,hasChanges:re,isDeletePending:a.isPending,isUpdatePending:i.isPending,connectivity:H,startPending:ne,importPending:q,onProviderDisplayNameChange:F,onApiKeyChange:b,onApiBaseChange:S,onAuthMethodChange:V,onStartProviderAuth:te,onImportProviderAuthFromCli:K,onModelDraftChange:N,onShowModelInputChange:z,onAddModel:()=>{let e=Be(D,M,h);ie(e.models),N(e.draft)},onModelsChange:ie,onRemoveModel:e=>{let t=Ue(D,k,e);O(t.models),A(t.modelConfig)},onToggleModelThinkingLevel:(e,t)=>{A(n=>We(n,e,t))},onSetModelThinkingDefault:(e,t)=>{A(n=>Ge(n,e,t))},onSetModelVision:(e,t)=>{A(n=>Ke(n,e,t))},onShowAdvancedChange:L,onWireApiChange:E,onExtraHeadersChange:w,onDeleteProvider:async()=>{if(e&&window.confirm(j(`providerDeleteConfirm`)))try{await a.mutateAsync({provider:e}),t?.(e)}catch{}},onSubmit:t=>{t.preventDefault(),e&&i.mutate({provider:e,data:Pe({providerName:e,apiKey:y,apiBase:x,currentApiBase:o,defaultApiBase:d,extraHeaders:C,currentHeaders:c,supportsWireApi:v,wireApi:T,currentWireApi:u,models:D,currentEditableModels:s,modelConfig:k,currentModelConfig:l,providerDisplayName:P,effectiveDisplayName:f})})},onTestConnection:H.testConnection})}function ht(e){if(!e)return null;try{let t=new URL(e);return`${t.host}${t.pathname&&t.pathname!==`/`?t.pathname:``}`}catch{return e.replace(/^https?:\/\//,``)}}function gt(e,t=[]){let n=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({provider:e,index:t})).sort((e,t)=>{let r=n.get(e.provider.providerId),i=n.get(t.provider.providerId);if(r!==void 0||i!==void 0)return(r??2**53-1)-(i??2**53-1);let a=e.provider.providerType===`nextclaw`?1:0,o=t.provider.providerType===`nextclaw`?1:0;return a===o?e.index-t.index:a-o}).map(({provider:e})=>e)}function _t(e){let t=e.findIndex(e=>e.providerType===`zhipu`),n=e.findIndex(e=>e.providerType===`dashscope-coding-plan`);return e.map((e,t)=>({template:e,index:t})).sort((e,r)=>{let i=({template:e,index:r})=>e.providerType===`nextclaw`?2**53-1:e.providerType===`deepseek`&&n>=0?n-.5:e.providerType===`mimo`&&t>=0?t+.5:r;return i(e)-i(r)}).map(({template:e})=>e)}function vt(){let{isMobile:e}=T(),{data:n}=le(),{data:i}=re(),c=ae(),l=J(),u=de(),[d,f]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)([]),[C,D]=(0,Y.useState)(``),O=(0,Y.useMemo)(()=>gt(Object.values(n?.providers??{}),x),[n?.providers,x]),A=(0,Y.useMemo)(()=>i?.providerTemplates??[],[i?.providerTemplates]),N=(0,Y.useMemo)(()=>_t(A),[A]),I=(0,Y.useMemo)(()=>new Map(A.map(e=>[e.providerType,e])),[A]),L=(0,Y.useMemo)(()=>{let e=C.trim().toLowerCase();return O.filter(t=>{if(!e)return!0;let n=t.providerType?I.get(t.providerType):null;return(t.displayName?.trim()||n?.displayName||t.providerId).toLowerCase().includes(e)||t.providerId.toLowerCase().includes(e)})},[O,C,I]),z=(0,Y.useMemo)(()=>d&&L.some(e=>e.providerId===d)?d:e?null:L[0]?.providerId??null,[L,e,d]);return!n||!i?(0,$.jsx)(o,{title:j(`providersPageTitle`),description:j(`providersPageDescription`),layout:`split`,children:(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:j(`providersLoading`)})}):(0,$.jsxs)(o,{title:j(`providersPageTitle`),description:j(`providersPageDescription`),layout:`split`,children:[(0,$.jsxs)(me,{className:`md:min-h-0`,compactView:d?`detail`:`list`,onMobileBack:()=>f(null),mobileListLabel:j(`providersPageTitle`),children:[(0,$.jsxs)(_e,{children:[(0,$.jsx)(he,{className:`space-y-3 px-4 pb-3 pt-4`,children:(0,$.jsxs)(R,{open:v,onOpenChange:b,children:[(0,$.jsx)(P,{asChild:!0,children:(0,$.jsxs)(a,{type:`button`,variant:`outline`,className:`w-full justify-center`,disabled:c.isPending,children:[(0,$.jsx)(E,{className:`mr-2 h-4 w-4`}),c.isPending?j(`saving`):j(`providerAdd`)]})}),(0,$.jsxs)(F,{className:`w-[42rem] max-w-[calc(100vw-2rem)] p-3`,align:`start`,children:[(0,$.jsx)(`div`,{className:`mb-2 px-1 text-xs font-semibold text-muted-foreground`,children:j(`providerTemplatePickerTitle`)}),(0,$.jsxs)(`div`,{className:`grid max-h-[24rem] grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-left transition-colors hover:border-border hover:bg-[var(--interaction-hover)]`,onClick:async()=>{try{let e=await c.mutateAsync({data:{providerType:null}});D(``),f(e.providerId),S(t=>[e.providerId,...t.filter(t=>t!==e.providerId)]),b(!1)}catch{}},children:[(0,$.jsx)(B,{name:`custom`,className:`h-8 w-8 rounded-lg border border-border/60 bg-muted/50`}),(0,$.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:j(`providerAddCustom`)})]}),N.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-border/55 bg-muted/15 px-3 py-2 text-left transition-colors hover:border-border/80 hover:bg-[var(--interaction-hover)]`,onClick:async()=>{try{let t=await c.mutateAsync({data:{providerType:e.providerType}});D(``),f(t.providerId),S(e=>[t.providerId,...e.filter(e=>e!==t.providerId)]),b(!1)}catch{}},children:[(0,$.jsx)(B,{name:e.providerType,src:e.logo?`/logos/${e.logo}`:null,className:`h-8 w-8 rounded-lg border border-border/55 bg-background`,imgClassName:`h-4 w-4 object-contain`}),(0,$.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:e.displayName||e.providerType})]},e.providerType))]})]})]})}),(0,$.jsx)(`div`,{className:`border-b border-border/70 px-4 py-3`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(y,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,$.jsx)(t,{value:C,onChange:e=>D(e.target.value),placeholder:j(`providersFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,$.jsxs)(ye,{className:`space-y-2 p-3`,children:[L.map(e=>{let t=e.providerType?I.get(e.providerType):null,n=e.enabled!==!1,i=M(e),a=e.displayName?.trim()||t?.displayName||e.providerId,o=ht(e.apiBase||t?.defaultApiBase||``)||j(`providersDefaultDescription`);return(0,$.jsx)(`div`,{onClick:()=>f(e.providerId),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),f(e.providerId))},role:`button`,tabIndex:0,className:s(`group w-full rounded-xl p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,z===e.providerId?`bg-[var(--interaction-selection)] text-foreground`:`bg-transparent text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:(0,$.jsxs)(`div`,{className:`relative min-h-10`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 pr-20`,children:[(0,$.jsx)(B,{name:e.providerType??e.providerId,src:t?.logo?`/logos/${t.logo}`:null,className:`h-10 w-10 rounded-lg bg-background/80`,imgClassName:`h-5 w-5 object-contain`,fallback:(0,$.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:e.providerId[0]})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:a}),(0,$.jsx)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground/65`,children:e.providerId}),(0,$.jsxs)(`p`,{className:`line-clamp-1 text-[11px] text-muted-foreground`,children:[o,` · `,e.models?.length??0]})]})]}),(0,$.jsxs)(`div`,{className:`absolute right-0 top-0 flex items-center gap-1.5 opacity-70 transition-opacity group-hover:opacity-100`,children:[(0,$.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,$.jsx)(r,{checked:n,disabled:u.isPending,title:j(n?`disabled`:`enabled`),className:`h-[18px] w-8`,thumbClassName:`h-4 w-4 data-[state=checked]:translate-x-4`,onCheckedChange:t=>{u.mutateAsync({provider:e.providerId,data:{enabled:t},silentSuccess:!0})}})}),(0,$.jsxs)(R,{children:[(0,$.jsx)(P,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground/70 hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:e=>e.stopPropagation(),title:j(`more`),children:(0,$.jsx)(h,{className:`h-4 w-4`})})}),(0,$.jsx)(F,{variant:`menu`,align:`end`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(`button`,{type:`button`,className:`${p} ${m.destructive}`,onClick:()=>_(e.providerId),children:[(0,$.jsx)(k,{className:`h-4 w-4`}),j(`providerDelete`)]})})]})]}),(0,$.jsx)(V,{status:n?i?`ready`:`setup`:`inactive`,label:j(n?i?`statusReady`:`statusSetup`:`disabled`),className:`absolute bottom-0 right-0 justify-end`})]})},e.providerId)}),L.length===0?(0,$.jsx)(ge,{icon:w,title:j(`providersNoMatch`)}):null]})]}),(0,$.jsx)(pt,{providerName:z??void 0,onProviderDeleted:e=>{S(t=>t.filter(t=>t!==e)),e===z&&f(null)}})]}),(0,$.jsx)(H,{open:!!g,onOpenChange:e=>{e||_(null)},title:j(`providerDelete`),description:g??void 0,confirmLabel:j(`delete`),variant:`destructive`,onCancel:()=>_(null),onConfirm:()=>{g&&l.mutateAsync({provider:g}).then(()=>{S(e=>e.filter(e=>e!==g)),g===z&&f(null),_(null)})}})]})}export{vt as ProvidersConfigPage};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{Gt as t,Ut as n,Wt as r,Xn as i,Yt as a,Zt as o,_n as s,hn as c,lr as l,ur as u,xr as d}from"./api-CI6_8Qt1.js";import{t as f}from"./createLucideIcon-reFMl-W-.js";import{g as p,h as m,lt as h,mt as g,pt as _,q as v}from"./context-menu-dGVv8klA.js";import{t as y}from"./search-BG2qAlNZ.js";import{z as b}from"./dist-ZaFFmAGl.js";import{n as x}from"./inbox-ClAG7SI_.js";import{i as S,t as C}from"./x-E9VB4HQx.js";import{i as w,t as T}from"./use-viewport-layout-IKKGpjzF.js";import{t as E}from"./plus-DUdl68Eo.js";import{t as D}from"./refresh-cw-OhwaPDn1.js";import{t as O}from"./settings-2-CWOGRRaA.js";import{t as k}from"./trash-2-DvJ6duOW.js";import{l as A,s as j}from"./i18n-IGQbjBqS.js";import{a as M,c as N,g as P,h as F,l as I,o as L,p as R,t as z}from"./provider-models-COzjYl29.js";import{n as B,t as V}from"./status-dot-CYifnSnt.js";import{t as H}from"./confirm-dialog-B-ejV666.js";import{t as ee}from"./host-capabilities-B107nwS3.js";import{a as U,i as W,n as G,r as K,t as q}from"./select-xUXYV0Gr.js";import{a as J,c as te,d as ne,f as re,h as ie,i as ae,l as oe,m as se,o as ce,p as le,r as ue,y as de}from"./use-config-COusaY5p.js";import{t as fe}from"./form-actions-B8VniHts.js";import{t as pe}from"./config-hints-CaB3I7KP.js";import{a as me,c as he,i as ge,l as _e,n as ve,o as ye,r as be,s as xe}from"./config-split-page-hY1xug28.js";var Se=f(`CircleDotDashed`,[[`path`,{d:`M10.1 2.18a9.93 9.93 0 0 1 3.8 0`,key:`1qdqn0`}],[`path`,{d:`M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7`,key:`1bq7p6`}],[`path`,{d:`M21.82 10.1a9.93 9.93 0 0 1 0 3.8`,key:`1rlaqf`}],[`path`,{d:`M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69`,key:`1xk03u`}],[`path`,{d:`M13.9 21.82a9.94 9.94 0 0 1-3.8 0`,key:`l7re25`}],[`path`,{d:`M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7`,key:`1v18p6`}],[`path`,{d:`M2.18 13.9a9.93 9.93 0 0 1 0-3.8`,key:`xdo6bj`}],[`path`,{d:`M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69`,key:`1jjmaz`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Ce=f(`EyeOff`,[[`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`}]]),Y=e(d(),1),we={providerId:``,providerType:null,isBuiltInType:!1,isCustom:!0,enabled:!0,displayName:``,apiKeySet:!1,apiKeyMasked:void 0,apiBase:null,extraHeaders:null,wireApi:null,models:[],modelConfig:{}};function X(e){if(!e)return null;let t=Object.entries(e).map(([e,t])=>[e.trim(),t]).filter(([e])=>e.length>0);return t.length===0?null:Object.fromEntries(t)}function Te(e,t){let n=X(e),r=X(t);if(n===null&&r===null)return!0;if(!n||!r)return!1;let i=Object.entries(n).sort(([e],[t])=>e.localeCompare(t)),a=Object.entries(r).sort(([e],[t])=>e.localeCompare(t));return i.length===a.length?i.every(([e,t],n)=>e===a[n][0]&&t===a[n][1]):!1}function Z(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function Ee(e,t){let n=e.trim();if(!n||!t.trim())return n;let r=`${t.trim()}/`;return n.startsWith(r)?n.slice(r.length):n}function Q(e,t){let n=e.trim();if(!n)return``;for(let e of t){let t=e.trim();t&&(n=Ee(n,t))}return n.trim()}function De(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function Oe(e,t){return Z(t)}function ke(e,t){return Z(e).map(e=>{let n=e.trim();return!n||n.startsWith(`${t}/`)?n:`${t}/${n}`})}function Ae(e,t){let n=new Set(t.map(e=>e.trim()).filter(Boolean)),r={};for(let[t,i]of Object.entries(e)){if(!n.has(t))continue;let e={},a=N(i.thinking?.supported);if(a.length>0){let t=I(i.thinking?.default);e.thinking=t&&a.includes(t)?{supported:a,default:t}:{supported:a}}i.vision===!0&&(e.vision=!0),(e.thinking||e.vision===!0)&&(r[t]=e)}return r}function je(e,t,n){return{...L(e,n),...L(t,n)}}function Me(e,t){let n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let i=0;i<n.length;i+=1){let a=n[i];if(a!==r[i])return!1;let o=e[a],s=t[a];if(!o||!s||!De([...o.thinking?.supported??[]].sort(),[...s.thinking?.supported??[]].sort())||(o.thinking?.default??null)!==(s.thinking?.default??null)||(o.vision??!1)!==(s.vision??!1))return!1}return!0}function Ne(e){return e.providerName?e.apiKey.trim().length>0||e.apiBase.trim()!==e.currentApiBase.trim()||!Te(e.extraHeaders,e.currentHeaders)||e.supportsWireApi&&e.wireApi!==e.currentWireApi||!De(e.models,e.currentEditableModels)||!Me(e.modelConfig,e.currentModelConfig)||e.providerDisplayName.trim()!==e.effectiveDisplayName:!1}function Pe(e){let t={},n=e.apiKey.trim(),r=e.apiBase.trim(),i=X(e.extraHeaders),a=e.providerDisplayName.trim();return a!==e.effectiveDisplayName&&(t.displayName=a.length>0?a:null),n.length>0&&(t.apiKey=n),r!==e.currentApiBase.trim()&&(t.apiBase=r.length>0&&r!==e.defaultApiBase?r:null),Te(i,e.currentHeaders)||(t.extraHeaders=i),e.supportsWireApi&&e.wireApi!==e.currentWireApi&&(t.wireApi=e.wireApi),De(e.models,e.currentEditableModels)||(t.models=ke(e.models,e.providerName??``)),Me(e.modelConfig,e.currentModelConfig)||(t.modelConfig=Ae(e.modelConfig,e.models)),t}function Fe(e){let t=Q(e.models.find(e=>e.trim().length>0)??``,e.providerModelAliases),n={...Ie(e),model:t||null};return e.supportsWireApi&&(n.wireApi=e.wireApi),n}function Ie(e){let t={apiBase:e.apiBase.trim(),extraHeaders:X(e.extraHeaders)};return e.apiKey.trim().length>0&&(t.apiKey=e.apiKey.trim()),t}function Le(e){return j(e===`off`?`chatThinkingLevelOff`:e===`minimal`?`chatThinkingLevelMinimal`:e===`low`?`chatThinkingLevelLow`:e===`medium`?`chatThinkingLevelMedium`:e===`high`?`chatThinkingLevelHigh`:e===`adaptive`?`chatThinkingLevelAdaptive`:`chatThinkingLevelXhigh`)}function Re(e){let{providerName:t,methods:n,defaultMethodId:r,language:i}=e;if(n.length===0)return``;let a=new Map;for(let e of n){let t=e.id.trim();t&&a.set(t.toLowerCase(),t)}let o=(...e)=>{for(let t of e){let e=a.get(t.toLowerCase());if(e)return e}},s=r?.trim();if(t===`minimax-portal`){if(i===`zh`)return o(`cn`,`china-mainland`)??o(s??``)??n[0]?.id??``;if(i===`en`)return o(`global`,`intl`,`international`)??o(s??``)??n[0]?.id??``}if(s){let e=o(s);if(e)return e}return i===`zh`?o(`cn`)??n[0]?.id??``:i===`en`?o(`global`)??n[0]?.id??``:n[0]?.id??``}function ze(e){let{required:t,hasDefault:n,optionCount:r}=e;return t&&n&&r>1&&r<=3}function Be(e,t,n){let r=Q(t,n);return r?e.includes(r)?{models:e,draft:``}:{models:[...e,r],draft:``}:{models:e,draft:t}}function Ve(e,t,n){let r=[...e],i=new Set(e);for(let e of t){let t=Q(e,n);t&&!i.has(t)&&(i.add(t),r.push(t))}return{models:r,addedCount:r.length-e.length}}function He(e,t,n){return Ve(e,t,n).models.slice(e.length)}function Ue(e,t,n){let r={...t};return delete r[n],{models:e.filter(e=>e!==n),modelConfig:r}}function We(e,t,n){let r=e[t],i=r?.thinking?.supported??[],a=i.includes(n)?i.filter(e=>e!==n):z.filter(e=>e===n||i.includes(e)),o=r?.thinking?.default&&a.includes(r.thinking.default)?r.thinking.default:void 0,s={...r,thinking:a.length>0?o?{supported:a,default:o}:{supported:a}:void 0},c={...e};return s.thinking||s.vision===!0?c[t]=s:delete c[t],c}function Ge(e,t,n){let r=e[t],i=r?.thinking;return!i||i.supported.length===0||n&&!i.supported.includes(n)?e:{...e,[t]:{...r,thinking:n?{supported:i.supported,default:n}:{supported:i.supported}}}}function Ke(e,t,n){let r={...e[t],vision:n?!0:void 0},i={...e};return r.thinking||r.vision===!0?i[t]=r:delete i[t],i}function qe(e){let{providerName:t,providerSpec:n,language:r}=e,i=n?.auth,a=i?.methods??[];return{providerAuth:i,providerAuthMethodOptions:a.map(e=>({value:e.id,label:e.label?.[r]||e.label?.en||e.id})),providerAuthMethods:a,preferredAuthMethodId:Re({providerName:n?.providerType??t,methods:a,defaultMethodId:i?.defaultMethodId,language:r}),shouldUseAuthMethodPills:ze({required:i?.kind===`device_code`,hasDefault:!!i?.defaultMethodId?.trim(),optionCount:a.length})}}function Je(e,t){let n=!!e?.supportsWireApi||t,r=(e?.wireApiOptions||[`auto`,`chat`,`responses`]).map(e=>({value:e,label:j(e===`chat`?`wireApiChat`:e===`responses`?`wireApiResponses`:`wireApiAuto`)}));return{shouldUseWireApiPills:ze({required:n,hasDefault:typeof e?.defaultWireApi==`string`&&e.defaultWireApi.length>0,optionCount:r.length}),supportsWireApi:n,wireApiSelectOptions:r}}function Ye(e){let{providerName:t,providersView:n,templatesView:r,schema:i,language:a}=e,o=t?n?.providers[t]:null,s=r?.providerTemplates.find(e=>e.providerType===o?.providerType),c=o??we,l=i?.uiHints,u=!!o?.isCustom,d=t?pe(`providers.${t}.apiKey`,l):void 0,f=t?pe(`providers.${t}.apiBase`,l):void 0,p=t?pe(`providers.${t}.extraHeaders`,l):void 0,m=t?pe(`providers.${t}.wireApi`,l):void 0,h=s?.displayName||o?.displayName||t||``,g=(c.displayName||``).trim()||h,_=c.enabled!==!1,v=u||s?.supportsModelDiscovery===!0,y=Z([s?.modelPrefix||s?.providerType||``,t||``]),b=s?.defaultApiBase||``,x=c.apiBase||b,S=X(c.extraHeaders||null),C=c.wireApi||s?.defaultWireApi||`auto`,w=Oe(Z((s?.defaultModels??[]).map(e=>Q(e,y))),Z((c.models??[]).map(e=>Q(e,y)))),T=Ae(je(s?.modelConfig,c.modelConfig,y),w),E=s?.apiBaseHelp?.[a]||s?.apiBaseHelp?.en||f?.help||j(`providerApiBaseHelp`),D=qe({providerName:t,providerSpec:s,language:a}),O=Je(s,u);return{apiBaseHelpText:E,apiBaseHint:f,apiKeyHint:d,currentApiBase:x,currentEditableModels:w,currentEnabled:_,currentHeaders:S,currentModelConfig:T,currentWireApi:C,defaultApiBase:b,defaultDisplayName:h,effectiveDisplayName:g,extraHeadersHint:p,...D,providerConfig:o,providerModelAliases:y,resolvedProviderConfig:c,supportsModelDiscovery:v,wireApiHint:m,...O}}function Xe(e){let{providerName:t,providerAuth:n,resolvedAuthMethodId:r}=e,a=l(),o=se(),s=oe(),c=te(),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(``),g=(0,Y.useRef)(null),_=(0,Y.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),v=(0,Y.useCallback)((e,n)=>{_(),g.current=window.setTimeout(()=>{(async()=>{if(t)try{let r=await s.mutateAsync({provider:t,data:{sessionId:e}});if(r.status===`pending`){h(j(`providerAuthWaitingBrowser`)),v(e,r.nextPollMs??n);return}if(r.status===`authorized`){p(null),_(),h(j(`providerAuthCompleted`)),i.success(j(`providerAuthCompleted`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]});return}p(null),_(),h(r.message||`Authorization ${r.status}.`),i.error(r.message||`Authorization ${r.status}.`)}catch(e){p(null),_();let t=e instanceof Error?e.message:String(e);h(t),i.error(`Authorization failed: ${t}`)}})()},Math.max(1e3,n))},[_,s,t,a]),y=(0,Y.useCallback)(async()=>{if(!(!t||n?.kind!==`device_code`))try{d(t),h(``);let e=await o.mutateAsync({provider:t,data:r?{methodId:r}:{}});if(!e.sessionId||!e.verificationUri)throw Error(j(`providerAuthStartFailed`));p(e.sessionId),h(`${j(`providerAuthOpenPrompt`)}${e.userCode}${j(`providerAuthOpenPromptSuffix`)}`),await ee.openExternalUrl(e.verificationUri),v(e.sessionId,e.intervalMs)}catch(e){let t=e instanceof Error?e.message:String(e);p(null),_(),h(t),i.error(`${j(`providerAuthStartFailed`)}: ${t}`)}},[_,n?.kind,t,r,v,o]),b=(0,Y.useCallback)(async()=>{if(!(!t||n?.kind!==`device_code`))try{d(t),_(),p(null);let e=await c.mutateAsync({provider:t});h(`${j(`providerAuthImportStatusPrefix`)}${e.expiresAt?` (expires: ${e.expiresAt})`:``}`),i.success(j(`providerAuthImportSuccess`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]})}catch(e){let t=e instanceof Error?e.message:String(e);h(t),i.error(`${j(`providerAuthImportFailed`)}: ${t}`)}},[_,c,n?.kind,t,a]);return(0,Y.useEffect)(()=>{_()},[_,t]),(0,Y.useEffect)(()=>()=>_(),[_]),{authSessionId:u===t?f:null,authStatusMessage:u===t?m:``,importAuthFromCli:b,importPending:c.isPending,startAuth:y,startPending:o.isPending}}function Ze(e){let{providerName:t,apiKey:n,apiKeyRequired:r,apiKeySet:a,apiBase:o,extraHeaders:s,supportsWireApi:l,wireApi:u,models:d,providerModelAliases:f}=e,p=ie(),m=ce(),h=(0,Y.useMemo)(()=>JSON.stringify({providerName:t,apiKey:n,apiBase:o,extraHeaders:s}),[o,n,s,t]),[g,_]=(0,Y.useState)(null),v=(0,Y.useCallback)(async()=>{if(t)try{let e=await p.mutateAsync({provider:t,data:Fe({apiKey:n,apiBase:o,extraHeaders:s,supportsWireApi:l,wireApi:u,models:d,providerModelAliases:f})});if(e.success){i.success(`${j(`providerTestConnectionSuccess`)} (${e.latencyMs}ms)`);return}let r=[`provider=${e.provider}`,`latency=${e.latencyMs}ms`];e.model&&r.push(`model=${e.model}`),i.error(`${j(`providerTestConnectionFailed`)}: ${e.message} | ${r.join(` | `)}`)}catch(e){let t=e instanceof Error?e.message:String(e);i.error(`${j(`providerTestConnectionFailed`)}: ${t}`)}},[o,n,s,d,f,t,l,p,u]);return{discoverModels:(0,Y.useCallback)(async()=>{if(!t)return null;if(r&&!n.trim()&&!a)return i.error(j(`providerModelsApiKeyRequired`)),null;try{let e=await m.mutateAsync({provider:t,data:Ie({apiKey:n,apiBase:o,extraHeaders:s})});return _({key:h,models:e.models}),i.success(j(`providerModelsFetchSuccess`)),e.models}catch(e){if(e instanceof c&&(e.details?.upstreamStatus===401||e.details?.upstreamStatus===403))return i.error(j(`providerModelsAuthorizationFailed`)),null;let t=e instanceof Error?e.message:String(e);return i.error(`${j(`providerModelsFetchFailed`)}: ${t}`),null}},[o,n,r,a,m,h,s,t]),fetchedModels:g?.key===h?g.models:[],isDiscoveringModels:m.isPending,isTestPending:p.isPending,testConnection:v}}var $=u();function Qe({value:e,onChange:n,className:r}){let i=e?Object.entries(e):[],o=(e,t,r)=>{let a=[...i];a[e]=[t,r],n(Object.fromEntries(a))},c=()=>{n({...e,"":``})},l=e=>{let t=i.filter((t,n)=>n!==e);n(Object.fromEntries(t))};return(0,$.jsxs)(`div`,{className:s(`space-y-2`,r),children:[i.map(([e,n],r)=>(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(t,{type:`text`,value:e,onChange:e=>o(r,e.target.value,n),placeholder:j(`headerName`),className:`flex-1`}),(0,$.jsx)(t,{type:`text`,value:n,onChange:t=>o(r,e,t.target.value),placeholder:j(`headerValue`),className:`flex-1`}),(0,$.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>l(r),children:(0,$.jsx)(k,{className:`h-4 w-4 text-red-500`})})]},r)),(0,$.jsxs)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:[(0,$.jsx)(E,{className:`h-4 w-4 mr-2`}),j(`add`)]})]})}function $e(e){let{value:t,onChange:n,options:r}=e;return(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let r=e.value===t;return(0,$.jsx)(`button`,{type:`button`,onClick:()=>n(e.value),"aria-pressed":r,className:`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors ${r?`border-[var(--interaction-selection-border)] bg-[var(--interaction-selection)] text-foreground`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-[var(--interaction-hover)] hover:text-foreground`}`,children:e.label},e.value)})})}function et(e){let{showAdvanced:t,onShowAdvancedChange:n,supportsWireApi:i,wireApiLabel:a,wireApi:o,onWireApiChange:s,shouldUseWireApiPills:c,wireApiSelectOptions:l,extraHeadersLabel:u,extraHeaders:d,onExtraHeadersChange:f}=e;return(0,$.jsxs)(`div`,{className:`border-t border-border/70 pt-4`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center justify-between text-sm text-muted-foreground transition-colors hover:text-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(O,{className:`h-3.5 w-3.5`}),j(`providerAdvancedSettings`)]}),(0,$.jsx)(b,{className:`h-4 w-4 transition-transform ${t?`rotate-180`:``}`})]}),t?(0,$.jsxs)(`div`,{className:`mt-4 space-y-5`,children:[i?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(r,{htmlFor:`wireApi`,className:`text-sm font-medium text-foreground`,children:a}),c?(0,$.jsx)($e,{value:o,onChange:e=>s(e),options:l}):(0,$.jsxs)(q,{value:o,onValueChange:e=>s(e),children:[(0,$.jsx)(W,{className:`rounded-xl`,children:(0,$.jsx)(U,{})}),(0,$.jsx)(G,{children:l.map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))})]})]}):null,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(r,{className:`text-sm font-medium text-foreground`,children:u}),(0,$.jsx)(Qe,{value:d,onChange:f}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerExtraHeadersHelpShort`)})]})]}):null]})}function tt({isSet:e,className:n,value:r,onChange:i,placeholder:o,...c}){let[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),p=typeof r==`string`&&r.length>0;return(0,$.jsxs)(`div`,{className:`relative`,children:[e&&!p&&!d?(0,$.jsx)(`div`,{onClick:()=>f(!0),className:s(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-500 cursor-text items-center pr-12`,n),children:`••••••••••••`}):(0,$.jsx)(t,{type:l?`text`:`password`,className:s(`pr-12`,n),value:r,onChange:i,onBlur:()=>{p||f(!1)},placeholder:o,autoFocus:d,...c}),(0,$.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex gap-1`,children:(e||p)&&(0,$.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>u(!l),children:l?(0,$.jsx)(Ce,{className:`h-4 w-4`}):(0,$.jsx)(x,{className:`h-4 w-4`})})})]})}function nt(e){let{apiKey:t,apiKeyRequired:n,apiKeySet:i,apiKeyPlaceholder:o,providerAuth:s,providerAuthNote:c,providerAuthMethodOptions:l,providerAuthMethodsCount:u,selectedAuthMethodHint:d,shouldUseAuthMethodPills:f,resolvedAuthMethodId:p,onAuthMethodChange:m,onStartProviderAuth:h,onImportProviderAuthFromCli:g,startPending:_,importPending:v,authSessionId:y,authStatusMessage:b,onApiKeyChange:x}=e,S=n?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(r,{htmlFor:`apiKey`,className:`text-sm font-medium text-foreground`,children:j(`apiKey`)}),(0,$.jsx)(tt,{id:`apiKey`,value:t,isSet:i,onChange:e=>x(e.target.value),placeholder:o,className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`leaveBlankToKeepUnchanged`)})]}):null;return s?.kind===`device_code`?(0,$.jsxs)($.Fragment,{children:[S,(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-muted/45 p-3`,children:[(0,$.jsx)(r,{className:`text-sm font-medium text-foreground`,children:s.displayName||j(`providerAuthSectionTitle`)}),c?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}):null,u>1?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(r,{className:`text-xs font-medium text-foreground`,children:j(`providerAuthMethodLabel`)}),f?(0,$.jsx)($e,{value:p,onChange:m,options:l}):(0,$.jsxs)(q,{value:p,onValueChange:m,children:[(0,$.jsx)(W,{className:`h-8 rounded-lg`,children:(0,$.jsx)(U,{placeholder:j(`providerAuthMethodPlaceholder`)})}),(0,$.jsx)(G,{children:l.map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))})]}),d?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d}):null]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:h,disabled:_||!!y,children:j(_?`providerAuthStarting`:y?`providerAuthAuthorizing`:`providerAuthAuthorizeInBrowser`)}),s.supportsCliImport?(0,$.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:g,disabled:v,children:j(v?`providerAuthImporting`:`providerAuthImportFromCli`)}):null,y?(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[j(`providerAuthSessionLabel`),`: `,y.slice(0,8),`…`]}):null]}),b?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b}):null]})]}):S}function rt(e){let{providerName:t,models:n,aliases:r,fetchedModels:i=[],onModelsChange:a}=e,o=ne({pollWhileRefreshing:!0,refreshOnMount:!0}),s=t?o.data?.providers[t]:void 0,c=i.length>0?`fetched`:`background`,l=(0,Y.useMemo)(()=>He(n,c===`fetched`?i:s?.models??[],r),[r,s?.models,i,n,c]);return{addSuggestedModels:(0,Y.useCallback)(e=>{let t=Ve(n,e,r);t.addedCount>0&&a(t.models)},[r,n,a]),hasSuggestionError:!!(s?.lastError&&!s.fetchedAt),isCheckingSuggestions:!!(t&&(o.isLoading||o.data?.refreshing&&!s)),suggestedModels:l,suggestionSource:c}}function it(e){let{models:t,modelConfig:i,onModelsChange:a,onRemoveModel:o,onToggleModelThinkingLevel:s,onSetModelThinkingDefault:c,onSetModelVision:l,thinkingLevels:u,formatThinkingLevelLabel:d}=e,[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(()=>new Set),g=(0,Y.useMemo)(()=>t.filter(e=>m.has(e)),[t,m]),_=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=()=>{p(!1),h(new Set)};return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`flex min-h-7 flex-wrap items-center justify-end gap-2`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mr-auto text-xs text-muted-foreground`,children:j(`providerModelsSuggestionsSelected`).replace(`{count}`,String(g.length))}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-primary hover:text-primary/80`,onClick:()=>h(g.length===t.length?new Set:new Set(t)),children:j(g.length===t.length?`providerModelsClearSelection`:`providerModelsSelectAll`)}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:v,children:j(`cancel`)}),(0,$.jsxs)(`button`,{type:`button`,disabled:g.length===0,className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/15 disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>{g.length!==0&&(a(t.filter(e=>!m.has(e))),v())},children:[(0,$.jsx)(k,{className:`h-3 w-3`}),j(`providerModelsRemoveSelected`)]})]}):(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:()=>p(!0),children:[(0,$.jsx)(k,{className:`h-3 w-3`}),j(`providerModelsBulkRemove`)]})}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>{if(f)return(0,$.jsxs)(`label`,{className:`inline-flex max-w-full cursor-pointer items-center gap-2 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5 hover:bg-[var(--interaction-hover)]`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:m.has(e),onChange:()=>_(e),"aria-label":j(`providerModelsSuggestionSelect`).replace(`{model}`,e),className:`h-3.5 w-3.5 shrink-0 accent-primary`}),(0,$.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e})]},e);let t=i[e],a=t?.thinking,p=a?.supported??[],h=a?.default??null,g=t?.vision===!0;return(0,$.jsxs)(`div`,{className:`group inline-flex max-w-full items-center gap-1 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5`,children:[(0,$.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e}),(0,$.jsxs)(R,{children:[(0,$.jsx)(P,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-[var(--interaction-hover)] hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":j(`providerModelThinkingTitle`),title:j(`providerModelThinkingTitle`),children:(0,$.jsx)(O,{className:`h-3 w-3`})})}),(0,$.jsxs)(F,{className:`w-80 space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-muted/50 px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:j(`providerModelVisionTitle`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerModelVisionHint`)})]}),(0,$.jsx)(n,{checked:g,onCheckedChange:t=>l(e,t)})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:j(`providerModelThinkingTitle`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerModelThinkingHint`)})]}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u.map(t=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(e,t),className:`rounded-full border px-2.5 py-1 text-xs font-medium transition-colors ${p.includes(t)?`border-[var(--interaction-selection-border)] bg-[var(--interaction-selection)] text-foreground`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-[var(--interaction-hover)] hover:text-foreground`}`,children:d(t)},t))}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(r,{className:`text-xs font-medium text-foreground`,children:j(`providerModelThinkingDefault`)}),(0,$.jsxs)(q,{value:h??`__none__`,onValueChange:t=>c(e,t===`__none__`?null:t),disabled:p.length===0,children:[(0,$.jsx)(W,{className:`h-8 rounded-lg text-xs`,children:(0,$.jsx)(U,{})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(K,{value:`__none__`,children:j(`providerModelThinkingDefaultNone`)}),p.map(e=>(0,$.jsx)(K,{value:e,children:d(e)},e))]})]}),p.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerModelThinkingNoSupported`)}):null]})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-[var(--interaction-hover)] hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":j(`remove`),children:(0,$.jsx)(C,{className:`h-3 w-3`})})]},e)})}),f?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerModelsRemoveSaveHint`)}):null]})}var at=20,ot=50,st=50;function ct(e){let{expanded:n,fetchedTotal:r,models:i,source:a,onExpandedChange:o,onAddModels:s}=e,[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(()=>new Set),f=(0,Y.useMemo)(()=>{let e=c.trim().toLowerCase();return e?i.filter(t=>t.toLowerCase().includes(e)):i},[i,c]),p=f.slice(0,st),m=(0,Y.useMemo)(()=>i.filter(e=>u.has(e)),[i,u]),h=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},_=e=>{e.length!==0&&(s(e),l(``),d(new Set))},b=a===`fetched`?`providerModelsFetchedSuggestionsSummary`:`providerModelsSuggestionsSummary`;return a===`fetched`&&i.length===0?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/35 px-3 py-2 text-xs text-muted-foreground`,role:`status`,children:[(0,$.jsx)(v,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{children:j(`providerModelsFetchedAllConfigured`).replace(`{count}`,String(r))})]}):(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted/35 p-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:()=>o(!n),children:[(0,$.jsx)(v,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:j(b).replace(`{count}`,String(i.length))}),(0,$.jsx)(g,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${n?`rotate-90`:``}`})]}),i.length<=ot?(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-lg px-2 py-1.5 text-xs font-medium text-primary transition-colors hover:bg-[var(--interaction-hover)]`,onClick:()=>_(i),children:j(`providerModelsSuggestionsAddAll`)}):null]}),n?(0,$.jsxs)(`div`,{className:`px-1 pb-1`,children:[i.length>at?(0,$.jsxs)(`div`,{className:`relative px-2 pb-1 pt-1.5`,children:[(0,$.jsx)(y,{className:`pointer-events-none absolute left-4 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(t,{value:c,onChange:e=>l(e.target.value),placeholder:j(`providerModelsSuggestionsSearchPlaceholder`),className:`h-8 rounded-lg pl-8 text-xs`})]}):null,(0,$.jsxs)(`div`,{className:`custom-scrollbar max-h-44 overflow-y-auto`,children:[p.map(e=>(0,$.jsxs)(`label`,{className:`grid min-w-0 cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-[var(--interaction-hover)]`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:u.has(e),onChange:()=>h(e),"aria-label":j(`providerModelsSuggestionSelect`).replace(`{model}`,e),className:`h-3.5 w-3.5 shrink-0 accent-primary`}),(0,$.jsx)(`span`,{className:`block min-w-0 truncate text-xs text-foreground`,title:e,children:e})]},e)),f.length===0?(0,$.jsx)(`p`,{className:`px-2 py-4 text-center text-xs text-muted-foreground`,children:j(`providerModelsSuggestionsSearchEmpty`)}):null]}),f.length>p.length?(0,$.jsx)(`p`,{className:`px-2 pt-1 text-[11px] text-muted-foreground`,children:j(`providerModelsSuggestionsShowing`).replace(`{visible}`,String(p.length)).replace(`{count}`,String(f.length))}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pt-1.5`,children:[(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:j(`providerModelsSuggestionsSelected`).replace(`{count}`,String(m.length))}),(0,$.jsx)(`button`,{type:`button`,disabled:m.length===0,className:`shrink-0 rounded-md bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary transition-colors hover:bg-[var(--interaction-hover)] disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>_(m),children:j(`providerModelsSuggestionsAddSelected`)})]}),(0,$.jsx)(`p`,{className:`px-2 pb-1 pt-1 text-[11px] text-muted-foreground`,children:j(`providerModelsSuggestionsSaveHint`)})]}):null]})}function lt({hasFetchedCatalog:e,hasSuggestionError:t,supportsModelDiscovery:n}){return!n||!t||e?null:(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:[(0,$.jsx)(_,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),j(`providerModelsSuggestionsFailed`)]})}function ut(e){let{providerName:n,providerModelAliases:i,models:o,modelConfig:s,modelDraft:c,showModelInput:l,onModelDraftChange:u,onShowModelInputChange:d,onAddModel:f,onModelsChange:p,supportsModelDiscovery:m,onDiscoverModels:h,isDiscoveringModels:g,fetchedModels:_,onRemoveModel:v,onToggleModelThinkingLevel:y,onSetModelThinkingDefault:b,onSetModelVision:x,thinkingLevels:w,formatThinkingLevelLabel:T}=e,[O,k]=(0,Y.useState)(!1),A=(0,Y.useRef)(null),{addSuggestedModels:M,hasSuggestionError:N,isCheckingSuggestions:P,suggestedModels:F,suggestionSource:I}=rt({providerName:n,models:o,aliases:i,fetchedModels:_,onModelsChange:p}),L=async()=>{await h()&&(k(!0),window.requestAnimationFrame(()=>{let e=A.current;e?.scrollIntoView?.({behavior:`smooth`,block:`center`}),e?.focus({preventScroll:!0})}))},R=_.length>0;return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(r,{className:`text-sm font-medium text-foreground`,children:j(`providerModelsTitle`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[m?(0,$.jsxs)(`button`,{type:`button`,onClick:L,disabled:g,className:`flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:text-primary/80 disabled:cursor-wait disabled:opacity-60`,children:[(0,$.jsx)(D,{className:`h-3 w-3 ${g?`animate-spin`:``}`}),j(g?`providerModelsFetching`:`providerModelsFetch`)]}):null,l?null:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(!0),className:`flex items-center gap-1 text-xs font-medium text-primary hover:text-primary/80`,children:[(0,$.jsx)(E,{className:`h-3 w-3`}),j(`providerAddModel`)]})]})]}),l?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(t,{value:c,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f()),e.key===`Escape`&&(d(!1),u(``))},placeholder:j(`providerModelInputPlaceholder`),className:`flex-1 rounded-xl`,autoFocus:!0}),(0,$.jsx)(a,{type:`button`,size:`sm`,onClick:f,disabled:c.trim().length===0,children:j(`add`)}),(0,$.jsx)(a,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{d(!1),u(``)},children:(0,$.jsx)(C,{className:`h-4 w-4`})})]}):null,(0,$.jsx)(lt,{hasFetchedCatalog:R,hasSuggestionError:N,supportsModelDiscovery:m}),m&&P&&!R?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/35 px-3 py-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(S,{className:`h-3.5 w-3.5 animate-spin`}),j(`providerModelsSuggestionsChecking`)]}):m&&(F.length>0||R)?(0,$.jsx)(`div`,{ref:A,tabIndex:-1,"aria-live":`polite`,className:`scroll-m-4 outline-none`,children:(0,$.jsx)(ct,{expanded:O,fetchedTotal:_.length,models:F,source:I,onExpandedChange:k,onAddModels:M})}):null,o.length===0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted/35 px-4 py-6 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:j(`providerModelsEmptyShort`)}),l?null:(0,$.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:`mt-2 text-sm font-medium text-primary hover:text-primary/80`,children:j(`providerAddFirstModel`)})]}):(0,$.jsx)(it,{models:o,modelConfig:s,onModelsChange:p,onRemoveModel:v,onToggleModelThinkingLevel:y,onSetModelThinkingDefault:b,onSetModelVision:x,thinkingLevels:w,formatThinkingLevelLabel:T})]})}function dt({apiKeyRequired:e=!0,apiKeySet:t,className:n,enabled:r}){if(!r)return(0,$.jsx)(V,{status:`inactive`,label:j(`disabled`),className:n});let i=!e||t;return(0,$.jsx)(V,{status:i?`ready`:`setup`,label:j(i?`statusReady`:`statusSetup`),className:n})}function ft(e){let{context:n,language:i,providerTitle:o,providerDisplayName:s,apiKey:c,apiBase:l,extraHeaders:u,wireApi:d,models:f,modelConfig:p,modelDraft:m,showAdvanced:h,showModelInput:g,resolvedAuthMethodId:_,authSessionId:v,authStatusMessage:y,hasChanges:b,isDeletePending:x,isUpdatePending:S,connectivity:C,startPending:w,importPending:T,onProviderDisplayNameChange:E,onApiKeyChange:D,onApiBaseChange:O,onAuthMethodChange:A,onStartProviderAuth:M,onImportProviderAuthFromCli:N,onModelDraftChange:P,onShowModelInputChange:F,onAddModel:I,onModelsChange:L,onRemoveModel:R,onToggleModelThinkingLevel:B,onSetModelThinkingDefault:V,onSetModelVision:H,onShowAdvancedChange:ee,onWireApiChange:U,onExtraHeadersChange:W,onDeleteProvider:G,onSubmit:K,onTestConnection:q}=e,J=n.providerAuthMethods.find(e=>e.id===_);return(0,$.jsxs)(ve,{children:[(0,$.jsx)(he,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`truncate text-lg font-semibold text-foreground`,children:o}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:G,disabled:x,className:`text-muted-foreground/70 transition-colors hover:text-red-500`,title:j(`providerDelete`),children:(0,$.jsx)(k,{className:`h-4 w-4`})}),(0,$.jsx)(dt,{enabled:n.currentEnabled,apiKeyRequired:n.resolvedProviderConfig.apiKeyRequired,apiKeySet:n.resolvedProviderConfig.apiKeySet})]})]})}),(0,$.jsxs)(`form`,{onSubmit:K,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(ye,{className:`space-y-4 px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(r,{htmlFor:`providerDisplayName`,className:`text-sm font-medium text-foreground`,children:j(`providerDisplayName`)}),(0,$.jsx)(t,{id:`providerDisplayName`,type:`text`,value:s,onChange:e=>E(e.target.value),placeholder:n.defaultDisplayName||j(`providerDisplayNamePlaceholder`),className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(`providerDisplayNameHelpShort`)})]}),(0,$.jsx)(nt,{apiKey:c,apiKeyRequired:n.resolvedProviderConfig.apiKeyRequired!==!1,apiKeySet:n.resolvedProviderConfig.apiKeySet,apiKeyPlaceholder:n.apiKeyHint?.placeholder??j(`enterApiKey`),providerAuth:n.providerAuth,providerAuthNote:n.providerAuth?.note?.[i]||n.providerAuth?.note?.en||n.providerAuth?.displayName||``,providerAuthMethodOptions:n.providerAuthMethodOptions,providerAuthMethodsCount:n.providerAuthMethods.length,selectedAuthMethodHint:J?.hint?.[i]||J?.hint?.en||``,shouldUseAuthMethodPills:n.shouldUseAuthMethodPills,resolvedAuthMethodId:_,onAuthMethodChange:A,onStartProviderAuth:M,onImportProviderAuthFromCli:N,startPending:w,importPending:T,authSessionId:v,authStatusMessage:y,onApiKeyChange:D}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(r,{htmlFor:`apiBase`,className:`text-sm font-medium text-foreground`,children:j(`apiBase`)}),(0,$.jsx)(t,{id:`apiBase`,type:`text`,value:l,onChange:e=>O(e.target.value),placeholder:n.defaultApiBase||n.apiBaseHint?.placeholder||`https://api.example.com`,className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.apiBaseHelpText})]}),(0,$.jsx)(ut,{providerName:n.providerConfig?.providerId??``,providerModelAliases:n.providerModelAliases,models:f,modelConfig:p,modelDraft:m,showModelInput:g,onModelDraftChange:P,onShowModelInputChange:F,onAddModel:I,onModelsChange:L,supportsModelDiscovery:n.supportsModelDiscovery,onDiscoverModels:C.discoverModels,isDiscoveringModels:C.isDiscoveringModels,fetchedModels:C.fetchedModels,onRemoveModel:R,onToggleModelThinkingLevel:B,onSetModelThinkingDefault:V,onSetModelVision:H,thinkingLevels:z,formatThinkingLevelLabel:Le},n.providerConfig?.providerId),(0,$.jsx)(et,{showAdvanced:h,onShowAdvancedChange:ee,supportsWireApi:n.supportsWireApi,wireApiLabel:j(`wireApi`),wireApi:d,onWireApiChange:U,shouldUseWireApiPills:n.shouldUseWireApiPills,wireApiSelectOptions:n.wireApiSelectOptions,extraHeadersLabel:j(`extraHeaders`),extraHeaders:u,onExtraHeadersChange:W})]}),(0,$.jsx)(xe,{children:(0,$.jsxs)(fe,{align:`between`,children:[(0,$.jsxs)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:q,disabled:C.isTestPending,children:[(0,$.jsx)(Se,{className:`mr-1.5 h-3.5 w-3.5`}),C.isTestPending?j(`providerTestingConnection`):j(`providerTestConnection`)]}),(0,$.jsx)(a,{type:`submit`,size:`sm`,disabled:S||!b,children:j(S?`saving`:b?`save`:`unchanged`)})]})})]})]})}function pt({providerName:e,onProviderDeleted:t}){let{data:n}=le(),{data:r}=re(),{data:i}=ue(),a=A(),o=(0,Y.useMemo)(()=>Ye({providerName:e,providersView:n,templatesView:r,schema:i,language:a}),[a,e,n,i,r]);if(!e||!o.providerConfig)return(0,$.jsx)(be,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:j(`providersSelectTitle`)}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:j(`providersSelectDescription`)})]})});let s=JSON.stringify({providerConfig:o.providerConfig,currentApiBase:o.currentApiBase,currentEditableModels:o.currentEditableModels,currentModelConfig:o.currentModelConfig,currentWireApi:o.currentWireApi,effectiveDisplayName:o.effectiveDisplayName,preferredAuthMethodId:o.preferredAuthMethodId});return(0,$.jsx)(mt,{providerName:e,onProviderDeleted:t,context:o,language:a},s)}function mt({providerName:e,onProviderDeleted:t,context:n,language:r}){let i=de(),a=J(),{currentApiBase:o,currentEditableModels:s,currentHeaders:c,currentModelConfig:l,currentWireApi:u,defaultApiBase:d,effectiveDisplayName:f,providerAuth:p,providerAuthMethods:m,providerModelAliases:h,resolvedProviderConfig:g,preferredAuthMethodId:_,supportsWireApi:v}=n,[y,b]=(0,Y.useState)(``),[x,S]=(0,Y.useState)(o),[C,w]=(0,Y.useState)(g.extraHeaders||null),[T,E]=(0,Y.useState)(u),[D,O]=(0,Y.useState)(s),[k,A]=(0,Y.useState)(l),[M,N]=(0,Y.useState)(``),[P,F]=(0,Y.useState)(f),[I,L]=(0,Y.useState)(!1),[R,z]=(0,Y.useState)(!1),[B,V]=(0,Y.useState)(_),H=Ze({providerName:e,apiKey:y,apiKeyRequired:g.apiKeyRequired!==!1,apiKeySet:g.apiKeySet,apiBase:x,extraHeaders:C,supportsWireApi:v,wireApi:T,models:D,providerModelAliases:h}),ee=P.trim()||f||e||j(`providersSelectPlaceholder`),U=(0,Y.useMemo)(()=>{if(!m.length)return``;let e=B.trim();return e&&m.some(t=>t.id===e)?e:_||m[0]?.id||``},[B,_,m]),{authSessionId:W,authStatusMessage:G,importAuthFromCli:K,importPending:q,startAuth:te,startPending:ne}=Xe({providerName:e,providerAuth:p,resolvedAuthMethodId:U}),re=(0,Y.useMemo)(()=>Ne({providerName:e,apiKey:y,apiBase:x,currentApiBase:o,extraHeaders:C,currentHeaders:c,supportsWireApi:v,wireApi:T,currentWireApi:u,models:D,currentEditableModels:s,modelConfig:k,currentModelConfig:l,providerDisplayName:P,effectiveDisplayName:f}),[e,y,x,o,C,c,v,T,u,D,s,k,l,P,f]),ie=e=>{O(e),A(t=>Ae(t,e))};return(0,$.jsx)(ft,{context:n,language:r,providerTitle:ee,providerDisplayName:P,apiKey:y,apiBase:x,extraHeaders:C,wireApi:T,models:D,modelConfig:k,modelDraft:M,showAdvanced:I,showModelInput:R,resolvedAuthMethodId:U,authSessionId:W,authStatusMessage:G,hasChanges:re,isDeletePending:a.isPending,isUpdatePending:i.isPending,connectivity:H,startPending:ne,importPending:q,onProviderDisplayNameChange:F,onApiKeyChange:b,onApiBaseChange:S,onAuthMethodChange:V,onStartProviderAuth:te,onImportProviderAuthFromCli:K,onModelDraftChange:N,onShowModelInputChange:z,onAddModel:()=>{let e=Be(D,M,h);ie(e.models),N(e.draft)},onModelsChange:ie,onRemoveModel:e=>{let t=Ue(D,k,e);O(t.models),A(t.modelConfig)},onToggleModelThinkingLevel:(e,t)=>{A(n=>We(n,e,t))},onSetModelThinkingDefault:(e,t)=>{A(n=>Ge(n,e,t))},onSetModelVision:(e,t)=>{A(n=>Ke(n,e,t))},onShowAdvancedChange:L,onWireApiChange:E,onExtraHeadersChange:w,onDeleteProvider:async()=>{if(e&&window.confirm(j(`providerDeleteConfirm`)))try{await a.mutateAsync({provider:e}),t?.(e)}catch{}},onSubmit:t=>{t.preventDefault(),e&&i.mutate({provider:e,data:Pe({providerName:e,apiKey:y,apiBase:x,currentApiBase:o,defaultApiBase:d,extraHeaders:C,currentHeaders:c,supportsWireApi:v,wireApi:T,currentWireApi:u,models:D,currentEditableModels:s,modelConfig:k,currentModelConfig:l,providerDisplayName:P,effectiveDisplayName:f})})},onTestConnection:H.testConnection})}function ht(e){if(!e)return null;try{let t=new URL(e);return`${t.host}${t.pathname&&t.pathname!==`/`?t.pathname:``}`}catch{return e.replace(/^https?:\/\//,``)}}function gt(e,t=[]){let n=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({provider:e,index:t})).sort((e,t)=>{let r=n.get(e.provider.providerId),i=n.get(t.provider.providerId);if(r!==void 0||i!==void 0)return(r??2**53-1)-(i??2**53-1);let a=e.provider.providerType===`nextclaw`?1:0,o=t.provider.providerType===`nextclaw`?1:0;return a===o?e.index-t.index:a-o}).map(({provider:e})=>e)}function _t(e){let t=e.findIndex(e=>e.providerType===`zhipu`),n=e.findIndex(e=>e.providerType===`dashscope-coding-plan`);return e.map((e,t)=>({template:e,index:t})).sort((e,r)=>{let i=({template:e,index:r})=>e.providerType===`nextclaw`?2**53-1:e.providerType===`deepseek`&&n>=0?n-.5:e.providerType===`mimo`&&t>=0?t+.5:r;return i(e)-i(r)}).map(({template:e})=>e)}function vt(){let{isMobile:e}=T(),{data:r}=le(),{data:i}=re(),c=ae(),l=J(),u=de(),[d,f]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)([]),[C,D]=(0,Y.useState)(``),O=(0,Y.useMemo)(()=>gt(Object.values(r?.providers??{}),x),[r?.providers,x]),A=(0,Y.useMemo)(()=>i?.providerTemplates??[],[i?.providerTemplates]),N=(0,Y.useMemo)(()=>_t(A),[A]),I=(0,Y.useMemo)(()=>new Map(A.map(e=>[e.providerType,e])),[A]),L=(0,Y.useMemo)(()=>{let e=C.trim().toLowerCase();return O.filter(t=>{if(!e)return!0;let n=t.providerType?I.get(t.providerType):null;return(t.displayName?.trim()||n?.displayName||t.providerId).toLowerCase().includes(e)||t.providerId.toLowerCase().includes(e)})},[O,C,I]),z=(0,Y.useMemo)(()=>d&&L.some(e=>e.providerId===d)?d:e?null:L[0]?.providerId??null,[L,e,d]);return!r||!i?(0,$.jsx)(o,{title:j(`providersPageTitle`),description:j(`providersPageDescription`),layout:`split`,children:(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:j(`providersLoading`)})}):(0,$.jsxs)(o,{title:j(`providersPageTitle`),description:j(`providersPageDescription`),layout:`split`,children:[(0,$.jsxs)(me,{className:`md:min-h-0`,compactView:d?`detail`:`list`,onMobileBack:()=>f(null),mobileListLabel:j(`providersPageTitle`),children:[(0,$.jsxs)(_e,{children:[(0,$.jsx)(he,{className:`space-y-3 px-4 pb-3 pt-4`,children:(0,$.jsxs)(R,{open:v,onOpenChange:b,children:[(0,$.jsx)(P,{asChild:!0,children:(0,$.jsxs)(a,{type:`button`,variant:`outline`,className:`w-full justify-center`,disabled:c.isPending,children:[(0,$.jsx)(E,{className:`mr-2 h-4 w-4`}),c.isPending?j(`saving`):j(`providerAdd`)]})}),(0,$.jsxs)(F,{className:`w-[42rem] max-w-[calc(100vw-2rem)] p-3`,align:`start`,children:[(0,$.jsx)(`div`,{className:`mb-2 px-1 text-xs font-semibold text-muted-foreground`,children:j(`providerTemplatePickerTitle`)}),(0,$.jsxs)(`div`,{className:`grid max-h-[24rem] grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-left transition-colors hover:border-border hover:bg-[var(--interaction-hover)]`,onClick:async()=>{try{let e=await c.mutateAsync({data:{providerType:null}});D(``),f(e.providerId),S(t=>[e.providerId,...t.filter(t=>t!==e.providerId)]),b(!1)}catch{}},children:[(0,$.jsx)(B,{name:`custom`,className:`h-8 w-8 rounded-lg border border-border/60 bg-muted/50`}),(0,$.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:j(`providerAddCustom`)})]}),N.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-border/55 bg-muted/15 px-3 py-2 text-left transition-colors hover:border-border/80 hover:bg-[var(--interaction-hover)]`,onClick:async()=>{try{let t=await c.mutateAsync({data:{providerType:e.providerType}});D(``),f(t.providerId),S(e=>[t.providerId,...e.filter(e=>e!==t.providerId)]),b(!1)}catch{}},children:[(0,$.jsx)(B,{name:e.providerType,src:e.logo?`/logos/${e.logo}`:null,className:`h-8 w-8 rounded-lg border border-border/55 bg-background`,imgClassName:`h-4 w-4 object-contain`}),(0,$.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:e.displayName||e.providerType})]},e.providerType))]})]})]})}),(0,$.jsx)(`div`,{className:`border-b border-border/70 px-4 py-3`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(y,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,$.jsx)(t,{value:C,onChange:e=>D(e.target.value),placeholder:j(`providersFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,$.jsxs)(ye,{className:`space-y-2 p-3`,children:[L.map(e=>{let t=e.providerType?I.get(e.providerType):null,r=e.enabled!==!1,i=M(e),a=e.displayName?.trim()||t?.displayName||e.providerId,o=ht(e.apiBase||t?.defaultApiBase||``)||j(`providersDefaultDescription`);return(0,$.jsx)(`div`,{onClick:()=>f(e.providerId),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),f(e.providerId))},role:`button`,tabIndex:0,className:s(`group w-full rounded-xl p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,z===e.providerId?`bg-[var(--interaction-selection)] text-foreground`:`bg-transparent text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:(0,$.jsxs)(`div`,{className:`relative min-h-10`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 pr-20`,children:[(0,$.jsx)(B,{name:e.providerType??e.providerId,src:t?.logo?`/logos/${t.logo}`:null,className:`h-10 w-10 rounded-lg bg-background/80`,imgClassName:`h-5 w-5 object-contain`,fallback:(0,$.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:e.providerId[0]})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:a}),(0,$.jsx)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground/65`,children:e.providerId}),(0,$.jsxs)(`p`,{className:`line-clamp-1 text-[11px] text-muted-foreground`,children:[o,` · `,e.models?.length??0]})]})]}),(0,$.jsxs)(`div`,{className:`absolute right-0 top-0 flex items-center gap-1.5 opacity-70 transition-opacity group-hover:opacity-100`,children:[(0,$.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,$.jsx)(n,{checked:r,disabled:u.isPending,title:j(r?`disabled`:`enabled`),className:`h-[18px] w-8`,thumbClassName:`h-4 w-4 data-[state=checked]:translate-x-4`,onCheckedChange:t=>{u.mutateAsync({provider:e.providerId,data:{enabled:t},silentSuccess:!0})}})}),(0,$.jsxs)(R,{children:[(0,$.jsx)(P,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground/70 hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:e=>e.stopPropagation(),title:j(`more`),children:(0,$.jsx)(h,{className:`h-4 w-4`})})}),(0,$.jsx)(F,{variant:`menu`,align:`end`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(`button`,{type:`button`,className:`${p} ${m.destructive}`,onClick:()=>_(e.providerId),children:[(0,$.jsx)(k,{className:`h-4 w-4`}),j(`providerDelete`)]})})]})]}),(0,$.jsx)(V,{status:r?i?`ready`:`setup`:`inactive`,label:j(r?i?`statusReady`:`statusSetup`:`disabled`),className:`absolute bottom-0 right-0 justify-end`})]})},e.providerId)}),L.length===0?(0,$.jsx)(ge,{icon:w,title:j(`providersNoMatch`)}):null]})]}),(0,$.jsx)(pt,{providerName:z??void 0,onProviderDeleted:e=>{S(t=>t.filter(t=>t!==e)),e===z&&f(null)}})]}),(0,$.jsx)(H,{open:!!g,onOpenChange:e=>{e||_(null)},title:j(`providerDelete`),description:g??void 0,confirmLabel:j(`delete`),variant:`destructive`,onCancel:()=>_(null),onConfirm:()=>{g&&l.mutateAsync({provider:g}).then(()=>{S(e=>e.filter(e=>e!==g)),g===z&&f(null),_(null)})}})]})}export{vt as ProvidersConfigPage};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-Lnt-4LMC.js";var t=e(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),n=e(`Puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]);export{t as n,n as t};
1
+ import{t as e}from"./createLucideIcon-reFMl-W-.js";var t=e(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),n=e(`Puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]);export{t as n,n as t};
@@ -1 +1 @@
1
- import{C as e,E as t,T as n}from"./theme-provider-D98XGa-c.js";import{Jn as r,Jt as i,Yt as a,_n as o,cr as s,fn as c,qt as l}from"./api-CG22BskB.js";import{t as u}from"./createLucideIcon-Lnt-4LMC.js";import{t as d}from"./download-f_sPcoLZ.js";import{t as f}from"./x-BqGj6_Vq.js";import{s as p}from"./i18n-B0V5NkFj.js";var m={"paper-ink":`#FAF8F4`,"plain-paper":`#FAF8F4`,natural:`#FAF9F7`,work:`#FFFFFF`,minimal:`#FFFFFF`,warm:`#FAF8F4`,cool:`#F8FAFC`,dawn:`#FAF7F4`,graphite:`#F8F8F7`,night:`#101318`,charcoal:`#1C1C1C`,island:`#FBF8ED`,probe:`#FEFCF6`},h=new class{constructor(){this.syncTheme=n=>{if(typeof document>`u`)return;let r=m[t(n)];this.updateThemeMeta(r),this.updateSurfaceBackgrounds(r);let i=e(n);document.documentElement.style.colorScheme=i,document.querySelector(`meta[name="color-scheme"]`)?.setAttribute(`content`,i)},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`);this.syncTheme(n(e)??`default`)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},g=u(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),_=`nextclaw-pwa-install-banner-dismissed`,v=`nextclaw-pwa-install-banner-dismissed-until`;function y(){let e=S();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:C(e):!1}function b(){let e=S();e?.setItem(_,`1`),e?.removeItem(v)}function x(){let e=S();e?.removeItem(_),e?.removeItem(v)}function S(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function C(e){let t=e.getItem(v);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(v),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(_,`1`),!0)}function w(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:y()}}var T=c(()=>w()),E=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),T.setState(w())},this.refreshState=()=>{let e=this.resolveInstallability();T.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:y()}))},this.dismissInstallPrompt=()=>{b(),T.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(x(),this.refreshState(),r.success(p(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,x(),T.setState({dismissedInstallPrompt:!0}),r.success(p(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}},D=s();function O(){let e=T(e=>e.installability);return(0,D.jsx)(`span`,{className:o(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:k(e)})}function k(e){return p(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function A(e,t,n){return p(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function j(){let e=T(e=>e.installability),t=T(e=>e.installMethod),n=T(e=>e.blockedReason);return(0,D.jsx)(i,{title:p(`pwaInstallTitle`),description:p(`pwaInstallDescription`),actions:(0,D.jsx)(O,{}),children:(0,D.jsx)(l,{children:(0,D.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,D.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:A(e,t,n)}),e===`available`&&t===`prompt`?(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(a,{type:`button`,className:`gap-2`,onClick:()=>void E.promptInstall(),children:[(0,D.jsx)(d,{className:`h-4 w-4`}),p(`pwaInstallAction`)]}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:p(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,D.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-background/65 p-4`,children:[(0,D.jsx)(g,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:p(`pwaInstallManualHint`)})]}):null]})})})}function M(){let e=T(e=>e.installability),t=T(e=>e.installMethod),n=T(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,D.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:p(`pwaInstallBannerTitle`)}),(0,D.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:p(`pwaInstallBannerDescription`)})]}),(0,D.jsx)(`button`,{type:`button`,"aria-label":p(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-[var(--interaction-hover)] hover:text-gray-600`,onClick:()=>{E.dismissInstallPrompt()},children:(0,D.jsx)(f,{className:`h-4 w-4`})})]}),(0,D.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,D.jsxs)(a,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{E.promptInstall()},children:[(0,D.jsx)(d,{className:`h-4 w-4`}),p(`pwaInstallAction`)]}),(0,D.jsx)(a,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{E.dismissInstallPrompt()},children:p(`pwaInstallDismiss`)})]})]})}var N=new class{constructor(){this.started=!1,this.registration=null,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{this.registration=await navigator.serviceWorker.register(`/sw.js`)}catch{return}}},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(this.started=!1,this.registration=null)},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));await Promise.all(e.map(async e=>await e.unregister())),e.length>0&&await this.clearNextClawCaches()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))}}},P=!1;function F(){P||typeof window>`u`||(P=!0,E.start(),N.start())}export{h as i,M as n,j as r,F as t};
1
+ import{D as e,O as t,T as n}from"./theme-provider-BToFZGZG.js";import{Jt as r,Xn as i,Yt as a,_n as o,fn as s,qt as c,ur as l}from"./api-CI6_8Qt1.js";import{t as u}from"./createLucideIcon-reFMl-W-.js";import{t as d}from"./download-DovI3Yvf.js";import{t as f}from"./x-E9VB4HQx.js";import{s as p}from"./i18n-IGQbjBqS.js";var m={"paper-ink":`#FAF8F4`,"plain-paper":`#FAF8F4`,natural:`#FAF9F7`,work:`#FFFFFF`,minimal:`#FFFFFF`,warm:`#FAF8F4`,cool:`#F8FAFC`,dawn:`#FAF7F4`,graphite:`#F8F8F7`,night:`#101318`,charcoal:`#1C1C1C`,island:`#FBF8ED`,probe:`#FEFCF6`},h=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let r=m[t(e)];this.updateThemeMeta(r),this.updateSurfaceBackgrounds(r);let i=n(e);document.documentElement.style.colorScheme=i,document.querySelector(`meta[name="color-scheme"]`)?.setAttribute(`content`,i)},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let t=document.documentElement.getAttribute(`data-theme`);this.syncTheme(e(t)??`default`)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},g=u(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),_=`nextclaw-pwa-install-banner-dismissed`,v=`nextclaw-pwa-install-banner-dismissed-until`;function y(){let e=S();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:C(e):!1}function b(){let e=S();e?.setItem(_,`1`),e?.removeItem(v)}function x(){let e=S();e?.removeItem(_),e?.removeItem(v)}function S(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function C(e){let t=e.getItem(v);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(v),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(_,`1`),!0)}function w(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:y()}}var T=s(()=>w()),E=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),T.setState(w())},this.refreshState=()=>{let e=this.resolveInstallability();T.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:y()}))},this.dismissInstallPrompt=()=>{b(),T.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(x(),this.refreshState(),i.success(p(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,x(),T.setState({dismissedInstallPrompt:!0}),i.success(p(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}},D=l();function O(){let e=T(e=>e.installability);return(0,D.jsx)(`span`,{className:o(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:k(e)})}function k(e){return p(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function A(e,t,n){return p(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function j(){let e=T(e=>e.installability),t=T(e=>e.installMethod),n=T(e=>e.blockedReason);return(0,D.jsx)(r,{title:p(`pwaInstallTitle`),description:p(`pwaInstallDescription`),actions:(0,D.jsx)(O,{}),children:(0,D.jsx)(c,{children:(0,D.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,D.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:A(e,t,n)}),e===`available`&&t===`prompt`?(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(a,{type:`button`,className:`gap-2`,onClick:()=>void E.promptInstall(),children:[(0,D.jsx)(d,{className:`h-4 w-4`}),p(`pwaInstallAction`)]}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:p(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,D.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-background/65 p-4`,children:[(0,D.jsx)(g,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:p(`pwaInstallManualHint`)})]}):null]})})})}function M(){let e=T(e=>e.installability),t=T(e=>e.installMethod),n=T(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,D.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:p(`pwaInstallBannerTitle`)}),(0,D.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:p(`pwaInstallBannerDescription`)})]}),(0,D.jsx)(`button`,{type:`button`,"aria-label":p(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-[var(--interaction-hover)] hover:text-gray-600`,onClick:()=>{E.dismissInstallPrompt()},children:(0,D.jsx)(f,{className:`h-4 w-4`})})]}),(0,D.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,D.jsxs)(a,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{E.promptInstall()},children:[(0,D.jsx)(d,{className:`h-4 w-4`}),p(`pwaInstallAction`)]}),(0,D.jsx)(a,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{E.dismissInstallPrompt()},children:p(`pwaInstallDismiss`)})]})]})}var N=new class{constructor(){this.started=!1,this.registration=null,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{this.registration=await navigator.serviceWorker.register(`/sw.js`)}catch{return}}},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(this.started=!1,this.registration=null)},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));await Promise.all(e.map(async e=>await e.unregister())),e.length>0&&await this.clearNextClawCaches()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))}}},P=!1;function F(){P||typeof window>`u`||(P=!0,E.start(),N.start())}export{h as i,M as n,j as r,F as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-rfGCG6pM.js";import{m as t,p as n}from"./src-CI2AvEMj.js";import{D as r,H as i,K as a,U as o,a as s,c,f as l,v as u,w as d,x as f,y as p,z as m}from"./chunk-WYO6CB5R-DPDGhyF6.js";import{t as h}from"./linear-4K_M1oYM.js";var g=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,3],r=[1,4],i=[1,5],a=[1,6],o=[1,7],s=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],l=[55,56,57],u=[2,36],d=[1,37],f=[1,36],p=[1,38],m=[1,35],h=[1,43],g=[1,41],_=[1,45],v=[1,14],y=[1,23],b=[1,18],x=[1,19],S=[1,20],C=[1,21],w=[1,22],T=[1,24],E=[1,25],D=[1,26],O=[1,27],k=[1,28],A=[1,29],j=[1,32],M=[1,33],N=[1,34],P=[1,39],F=[1,40],I=[1,42],L=[1,44],R=[1,63],z=[1,62],B=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],ee=[1,66],te=[1,67],ne=[1,68],re=[1,69],ie=[1,70],ae=[1,71],oe=[1,72],se=[1,73],ce=[1,74],le=[1,75],ue=[1,76],de=[1,77],V=[4,5,6,7,8,9,10,11,12,13,14,15,18],H=[1,91],U=[1,92],W=[1,93],G=[1,100],K=[1,94],q=[1,97],J=[1,95],Y=[1,96],X=[1,98],Z=[1,99],fe=[1,103],pe=[10,55,56,57],Q=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],me={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:`error`,4:`ALPHA`,5:`NUM`,6:`NODE_STRING`,7:`DOWN`,8:`MINUS`,9:`DEFAULT`,10:`COMMA`,11:`COLON`,12:`AMP`,13:`BRKT`,14:`MULT`,15:`UNICODE_TEXT`,17:`UNIT`,18:`SPACE`,19:`STYLE`,20:`PCT`,25:`CLASSDEF`,28:`QUADRANT`,35:`title`,36:`title_value`,37:`acc_title`,38:`acc_title_value`,39:`acc_descr`,40:`acc_descr_value`,41:`acc_descr_multiline_value`,42:`section`,44:`point_start`,45:`point_x`,46:`point_y`,47:`class_name`,48:`X-AXIS`,49:`AXIS-TEXT-DELIMITER`,50:`Y-AXIS`,51:`QUADRANT_1`,52:`QUADRANT_2`,53:`QUADRANT_3`,54:`QUADRANT_4`,55:`NEWLINE`,56:`SEMI`,57:`EOF`,60:`STR`,61:`MD_STR`,63:`PUNCTUATION`,64:`PLUS`,65:`EQUALS`,66:`DOT`,67:`UNDERSCORE`},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 23:this.$=a[s];break;case 24:this.$=a[s-1]+``+a[s];break;case 26:this.$=a[s-1]+a[s];break;case 27:this.$=[a[s].trim()];break;case 28:a[s-2].push(a[s].trim()),this.$=a[s-2];break;case 29:this.$=a[s-4],r.addClass(a[s-2],a[s]);break;case 37:this.$=[];break;case 42:this.$=a[s].trim(),r.setDiagramTitle(this.$);break;case 43:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 44:case 45:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 46:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 47:r.addPoint(a[s-3],``,a[s-1],a[s],[]);break;case 48:r.addPoint(a[s-4],a[s-3],a[s-1],a[s],[]);break;case 49:r.addPoint(a[s-4],``,a[s-2],a[s-1],a[s]);break;case 50:r.addPoint(a[s-5],a[s-4],a[s-2],a[s-1],a[s]);break;case 51:r.setXAxisLeftText(a[s-2]),r.setXAxisRightText(a[s]);break;case 52:a[s-1].text+=` ⟶ `,r.setXAxisLeftText(a[s-1]);break;case 53:r.setXAxisLeftText(a[s]);break;case 54:r.setYAxisBottomText(a[s-2]),r.setYAxisTopText(a[s]);break;case 55:a[s-1].text+=` ⟶ `,r.setYAxisBottomText(a[s-1]);break;case 56:r.setYAxisBottomText(a[s]);break;case 57:r.setQuadrant1Text(a[s]);break;case 58:r.setQuadrant2Text(a[s]);break;case 59:r.setQuadrant3Text(a[s]);break;case 60:r.setQuadrant4Text(a[s]);break;case 64:this.$={text:a[s],type:`text`};break;case 65:this.$={text:a[s-1].text+``+a[s],type:a[s-1].type};break;case 66:this.$={text:a[s],type:`text`};break;case 67:this.$={text:a[s],type:`markdown`};break;case 68:this.$=a[s];break;case 69:this.$=a[s-1]+``+a[s];break}},`anonymous`),table:[{18:n,26:1,27:2,28:r,55:i,56:a,57:o},{1:[3]},{18:n,26:8,27:2,28:r,55:i,56:a,57:o},{18:n,26:9,27:2,28:r,55:i,56:a,57:o},t(s,[2,33],{29:10}),t(c,[2,61]),t(c,[2,62]),t(c,[2,63]),{1:[2,30]},{1:[2,31]},t(l,u,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:f,10:p,12:m,13:h,14:g,15:_,18:v,25:y,35:b,37:x,39:S,41:C,42:w,48:T,50:E,51:D,52:O,53:k,54:A,60:j,61:M,63:N,64:P,65:F,66:I,67:L}),t(s,[2,34]),{27:46,55:i,56:a,57:o},t(l,[2,37]),t(l,u,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:f,10:p,12:m,13:h,14:g,15:_,18:v,25:y,35:b,37:x,39:S,41:C,42:w,48:T,50:E,51:D,52:O,53:k,54:A,60:j,61:M,63:N,64:P,65:F,66:I,67:L}),t(l,[2,39]),t(l,[2,40]),t(l,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(l,[2,45]),t(l,[2,46]),{18:[1,51]},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:52,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:53,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:54,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:55,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:56,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:57,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,44:[1,58],47:[1,59],58:61,59:60,63:N,64:P,65:F,66:I,67:L},t(B,[2,64]),t(B,[2,66]),t(B,[2,67]),t(B,[2,70]),t(B,[2,71]),t(B,[2,72]),t(B,[2,73]),t(B,[2,74]),t(B,[2,75]),t(B,[2,76]),t(B,[2,77]),t(B,[2,78]),t(B,[2,79]),t(B,[2,80]),t(B,[2,81]),t(s,[2,35]),t(l,[2,38]),t(l,[2,42]),t(l,[2,43]),t(l,[2,44]),{3:65,4:ee,5:te,6:ne,7:re,8:ie,9:ae,10:oe,11:se,12:ce,13:le,14:ue,15:de,21:64},t(l,[2,53],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,49:[1,78],63:N,64:P,65:F,66:I,67:L}),t(l,[2,56],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,49:[1,79],63:N,64:P,65:F,66:I,67:L}),t(l,[2,57],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),t(l,[2,58],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),t(l,[2,59],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),t(l,[2,60],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),{45:[1,80]},{44:[1,81]},t(B,[2,65]),t(B,[2,82]),t(B,[2,83]),t(B,[2,84]),{3:83,4:ee,5:te,6:ne,7:re,8:ie,9:ae,10:oe,11:se,12:ce,13:le,14:ue,15:de,18:[1,82]},t(V,[2,23]),t(V,[2,1]),t(V,[2,2]),t(V,[2,3]),t(V,[2,4]),t(V,[2,5]),t(V,[2,6]),t(V,[2,7]),t(V,[2,8]),t(V,[2,9]),t(V,[2,10]),t(V,[2,11]),t(V,[2,12]),t(l,[2,52],{58:31,43:84,4:d,5:f,10:p,12:m,13:h,14:g,15:_,60:j,61:M,63:N,64:P,65:F,66:I,67:L}),t(l,[2,55],{58:31,43:85,4:d,5:f,10:p,12:m,13:h,14:g,15:_,60:j,61:M,63:N,64:P,65:F,66:I,67:L}),{46:[1,86]},{45:[1,87]},{4:H,5:U,6:W,8:G,11:K,13:q,16:90,17:J,18:Y,19:X,20:Z,22:89,23:88},t(V,[2,24]),t(l,[2,51],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),t(l,[2,54],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),t(l,[2,47],{22:89,16:90,23:101,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z}),{46:[1,102]},t(l,[2,29],{10:fe}),t(pe,[2,27],{16:104,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z}),t(Q,[2,25]),t(Q,[2,13]),t(Q,[2,14]),t(Q,[2,15]),t(Q,[2,16]),t(Q,[2,17]),t(Q,[2,18]),t(Q,[2,19]),t(Q,[2,20]),t(Q,[2,21]),t(Q,[2,22]),t(l,[2,49],{10:fe}),t(l,[2,48],{22:89,16:90,23:105,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z}),{4:H,5:U,6:W,8:G,11:K,13:q,16:90,17:J,18:Y,19:X,20:Z,22:106},t(Q,[2,26]),t(l,[2,50],{10:fe}),t(pe,[2,28],{16:104,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z})],defaultActions:{8:[2,30],9:[2,31]},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;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.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-CHjSjwoV.js";import{m as t,p as n}from"./src-zrGbZsfc.js";import{D as r,H as i,K as a,U as o,a as s,c,f as l,v as u,w as d,x as f,y as p,z as m}from"./chunk-WYO6CB5R-B30N3ZP8.js";import{t as h}from"./linear-D7CWUHTF.js";var g=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,3],r=[1,4],i=[1,5],a=[1,6],o=[1,7],s=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],l=[55,56,57],u=[2,36],d=[1,37],f=[1,36],p=[1,38],m=[1,35],h=[1,43],g=[1,41],_=[1,45],v=[1,14],y=[1,23],b=[1,18],x=[1,19],S=[1,20],C=[1,21],w=[1,22],T=[1,24],E=[1,25],D=[1,26],O=[1,27],k=[1,28],A=[1,29],j=[1,32],M=[1,33],N=[1,34],P=[1,39],F=[1,40],I=[1,42],L=[1,44],R=[1,63],z=[1,62],B=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],ee=[1,66],te=[1,67],ne=[1,68],re=[1,69],ie=[1,70],ae=[1,71],oe=[1,72],se=[1,73],ce=[1,74],le=[1,75],ue=[1,76],de=[1,77],V=[4,5,6,7,8,9,10,11,12,13,14,15,18],H=[1,91],U=[1,92],W=[1,93],G=[1,100],K=[1,94],q=[1,97],J=[1,95],Y=[1,96],X=[1,98],Z=[1,99],fe=[1,103],pe=[10,55,56,57],Q=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],me={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:`error`,4:`ALPHA`,5:`NUM`,6:`NODE_STRING`,7:`DOWN`,8:`MINUS`,9:`DEFAULT`,10:`COMMA`,11:`COLON`,12:`AMP`,13:`BRKT`,14:`MULT`,15:`UNICODE_TEXT`,17:`UNIT`,18:`SPACE`,19:`STYLE`,20:`PCT`,25:`CLASSDEF`,28:`QUADRANT`,35:`title`,36:`title_value`,37:`acc_title`,38:`acc_title_value`,39:`acc_descr`,40:`acc_descr_value`,41:`acc_descr_multiline_value`,42:`section`,44:`point_start`,45:`point_x`,46:`point_y`,47:`class_name`,48:`X-AXIS`,49:`AXIS-TEXT-DELIMITER`,50:`Y-AXIS`,51:`QUADRANT_1`,52:`QUADRANT_2`,53:`QUADRANT_3`,54:`QUADRANT_4`,55:`NEWLINE`,56:`SEMI`,57:`EOF`,60:`STR`,61:`MD_STR`,63:`PUNCTUATION`,64:`PLUS`,65:`EQUALS`,66:`DOT`,67:`UNDERSCORE`},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 23:this.$=a[s];break;case 24:this.$=a[s-1]+``+a[s];break;case 26:this.$=a[s-1]+a[s];break;case 27:this.$=[a[s].trim()];break;case 28:a[s-2].push(a[s].trim()),this.$=a[s-2];break;case 29:this.$=a[s-4],r.addClass(a[s-2],a[s]);break;case 37:this.$=[];break;case 42:this.$=a[s].trim(),r.setDiagramTitle(this.$);break;case 43:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 44:case 45:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 46:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 47:r.addPoint(a[s-3],``,a[s-1],a[s],[]);break;case 48:r.addPoint(a[s-4],a[s-3],a[s-1],a[s],[]);break;case 49:r.addPoint(a[s-4],``,a[s-2],a[s-1],a[s]);break;case 50:r.addPoint(a[s-5],a[s-4],a[s-2],a[s-1],a[s]);break;case 51:r.setXAxisLeftText(a[s-2]),r.setXAxisRightText(a[s]);break;case 52:a[s-1].text+=` ⟶ `,r.setXAxisLeftText(a[s-1]);break;case 53:r.setXAxisLeftText(a[s]);break;case 54:r.setYAxisBottomText(a[s-2]),r.setYAxisTopText(a[s]);break;case 55:a[s-1].text+=` ⟶ `,r.setYAxisBottomText(a[s-1]);break;case 56:r.setYAxisBottomText(a[s]);break;case 57:r.setQuadrant1Text(a[s]);break;case 58:r.setQuadrant2Text(a[s]);break;case 59:r.setQuadrant3Text(a[s]);break;case 60:r.setQuadrant4Text(a[s]);break;case 64:this.$={text:a[s],type:`text`};break;case 65:this.$={text:a[s-1].text+``+a[s],type:a[s-1].type};break;case 66:this.$={text:a[s],type:`text`};break;case 67:this.$={text:a[s],type:`markdown`};break;case 68:this.$=a[s];break;case 69:this.$=a[s-1]+``+a[s];break}},`anonymous`),table:[{18:n,26:1,27:2,28:r,55:i,56:a,57:o},{1:[3]},{18:n,26:8,27:2,28:r,55:i,56:a,57:o},{18:n,26:9,27:2,28:r,55:i,56:a,57:o},t(s,[2,33],{29:10}),t(c,[2,61]),t(c,[2,62]),t(c,[2,63]),{1:[2,30]},{1:[2,31]},t(l,u,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:f,10:p,12:m,13:h,14:g,15:_,18:v,25:y,35:b,37:x,39:S,41:C,42:w,48:T,50:E,51:D,52:O,53:k,54:A,60:j,61:M,63:N,64:P,65:F,66:I,67:L}),t(s,[2,34]),{27:46,55:i,56:a,57:o},t(l,[2,37]),t(l,u,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:f,10:p,12:m,13:h,14:g,15:_,18:v,25:y,35:b,37:x,39:S,41:C,42:w,48:T,50:E,51:D,52:O,53:k,54:A,60:j,61:M,63:N,64:P,65:F,66:I,67:L}),t(l,[2,39]),t(l,[2,40]),t(l,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(l,[2,45]),t(l,[2,46]),{18:[1,51]},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:52,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:53,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:54,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:55,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:56,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,10:p,12:m,13:h,14:g,15:_,43:57,58:31,60:j,61:M,63:N,64:P,65:F,66:I,67:L},{4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,44:[1,58],47:[1,59],58:61,59:60,63:N,64:P,65:F,66:I,67:L},t(B,[2,64]),t(B,[2,66]),t(B,[2,67]),t(B,[2,70]),t(B,[2,71]),t(B,[2,72]),t(B,[2,73]),t(B,[2,74]),t(B,[2,75]),t(B,[2,76]),t(B,[2,77]),t(B,[2,78]),t(B,[2,79]),t(B,[2,80]),t(B,[2,81]),t(s,[2,35]),t(l,[2,38]),t(l,[2,42]),t(l,[2,43]),t(l,[2,44]),{3:65,4:ee,5:te,6:ne,7:re,8:ie,9:ae,10:oe,11:se,12:ce,13:le,14:ue,15:de,21:64},t(l,[2,53],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,49:[1,78],63:N,64:P,65:F,66:I,67:L}),t(l,[2,56],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,49:[1,79],63:N,64:P,65:F,66:I,67:L}),t(l,[2,57],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),t(l,[2,58],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),t(l,[2,59],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),t(l,[2,60],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),{45:[1,80]},{44:[1,81]},t(B,[2,65]),t(B,[2,82]),t(B,[2,83]),t(B,[2,84]),{3:83,4:ee,5:te,6:ne,7:re,8:ie,9:ae,10:oe,11:se,12:ce,13:le,14:ue,15:de,18:[1,82]},t(V,[2,23]),t(V,[2,1]),t(V,[2,2]),t(V,[2,3]),t(V,[2,4]),t(V,[2,5]),t(V,[2,6]),t(V,[2,7]),t(V,[2,8]),t(V,[2,9]),t(V,[2,10]),t(V,[2,11]),t(V,[2,12]),t(l,[2,52],{58:31,43:84,4:d,5:f,10:p,12:m,13:h,14:g,15:_,60:j,61:M,63:N,64:P,65:F,66:I,67:L}),t(l,[2,55],{58:31,43:85,4:d,5:f,10:p,12:m,13:h,14:g,15:_,60:j,61:M,63:N,64:P,65:F,66:I,67:L}),{46:[1,86]},{45:[1,87]},{4:H,5:U,6:W,8:G,11:K,13:q,16:90,17:J,18:Y,19:X,20:Z,22:89,23:88},t(V,[2,24]),t(l,[2,51],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),t(l,[2,54],{59:60,58:61,4:d,5:f,8:R,10:p,12:m,13:h,14:g,15:_,18:z,63:N,64:P,65:F,66:I,67:L}),t(l,[2,47],{22:89,16:90,23:101,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z}),{46:[1,102]},t(l,[2,29],{10:fe}),t(pe,[2,27],{16:104,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z}),t(Q,[2,25]),t(Q,[2,13]),t(Q,[2,14]),t(Q,[2,15]),t(Q,[2,16]),t(Q,[2,17]),t(Q,[2,18]),t(Q,[2,19]),t(Q,[2,20]),t(Q,[2,21]),t(Q,[2,22]),t(l,[2,49],{10:fe}),t(l,[2,48],{22:89,16:90,23:105,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z}),{4:H,5:U,6:W,8:G,11:K,13:q,16:90,17:J,18:Y,19:X,20:Z,22:106},t(Q,[2,26]),t(l,[2,50],{10:fe}),t(pe,[2,28],{16:104,4:H,5:U,6:W,8:G,11:K,13:q,17:J,18:Y,19:X,20:Z})],defaultActions:{8:[2,30],9:[2,31]},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;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.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`)};me.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()+`
@@ -0,0 +1 @@
1
+ import"./chunk-KEIR6QF5-BOAXXeyv.js";import{n as e}from"./chunk-QBLGF6JB-CHiGeRY1.js";export{e as createRadarServices};
@@ -0,0 +1 @@
1
+ import"./chunk-KEIR6QF5-BOAXXeyv.js";import{n as e}from"./chunk-5TONJI2A-BhpKv1k2.js";export{e as createRailroadServices};
@@ -0,0 +1 @@
1
+ import"./chunk-KEIR6QF5-BOAXXeyv.js";import{n as e}from"./chunk-5HE753X5-DqaMSMeS.js";export{e as createRailroadAbnfServices};
@@ -0,0 +1 @@
1
+ import"./chunk-KEIR6QF5-BOAXXeyv.js";import{n as e}from"./chunk-U6XO7XAA-CM0EK7Y0.js";export{e as createRailroadEbnfServices};
@@ -0,0 +1 @@
1
+ import"./chunk-KEIR6QF5-BOAXXeyv.js";import{n as e}from"./chunk-JG7HCLWE-DnCasQja.js";export{e as createRailroadPegServices};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-5TONJI2A-BKFbUT7J.js";import{n as t}from"./chunk-Y2CYZVJY-rfGCG6pM.js";import{m as n}from"./src-CI2AvEMj.js";import"./chunk-WYO6CB5R-DPDGhyF6.js";import"./chunk-VAUOI2AC-GYimZYx9.js";import{n as r,r as i,t as a}from"./chunk-MOJQB5TN-CV10sB1I.js";import{t as o}from"./chunk-JWPE2WC7-BpiZMeRl.js";import{t as s}from"./mermaid-parser.core-BTJFnvRC.js";var c=e().Railroad.parser.LangiumParser,l=t(e=>{switch(e.$type){case`RailroadTerminalExpr`:return{type:`terminal`,value:e.value};case`RailroadNonTerminalExpr`:return{type:`nonterminal`,name:e.name};case`RailroadSpecialExpr`:return{type:`special`,text:e.text};case`RailroadSequenceExpr`:{let t=e.elements.map(l);return t.length===1?t[0]:{type:`sequence`,elements:t}}case`RailroadChoiceExpr`:{let t=e.alternatives.map(l);return t.length===1?t[0]:{type:`choice`,alternatives:t}}case`RailroadOptionalExpr`:return{type:`optional`,element:l(e.element)};case`RailroadOneOrMoreExpr`:return{type:`repetition`,element:l(e.element),min:1,max:1/0};case`RailroadZeroOrMoreExpr`:return{type:`repetition`,element:l(e.element),min:0,max:1/0};default:throw Error(`Unsupported railroad expression: ${e.$type}`)}},`transformExpression`),u=t(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),d=t(e=>{o(e,a),e.title&&a.setTitle(e.title),e.rules.map(e=>a.addRule(u(e)))},`populateDb`),f={parser:{parse:t(e=>{a.clear(),n.debug(`[Railroad Parser] Starting Langium parse`);let t=c.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new s(t);let r=t.value;n.debug(`[Railroad Parser] Parsed rules:`,r.rules.length),d(r),n.debug(`[Railroad Parser] Parse complete`)},`parse`),parser:{yy:a}},db:a,renderer:i,styles:r};export{f as diagram};
1
+ import{n as e}from"./chunk-5TONJI2A-BhpKv1k2.js";import{n as t}from"./chunk-Y2CYZVJY-CHjSjwoV.js";import{m as n}from"./src-zrGbZsfc.js";import"./chunk-WYO6CB5R-B30N3ZP8.js";import"./chunk-VAUOI2AC-CsTIB8qD.js";import{n as r,r as i,t as a}from"./chunk-MOJQB5TN-Pi--K4-1.js";import{t as o}from"./chunk-JWPE2WC7-C3CkbEj1.js";import{t as s}from"./mermaid-parser.core-Cc9wjl82.js";var c=e().Railroad.parser.LangiumParser,l=t(e=>{switch(e.$type){case`RailroadTerminalExpr`:return{type:`terminal`,value:e.value};case`RailroadNonTerminalExpr`:return{type:`nonterminal`,name:e.name};case`RailroadSpecialExpr`:return{type:`special`,text:e.text};case`RailroadSequenceExpr`:{let t=e.elements.map(l);return t.length===1?t[0]:{type:`sequence`,elements:t}}case`RailroadChoiceExpr`:{let t=e.alternatives.map(l);return t.length===1?t[0]:{type:`choice`,alternatives:t}}case`RailroadOptionalExpr`:return{type:`optional`,element:l(e.element)};case`RailroadOneOrMoreExpr`:return{type:`repetition`,element:l(e.element),min:1,max:1/0};case`RailroadZeroOrMoreExpr`:return{type:`repetition`,element:l(e.element),min:0,max:1/0};default:throw Error(`Unsupported railroad expression: ${e.$type}`)}},`transformExpression`),u=t(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),d=t(e=>{o(e,a),e.title&&a.setTitle(e.title),e.rules.map(e=>a.addRule(u(e)))},`populateDb`),f={parser:{parse:t(e=>{a.clear(),n.debug(`[Railroad Parser] Starting Langium parse`);let t=c.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new s(t);let r=t.value;n.debug(`[Railroad Parser] Parsed rules:`,r.rules.length),d(r),n.debug(`[Railroad Parser] Parse complete`)},`parse`),parser:{yy:a}},db:a,renderer:i,styles:r};export{f as diagram};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-Lnt-4LMC.js";var t=e(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
1
+ import{t as e}from"./createLucideIcon-reFMl-W-.js";var t=e(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{F as e}from"./app-presenter-provider-_UK6sArj.js";export{e as RemoteAccessPage};
@@ -1,4 +1,4 @@
1
- import{n as e,t}from"./chunk-Y2CYZVJY-rfGCG6pM.js";import{m as n}from"./src-CI2AvEMj.js";import{H as r,K as i,U as a,a as o,b as s,v as c,w as l,x as u,y as d}from"./chunk-WYO6CB5R-DPDGhyF6.js";import{g as f}from"./chunk-ICXQ74PX-F_pmNX6t.js";import"./chunk-HOUHSVGY-i3MDyUY5.js";import"./chunk-Q4XR5HBZ-GE0v_E5y.js";import"./chunk-7BUUIJ7U-CvSeJlKZ.js";import"./chunk-OGEWGWER-DuSw54VR.js";import{t as p}from"./chunk-XXDRQBXY-KKCf0HV5.js";import{t as m}from"./chunk-VR4S4FIN-COdhHR1o.js";import"./chunk-C7G6YPKG-BTL0-xL3.js";import"./chunk-ZGVPDNZ5-BuNKD836.js";import"./chunk-52WLFC77-ZXIcYPYs.js";import{r as h,t as g}from"./chunk-FWX5IMBZ-DUuJUrXJ.js";var _=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,3],r=[1,4],i=[1,5],a=[1,6],o=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],s=[1,22],c=[2,7],l=[1,26],u=[1,27],d=[1,28],f=[1,29],p=[1,33],m=[1,34],h=[1,35],g=[1,36],_=[1,37],v=[1,38],y=[1,24],b=[1,31],x=[1,32],S=[1,30],C=[1,39],w=[1,40],T=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],E=[1,61],D=[89,90],O=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],k=[27,29],ee=[1,70],A=[1,71],te=[1,72],ne=[1,73],re=[1,74],ie=[1,75],ae=[1,76],j=[1,83],M=[1,80],N=[1,84],P=[1,85],F=[1,86],I=[1,87],L=[1,88],R=[1,89],z=[1,90],B=[1,91],V=[1,92],oe=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],H=[63,64],se=[1,101],ce=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],U=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],W=[1,110],G=[1,106],K=[1,107],q=[1,108],J=[1,109],Y=[1,111],X=[1,116],Z=[1,117],Q=[1,114],$=[1,115],le={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:`error`,5:`NEWLINE`,6:`RD`,8:`EOF`,9:`acc_title`,10:`acc_title_value`,11:`acc_descr`,12:`acc_descr_value`,13:`acc_descr_multiline_value`,21:`direction_tb`,22:`direction_bt`,23:`direction_rl`,24:`direction_lr`,27:`STRUCT_START`,29:`STYLE_SEPARATOR`,31:`ID`,32:`COLONSEP`,34:`TEXT`,36:`RISK`,38:`VERIFYMTHD`,40:`STRUCT_STOP`,41:`REQUIREMENT`,42:`FUNCTIONAL_REQUIREMENT`,43:`INTERFACE_REQUIREMENT`,44:`PERFORMANCE_REQUIREMENT`,45:`PHYSICAL_REQUIREMENT`,46:`DESIGN_CONSTRAINT`,47:`LOW_RISK`,48:`MED_RISK`,49:`HIGH_RISK`,50:`VERIFY_ANALYSIS`,51:`VERIFY_DEMONSTRATION`,52:`VERIFY_INSPECTION`,53:`VERIFY_TEST`,54:`ELEMENT`,57:`TYPE`,59:`DOCREF`,61:`END_ARROW_L`,63:`LINE`,64:`END_ARROW_R`,65:`CONTAINS`,66:`COPIES`,67:`DERIVES`,68:`SATISFIES`,69:`VERIFIES`,70:`REFINES`,71:`TRACES`,72:`CLASSDEF`,74:`CLASS`,75:`ALPHA`,76:`COMMA`,77:`STYLE`,80:`NUM`,81:`COLON`,82:`UNIT`,83:`SPACE`,84:`BRKT`,85:`PCT`,86:`MINUS`,87:`LABEL`,88:`SEMICOLON`,89:`unqString`,90:`qString`},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 4:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 5:case 6:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:r.setDirection(`TB`);break;case 18:r.setDirection(`BT`);break;case 19:r.setDirection(`RL`);break;case 20:r.setDirection(`LR`);break;case 21:r.addRequirement(a[s-3],a[s-4]);break;case 22:r.addRequirement(a[s-5],a[s-6]),r.setClass([a[s-5]],a[s-3]);break;case 23:r.setNewReqId(a[s-2]);break;case 24:r.setNewReqText(a[s-2]);break;case 25:r.setNewReqRisk(a[s-2]);break;case 26:r.setNewReqVerifyMethod(a[s-2]);break;case 29:this.$=r.RequirementType.REQUIREMENT;break;case 30:this.$=r.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=r.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=r.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=r.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=r.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=r.RiskLevel.LOW_RISK;break;case 36:this.$=r.RiskLevel.MED_RISK;break;case 37:this.$=r.RiskLevel.HIGH_RISK;break;case 38:this.$=r.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=r.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=r.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=r.VerifyType.VERIFY_TEST;break;case 42:r.addElement(a[s-3]);break;case 43:r.addElement(a[s-5]),r.setClass([a[s-5]],a[s-3]);break;case 44:r.setNewElementType(a[s-2]);break;case 45:r.setNewElementDocRef(a[s-2]);break;case 48:r.addRelationship(a[s-2],a[s],a[s-4]);break;case 49:r.addRelationship(a[s-2],a[s-4],a[s]);break;case 50:this.$=r.Relationships.CONTAINS;break;case 51:this.$=r.Relationships.COPIES;break;case 52:this.$=r.Relationships.DERIVES;break;case 53:this.$=r.Relationships.SATISFIES;break;case 54:this.$=r.Relationships.VERIFIES;break;case 55:this.$=r.Relationships.REFINES;break;case 56:this.$=r.Relationships.TRACES;break;case 57:this.$=a[s-2],r.defineClass(a[s-1],a[s]);break;case 58:r.setClass(a[s-1],a[s]);break;case 59:r.setClass([a[s-2]],a[s]);break;case 60:case 62:this.$=[a[s]];break;case 61:case 63:this.$=a[s-2].concat([a[s]]);break;case 64:this.$=a[s-2],r.setCssStyle(a[s-1],a[s]);break;case 65:this.$=[a[s]];break;case 66:a[s-2].push(a[s]),this.$=a[s-2];break;case 68:this.$=a[s-1]+a[s];break}},`anonymous`),table:[{3:1,4:2,6:n,9:r,11:i,13:a},{1:[3]},{3:8,4:2,5:[1,7],6:n,9:r,11:i,13:a},{5:[1,9]},{10:[1,10]},{12:[1,11]},t(o,[2,6]),{3:12,4:2,6:n,9:r,11:i,13:a},{1:[2,2]},{4:17,5:s,7:13,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},t(o,[2,4]),t(o,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:s,7:42,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:43,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:44,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:45,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:46,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:47,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:48,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:49,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:50,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},t(T,[2,17]),t(T,[2,18]),t(T,[2,19]),t(T,[2,20]),{30:60,33:62,75:E,89:C,90:w},{30:63,33:62,75:E,89:C,90:w},{30:64,33:62,75:E,89:C,90:w},t(D,[2,29]),t(D,[2,30]),t(D,[2,31]),t(D,[2,32]),t(D,[2,33]),t(D,[2,34]),t(O,[2,81]),t(O,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},t(k,[2,79]),t(k,[2,80]),{27:[1,67],29:[1,68]},t(k,[2,85]),t(k,[2,86]),{62:69,65:ee,66:A,67:te,68:ne,69:re,70:ie,71:ae},{62:77,65:ee,66:A,67:te,68:ne,69:re,70:ie,71:ae},{30:78,33:62,75:E,89:C,90:w},{73:79,75:j,76:M,78:81,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},t(oe,[2,60]),t(oe,[2,62]),{73:93,75:j,76:M,78:81,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},{30:94,33:62,75:E,76:M,89:C,90:w},{5:[1,95]},{30:96,33:62,75:E,89:C,90:w},{5:[1,97]},{30:98,33:62,75:E,89:C,90:w},{63:[1,99]},t(H,[2,50]),t(H,[2,51]),t(H,[2,52]),t(H,[2,53]),t(H,[2,54]),t(H,[2,55]),t(H,[2,56]),{64:[1,100]},t(T,[2,59],{76:M}),t(T,[2,64],{76:se}),{33:103,75:[1,102],89:C,90:w},t(ce,[2,65],{79:104,75:j,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V}),t(U,[2,67]),t(U,[2,69]),t(U,[2,70]),t(U,[2,71]),t(U,[2,72]),t(U,[2,73]),t(U,[2,74]),t(U,[2,75]),t(U,[2,76]),t(U,[2,77]),t(U,[2,78]),t(T,[2,57],{76:se}),t(T,[2,58],{76:M}),{5:W,28:105,31:G,34:K,36:q,38:J,40:Y},{27:[1,112],76:M},{5:X,40:Z,56:113,57:Q,59:$},{27:[1,118],76:M},{33:119,89:C,90:w},{33:120,89:C,90:w},{75:j,78:121,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},t(oe,[2,61]),t(oe,[2,63]),t(U,[2,68]),t(T,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:W,28:126,31:G,34:K,36:q,38:J,40:Y},t(T,[2,28]),{5:[1,127]},t(T,[2,42]),{32:[1,128]},{32:[1,129]},{5:X,40:Z,56:130,57:Q,59:$},t(T,[2,47]),{5:[1,131]},t(T,[2,48]),t(T,[2,49]),t(ce,[2,66],{79:104,75:j,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V}),{33:132,89:C,90:w},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},t(T,[2,27]),{5:W,28:145,31:G,34:K,36:q,38:J,40:Y},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},t(T,[2,46]),{5:X,40:Z,56:152,57:Q,59:$},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},t(T,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},t(T,[2,43]),{5:W,28:159,31:G,34:K,36:q,38:J,40:Y},{5:W,28:160,31:G,34:K,36:q,38:J,40:Y},{5:W,28:161,31:G,34:K,36:q,38:J,40:Y},{5:W,28:162,31:G,34:K,36:q,38:J,40:Y},{5:X,40:Z,56:163,57:Q,59:$},{5:X,40:Z,56:164,57:Q,59:$},t(T,[2,23]),t(T,[2,24]),t(T,[2,25]),t(T,[2,26]),t(T,[2,44]),t(T,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},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;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.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,ee,A;;){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 te=``;for(O in A=[],s[w])this.terminals_[O]&&O>f&&A.push(`'`+this.terminals_[O]+`'`);te=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{n as e,t}from"./chunk-Y2CYZVJY-CHjSjwoV.js";import{m as n}from"./src-zrGbZsfc.js";import{H as r,K as i,U as a,a as o,b as s,v as c,w as l,x as u,y as d}from"./chunk-WYO6CB5R-B30N3ZP8.js";import{g as f}from"./chunk-ICXQ74PX-BRPUu3ff.js";import"./chunk-HOUHSVGY-Dd_Ycn9Z.js";import"./chunk-Q4XR5HBZ-UYxXzi7_.js";import"./chunk-7BUUIJ7U-CgDQOLnC.js";import"./chunk-OGEWGWER-BetLLyJt.js";import{t as p}from"./chunk-XXDRQBXY-DK6dz0Q3.js";import{t as m}from"./chunk-VR4S4FIN-CY5KYeEi.js";import"./chunk-C7G6YPKG-CNGFAFYL.js";import"./chunk-ZGVPDNZ5-BN5NX5qA.js";import"./chunk-52WLFC77-aJoxU2Ow.js";import{r as h,t as g}from"./chunk-FWX5IMBZ-BdHymAs0.js";var _=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,3],r=[1,4],i=[1,5],a=[1,6],o=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],s=[1,22],c=[2,7],l=[1,26],u=[1,27],d=[1,28],f=[1,29],p=[1,33],m=[1,34],h=[1,35],g=[1,36],_=[1,37],v=[1,38],y=[1,24],b=[1,31],x=[1,32],S=[1,30],C=[1,39],w=[1,40],T=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],E=[1,61],D=[89,90],O=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],k=[27,29],ee=[1,70],A=[1,71],te=[1,72],ne=[1,73],re=[1,74],ie=[1,75],ae=[1,76],j=[1,83],M=[1,80],N=[1,84],P=[1,85],F=[1,86],I=[1,87],L=[1,88],R=[1,89],z=[1,90],B=[1,91],V=[1,92],oe=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],H=[63,64],se=[1,101],ce=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],U=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],W=[1,110],G=[1,106],K=[1,107],q=[1,108],J=[1,109],Y=[1,111],X=[1,116],Z=[1,117],Q=[1,114],$=[1,115],le={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:`error`,5:`NEWLINE`,6:`RD`,8:`EOF`,9:`acc_title`,10:`acc_title_value`,11:`acc_descr`,12:`acc_descr_value`,13:`acc_descr_multiline_value`,21:`direction_tb`,22:`direction_bt`,23:`direction_rl`,24:`direction_lr`,27:`STRUCT_START`,29:`STYLE_SEPARATOR`,31:`ID`,32:`COLONSEP`,34:`TEXT`,36:`RISK`,38:`VERIFYMTHD`,40:`STRUCT_STOP`,41:`REQUIREMENT`,42:`FUNCTIONAL_REQUIREMENT`,43:`INTERFACE_REQUIREMENT`,44:`PERFORMANCE_REQUIREMENT`,45:`PHYSICAL_REQUIREMENT`,46:`DESIGN_CONSTRAINT`,47:`LOW_RISK`,48:`MED_RISK`,49:`HIGH_RISK`,50:`VERIFY_ANALYSIS`,51:`VERIFY_DEMONSTRATION`,52:`VERIFY_INSPECTION`,53:`VERIFY_TEST`,54:`ELEMENT`,57:`TYPE`,59:`DOCREF`,61:`END_ARROW_L`,63:`LINE`,64:`END_ARROW_R`,65:`CONTAINS`,66:`COPIES`,67:`DERIVES`,68:`SATISFIES`,69:`VERIFIES`,70:`REFINES`,71:`TRACES`,72:`CLASSDEF`,74:`CLASS`,75:`ALPHA`,76:`COMMA`,77:`STYLE`,80:`NUM`,81:`COLON`,82:`UNIT`,83:`SPACE`,84:`BRKT`,85:`PCT`,86:`MINUS`,87:`LABEL`,88:`SEMICOLON`,89:`unqString`,90:`qString`},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 4:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 5:case 6:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:r.setDirection(`TB`);break;case 18:r.setDirection(`BT`);break;case 19:r.setDirection(`RL`);break;case 20:r.setDirection(`LR`);break;case 21:r.addRequirement(a[s-3],a[s-4]);break;case 22:r.addRequirement(a[s-5],a[s-6]),r.setClass([a[s-5]],a[s-3]);break;case 23:r.setNewReqId(a[s-2]);break;case 24:r.setNewReqText(a[s-2]);break;case 25:r.setNewReqRisk(a[s-2]);break;case 26:r.setNewReqVerifyMethod(a[s-2]);break;case 29:this.$=r.RequirementType.REQUIREMENT;break;case 30:this.$=r.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=r.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=r.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=r.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=r.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=r.RiskLevel.LOW_RISK;break;case 36:this.$=r.RiskLevel.MED_RISK;break;case 37:this.$=r.RiskLevel.HIGH_RISK;break;case 38:this.$=r.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=r.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=r.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=r.VerifyType.VERIFY_TEST;break;case 42:r.addElement(a[s-3]);break;case 43:r.addElement(a[s-5]),r.setClass([a[s-5]],a[s-3]);break;case 44:r.setNewElementType(a[s-2]);break;case 45:r.setNewElementDocRef(a[s-2]);break;case 48:r.addRelationship(a[s-2],a[s],a[s-4]);break;case 49:r.addRelationship(a[s-2],a[s-4],a[s]);break;case 50:this.$=r.Relationships.CONTAINS;break;case 51:this.$=r.Relationships.COPIES;break;case 52:this.$=r.Relationships.DERIVES;break;case 53:this.$=r.Relationships.SATISFIES;break;case 54:this.$=r.Relationships.VERIFIES;break;case 55:this.$=r.Relationships.REFINES;break;case 56:this.$=r.Relationships.TRACES;break;case 57:this.$=a[s-2],r.defineClass(a[s-1],a[s]);break;case 58:r.setClass(a[s-1],a[s]);break;case 59:r.setClass([a[s-2]],a[s]);break;case 60:case 62:this.$=[a[s]];break;case 61:case 63:this.$=a[s-2].concat([a[s]]);break;case 64:this.$=a[s-2],r.setCssStyle(a[s-1],a[s]);break;case 65:this.$=[a[s]];break;case 66:a[s-2].push(a[s]),this.$=a[s-2];break;case 68:this.$=a[s-1]+a[s];break}},`anonymous`),table:[{3:1,4:2,6:n,9:r,11:i,13:a},{1:[3]},{3:8,4:2,5:[1,7],6:n,9:r,11:i,13:a},{5:[1,9]},{10:[1,10]},{12:[1,11]},t(o,[2,6]),{3:12,4:2,6:n,9:r,11:i,13:a},{1:[2,2]},{4:17,5:s,7:13,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},t(o,[2,4]),t(o,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:s,7:42,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:43,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:44,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:45,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:46,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:47,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:48,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:49,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{4:17,5:s,7:50,8:c,9:r,11:i,13:a,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:d,24:f,25:23,33:25,41:p,42:m,43:h,44:g,45:_,46:v,54:y,72:b,74:x,77:S,89:C,90:w},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},t(T,[2,17]),t(T,[2,18]),t(T,[2,19]),t(T,[2,20]),{30:60,33:62,75:E,89:C,90:w},{30:63,33:62,75:E,89:C,90:w},{30:64,33:62,75:E,89:C,90:w},t(D,[2,29]),t(D,[2,30]),t(D,[2,31]),t(D,[2,32]),t(D,[2,33]),t(D,[2,34]),t(O,[2,81]),t(O,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},t(k,[2,79]),t(k,[2,80]),{27:[1,67],29:[1,68]},t(k,[2,85]),t(k,[2,86]),{62:69,65:ee,66:A,67:te,68:ne,69:re,70:ie,71:ae},{62:77,65:ee,66:A,67:te,68:ne,69:re,70:ie,71:ae},{30:78,33:62,75:E,89:C,90:w},{73:79,75:j,76:M,78:81,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},t(oe,[2,60]),t(oe,[2,62]),{73:93,75:j,76:M,78:81,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},{30:94,33:62,75:E,76:M,89:C,90:w},{5:[1,95]},{30:96,33:62,75:E,89:C,90:w},{5:[1,97]},{30:98,33:62,75:E,89:C,90:w},{63:[1,99]},t(H,[2,50]),t(H,[2,51]),t(H,[2,52]),t(H,[2,53]),t(H,[2,54]),t(H,[2,55]),t(H,[2,56]),{64:[1,100]},t(T,[2,59],{76:M}),t(T,[2,64],{76:se}),{33:103,75:[1,102],89:C,90:w},t(ce,[2,65],{79:104,75:j,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V}),t(U,[2,67]),t(U,[2,69]),t(U,[2,70]),t(U,[2,71]),t(U,[2,72]),t(U,[2,73]),t(U,[2,74]),t(U,[2,75]),t(U,[2,76]),t(U,[2,77]),t(U,[2,78]),t(T,[2,57],{76:se}),t(T,[2,58],{76:M}),{5:W,28:105,31:G,34:K,36:q,38:J,40:Y},{27:[1,112],76:M},{5:X,40:Z,56:113,57:Q,59:$},{27:[1,118],76:M},{33:119,89:C,90:w},{33:120,89:C,90:w},{75:j,78:121,79:82,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V},t(oe,[2,61]),t(oe,[2,63]),t(U,[2,68]),t(T,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:W,28:126,31:G,34:K,36:q,38:J,40:Y},t(T,[2,28]),{5:[1,127]},t(T,[2,42]),{32:[1,128]},{32:[1,129]},{5:X,40:Z,56:130,57:Q,59:$},t(T,[2,47]),{5:[1,131]},t(T,[2,48]),t(T,[2,49]),t(ce,[2,66],{79:104,75:j,80:N,81:P,82:F,83:I,84:L,85:R,86:z,87:B,88:V}),{33:132,89:C,90:w},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},t(T,[2,27]),{5:W,28:145,31:G,34:K,36:q,38:J,40:Y},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},t(T,[2,46]),{5:X,40:Z,56:152,57:Q,59:$},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},t(T,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},t(T,[2,43]),{5:W,28:159,31:G,34:K,36:q,38:J,40:Y},{5:W,28:160,31:G,34:K,36:q,38:J,40:Y},{5:W,28:161,31:G,34:K,36:q,38:J,40:Y},{5:W,28:162,31:G,34:K,36:q,38:J,40:Y},{5:X,40:Z,56:163,57:Q,59:$},{5:X,40:Z,56:164,57:Q,59:$},t(T,[2,23]),t(T,[2,24]),t(T,[2,25]),t(T,[2,26]),t(T,[2,44]),t(T,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},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;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.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,ee,A;;){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 te=``;for(O in A=[],s[w])this.terminals_[O]&&O>f&&A.push(`'`+this.terminals_[O]+`'`);te=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+A.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(te,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:A})}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._$),ee=s[r[r.length-2]][r[r.length-1]],r.push(ee);break;case 3:return!0}}return!0},`parse`)};le.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()+`
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-Lnt-4LMC.js";var t=e(`RotateCw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]);export{t};
1
+ import{t as e}from"./createLucideIcon-reFMl-W-.js";var t=e(`RotateCw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{r as t}from"./pwa-CAg_9zFs.js";import{Gt as n,Jt as r,Kt as i,Ut as a,Xn as o,Yt as s,Zt as c,dn as l,ln as u,pn as d,qt as f,sn as p,ur as m,xr as h}from"./api-CI6_8Qt1.js";import{L as g,R as _,Zt as v,pt as y}from"./app-presenter-provider-_UK6sArj.js";import{X as b}from"./context-menu-dGVv8klA.js";import{i as x}from"./x-E9VB4HQx.js";import{t as S}from"./plus-DUdl68Eo.js";import{t as C}from"./rotate-cw-aBponvp7.js";import{t as w}from"./save-394QCMXn.js";import{t as T}from"./trash-2-DvJ6duOW.js";import{s as E}from"./i18n-IGQbjBqS.js";import{a as D,i as O,n as k,r as A,t as j}from"./select-xUXYV0Gr.js";import{b as M,t as ee}from"./use-config-COusaY5p.js";import{t as te}from"./form-actions-B8VniHts.js";var N=e(h(),1),P=m(),F={healthy:`runtimeControlHealthy`,"starting-service":`runtimeControlStartingService`,"restarting-service":`runtimeControlRestartingService`,"stopping-service":`runtimeControlStoppingService`,"restarting-app":`runtimeControlRestartingApp`,recovering:`runtimeControlRecovering`,failed:`runtimeControlFailed`},I={running:`runtimeControlServiceRunning`,stopped:`runtimeControlServiceStopped`,starting:`runtimeControlServiceStarting`,stopping:`runtimeControlServiceStopping`,restarting:`runtimeControlServiceRestarting`},L={"desktop-embedded":`runtimeControlEnvironmentDesktop`,"managed-local-service":`runtimeControlEnvironmentManagedService`,"self-hosted-web":`runtimeControlEnvironmentSelfHosted`,"shared-web":`runtimeControlEnvironmentSharedWeb`};function R(e){return E(F[e]??`runtimeControlUnavailable`)}function z(e){return E(I[e]??`runtimeControlServiceUnknown`)}function B(e){return E(L[e.environment])}function V(e,t){return t===`start-service`?e?.canStartService:t===`stop-service`?e?.canStopService:e?.canRestartService}function H(e){return e?[{action:`start-service`,capability:e.canStartService,label:E(`runtimeControlStartService`),icon:`play`},{action:`restart-service`,capability:e.canRestartService,label:E(`runtimeControlRestartService`),icon:`rotate`},{action:`stop-service`,capability:e.canStopService,label:E(`runtimeControlStopService`),icon:`square`,variant:`destructive`},{action:`restart-app`,capability:e.canRestartApp,label:E(`runtimeControlRestartApp`),icon:`rotate`,variant:`secondary`}].filter(e=>e.capability.available||!!e.capability.reasonIfUnavailable):[]}function U(e){let{busy:t,icon:n}=e;return t?(0,P.jsx)(x,{className:`mr-2 h-4 w-4 animate-spin`}):n===`play`?(0,P.jsx)(b,{className:`mr-2 h-4 w-4`}):n===`square`?(0,P.jsx)(v,{className:`mr-2 h-4 w-4`}):(0,P.jsx)(C,{className:`mr-2 h-4 w-4`})}function W(){let{busy:e,busyAction:t,controlView:n,errorMessage:i,pendingRestart:a,visibleLifecycle:c,visibleMessage:u,visibleServiceState:m}=p(),h=H(n??void 0),g=async e=>{let t=V(n,e);if(!t?.available){o.error(d(t?.reasonIfUnavailable)??E(`runtimeControlLoadFailed`));return}if(!(e===`stop-service`&&t.requiresConfirmation&&!window.confirm(E(`runtimeControlStopServiceConfirm`))))try{let t=await l.runRuntimeControlAction(e);o.success(d(t.message)??t.message)}catch(e){let t=e instanceof Error?e.message:E(`runtimeControlActionFailed`);o.error(`${E(`runtimeControlActionFailed`)}: ${t}`)}},_=async()=>{if(!n?.canRestartApp.available){o.error(d(n?.canRestartApp.reasonIfUnavailable)??E(`runtimeRestartAppUnavailable`));return}if(window.confirm(E(`runtimeControlRestartAppConfirm`)))try{let e=await l.runRuntimeControlAction(`restart-app`);o.success(d(e.message)??e.message)}catch(e){let t=e instanceof Error?e.message:E(`runtimeControlActionFailed`);o.error(`${E(`runtimeControlActionFailed`)}: ${t}`)}};return(0,P.jsx)(r,{title:E(`runtimeControlTitle`),description:E(`runtimeControlDescription`),children:(0,P.jsxs)(f,{children:[(0,P.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-center md:justify-between`,children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:z(m)}),(0,P.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:n?B(n):E(`runtimeControlLoading`)})]}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u}),(0,P.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:R(c)}),n?.managementHint?(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d(n.managementHint)}):null,i&&!e?(0,P.jsx)(`p`,{className:`text-sm text-amber-700`,children:i}):null]}),a?(0,P.jsxs)(`div`,{className:`space-y-3 bg-amber-50/75 p-4 dark:bg-amber-950/20`,children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-amber-900`,children:E(`runtimeControlPendingRestartTitle`)}),(0,P.jsx)(`p`,{className:`text-sm text-amber-800`,children:E(`runtimeControlPendingRestartDescription`)}),a.changedPaths.length>0?(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-amber-700`,children:E(`runtimeControlPendingRestartPaths`)}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:a.changedPaths.map(e=>(0,P.jsx)(`span`,{className:`rounded-full bg-background/80 px-2.5 py-1 text-xs text-amber-800 dark:text-amber-300`,children:e},e))})]}):null]}):null,(0,P.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,P.jsx)(`div`,{className:`flex flex-col gap-3 md:flex-row md:flex-wrap`,children:h.map(n=>(0,P.jsxs)(s,{type:`button`,variant:n.variant??`default`,onClick:()=>{if(n.action===`restart-app`){_();return}g(n.action)},disabled:!n.capability.available||e,children:[(0,P.jsx)(U,{icon:n.icon,busy:t===n.action}),n.label]},n.action))}),h.filter(e=>!e.capability.available&&e.capability.reasonIfUnavailable).map(e=>(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d(e.capability.reasonIfUnavailable)},`${e.action}-reason`))]})]})})}function G(e){let{description:t,title:n}=e;return(0,P.jsx)(y,{tone:`neutral`,title:n,description:t})}function K(e){let{children:t}=e;return(0,P.jsx)(r,{title:E(`runtimePresenceTitle`),description:E(`runtimePresenceDescription`),children:(0,P.jsx)(f,{children:t})})}function q(){let e=u().runtimeControlView?.environment,t=_(e=>e.supported),n=_(e=>e.initialized),r=_(e=>e.busyAction),o=_(e=>e.snapshot);return(0,N.useEffect)(()=>{if(e===`desktop-embedded`){g.start();return}g.markUnsupported()},[e]),e===`desktop-embedded`?(0,P.jsxs)(K,{children:[(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsx)(y,{tone:`neutral`,title:E(`runtimePresenceBehaviorLabel`),description:o?.closeToBackground?E(`runtimePresenceBehaviorBackground`):E(`runtimePresenceBehaviorQuit`),className:`rounded-xl`})}),!n||t&&!o?(0,P.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:E(`runtimePresenceLoading`)}):null,o?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(i,{title:E(`runtimePresenceCloseToBackground`),description:E(`runtimePresenceCloseToBackgroundHelp`),control:(0,P.jsx)(a,{id:`runtime-presence-close-background`,"aria-label":E(`runtimePresenceCloseToBackground`),checked:o.closeToBackground,disabled:r===`saving-preferences`,onCheckedChange:e=>{g.updatePreferences({closeToBackground:e})}})}),(0,P.jsx)(i,{title:E(`runtimePresenceLaunchAtLogin`),description:o.supportsLaunchAtLogin?E(`runtimePresenceLaunchAtLoginHelp`):o.launchAtLoginReason??E(`runtimePresenceLaunchAtLoginUnavailable`),control:(0,P.jsx)(a,{id:`runtime-presence-launch-login`,"aria-label":E(`runtimePresenceLaunchAtLogin`),checked:o.launchAtLogin,disabled:!o.supportsLaunchAtLogin||r===`saving-preferences`,onCheckedChange:e=>{g.updatePreferences({launchAtLogin:e})}})})]}):null]}):e===`managed-local-service`?(0,P.jsx)(K,{children:(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsx)(G,{title:E(`runtimePresenceManagedLocalTitle`),description:E(`runtimePresenceManagedLocalDescription`)})})}):e===`self-hosted-web`?(0,P.jsx)(K,{children:(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsx)(G,{title:E(`runtimePresenceSelfHostedTitle`),description:E(`runtimePresenceSelfHostedDescription`)})})}):e===`shared-web`?(0,P.jsx)(K,{children:(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsx)(G,{title:E(`runtimePresenceSharedTitle`),description:E(`runtimePresenceSharedDescription`)})})}):(0,P.jsx)(K,{children:(0,P.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:E(`runtimePresenceLoading`)})})}function J(){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(W,{}),(0,P.jsx)(q,{}),(0,P.jsx)(t,{})]})}var Y={wireDialect:`acp`,processScope:`per-session`,command:``,args:[`acp`],env:{},cwd:``,startupTimeoutMs:8e3,probeTimeoutMs:3e3,requestTimeoutMs:12e4};function X(){return{id:``,default:!1,workspace:``,model:``,runtime:``,contextTokens:void 0}}function Z(){return{agentId:``,match:{channel:``,accountId:``}}}function Q(){return{id:``,enabled:!0,label:``,type:`narp-stdio`,config:Y,configText:JSON.stringify(Y,null,2)}}function ne(e){return{id:e.id??``,default:!!e.default,displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,workspace:e.workspace??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:e.contextTokens}}function re(e){return{agentId:e.agentId??``,match:{channel:e.match?.channel??``,accountId:e.match?.accountId??``,peer:e.match?.peer?{kind:e.match.peer.kind,id:e.match.peer.id}:void 0}}}function ie(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:void 0}function ae(e){return{companionEnabled:e.companion?.enabled===!0,agents:(e.agents.list??[]).map(ne),bindings:(e.bindings??[]).map(re),runtimeEntries:Object.entries(e.agents.runtimes?.entries??{}).map(([e,t])=>({id:e,enabled:t.enabled!==!1,label:t.label??``,type:t.type,config:t.config??{},configText:JSON.stringify(t.config??{},null,2)})),dmScope:e.session?.dmScope??`per-channel-peer`,defaultContextTokens:e.agents.defaults.contextTokens??2e5,defaultEngine:e.agents.defaults.engine??`native`}}function oe(e){let t={id:e.id.trim()};e.default&&(t.default=!0),e.displayName?.trim()&&(t.displayName=e.displayName.trim()),e.description?.trim()&&(t.description=e.description.trim()),e.avatar?.trim()&&(t.avatar=e.avatar.trim()),e.workspace?.trim()&&(t.workspace=e.workspace.trim()),e.model?.trim()&&(t.model=e.model.trim());let n=e.runtime?.trim()??e.engine?.trim();return n&&(t.engine=n),typeof e.contextTokens==`number`&&(t.contextTokens=Math.max(1e3,e.contextTokens)),t}function $(e){let t=e.agents.map((e,t)=>{if(!e.id.trim())throw Error(E(`agentIdRequiredError`).replace(`{index}`,String(t)));return oe(e)}),n=t.map(e=>e.id).filter((e,t,n)=>n.indexOf(e)!==t);if(n.length>0)throw Error(`${E(`duplicateAgentId`)}: ${n[0]}`);let r=e.bindings.map((t,n)=>{let r=t.agentId.trim(),i=t.match.channel.trim(),a=t.match.accountId?.trim()??``,o=t.match.peer?.kind,s=t.match.peer?.id?.trim()??``;if(!r)throw Error(E(`bindingAgentIdRequired`).replace(`{index}`,String(n)));if(!e.knownAgentIds.has(r))throw Error(`${E(`bindingAgentIdNotFound`).replace(`{index}`,String(n))}: ${r}`);if(!i)throw Error(E(`bindingChannelRequired`).replace(`{index}`,String(n)));let c={agentId:r,match:{channel:i}};if(a&&(c.match.accountId=a),o){if(!s)throw Error(E(`bindingPeerIdRequired`).replace(`{index}`,String(n)));c.match.peer={kind:o,id:s}}return c}),i=e.runtimeEntries.reduce((e,t,n)=>{let r=t.id.trim(),i=t.type.trim();if(!r)throw Error(E(`runtimeEntryIdRequired`).replace(`{index}`,String(n)));if(!i)throw Error(E(`runtimeEntryTypeRequired`).replace(`{id}`,r));if(e[r])throw Error(`${E(`runtimeEntryDuplicate`)}: ${r}`);let a=t.configText.trim()?JSON.parse(t.configText):{};if(a&&(typeof a!=`object`||Array.isArray(a)))throw Error(E(`runtimeEntryConfigObjectRequired`).replace(`{id}`,r));return e[r]={enabled:t.enabled!==!1,...t.label?.trim()?{label:t.label.trim()}:{},type:i,config:a??{}},e},{});return{companion:{enabled:e.companionEnabled},agents:{defaults:{contextTokens:Math.max(1e3,e.defaultContextTokens),engine:e.defaultEngine.trim()||`native`},list:t,runtimes:{entries:i}},bindings:r,session:{dmScope:e.dmScope}}}function se({agents:e,onAddAgent:t,onRemoveAgent:i,onSetDefaultAgent:o,onUpdateAgent:c}){return(0,P.jsx)(r,{title:E(`agentList`),description:E(`agentListHelp`),actions:(0,P.jsxs)(s,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:[(0,P.jsx)(S,{className:`mr-2 h-4 w-4`}),E(`addAgent`)]}),children:(0,P.jsx)(f,{children:e.map((e,t)=>(0,P.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,P.jsx)(n,{value:e.id,onChange:e=>c(t,{id:e.target.value}),placeholder:E(`agentIdPlaceholder`)}),(0,P.jsx)(n,{value:e.workspace??``,onChange:e=>c(t,{workspace:e.target.value}),placeholder:E(`workspaceOverridePlaceholder`)}),(0,P.jsx)(n,{value:e.model??``,onChange:e=>c(t,{model:e.target.value}),placeholder:E(`modelOverridePlaceholder`)}),(0,P.jsx)(n,{value:e.runtime??e.engine??``,onChange:e=>c(t,{runtime:e.target.value}),placeholder:E(`engineOverridePlaceholder`)}),(0,P.jsx)(n,{type:`number`,min:1e3,step:1e3,value:e.contextTokens??``,onChange:e=>c(t,{contextTokens:ie(e.target.value)}),placeholder:E(`contextTokensPlaceholder`)})]}),(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,P.jsx)(a,{checked:!!e.default,onCheckedChange:e=>o(t,e)}),(0,P.jsx)(`span`,{children:E(`defaultAgent`)})]}),(0,P.jsxs)(s,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(t),children:[(0,P.jsx)(T,{className:`h-4 w-4 mr-1`}),E(`remove`)]})]})]},`${t}-${e.id}`))})})}function ce({bindings:e,onAddBinding:t,onRemoveBinding:i,onUpdateBinding:a}){return(0,P.jsx)(r,{title:E(`bindings`),description:E(`bindingsHelp`),actions:(0,P.jsxs)(s,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:[(0,P.jsx)(S,{className:`mr-2 h-4 w-4`}),E(`addBinding`)]}),children:(0,P.jsx)(f,{children:e.map((e,t)=>{let r=e.match.peer?.kind??``;return(0,P.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,P.jsx)(n,{value:e.agentId,onChange:n=>a(t,{...e,agentId:n.target.value}),placeholder:E(`targetAgentIdPlaceholder`)}),(0,P.jsx)(n,{value:e.match.channel,onChange:n=>a(t,{...e,match:{...e.match,channel:n.target.value}}),placeholder:E(`channelPlaceholder`)}),(0,P.jsx)(n,{value:e.match.accountId??``,onChange:n=>a(t,{...e,match:{...e.match,accountId:n.target.value}}),placeholder:E(`accountIdOptionalPlaceholder`)}),(0,P.jsxs)(j,{value:r||`__none__`,onValueChange:n=>{let r=n===`__none__`?``:n;a(t,r?{...e,match:{...e.match,peer:{kind:r,id:e.match.peer?.id??``}}}:{...e,match:{...e.match,peer:void 0}})},children:[(0,P.jsx)(O,{children:(0,P.jsx)(D,{})}),(0,P.jsxs)(k,{children:[(0,P.jsx)(A,{value:`__none__`,children:E(`peerKindOptional`)}),(0,P.jsx)(A,{value:`direct`,children:E(`peerKindDirect`)}),(0,P.jsx)(A,{value:`group`,children:E(`peerKindGroup`)}),(0,P.jsx)(A,{value:`channel`,children:E(`peerKindChannel`)})]})]}),(0,P.jsx)(n,{value:e.match.peer?.id??``,onChange:n=>a(t,{...e,match:{...e.match,peer:r?{kind:r,id:n.target.value}:void 0}}),placeholder:E(`peerIdPlaceholder`)})]}),(0,P.jsx)(`div`,{className:`flex justify-end`,children:(0,P.jsxs)(s,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(t),children:[(0,P.jsx)(T,{className:`h-4 w-4 mr-1`}),E(`remove`)]})})]},`${t}-${e.agentId}`)})})})}function le({entries:e,onAddEntry:t,onRemoveEntry:i,onUpdateEntry:o}){return(0,P.jsx)(r,{title:E(`runtimeEntries`),description:E(`runtimeEntriesHelp`),actions:(0,P.jsxs)(s,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:[(0,P.jsx)(S,{className:`mr-2 h-4 w-4`}),E(`addRuntimeEntry`)]}),children:(0,P.jsx)(f,{children:e.map((e,t)=>(0,P.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,P.jsx)(n,{value:e.id,onChange:e=>o(t,{id:e.target.value}),placeholder:E(`runtimeEntryIdPlaceholder`)}),(0,P.jsx)(n,{value:e.label??``,onChange:e=>o(t,{label:e.target.value}),placeholder:E(`runtimeEntryLabelPlaceholder`)}),(0,P.jsx)(n,{value:e.type,onChange:e=>o(t,{type:e.target.value}),placeholder:E(`runtimeEntryTypePlaceholder`)}),(0,P.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg bg-background/65 px-3 py-2`,children:[(0,P.jsx)(`span`,{className:`text-sm text-foreground`,children:E(`enabled`)}),(0,P.jsx)(a,{checked:e.enabled!==!1,onCheckedChange:e=>o(t,{enabled:e})})]})]}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-foreground`,children:E(`runtimeEntryConfigJson`)}),(0,P.jsx)(`textarea`,{className:`min-h-32 w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-sm`,value:e.configText,onChange:e=>o(t,{configText:e.target.value}),spellCheck:!1})]}),(0,P.jsx)(`div`,{className:`flex justify-end`,children:(0,P.jsxs)(s,{type:`button`,variant:`outline`,onClick:()=>i(t),children:[(0,P.jsx)(T,{className:`mr-2 h-4 w-4`}),E(`delete`)]})})]},`${t}-${e.id||`runtime-entry`}`))})})}var ue=[{value:`main`,labelKey:`dmScopeMain`},{value:`per-peer`,labelKey:`dmScopePerPeer`},{value:`per-channel-peer`,labelKey:`dmScopePerChannelPeer`},{value:`per-account-channel-peer`,labelKey:`dmScopePerAccountChannelPeer`}];function de({companionEnabled:e,defaultContextTokens:t,defaultEngine:o,dmScope:s,onCompanionEnabledChange:c,onDefaultContextTokensChange:l,onDefaultEngineChange:u,onDmScopeChange:d}){return(0,P.jsx)(r,{title:E(`dmScope`),description:E(`dmScopeHelp`),children:(0,P.jsxs)(f,{children:[(0,P.jsx)(i,{title:E(`runtimeCompanionEnabled`),description:E(`runtimeCompanionEnabledHelp`),control:(0,P.jsx)(a,{checked:e,onCheckedChange:c})}),(0,P.jsx)(i,{title:E(`defaultContextTokens`),description:E(`defaultContextTokensHelp`),control:(0,P.jsx)(n,{type:`number`,min:1e3,step:1e3,value:t,onChange:e=>l(Math.max(1e3,Number.parseInt(e.target.value,10)||1e3)),className:`w-36`})}),(0,P.jsx)(i,{title:E(`defaultEngine`),description:E(`defaultEngineHelp`),control:(0,P.jsx)(n,{value:o,onChange:e=>u(e.target.value),placeholder:E(`defaultEnginePlaceholder`),className:`w-56`})}),(0,P.jsx)(i,{title:E(`dmScope`),control:(0,P.jsxs)(j,{value:s,onValueChange:e=>d(e),children:[(0,P.jsx)(O,{className:`w-56`,children:(0,P.jsx)(D,{})}),(0,P.jsx)(k,{children:ue.map(e=>(0,P.jsx)(A,{value:e.value,children:E(e.labelKey)},e.value))})]})})]})})}function fe({config:e,updateRuntime:t}){let n=(0,N.useMemo)(()=>ae(e),[e]),[r,i]=(0,N.useState)(n.agents),[a,l]=(0,N.useState)(n.bindings),[u,d]=(0,N.useState)(n.runtimeEntries),[f,p]=(0,N.useState)(n.dmScope),[m,h]=(0,N.useState)(n.companionEnabled),[g,_]=(0,N.useState)(n.defaultContextTokens),[v,y]=(0,N.useState)(n.defaultEngine),b=(0,N.useMemo)(()=>{let e=new Set([`main`]);return r.forEach(t=>{let n=t.id.trim();n&&e.add(n)}),e},[r]);return(0,P.jsxs)(c,{title:E(`runtimePageTitle`),description:E(`runtimePageDescription`),children:[(0,P.jsx)(J,{}),(0,P.jsx)(de,{companionEnabled:m,dmScope:f,defaultContextTokens:g,defaultEngine:v,onCompanionEnabledChange:h,onDmScopeChange:p,onDefaultContextTokensChange:_,onDefaultEngineChange:y}),(0,P.jsx)(le,{entries:u,onUpdateEntry:(e,t)=>d(n=>n.map((n,r)=>r===e?{...n,...t}:n)),onRemoveEntry:e=>d(t=>t.filter((t,n)=>n!==e)),onAddEntry:()=>d(e=>[...e,Q()])}),(0,P.jsx)(se,{agents:r,onUpdateAgent:(e,t)=>{i(n=>n.map((n,r)=>r===e?{...n,...t}:n))},onRemoveAgent:e=>i(t=>t.filter((t,n)=>n!==e)),onAddAgent:()=>i(e=>[...e,X()]),onSetDefaultAgent:(e,t)=>i(n=>t?n.map((t,n)=>({...t,default:n===e})):n.map((t,n)=>n===e?{...t,default:!1}:t))}),(0,P.jsx)(ce,{bindings:a,onUpdateBinding:(e,t)=>{l(n=>n.map((n,r)=>r===e?t:n))},onRemoveBinding:e=>l(t=>t.filter((t,n)=>n!==e)),onAddBinding:()=>l(e=>[...e,Z()])}),(0,P.jsx)(te,{children:(0,P.jsxs)(s,{type:`button`,size:`sm`,onClick:()=>{try{let e=$({companionEnabled:m,agents:r,bindings:a,runtimeEntries:u,dmScope:f,defaultContextTokens:g,defaultEngine:v,knownAgentIds:b});t.mutate({data:e})}catch(e){o.error(e instanceof Error?e.message:String(e))}},disabled:t.isPending,children:[(0,P.jsx)(w,{className:`mr-1.5 h-3.5 w-3.5`}),t.isPending?E(`saving`):E(`saveRuntimeSettings`)]})})]})}function pe(){let{data:e,isLoading:t}=ee(),n=M();return t||!e?(0,P.jsx)(c,{title:E(`runtimePageTitle`),description:E(`runtimePageDescription`),children:(0,P.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:E(`runtimeLoading`)})}):(0,P.jsx)(fe,{config:e,updateRuntime:n})}export{pe as RuntimeConfig};