@undefineds.co/xpod 0.4.13 → 0.4.15

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 (331) hide show
  1. package/config/cloud.json +0 -3
  2. package/config/components-ignore.json +11 -7
  3. package/config/local.json +0 -3
  4. package/config/xpod.base.json +0 -24
  5. package/dist/api/ai-config/AiConfigStore.d.ts +2 -2
  6. package/dist/api/ai-config/AiConfigStore.js +4 -1
  7. package/dist/api/ai-gateway/auth/CallerPodAccess.d.ts +2 -5
  8. package/dist/api/ai-gateway/auth/CallerPodAccess.js +3 -42
  9. package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.d.ts +2 -1
  10. package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.js +1 -1
  11. package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.d.ts +3 -8
  12. package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.js +9 -32
  13. package/dist/api/ai-gateway/connect/index.d.ts +3 -3
  14. package/dist/api/ai-gateway/connect/index.js +9 -38
  15. package/dist/api/ai-gateway/errors.js +2 -1
  16. package/dist/api/ai-gateway/models/PodModelSelectionRepository.d.ts +3 -3
  17. package/dist/api/ai-gateway/models/PodModelSelectionRepository.js +7 -11
  18. package/dist/api/ai-gateway/pod/HostedPodRoute.d.ts +27 -0
  19. package/dist/api/ai-gateway/pod/HostedPodRoute.js +47 -0
  20. package/dist/api/ai-gateway/pod/OwnerPodAccess.d.ts +79 -0
  21. package/dist/api/ai-gateway/pod/OwnerPodAccess.js +192 -0
  22. package/dist/api/ai-gateway/pod/PodInterfaceKeyStore.d.ts +52 -0
  23. package/dist/api/ai-gateway/pod/PodInterfaceKeyStore.js +61 -0
  24. package/dist/api/ai-gateway/providers/ProviderRegistry.js +1 -1
  25. package/dist/api/ai-gateway/quota/ProviderQuotaAdapter.d.ts +3 -3
  26. package/dist/api/ai-gateway/quota/ProviderQuotaAdapter.js +7 -32
  27. package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.d.ts +1 -1
  28. package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.js +1 -1
  29. package/dist/api/auth/ClientCredentialsAuthenticator.js +5 -28
  30. package/dist/api/auth/TokenEndpointRoute.d.ts +18 -0
  31. package/dist/api/auth/TokenEndpointRoute.js +36 -0
  32. package/dist/api/chatkit/pod-store.d.ts +4 -4
  33. package/dist/api/chatkit/pod-store.js +24 -95
  34. package/dist/api/container/common.js +36 -23
  35. package/dist/api/container/index.js +1 -0
  36. package/dist/api/container/local.js +88 -37
  37. package/dist/api/container/routes.js +41 -7
  38. package/dist/api/container/types.d.ts +4 -2
  39. package/dist/api/handlers/AdminHandler.d.ts +17 -1
  40. package/dist/api/handlers/AdminHandler.js +40 -3
  41. package/dist/api/handlers/AiGatewayManagementHandler.d.ts +6 -0
  42. package/dist/api/handlers/AiGatewayManagementHandler.js +17 -4
  43. package/dist/api/handlers/EdgeNodeSignalHandler.js +10 -2
  44. package/dist/api/handlers/NetworkSettingsHandler.d.ts +44 -5
  45. package/dist/api/handlers/NetworkSettingsHandler.js +46 -11
  46. package/dist/api/handlers/PodSettingsHandler.d.ts +3 -3
  47. package/dist/api/handlers/PodSettingsHandler.js +3 -3
  48. package/dist/api/handlers/ProvisionHandler.d.ts +35 -1
  49. package/dist/api/handlers/ProvisionHandler.js +53 -2
  50. package/dist/api/handlers/ReachabilityHandler.d.ts +6 -0
  51. package/dist/api/handlers/ReachabilityHandler.js +25 -6
  52. package/dist/api/network/NetworkEnvironmentConfigurationStore.d.ts +6 -1
  53. package/dist/api/network/NetworkEnvironmentConfigurationStore.js +72 -16
  54. package/dist/api/runtime.d.ts +18 -0
  55. package/dist/api/runtime.js +28 -2
  56. package/dist/api/service/AiClientConfigurationService.d.ts +1 -1
  57. package/dist/api/service/AiClientConfigurationService.js +1 -1
  58. package/dist/cli/commands/start.d.ts +26 -1
  59. package/dist/cli/commands/start.js +69 -5
  60. package/dist/components/components.jsonld +1 -1
  61. package/dist/components/context.jsonld +35 -42
  62. package/dist/edge/EdgeNodeAgent.d.ts +16 -0
  63. package/dist/edge/EdgeNodeAgent.js +56 -1
  64. package/dist/edge/EdgeNodeAgent.jsonld +8 -0
  65. package/dist/edge/EdgeNodeAgentInitializer.d.ts +2 -0
  66. package/dist/edge/EdgeNodeAgentInitializer.js +1 -0
  67. package/dist/edge/EdgeNodeAgentInitializer.jsonld +19 -0
  68. package/dist/edge/EdgeNodeDnsCoordinator.d.ts +11 -1
  69. package/dist/edge/EdgeNodeDnsCoordinator.js +12 -2
  70. package/dist/edge/EdgeNodeHealthProbeService.d.ts +15 -0
  71. package/dist/edge/EdgeNodeHealthProbeService.js +44 -12
  72. package/dist/edge/EdgeNodeHealthProbeService.jsonld +77 -0
  73. package/dist/edge/ProbeTargetGuard.d.ts +35 -0
  74. package/dist/edge/ProbeTargetGuard.js +142 -0
  75. package/dist/edge/reachability/NodeAccessResolver.d.ts +16 -0
  76. package/dist/edge/reachability/NodeAccessResolver.js +30 -0
  77. package/dist/edge/reachability/ReachabilitySessionService.js +4 -1
  78. package/dist/edge/reachability/RouteSetBuilder.d.ts +18 -1
  79. package/dist/edge/reachability/RouteSetBuilder.js +47 -0
  80. package/dist/edge/reachability/RouteSetBuilder.jsonld +29 -0
  81. package/dist/edge/reachability/types.d.ts +8 -2
  82. package/dist/http/SubgraphSparqlHttpHandler.d.ts +1 -25
  83. package/dist/http/SubgraphSparqlHttpHandler.js +0 -100
  84. package/dist/http/SubgraphSparqlHttpHandler.jsonld +0 -8
  85. package/dist/identity/drizzle/PodInterfaceKeyRepository.d.ts +33 -0
  86. package/dist/identity/drizzle/PodInterfaceKeyRepository.js +78 -0
  87. package/dist/identity/drizzle/db.d.ts +7 -0
  88. package/dist/identity/drizzle/db.js +30 -0
  89. package/dist/identity/drizzle/schema.pg.d.ts +9 -0
  90. package/dist/identity/drizzle/schema.pg.js +16 -1
  91. package/dist/identity/drizzle/schema.sqlite.d.ts +106 -0
  92. package/dist/identity/drizzle/schema.sqlite.js +16 -1
  93. package/dist/index.d.ts +3 -2
  94. package/dist/index.js +9 -5
  95. package/dist/main.js +7 -0
  96. package/dist/runtime/GatewayAdminProxyAuth.d.ts +1 -16
  97. package/dist/runtime/GatewayAdminProxyAuth.js +2 -71
  98. package/dist/runtime/Proxy.d.ts +32 -1
  99. package/dist/runtime/Proxy.js +125 -31
  100. package/dist/runtime/bootstrap.d.ts +21 -0
  101. package/dist/runtime/bootstrap.js +45 -1
  102. package/dist/runtime/css-process.d.ts +1 -0
  103. package/dist/runtime/css-process.js +1 -0
  104. package/dist/runtime/host/node/NodeRuntimeHost.js +6 -1
  105. package/dist/runtime/host/types.d.ts +6 -0
  106. package/dist/runtime/index.d.ts +1 -1
  107. package/dist/runtime/index.js +4 -1
  108. package/dist/runtime/js-runtime.js +10 -3
  109. package/dist/runtime/lifecycle.js +6 -4
  110. package/dist/runtime/port-finder.d.ts +26 -0
  111. package/dist/runtime/port-finder.js +64 -0
  112. package/dist/runtime/runner/node/NodeGatewayRuntimeRunner.js +1 -0
  113. package/dist/runtime/runner/types.d.ts +5 -0
  114. package/dist/runtime/runtime-types.d.ts +1 -0
  115. package/dist/test-utils/local-managed-client-p2p-e2e-smoke.js +1 -1
  116. package/dist/tunnel/AutoTunnelProvider.d.ts +56 -0
  117. package/dist/tunnel/AutoTunnelProvider.js +181 -0
  118. package/dist/tunnel/LocalTunnelProvider.d.ts +15 -0
  119. package/dist/tunnel/LocalTunnelProvider.js +87 -18
  120. package/dist/tunnel/LocalTunnelProvider.jsonld +27 -0
  121. package/dist/tunnel/NgrokTunnelProvider.d.ts +4 -0
  122. package/dist/tunnel/NgrokTunnelProvider.js +117 -43
  123. package/dist/tunnel/NgrokTunnelProvider.jsonld +4 -0
  124. package/dist/tunnel/SakuraFrpTunnelProvider.d.ts +65 -3
  125. package/dist/tunnel/SakuraFrpTunnelProvider.js +268 -25
  126. package/dist/tunnel/TunnelLifecycle.d.ts +14 -0
  127. package/dist/tunnel/TunnelLifecycle.js +34 -0
  128. package/dist/tunnel/TunnelProfiles.d.ts +33 -3
  129. package/dist/tunnel/TunnelProfiles.js +105 -78
  130. package/dist/tunnel/TunnelProvider.d.ts +15 -2
  131. package/dist/tunnel/TunnelProvider.jsonld +8 -0
  132. package/dist/tunnel/TunnelProviderCatalog.d.ts +62 -0
  133. package/dist/tunnel/TunnelProviderCatalog.js +130 -0
  134. package/dist/tunnel/index.d.ts +1 -0
  135. package/dist/tunnel/index.js +3 -1
  136. package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.d.ts +1 -1
  137. package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.js +1 -1
  138. package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.d.ts +1 -1
  139. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.d.ts +1 -1
  140. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.js +1 -1
  141. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectDialog.d.ts +1 -1
  142. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.d.ts +1 -1
  143. package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.d.ts +1 -1
  144. package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialRow.d.ts +1 -1
  145. package/node_modules/@undefineds.co/ai-connections/dist/AiCustomProviderDialog.d.ts +1 -1
  146. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeyRow.d.ts +1 -1
  147. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +1 -1
  148. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.d.ts +1 -1
  149. package/node_modules/@undefineds.co/ai-connections/dist/AiOfferingDetails.d.ts +1 -1
  150. package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.d.ts +1 -1
  151. package/node_modules/@undefineds.co/ai-connections/dist/AiQuotaCard.d.ts +1 -1
  152. package/node_modules/@undefineds.co/ai-connections/dist/AiSortableCredentialList.d.ts +1 -1
  153. package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.d.ts +1 -1
  154. package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.d.ts +1 -1
  155. package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.js +3 -3
  156. package/node_modules/@undefineds.co/ai-connections/dist/collections.d.ts +1 -1
  157. package/node_modules/@undefineds.co/ai-connections/dist/collections.js +3 -3
  158. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/ai-connections-client.d.ts +1 -1
  159. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/ai-connections-client.js +1 -1
  160. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/index.cjs +8 -8
  161. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/index.d.ts +1 -1
  162. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/index.js +1 -1
  163. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/provider-catalog.cjs +3 -3
  164. package/node_modules/@undefineds.co/ai-connections/dist/controller.d.ts +1 -1
  165. package/node_modules/@undefineds.co/ai-connections/dist/controller.js +1 -1
  166. package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.d.ts +1 -1
  167. package/node_modules/@undefineds.co/ai-connections/dist/display-wording.d.ts +1 -1
  168. package/node_modules/@undefineds.co/ai-connections/dist/error-wording.d.ts +1 -1
  169. package/node_modules/@undefineds.co/ai-connections/dist/error-wording.js +8 -3
  170. package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.js +1 -1
  171. package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.d.ts +1 -1
  172. package/node_modules/@undefineds.co/ai-connections/dist/offering-label.d.ts +1 -1
  173. package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.d.ts +1 -1
  174. package/node_modules/@undefineds.co/ai-connections/dist/service-access.js +1 -1
  175. package/node_modules/@undefineds.co/ai-connections/dist/useAiConnectDialog.d.ts +1 -1
  176. package/node_modules/@undefineds.co/ai-connections/package.json +31 -1
  177. package/node_modules/@undefineds.co/solid-sdk/dist/access-route.cjs +230 -0
  178. package/node_modules/@undefineds.co/solid-sdk/dist/access-route.d.ts +76 -0
  179. package/node_modules/@undefineds.co/solid-sdk/dist/access-route.js +115 -0
  180. package/node_modules/@undefineds.co/solid-sdk/dist/index.cjs +89 -0
  181. package/node_modules/@undefineds.co/solid-sdk/dist/index.d.ts +1 -0
  182. package/node_modules/@undefineds.co/solid-sdk/dist/index.js +1 -0
  183. package/node_modules/@undefineds.co/solid-sdk/package.json +6 -1
  184. package/package.json +5 -6
  185. package/static/app/assets/inrupt-smoke.js +23 -23
  186. package/static/app/assets/main.css +1 -1
  187. package/static/auth-callback/assets/{AiConfigContext-DlFyEWy9.js → AiConfigContext-Bx0HCAW5.js} +1 -1
  188. package/static/auth-callback/assets/{AiConfigPage-CkYk-SFW.js → AiConfigPage-ChQImMbm.js} +1 -1
  189. package/static/auth-callback/assets/{DocumentProcessingPanel-CqIr3JqN.js → DocumentProcessingPanel-D830H4SH.js} +1 -1
  190. package/static/auth-callback/assets/{IndexLifecyclePanel-C1GKV3Vx.js → IndexLifecyclePanel-CnlkjMF8.js} +1 -1
  191. package/static/auth-callback/assets/{IndexSubjectPanel-ro9lC6XW.js → IndexSubjectPanel-CdEfg_CO.js} +1 -1
  192. package/static/auth-callback/assets/{ModelAssignmentsPanel-DxNdyKRJ.js → ModelAssignmentsPanel-D-8A8dZx.js} +1 -1
  193. package/static/auth-callback/assets/{ModelsPage-BVtWSPBU.js → ModelsPage-Cim7cubp.js} +3 -3
  194. package/static/auth-callback/assets/NetworkPage-CfK3x-pb.js +2 -0
  195. package/static/auth-callback/assets/{PaneListHeader-ByKw8ada.js → PaneListHeader-Bf_kEd4U.js} +1 -1
  196. package/static/auth-callback/assets/{SearchIndexingPanel-CulBKcYT.js → SearchIndexingPanel-4kD4RBEQ.js} +1 -1
  197. package/static/auth-callback/assets/{StatusSubjectPanel-VOcfrt8o.js → StatusSubjectPanel-Bw9AiTSf.js} +1 -1
  198. package/static/auth-callback/assets/{StatusWorkspace-Jsz6hAdE.js → StatusWorkspace-C-301H-0.js} +1 -1
  199. package/static/auth-callback/assets/{SystemSettingsPage-BFNvGAle.js → SystemSettingsPage-BbWn-eG6.js} +1 -1
  200. package/static/auth-callback/assets/{SystemSettingsSubjectPanel-DFRdrSfK.js → SystemSettingsSubjectPanel-DA4wvNSm.js} +1 -1
  201. package/static/auth-callback/assets/{XpodAiConnectionsPodStore-C6KpvHVg.js → XpodAiConnectionsPodStore-CohdyLoX.js} +1 -1
  202. package/static/auth-callback/assets/{activity-DnTlb9iM.js → activity-CCsb9Oam.js} +1 -1
  203. package/static/auth-callback/assets/ai-connections-DexTPyfC.js +1 -0
  204. package/static/auth-callback/assets/{auth-callback-D2UkK5Xj.js → auth-callback-Ds-c62W3.js} +5 -5
  205. package/static/auth-callback/assets/auth-callback-rk080mvG.css +1 -0
  206. package/static/auth-callback/assets/{badge-D7IJuuTM.js → badge-CQm5OyzR.js} +1 -1
  207. package/static/auth-callback/assets/{collection-runtime-wT1n4GS2.js → collection-runtime-DlAuU5TW.js} +1 -1
  208. package/static/auth-callback/assets/{dialog-DickLu5z.js → dialog-CnGzg5Ff.js} +1 -1
  209. package/static/auth-callback/assets/{download-kn8WnRu3.js → download-DwMONJvm.js} +1 -1
  210. package/static/auth-callback/assets/{external-link-B6B8jfSn.js → external-link-Bu5AGqCO.js} +1 -1
  211. package/static/auth-callback/assets/{index-DHF97YLP.js → index-B0T-1YO8.js} +1 -1
  212. package/static/auth-callback/assets/{index-Dz83EEHD.js → index-C8QZf_4W.js} +1 -1
  213. package/static/auth-callback/assets/index-DwIlrIDG.js +4 -0
  214. package/static/auth-callback/assets/{index-browser-CSghinyi.js → index-browser-lRsMcP_7.js} +1 -1
  215. package/static/auth-callback/assets/{key-round-ChkOx3E1.js → key-round-BDMtU57P.js} +1 -1
  216. package/static/auth-callback/assets/{rotate-ccw-B3hE-nyd.js → rotate-ccw-CoKIGCsQ.js} +1 -1
  217. package/static/auth-callback/assets/{skeleton-kEqR7tpI.js → skeleton-CPoSWHDr.js} +1 -1
  218. package/static/auth-callback/assets/{waypoints-D6Jo-SZa.js → waypoints-BeYHxqHv.js} +1 -1
  219. package/static/auth-callback/assets/{workspace-layout-BHwT_cHd.js → workspace-layout-xA5YxiK3.js} +1 -1
  220. package/static/auth-callback/auth-callback.html +2 -2
  221. package/static/dashboard/assets/{AiConfigContext-BfC3v-x2.js → AiConfigContext-rWx4TyiH.js} +1 -1
  222. package/static/dashboard/assets/{AiConfigPage-QNS3u7Ff.js → AiConfigPage-StVJpDFT.js} +1 -1
  223. package/static/dashboard/assets/{DocumentProcessingPanel-Dr4XLeT4.js → DocumentProcessingPanel-DJ5yul2O.js} +1 -1
  224. package/static/dashboard/assets/{IndexLifecyclePanel-KtM_gpeO.js → IndexLifecyclePanel-CpjtgezK.js} +1 -1
  225. package/static/dashboard/assets/{IndexSubjectPanel-DLaiKdLc.js → IndexSubjectPanel-BVKcot1_.js} +1 -1
  226. package/static/dashboard/assets/{ModelAssignmentsPanel-Bk7TvQRq.js → ModelAssignmentsPanel-BxVgWZPc.js} +1 -1
  227. package/static/dashboard/assets/{ModelsPage-Cci3vlos.js → ModelsPage-CECBwmeO.js} +3 -3
  228. package/static/dashboard/assets/NetworkPage-zQgFscEW.js +2 -0
  229. package/static/dashboard/assets/{PaneListHeader-qHME_s08.js → PaneListHeader-DIPe8pS6.js} +1 -1
  230. package/static/dashboard/assets/{SearchIndexingPanel-HZPKj8H9.js → SearchIndexingPanel-lalFJ3c8.js} +1 -1
  231. package/static/dashboard/assets/{StatusSubjectPanel-ij7IpI8d.js → StatusSubjectPanel-CpY_KU-G.js} +1 -1
  232. package/static/dashboard/assets/{StatusWorkspace-Cp02JcaN.js → StatusWorkspace-BwWCii3A.js} +1 -1
  233. package/static/dashboard/assets/{SystemSettingsPage-BSeuvb8X.js → SystemSettingsPage-BKZxX-_n.js} +1 -1
  234. package/static/dashboard/assets/{SystemSettingsSubjectPanel-CP4_luGS.js → SystemSettingsSubjectPanel-BZrqb2C5.js} +1 -1
  235. package/static/dashboard/assets/{XpodAiConnectionsPodStore-urO6zaHL.js → XpodAiConnectionsPodStore-Bbpx9dTN.js} +1 -1
  236. package/static/dashboard/assets/{activity-DxjgQNvr.js → activity-BJ15TLVP.js} +1 -1
  237. package/static/dashboard/assets/ai-connections-GG6qkTJt.js +1 -0
  238. package/static/dashboard/assets/{badge-53qCrRbl.js → badge-BBX5FlaB.js} +1 -1
  239. package/static/dashboard/assets/{collection-runtime-BPAmHG46.js → collection-runtime-UBbHBzdf.js} +1 -1
  240. package/static/dashboard/assets/{dashboard-BcT2ByXw.js → dashboard-7Y6BHyV9.js} +62 -62
  241. package/static/dashboard/assets/dashboard-rk080mvG.css +1 -0
  242. package/static/dashboard/assets/{dialog-B28YtNhS.js → dialog-QrOJ-hB0.js} +1 -1
  243. package/static/dashboard/assets/{download-DkLNceJ4.js → download-DK9x-VOP.js} +1 -1
  244. package/static/dashboard/assets/{external-link-D3TXnlo3.js → external-link-Cnkn87mJ.js} +1 -1
  245. package/static/dashboard/assets/index-B1z84it5.js +4 -0
  246. package/static/dashboard/assets/{index-CIiBu9mr.js → index-DzjauX3N.js} +1 -1
  247. package/static/dashboard/assets/{index-CFIenkeK.js → index-cIa8_efI.js} +1 -1
  248. package/static/dashboard/assets/{key-round-B5ccp6nx.js → key-round-BoS6UqKz.js} +1 -1
  249. package/static/dashboard/assets/{rotate-ccw-DUpfkNnk.js → rotate-ccw-BeWV76i0.js} +1 -1
  250. package/static/dashboard/assets/{skeleton-BRe19fO0.js → skeleton-CypcJL07.js} +1 -1
  251. package/static/dashboard/assets/{waypoints-BKDMxEvu.js → waypoints-zHOOqfhi.js} +1 -1
  252. package/static/dashboard/assets/{workspace-layout-ZTF7C16h.js → workspace-layout-DZ9JuxnM.js} +1 -1
  253. package/static/dashboard/dashboard.html +2 -2
  254. package/static/settings/assets/{AiConfigContext-DsyWgu2i.js → AiConfigContext-D3b1l_Kw.js} +1 -1
  255. package/static/settings/assets/{AiConfigPage-CSCBckKo.js → AiConfigPage-DYKw-atP.js} +1 -1
  256. package/static/settings/assets/{DocumentProcessingPanel-w9yQDbBe.js → DocumentProcessingPanel-DguRfsIV.js} +1 -1
  257. package/static/settings/assets/{IndexLifecyclePanel-CUUXI8mP.js → IndexLifecyclePanel-B85qJJA4.js} +1 -1
  258. package/static/settings/assets/{IndexSubjectPanel-BypAU5TJ.js → IndexSubjectPanel-CsN7IxaV.js} +1 -1
  259. package/static/settings/assets/{ModelAssignmentsPanel-BetgXw1G.js → ModelAssignmentsPanel-DEp9byI6.js} +1 -1
  260. package/static/settings/assets/{ModelsPage-DZpTlTZ3.js → ModelsPage-CzTnPs_G.js} +3 -3
  261. package/static/settings/assets/NetworkPage-BDVnmUU0.js +2 -0
  262. package/static/settings/assets/{PaneListHeader-BGOqGec4.js → PaneListHeader-Cpe39N76.js} +1 -1
  263. package/static/settings/assets/{SearchIndexingPanel-DYAbpZ_9.js → SearchIndexingPanel-DA9w8lLL.js} +1 -1
  264. package/static/settings/assets/{StatusSubjectPanel-CFgzeQ8Q.js → StatusSubjectPanel-BU0Aq0CS.js} +1 -1
  265. package/static/settings/assets/{StatusWorkspace-4Z6g4Jvv.js → StatusWorkspace-D1AC1i5N.js} +1 -1
  266. package/static/settings/assets/{SystemSettingsPage-C1tlrgvI.js → SystemSettingsPage-ChKvOioO.js} +1 -1
  267. package/static/settings/assets/{SystemSettingsSubjectPanel-CcURI-1L.js → SystemSettingsSubjectPanel-DyTpOnD2.js} +1 -1
  268. package/static/settings/assets/{XpodAiConnectionsPodStore-owBQc5nY.js → XpodAiConnectionsPodStore-VU5Bsz1a.js} +1 -1
  269. package/static/settings/assets/{activity-CtBc9cNy.js → activity-DGpLfsQB.js} +1 -1
  270. package/static/settings/assets/ai-connections-DexTPyfC.js +1 -0
  271. package/static/settings/assets/{badge--r-FDIhU.js → badge-_hCrrWRP.js} +1 -1
  272. package/static/settings/assets/{collection-runtime-CnhPmwAM.js → collection-runtime-E40TZ8Cl.js} +1 -1
  273. package/static/settings/assets/{dialog-B7ZRsjN7.js → dialog-DTr2JkHn.js} +1 -1
  274. package/static/settings/assets/{download-DgQ1F8QR.js → download-B_D21DDX.js} +1 -1
  275. package/static/settings/assets/{external-link-Bz7NckNO.js → external-link-BATYaM13.js} +1 -1
  276. package/static/settings/assets/index-BAlAVi-J.js +4 -0
  277. package/static/settings/assets/{index-CkGda_Pg.js → index-Ckh4h9jj.js} +1 -1
  278. package/static/settings/assets/{index-Vv-8Vslg.js → index-DOiwLF4B.js} +1 -1
  279. package/static/settings/assets/{index-browser-Dq7omlpY.js → index-browser-DFFWN3Kr.js} +1 -1
  280. package/static/settings/assets/{key-round-CvuhloKV.js → key-round-ZTVU_1O1.js} +1 -1
  281. package/static/settings/assets/{rotate-ccw-DgFKDaz7.js → rotate-ccw-DDdw8PTU.js} +1 -1
  282. package/static/settings/assets/{settings-BvqY7K96.js → settings-CyLnISOv.js} +62 -62
  283. package/static/settings/assets/settings-rk080mvG.css +1 -0
  284. package/static/settings/assets/{skeleton-D3OeFDF6.js → skeleton-DEzA3hc2.js} +1 -1
  285. package/static/settings/assets/{waypoints-C4WbspTb.js → waypoints-BSdfNvEb.js} +1 -1
  286. package/static/settings/assets/{workspace-layout-B9H1Tqrk.js → workspace-layout-BOQnl_3d.js} +1 -1
  287. package/static/settings/settings.html +2 -2
  288. package/dist/api/ai-gateway/pod/HostedPodDataAccess.d.ts +0 -31
  289. package/dist/api/ai-gateway/pod/HostedPodDataAccess.js +0 -330
  290. package/dist/http/InternalPodDataHttpHandler.d.ts +0 -57
  291. package/dist/http/InternalPodDataHttpHandler.js +0 -551
  292. package/dist/http/InternalPodDataHttpHandler.jsonld +0 -243
  293. package/node_modules/@undefineds.co/ai-connections-core/package.json +0 -61
  294. package/static/auth-callback/assets/NetworkPage-cEvxRMAl.js +0 -2
  295. package/static/auth-callback/assets/ai-connections-C6yaE6WQ.js +0 -1
  296. package/static/auth-callback/assets/auth-callback-Cx9D_1qj.css +0 -1
  297. package/static/auth-callback/assets/index-Cu0EguPo.js +0 -4
  298. package/static/dashboard/assets/NetworkPage-Ot4G2dX5.js +0 -2
  299. package/static/dashboard/assets/ai-connections-CXp5gd1J.js +0 -1
  300. package/static/dashboard/assets/dashboard-Cx9D_1qj.css +0 -1
  301. package/static/dashboard/assets/index-Gp3cLolR.js +0 -4
  302. package/static/settings/assets/NetworkPage-BVkasFGM.js +0 -2
  303. package/static/settings/assets/ai-connections-C6yaE6WQ.js +0 -1
  304. package/static/settings/assets/index-BdXwm8nh.js +0 -4
  305. package/static/settings/assets/settings-Cx9D_1qj.css +0 -1
  306. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/normalize.d.ts +0 -0
  307. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/normalize.js +0 -0
  308. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/request.d.ts +0 -0
  309. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/request.js +0 -0
  310. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/types.d.ts +0 -0
  311. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/types.js +0 -0
  312. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/base-adapter.d.ts +0 -0
  313. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/base-adapter.js +0 -0
  314. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/codex.d.ts +0 -0
  315. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/codex.js +0 -0
  316. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/index.d.ts +0 -0
  317. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/index.js +0 -0
  318. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/json-env-adapter.d.ts +0 -0
  319. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/json-env-adapter.js +0 -0
  320. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/pi.d.ts +0 -0
  321. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/pi.js +0 -0
  322. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/transaction.d.ts +0 -0
  323. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/transaction.js +0 -0
  324. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/types.d.ts +0 -0
  325. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/types.js +0 -0
  326. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/credential-storage.d.ts +0 -0
  327. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/credential-storage.js +0 -0
  328. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/endpoint-urls.d.ts +0 -0
  329. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/endpoint-urls.js +0 -0
  330. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/provider-catalog.d.ts +0 -0
  331. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/provider-catalog.js +0 -0
@@ -0,0 +1,2 @@
1
+ import{c as I,v as pe,r as d,Y as U,j as e,C as k,a as C,b as S,d as P,e as R,B as g,Z as se,R as he,N as fe,w as ve,x as be}from"./settings-CyLnISOv.js";import{P as ge}from"./PaneListHeader-Cpe39N76.js";import{N as ie,W as je}from"./waypoints-BSdfNvEb.js";import{A as oe}from"./activity-DGpLfsQB.js";import{T as ye,u as Ne}from"./workspace-layout-BOQnl_3d.js";import{E as le}from"./external-link-BATYaM13.js";import{B as M}from"./badge-_hCrrWRP.js";import{R as we}from"./rotate-ccw-DDdw8PTU.js";import{D as ke}from"./download-B_D21DDX.js";const Ce=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],Se=I("cable",Ce);const Pe=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],de=I("earth",Pe);const Re=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],De=I("lock-keyhole",Re);const Te=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Ae=I("radio",Te);const Ee=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],Le=I("route",Ee);const Ie=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$e=I("shield-check",Ie);const Me=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Oe=I("wifi",Me);async function Ue({fetchImpl:t}){return Z(t,X("/api/network/settings/status"),{method:"GET",credentials:"include",headers:{accept:"application/json"}})}async function qe({fetchImpl:t}){return Z(t,X("/api/network/settings/diagnose"),{method:"POST",credentials:"include",headers:{accept:"application/json"}})}async function ze({fetchImpl:t}){await Z(t,X("/api/network/settings/certificate/renew"),{method:"POST",credentials:"include",headers:{accept:"application/json"}})}async function Ve({podUrl:t,fetchImpl:n,patch:r}){return Z(n,He("/api/network/settings/configuration",t),{method:"PUT",credentials:"include",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(r)})}function X(t){const n=typeof window>"u"?"http://localhost":window.location.origin;return new URL(t,n).toString()}function He(t,n){return n?new URL(t,n).toString():X(t)}async function Z(t,n,r){const i=await t(n,r);if(!i.ok)throw await i.arrayBuffer(),new Error("Network settings request failed. Please try again.");if(!i.headers.get("content-type")?.includes("application/json"))throw await i.arrayBuffer(),new Error("Network settings request failed. Please try again.");return await i.json()}const ne=[{id:"overview",label:"Overview",path:"",icon:ie},{id:"endpoints",label:"Endpoints",path:"endpoints",icon:Se},{id:"addresses",label:"Addresses",path:"addresses",icon:de},{id:"domain-dns",label:"Domain & DNS",path:"domain-dns",icon:Le},{id:"https",label:"HTTPS",path:"https",icon:De},{id:"tunnel-profiles",label:"Tunnel Profiles",path:"tunnel-profiles",icon:je},{id:"p2p",label:"P2P",path:"p2p",icon:Ae},{id:"diagnostics",label:"Diagnostics",path:"diagnostics",icon:oe}];function _e(t){const n=["Xpod Network Diagnostics",`Generated: ${t.generatedAt}`,`Canonical URL: ${t.endpoint??"Unavailable"}`],r=t.checks.flatMap(i=>["",`[${i.status.toUpperCase()}] ${i.label}`,...i.detail?[i.detail]:[]]);return[...n,...r].join(`
2
+ `)}function bt(){const t=pe(),[n,r]=d.useState(),[i,s]=d.useState([]),[o,l]=d.useState(),[p,u]=d.useState(),[y,h]=d.useState(!1),[D,T]=d.useState(!1),[B,E]=d.useState(!1),[$,F]=d.useState(!1),[a,m]=d.useState(),v=d.useRef(0),N=d.useRef(0),z=d.useRef(0),V=d.useRef(void 0),H=d.useRef(!0),K=typeof window>"u"?void 0:window.location.origin,w=K?`local-host:${K}`:void 0,A=globalThis.fetch;d.useEffect(()=>(H.current=!0,()=>{H.current=!1,v.current+=1,N.current+=1,z.current+=1}),[]);const W=d.useCallback((c,x)=>H.current&&v.current===c&&V.current===x,[]),G=d.useCallback((c,x)=>H.current&&N.current===c&&V.current===x,[]),J=d.useCallback((c,x)=>H.current&&z.current===c&&V.current===x,[]),_=d.useCallback(async()=>{const c=w;if(!c)return;const x=v.current+1;v.current=x,h(!0),u(void 0);try{const L=await Ue({fetchImpl:A});W(x,c)&&r(L)}catch{W(x,c)&&u("网络设置请求失败,请重试。")}finally{W(x,c)&&h(!1)}},[A,w,W]);d.useEffect(()=>{let c=!1;return V.current=w,v.current+=1,N.current+=1,z.current+=1,queueMicrotask(()=>{c||V.current!==w||(r(void 0),s([]),l(void 0),u(void 0),h(!1),T(!1),E(!1),w&&_())}),()=>{c=!0}},[w,_]);const ue=d.useCallback(async()=>{const c=w;if(!c)return;const x=N.current+1;N.current=x,T(!0),u(void 0);try{const L=await qe({fetchImpl:A});G(x,c)&&(s(L.checks),l(new Date),U({description:"诊断完成"}))}catch{G(x,c)&&u("网络诊断失败,请重试。")}finally{G(x,c)&&T(!1)}},[A,w,G]),me=d.useCallback(async()=>{const c=w;if(!c)return;const x=z.current+1;z.current=x,E(!0),u(void 0);try{await ze({fetchImpl:A}),J(x,c)&&(U({variant:"success",description:"证书续签成功"}),await _())}catch{J(x,c)&&u("证书续签失败,请重试。")}finally{J(x,c)&&E(!1)}},[A,w,J,_]),Y=d.useCallback(async c=>{if(K){F(!0),u(void 0);try{const x=await Ve({fetchImpl:A,patch:c});r(L=>L&&{...L,configuration:x.configuration}),m(x.applyState),U({variant:"success",description:"Network configuration saved"})}catch{u("网络配置保存失败,请重试。")}finally{F(!1)}}},[A,K]),xe=d.useMemo(()=>[{key:"local",title:"本机",values:n?.addresses.local??[]},{key:"lan",title:"局域网",values:n?.addresses.lan??[]},{key:"public",title:"公网",values:n?.addresses.public??[]}],[n]),re=t.pathname.split("/").filter(Boolean).at(-1),b=ne.some(c=>c.path===re)?re:"overview";return e.jsx(ye,{mode:"auto",listHeader:e.jsx(ge,{title:"Network"}),list:e.jsx(Be,{}),mainHeader:e.jsx(Fe,{title:ne.find(c=>(c.path||"overview")===b)?.label??"Overview",loading:y,stale:y&&!!n,onRefresh:_}),main:e.jsxs("section",{className:"flex min-h-full flex-col gap-4 bg-background p-6",children:[p?e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:p}):null,(b==="overview"||b==="endpoints")&&e.jsx(Qe,{endpoint:n?.endpoint,loading:y&&!n}),b==="overview"&&e.jsx(Ke,{status:n}),(b==="overview"||b==="addresses")&&e.jsx(tt,{sections:xe,loading:y&&!n,diagnostics:i,checkedAt:o}),b==="overview"&&e.jsx(it,{status:n}),b==="domain-dns"&&e.jsxs(e.Fragment,{children:[e.jsx(at,{status:n}),e.jsx(Ge,{configuration:n?.configuration,saving:$,applyState:a,onSave:Y})]}),b==="https"&&e.jsxs(e.Fragment,{children:[e.jsx(rt,{status:n}),e.jsx(Je,{configuration:n?.configuration,saving:$,applyState:a,onSave:Y})]}),b==="tunnel-profiles"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{title:"Observed tunnel",label:"Tunnel",capability:n?.tunnel}),e.jsx(Ye,{configuration:n?.configuration,providers:n?.providers??[],ingress:n?.ingress,saving:$,applyState:a,onSave:Y})]}),b==="p2p"&&e.jsx(Ze,{configuration:n?.configuration,saving:$,applyState:a,onSave:Y}),(b==="overview"||b==="diagnostics"||b==="https")&&e.jsx(ot,{status:n,endpoint:n?.endpoint,diagnostics:i,diagnosing:D,renewing:B,onDiagnose:ue,onRenewCertificate:me})]}),className:"min-h-full"})}function Be(){const t=Ne();return e.jsx("aside",{className:"h-full border-r border-border bg-muted/20 py-2",children:e.jsx("nav",{"aria-label":"Network sections","data-list-navigation":!0,children:ne.map(n=>{const r=n.icon,i=`/network${n.path?`/${n.path}`:""}`;return e.jsxs(fe,{to:i,onClick:()=>t.openMain(),onKeyDown:ve,className:({isActive:s})=>be(s,{compact:!1}),end:n.path==="",children:[e.jsx(r,{className:"h-4 w-4","aria-hidden":"true"}),n.label]},n.id)})})})}function Fe({title:t,loading:n,stale:r,onRefresh:i}){return e.jsxs("div",{className:"flex h-full min-w-0 items-center justify-between gap-4 px-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h1",{className:"text-sm font-semibold text-foreground",children:["Network · ",t]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground","aria-live":"polite",children:r?"Refreshing · showing previous snapshot":"接入点、DNS、TLS、隧道与连通性诊断"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:i,disabled:n,children:[e.jsx(he,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"刷新"]})})]})}function Ke({status:t}){const n=t?.addresses.public[0]??t?.addresses.lan[0]??t?.addresses.local[0]??t?.endpoint,r=t?!t.dns.supported||t.dns.status==="unsupported"?"Configure Domain & DNS, then recheck observed DNS.":!t.tls.supported||!["valid","active","ready"].includes(t.tls.status)?"Review HTTPS configuration and certificate renewal evidence.":"No connectivity action is currently required.":"Refresh network status.",i=t?.tunnel.supported===!0;return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:"Preferred access path"}),e.jsx(P,{children:"First address this runtime has configured, in public → LAN → local order"})]}),e.jsxs(R,{className:"space-y-3 text-sm",children:[e.jsx("div",{className:"break-words font-medium",children:n??"Not configured"}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[e.jsxs(M,{variant:"outline",children:["Local ",t?.addresses.local.length?"configured":"not configured"]}),e.jsxs(M,{variant:"outline",children:["LAN ",t?.addresses.lan.length?"configured":"not configured"]}),e.jsxs(M,{variant:"outline",children:["Public ",t?.addresses.public.length?"configured":"not configured"]}),e.jsxs(M,{variant:"outline",children:["Tunnel ",i?t?.tunnel.status??"unknown":"not observed"]})]}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Configured addresses are not probe results; reachability is reported per route."}),e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsx("div",{className:"font-medium",children:"Next action"}),e.jsx("div",{className:"mt-1 text-muted-foreground",children:r})]})]})]})}function We({title:t,label:n,capability:r,extra:i}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:t}),e.jsx(P,{children:"Observed runtime state"})]}),e.jsx(R,{children:e.jsx(q,{label:n,capability:r,extra:i})})]})}function Q({title:t}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:t}),e.jsx(P,{children:"Desired configuration"})]}),e.jsxs(R,{className:"text-sm text-muted-foreground",children:["This runtime does not report a configurable ",t," capability."]})]})}function Ge({configuration:t,saving:n,applyState:r,onSave:i}){const[s,o]=d.useState(t?.domainDns),[l,p]=d.useState("");return d.useEffect(()=>{let u=!1;return queueMicrotask(()=>{u||o(t?.domainDns)}),()=>{u=!0}},[t]),s?e.jsxs(ee,{title:"Saved configuration",applyState:r,children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(j,{name:"domain",label:"Domain",value:s.domain,onChange:u=>o({...s,domain:u})}),e.jsx(j,{name:"provider",label:"DNS provider",value:s.provider,onChange:u=>o({...s,provider:u})}),e.jsx(ce,{name:"recordTtl",label:"Record TTL (seconds)",value:s.recordTtl,min:30,max:86400,onChange:u=>o({...s,recordTtl:u})}),e.jsx(j,{name:"dnsCredential",label:s.credentialConfigured?"Replace credential (configured)":"Credential",value:l,type:"password",onChange:p})]}),e.jsx(ae,{label:"Enable DDNS",checked:s.ddnsEnabled,onChange:u=>o({...s,ddnsEnabled:u})}),e.jsx(te,{label:"Save DNS configuration",saving:n,onClick:()=>i({domainDns:{domain:s.domain,ddnsEnabled:s.ddnsEnabled,provider:s.provider,recordTtl:s.recordTtl,...l?{credential:l}:{}}})})]}):e.jsx(Q,{title:"Domain & DNS"})}function Je({configuration:t,saving:n,applyState:r,onSave:i}){const[s,o]=d.useState(t?.https);return d.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||o(t?.https)}),()=>{l=!0}},[t]),s?e.jsxs(ee,{title:"Saved configuration",applyState:r,children:[e.jsx(ae,{label:"Enable HTTPS",checked:s.enabled,onChange:l=>o({...s,enabled:l})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(j,{name:"acmeEmail",label:"ACME email",value:s.acmeEmail,onChange:l=>o({...s,acmeEmail:l})}),e.jsx(j,{name:"acmeDomains",label:"Certificate domains",value:s.domains.join(", "),onChange:l=>o({...s,domains:l.split(",").map(p=>p.trim()).filter(Boolean)})}),e.jsx(j,{name:"certificatePath",label:"Certificate path",value:s.certificatePath??"",onChange:l=>o({...s,certificatePath:l})}),e.jsx(j,{name:"certificateKeyPath",label:"Private-key path",value:s.certificateKeyPath??"",onChange:l=>o({...s,certificateKeyPath:l})}),e.jsx(ce,{name:"renewBeforeDays",label:"Renew before (days)",value:s.renewBeforeDays,min:1,max:90,onChange:l=>o({...s,renewBeforeDays:l})})]}),e.jsx(te,{label:"Save HTTPS configuration",saving:n,onClick:()=>i({https:s})})]}):e.jsx(Q,{title:"HTTPS"})}function Ye({configuration:t,providers:n,ingress:r,saving:i,applyState:s,onSave:o}){const[l,p]=d.useState(t?.tunnelProfiles.activeProfileId??""),[u,y]=d.useState(t?.tunnelProfiles.profiles??[]),[h,D]=d.useState({});if(d.useEffect(()=>{let a=!1;return queueMicrotask(()=>{a||(p(t?.tunnelProfiles.activeProfileId??""),y(t?.tunnelProfiles.profiles??[]),D({}))}),()=>{a=!0}},[t]),!t)return e.jsx(Q,{title:"Tunnel Profiles"});const T=(a,m)=>y(v=>v.map(N=>N.id===a?{...N,...m}:N)),B=n.filter(a=>a.runtimeSupported),E=a=>n.find(m=>m.id===a),$=()=>{const a=`tunnel-${Date.now()}`,m=B[0]?.id??"ngrok";y(v=>[...v,{id:a,provider:m,label:"New tunnel",credentialConfigured:!1,parameters:{}}])},F=a=>{y(m=>m.filter(v=>v.id!==a)),l===a&&p("none")};return e.jsxs(ee,{title:"Saved tunnel profiles",applyState:s,children:[e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Active profile",e.jsxs("select",{value:l||"none",onChange:a=>p(a.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-sm",children:[e.jsx("option",{value:"none",children:"None"}),u.map(a=>e.jsxs("option",{value:a.id,children:[a.label," · ",a.provider]},a.id))]})]}),e.jsx("div",{className:"space-y-3",children:u.map(a=>e.jsxs("div",{className:"space-y-3 rounded-md border border-border p-3 text-sm",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(j,{name:`tunnel-label-${a.id}`,label:"Label",value:a.label,onChange:m=>T(a.id,{label:m})}),e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Provider",e.jsx("select",{value:a.provider,onChange:m=>T(a.id,{provider:m.target.value,parameters:{}}),className:"block h-10 w-full rounded-md border border-input bg-background px-3",children:B.map(m=>e.jsx("option",{value:m.id,children:m.label},m.id))})]}),E(a.provider)?.endpointSource==="declared"?e.jsx(j,{name:`tunnel-url-${a.id}`,label:"Public endpoint (declared)",value:a.publicUrl??"",onChange:m=>T(a.id,{publicUrl:m})}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"The provider reports its public endpoint; there is nothing to type here."}),e.jsx(j,{name:`tunnel-credential-${a.id}`,label:a.credentialConfigured?"Replace credential (configured)":"Credential",type:"password",value:h[a.id]??"",onChange:m=>D(v=>({...v,[a.id]:m}))})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer font-medium",children:"Provider-specific parameters"}),e.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:(E(a.provider)?.parameterFields??[]).map(({key:m,label:v})=>e.jsx(j,{name:`tunnel-${m}-${a.id}`,label:v,value:a.parameters?.[m]??"",onChange:N=>T(a.id,{parameters:{...a.parameters,[m]:N}})},m))})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[l===a.id?"Active after restart":"Inactive"," · credential ",a.credentialConfigured?"configured":"missing"]}),e.jsx(g,{type:"button",size:"sm",variant:"ghost",onClick:()=>F(a.id),children:"Remove"})]})]},a.id))}),e.jsx(g,{type:"button",size:"sm",variant:"outline",onClick:$,children:"Add tunnel profile"}),e.jsx(Xe,{ingress:r,descriptor:E(u.find(a=>a.id===l)?.provider??"")}),e.jsx(te,{label:"Save tunnel profiles",saving:i,onClick:()=>o({tunnelProfiles:{activeProfileId:l,profiles:u.map(a=>({id:a.id,provider:a.provider,label:a.label,publicUrl:a.publicUrl,parameters:a.parameters,...h[a.id]?{credential:h[a.id]}:{}}))}})})]})}function Xe({ingress:t,descriptor:n}){if(!t||n?.originOwner!=="console")return null;const r=async()=>{await window.navigator.clipboard.writeText(t.originUrl),U({description:"Tunnel origin copied"})};return e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3","data-testid":"ingress-origin",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Tunnel origin (paste into the provider console)"}),e.jsxs("div",{className:"mt-1 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"break-all font-mono text-sm",children:t.originUrl}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Set the tunnel's local port / service to this address, not the Gateway port: this is the entry that never treats a tunnelled caller as local."})]}),e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":"Copy tunnel origin",onClick:()=>{r()},children:e.jsx(se,{className:"h-4 w-4","aria-hidden":"true"})}),n.consoleUrl?e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":`Open ${n.label} console`,onClick:()=>window.open(n.consoleUrl,"_blank","noopener,noreferrer"),children:e.jsx(le,{className:"h-4 w-4","aria-hidden":"true"})}):null]})]})]})}function Ze({configuration:t,saving:n,applyState:r,onSave:i}){const[s,o]=d.useState(t?.p2p);return d.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||o(t?.p2p)}),()=>{l=!0}},[t]),s?e.jsxs(ee,{title:"Saved P2P configuration",applyState:r,children:[e.jsx(ae,{label:"Enable P2P fallback",checked:s.enabled,onChange:l=>o({...s,enabled:l})}),e.jsx(j,{name:"signalService",label:"Signal service",value:s.signalService,onChange:l=>o({...s,signalService:l})}),e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Fallback policy",e.jsxs("select",{value:s.fallbackPolicy,onChange:l=>o({...s,fallbackPolicy:l.target.value}),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-sm",children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"when-direct-unavailable",children:"When direct is unavailable"}),e.jsx("option",{value:"prefer-p2p",children:"Prefer P2P"})]})]}),e.jsx(te,{label:"Save P2P configuration",saving:n,onClick:()=>i({p2p:s})})]}):e.jsx(Q,{title:"P2P"})}function ee({title:t,applyState:n,children:r}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:t}),e.jsx(P,{children:"Desired configuration · not presented as observed until verified"})]}),e.jsxs(R,{className:"space-y-4",children:[n==="restart-required"?e.jsx("div",{role:"status",className:"rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-200",children:"Saved · restart required"}):null,r]})]})}function j({name:t,label:n,value:r,type:i="text",onChange:s}){return e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[n,e.jsx("input",{name:t,type:i,value:r,onChange:o=>s(o.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm"})]})}function ce({name:t,label:n,value:r,min:i,max:s,onChange:o}){return e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[n,e.jsx("input",{name:t,type:"number",value:r,min:i,max:s,onChange:l=>o(l.target.valueAsNumber),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm"})]})}function ae({label:t,checked:n,onChange:r}){return e.jsxs("label",{className:"flex items-center justify-between gap-3 rounded-md border border-border p-3 text-sm font-medium",children:[t,e.jsx("input",{type:"checkbox",checked:n,onChange:i=>r(i.target.checked)})]})}function te({label:t,saving:n,onClick:r}){return e.jsx("div",{className:"flex justify-end",children:e.jsx(g,{type:"button",onClick:r,disabled:n,children:n?"Saving…":t})})}function Qe({endpoint:t,loading:n}){const r=[{label:"Canonical URL",value:t},{label:"API endpoint",value:t?et(t,"/api/"):void 0}],i=async(s,o)=>{await window.navigator.clipboard.writeText(o),U({description:`${s} copied`})};return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4","aria-hidden":"true"}),"接入点"]}),e.jsx(P,{children:n?"正在解析接入点":"Observed endpoints · Currently effective route is the canonical URL"})]}),e.jsx(R,{className:"space-y-3",children:r.map(({label:s,value:o})=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:s}),e.jsx("div",{className:"mt-1 break-words text-sm text-foreground",children:o||"Unavailable"})]}),o?e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":`Copy ${s}`,onClick:()=>{i(s,o)},children:e.jsx(se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":`Open ${s}`,onClick:()=>window.open(o,"_blank","noopener,noreferrer"),children:e.jsx(le,{className:"h-4 w-4","aria-hidden":"true"})})]}):null]},s))})]})}function et(t,n){try{return new URL(n,t).toString()}catch{return t}}function tt({sections:t,loading:n,diagnostics:r,checkedAt:i}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(Oe,{className:"h-4 w-4","aria-hidden":"true"}),"网络地址"]}),e.jsx(P,{children:n?"正在刷新地址":"由运行时网络能力上报"})]}),e.jsx(R,{className:"space-y-4",children:t.map(s=>e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:s.title}),s.values.length>0?e.jsx("div",{className:"mt-1 space-y-1",children:s.values.map(o=>e.jsx(nt,{scope:s.key,value:o,diagnostics:r,checkedAt:i},o))}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"未提供"})]},s.key))})]})}function nt({scope:t,value:n,diagnostics:r,checkedAt:i}){const s=st(n),o=r.find(l=>l.id==="address-configuration");return e.jsxs("div",{className:"rounded-md border border-border p-3 text-sm",children:[e.jsx("div",{className:"break-words font-medium text-foreground",children:n}),e.jsxs("dl",{className:"mt-2 grid gap-x-4 gap-y-1 text-xs sm:grid-cols-2",children:[e.jsx(f,{label:"Interface",value:t==="local"?"Loopback":t==="lan"?"LAN interface (name not reported)":"Public route"}),e.jsx(f,{label:"IP version",value:s.ipVersion}),e.jsx(f,{label:"Port",value:s.port}),e.jsx(f,{label:"Configured",value:o?o.status==="ok"?"Yes":"No":"Not checked"}),e.jsx(f,{label:"Reachability",value:"Not probed"}),e.jsx(f,{label:"Configuration checked",value:o?.checkedAt?O(o.checkedAt):i?i.toLocaleString():"Not checked"})]})]})}function f({label:t,value:n}){return e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("dt",{className:"text-muted-foreground",children:t}),e.jsx("dd",{className:"text-right text-foreground",children:n})]})}function st(t){try{const n=new URL(t),r=n.hostname.replace(/^\[|\]$/g,"");return{ipVersion:r.includes(":")?"IPv6":/^\d{1,3}(?:\.\d{1,3}){3}$/.test(r)?"IPv4":"Resolved hostname",port:n.port||(n.protocol==="https:"?"443":n.protocol==="http:"?"80":"Not reported")}}catch{return{ipVersion:"Not reported",port:"Not reported"}}}function at({status:t}){const n=t?.configuration?.domainDns,r=(t?.addresses.public??[]).map(i=>{try{return new URL(i).hostname}catch{return i}});return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:"Observed DNS"}),e.jsx(P,{children:"Observed state is kept separate from desired DNS policy."})]}),e.jsxs(R,{className:"space-y-3",children:[e.jsx(q,{label:"Runtime status",capability:t?.dns}),e.jsxs("dl",{className:"grid gap-2 text-sm sm:grid-cols-2",children:[e.jsx(f,{label:"Observed hostnames",value:r.join(", ")||"Not reported"}),e.jsx(f,{label:"Expected domain",value:n?.domain||"Not configured"}),e.jsx(f,{label:"Expected value",value:t?.addresses.public[0]||"Not reported"}),e.jsx(f,{label:"Provider",value:n?.provider||"Not configured"})]})]})]})}function rt({status:t}){const n=t?.configuration?.https;return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:"Observed HTTPS"}),e.jsx(P,{children:"Certificate evidence reported by the active runtime."})]}),e.jsxs(R,{className:"space-y-3",children:[e.jsx(q,{label:"TLS",capability:t?.tls,extra:t?.tls.expiresAt?`Expires ${O(t.tls.expiresAt)}`:void 0}),e.jsxs("dl",{className:"grid gap-2 text-sm sm:grid-cols-2",children:[e.jsx(f,{label:"Certificate domains",value:t?.tls.domains?.join(", ")||n?.domains.join(", ")||"Not reported"}),e.jsx(f,{label:"Issuer",value:t?.tls.issuer||"Not reported by runtime"}),e.jsx(f,{label:"Validity",value:t?.tls.validFrom?`${O(t.tls.validFrom)} — ${t.tls.expiresAt?O(t.tls.expiresAt):"open"}`:t?.tls.status??"Not reported"}),e.jsx(f,{label:"Expiry",value:t?.tls.expiresAt?O(t.tls.expiresAt):"Not reported"}),e.jsx(f,{label:"Renewal status",value:t?.tls.renewalStatus||(t?.actions.renewCertificate?"Renewal available":"Renewal unavailable")}),e.jsx(f,{label:"Renewal policy",value:n?`${n.renewBeforeDays} days before expiry`:"Not configured"})]})]})]})}function it({status:t}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(ie,{className:"h-4 w-4","aria-hidden":"true"}),"网络能力"]}),e.jsx(P,{children:"服务端声明的网络支持"})]}),e.jsxs(R,{className:"grid gap-3 text-sm",children:[e.jsx(q,{label:"TLS",capability:t?.tls,extra:t?.tls.expiresAt?`到期时间 ${O(t.tls.expiresAt)}`:void 0}),e.jsx(q,{label:"DNS",capability:t?.dns}),e.jsx(q,{label:"Tunnel",capability:t?.tunnel})]})]})}function ot({status:t,endpoint:n,diagnostics:r,diagnosing:i,renewing:s,onDiagnose:o,onRenewCertificate:l}){const p=r.length>0?_e({generatedAt:new Date().toISOString(),endpoint:n,checks:r}):void 0,u=async()=>{p&&(await window.navigator.clipboard.writeText(p),U({description:"Diagnostic report copied"}))},y=()=>{if(!p)return;const h=URL.createObjectURL(new Blob([p],{type:"text/plain;charset=utf-8"})),D=document.createElement("a");D.href=h,D.download=`xpod-network-diagnostics-${new Date().toISOString().replace(/[:.]/g,"-")}.txt`,D.click(),URL.revokeObjectURL(h)};return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(oe,{className:"h-4 w-4","aria-hidden":"true"}),"操作"]}),e.jsx(P,{children:"仅显示网络能力允许的操作"})]}),e.jsxs(R,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t?.actions.diagnose?e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:o,disabled:i,children:[e.jsx($e,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"连通性诊断"]}):null,t?.actions.renewCertificate?e.jsxs(g,{type:"button",size:"sm",variant:"subtle",onClick:l,disabled:s,children:[e.jsx(we,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"续签证书"]}):null,e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:()=>{u()},disabled:!p,children:[e.jsx(se,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Copy diagnostics"]}),e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:y,disabled:!p,children:[e.jsx(ke,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Export diagnostics"]})]}),r.length>0?e.jsx("div",{className:"space-y-2",children:r.map(h=>e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:h.label}),e.jsx(M,{variant:h.status==="ok"?"secondary":"outline",children:h.status})]}),h.detail?e.jsx("div",{className:"mt-1 break-words text-xs text-muted-foreground",children:h.detail}):null]},h.id))}):e.jsx("div",{className:"text-sm text-muted-foreground",children:"尚未运行过诊断。"})]})]})}function q({label:t,capability:n,extra:r}){const i=n?.supported===!0;return e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:i?t:`${t} 不支持`}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[n?.status??"读取中",n?.detail?` · ${n.detail}`:""]})]}),e.jsx(M,{variant:i?"secondary":"outline",children:i?"支持":"不支持"})]}),r?e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:r}):null]})}function O(t){if(!t)return"暂无记录";const n=new Date(t);return Number.isNaN(n.getTime())?"暂无记录":n.toLocaleString()}export{bt as default};
@@ -1 +1 @@
1
- import{j as t}from"./settings-BvqY7K96.js";function s({title:e}){return t.jsx("div",{className:"flex h-full items-center px-4 text-sm font-semibold text-foreground",children:e})}export{s as P};
1
+ import{j as t}from"./settings-CyLnISOv.js";function s({title:e}){return t.jsx("div",{className:"flex h-full items-center px-4 text-sm font-semibold text-foreground",children:e})}export{s as P};
@@ -1 +1 @@
1
- import{r as g,j as n}from"./settings-BvqY7K96.js";import{i as p,A as f}from"./ModelAssignmentsPanel-BetgXw1G.js";import{u as k}from"./AiConfigContext-DsyWgu2i.js";import"./dialog-B7ZRsjN7.js";import"./index-CkGda_Pg.js";import"./ai-connections-C6yaE6WQ.js";import"./XpodAiConnectionsPodStore-owBQc5nY.js";import"./index-browser-Dq7omlpY.js";function w(){const{config:r,capabilities:d,save:o,rebuild:c,saveAndRebuild:i,saving:l,rebuilding:s}=k(),[e,a]=g.useState(r?.searchIndexing);if(g.useEffect(()=>{let t=!1;return queueMicrotask(()=>{t||a(r?.searchIndexing)}),()=>{t=!0}},[r]),!e)return null;const u=async t=>{t.preventDefault(),await o({searchIndexing:e})},x=e.ftsEnabled&&e.vectorEnabled?"all":e.vectorEnabled?"vector":"fts",b=d?.rebuildTargets?.includes(x)===!0,m=p(e,r?.searchIndexing);return n.jsxs(f,{title:"Search & Indexing",description:"Choose which derived search indexes Xpod maintains for this Pod.",onSubmit:u,onRestore:()=>o({searchIndexing:{ftsEnabled:!0,vectorEnabled:!0,progressiveIndexingEnabled:!0,textBackend:"auto",vectorBackend:"auto"}}),saving:l||s,dirty:m,footerActions:n.jsx("button",{type:"button",disabled:!b||l||s,onClick:()=>m?i({searchIndexing:e},x):c(x),className:"h-9 rounded-md border border-input px-3 text-sm font-medium disabled:opacity-50",children:s?"Scheduling…":m&&b?"Save and schedule rebuild":b?"Schedule rebuild":"Rebuild unavailable on this runtime"}),children:[n.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[n.jsx(h,{title:"Full-text Search",enabled:e.ftsEnabled,onEnabled:t=>a({...e,ftsEnabled:t}),backend:e.textBackend,onBackend:t=>a({...e,textBackend:t}),backends:[["auto","Auto"],...(d?.textBackends??[]).map(t=>[t,t==="fts5"?"FTS5":"PostgreSQL FTS"])]}),n.jsx(h,{title:"Vector Search",enabled:e.vectorEnabled,onEnabled:t=>a({...e,vectorEnabled:t}),backend:e.vectorBackend,onBackend:t=>a({...e,vectorBackend:t}),backends:[["auto","Auto"],...(d?.vectorBackends??[]).map(t=>[t,t==="vec"?"VEC":"pgvector"])]})]}),n.jsxs("label",{className:"flex items-start justify-between gap-4 rounded-xl border border-border p-4",children:[n.jsxs("span",{children:[n.jsx("span",{className:"block text-sm font-medium",children:"Progressive indexing"}),n.jsx("span",{className:"block text-xs text-muted-foreground",children:"Expand coverage as content becomes relevant instead of embedding everything eagerly."})]}),n.jsx("input",{name:"progressiveIndexingEnabled",type:"checkbox",checked:e.progressiveIndexingEnabled,onChange:t=>a({...e,progressiveIndexingEnabled:t.target.checked}),className:"mt-1 h-4 w-4 rounded border-input"})]})]})}function h({title:r,enabled:d,onEnabled:o,backend:c,onBackend:i,backends:l}){const s=l.filter(([a])=>a!=="auto"),e=v(c);return n.jsxs("section",{className:"rounded-xl border border-border p-4",children:[n.jsxs("label",{className:"flex items-center justify-between gap-3 text-sm font-medium",children:[r,n.jsx("input",{type:"checkbox",checked:d,onChange:a=>o(a.target.checked),className:"h-4 w-4 rounded border-input"})]}),n.jsxs("label",{className:"mt-4 flex items-center justify-between gap-3 text-xs font-medium text-muted-foreground",children:["Choose backend manually",n.jsx("input",{type:"checkbox",checked:e,disabled:s.length===0,onChange:a=>i(a.target.checked?s[0]?.[0]??"auto":"auto"),className:"h-4 w-4 rounded border-input"})]}),e?n.jsxs("label",{className:"mt-3 block space-y-2 text-xs font-medium text-muted-foreground",children:["Backend",n.jsx("select",{value:c,onChange:a=>i(a.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground",children:s.map(([a,u])=>n.jsx("option",{value:a,children:u},a))})]}):n.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Auto selects the runtime-supported backend."})]})}function v(r){return r!=="auto"}export{w as SearchIndexingPanel,v as isManualBackendSelection};
1
+ import{r as g,j as n}from"./settings-CyLnISOv.js";import{i as p,A as f}from"./ModelAssignmentsPanel-DEp9byI6.js";import{u as k}from"./AiConfigContext-D3b1l_Kw.js";import"./dialog-DTr2JkHn.js";import"./index-Ckh4h9jj.js";import"./ai-connections-DexTPyfC.js";import"./XpodAiConnectionsPodStore-VU5Bsz1a.js";import"./index-browser-DFFWN3Kr.js";function w(){const{config:r,capabilities:d,save:o,rebuild:c,saveAndRebuild:i,saving:l,rebuilding:s}=k(),[e,a]=g.useState(r?.searchIndexing);if(g.useEffect(()=>{let t=!1;return queueMicrotask(()=>{t||a(r?.searchIndexing)}),()=>{t=!0}},[r]),!e)return null;const u=async t=>{t.preventDefault(),await o({searchIndexing:e})},x=e.ftsEnabled&&e.vectorEnabled?"all":e.vectorEnabled?"vector":"fts",b=d?.rebuildTargets?.includes(x)===!0,m=p(e,r?.searchIndexing);return n.jsxs(f,{title:"Search & Indexing",description:"Choose which derived search indexes Xpod maintains for this Pod.",onSubmit:u,onRestore:()=>o({searchIndexing:{ftsEnabled:!0,vectorEnabled:!0,progressiveIndexingEnabled:!0,textBackend:"auto",vectorBackend:"auto"}}),saving:l||s,dirty:m,footerActions:n.jsx("button",{type:"button",disabled:!b||l||s,onClick:()=>m?i({searchIndexing:e},x):c(x),className:"h-9 rounded-md border border-input px-3 text-sm font-medium disabled:opacity-50",children:s?"Scheduling…":m&&b?"Save and schedule rebuild":b?"Schedule rebuild":"Rebuild unavailable on this runtime"}),children:[n.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[n.jsx(h,{title:"Full-text Search",enabled:e.ftsEnabled,onEnabled:t=>a({...e,ftsEnabled:t}),backend:e.textBackend,onBackend:t=>a({...e,textBackend:t}),backends:[["auto","Auto"],...(d?.textBackends??[]).map(t=>[t,t==="fts5"?"FTS5":"PostgreSQL FTS"])]}),n.jsx(h,{title:"Vector Search",enabled:e.vectorEnabled,onEnabled:t=>a({...e,vectorEnabled:t}),backend:e.vectorBackend,onBackend:t=>a({...e,vectorBackend:t}),backends:[["auto","Auto"],...(d?.vectorBackends??[]).map(t=>[t,t==="vec"?"VEC":"pgvector"])]})]}),n.jsxs("label",{className:"flex items-start justify-between gap-4 rounded-xl border border-border p-4",children:[n.jsxs("span",{children:[n.jsx("span",{className:"block text-sm font-medium",children:"Progressive indexing"}),n.jsx("span",{className:"block text-xs text-muted-foreground",children:"Expand coverage as content becomes relevant instead of embedding everything eagerly."})]}),n.jsx("input",{name:"progressiveIndexingEnabled",type:"checkbox",checked:e.progressiveIndexingEnabled,onChange:t=>a({...e,progressiveIndexingEnabled:t.target.checked}),className:"mt-1 h-4 w-4 rounded border-input"})]})]})}function h({title:r,enabled:d,onEnabled:o,backend:c,onBackend:i,backends:l}){const s=l.filter(([a])=>a!=="auto"),e=v(c);return n.jsxs("section",{className:"rounded-xl border border-border p-4",children:[n.jsxs("label",{className:"flex items-center justify-between gap-3 text-sm font-medium",children:[r,n.jsx("input",{type:"checkbox",checked:d,onChange:a=>o(a.target.checked),className:"h-4 w-4 rounded border-input"})]}),n.jsxs("label",{className:"mt-4 flex items-center justify-between gap-3 text-xs font-medium text-muted-foreground",children:["Choose backend manually",n.jsx("input",{type:"checkbox",checked:e,disabled:s.length===0,onChange:a=>i(a.target.checked?s[0]?.[0]??"auto":"auto"),className:"h-4 w-4 rounded border-input"})]}),e?n.jsxs("label",{className:"mt-3 block space-y-2 text-xs font-medium text-muted-foreground",children:["Backend",n.jsx("select",{value:c,onChange:a=>i(a.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground",children:s.map(([a,u])=>n.jsx("option",{value:a,children:u},a))})]}):n.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Auto selects the runtime-supported backend."})]})}function v(r){return r!=="auto"}export{w as SearchIndexingPanel,v as isManualBackendSelection};
@@ -1 +1 @@
1
- import{c as L,r as o,j as e,B as N,R as T,C as l,a as u,b as h,d as f,e as m}from"./settings-BvqY7K96.js";import{f as D,a as M,t as _,r as O}from"./admin-C6qCRFiY.js";import{E as q}from"./external-link-Bz7NckNO.js";const G=[["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"}]],U=L("rotate-cw",G);function Q({serviceId:t,title:r}){const[s,d]=o.useState(),[g,R]=o.useState(),[j,k]=o.useState([]),[v,p]=o.useState(),[b,S]=o.useState(!0),[y,w]=o.useState(!1),[C,$]=o.useState(),c=o.useCallback(async a=>{S(!0);try{const[n,A]=await Promise.all([D({signal:a}),M({source:t,level:"error",limit:5})]);d(t==="gateway"?{name:"gateway",status:"running",pid:n.adminData?.pid,uptime:n.adminData?.uptime?n.adminData.uptime*1e3:void 0,restartCount:0}:n.servicesData?.find(E=>E.name===t)),R(n.configData??void 0),k(A),$(n.checkedAt),p(void 0)}catch(n){n instanceof DOMException&&n.name==="AbortError"||p("Service status could not be loaded. The previous snapshot is retained.")}finally{S(!1)}},[t]);o.useEffect(()=>{const a=new AbortController;let n=!0;return Promise.resolve().then(()=>{n&&c(a.signal)}),()=>{n=!1,a.abort()}},[c]);const x=o.useMemo(()=>X(t,g),[g,t]),P=async()=>{const a=t==="gateway"?"the whole Xpod runtime":`${r} only`;if(!window.confirm(`Restart ${a}? Active requests may be interrupted.`))return;w(!0);const n=t==="gateway"?await _():await O(t);w(!1),n?setTimeout(()=>{c()},750):p(`Restart request for ${r} was not accepted by this runtime.`)};return e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{"aria-live":"polite",className:"text-xs text-muted-foreground",children:b?"Refreshing service evidence…":C?`Checked ${C.toLocaleString()}`:"Not checked"}),e.jsxs(N,{type:"button",size:"sm",variant:"outline",onClick:()=>{c()},disabled:b,children:[e.jsx(T,{className:"mr-2 h-4 w-4"}),"Refresh"]})]}),v&&e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:v}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:r}),e.jsx(f,{children:"Observed state, endpoint, health evidence, dependencies, and explicitly scoped lifecycle action."})]}),e.jsxs(m,{className:"grid gap-3 text-sm sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(i,{label:"State",value:s?.status??"Unknown"}),e.jsx(i,{label:"PID",value:s?.pid?.toString()??"Not reported"}),e.jsx(i,{label:"Uptime",value:s?.uptime?z(s.uptime):"Not reported"}),e.jsx(i,{label:"Restart count",value:s?.restartCount?.toString()??"Not reported"}),e.jsx(i,{label:"Internal endpoint",value:x.endpoint}),e.jsx(i,{label:"Health check",value:x.healthCheck})]})]}),e.jsxs(l,{children:[e.jsx(u,{children:e.jsx(h,{children:"Dependencies"})}),e.jsx(m,{className:"grid gap-3 text-sm sm:grid-cols-2",children:x.dependencies.map(a=>e.jsx(i,{label:a,value:B(a,t,s)},a))})]}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Recent errors"}),e.jsxs(f,{children:["Latest supervisor errors scoped to ",r,"."]})]}),e.jsxs(m,{className:"space-y-2",children:[j.length?j.map(a=>e.jsxs("div",{className:"rounded-lg border border-border p-3 text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(a.timestamp).toLocaleString()}),e.jsx("div",{className:"mt-1 break-words",children:a.message})]},`${a.timestamp}-${a.message}`)):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No recent errors reported."}),e.jsxs("a",{className:"inline-flex items-center text-sm font-medium text-primary hover:underline",href:`/status/logs?source=${t}`,children:[e.jsx(q,{className:"mr-1.5 h-4 w-4"}),"Open related logs"]})]})]}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Lifecycle"}),e.jsx(f,{children:t==="gateway"?"Gateway is the parent process, so this action restarts the whole Xpod runtime.":`This action restarts ${r} only; dependent requests may briefly fail.`})]}),e.jsx(m,{children:e.jsxs(N,{type:"button",variant:"destructive",onClick:()=>{P()},disabled:y,children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),y?"Restarting…":t==="gateway"?"Restart Xpod runtime…":`Restart ${r}…`]})})]})]})}function X(t,r){const s=r?.env??{};return t==="gateway"?{endpoint:window.location.origin,healthCheck:"GET /service/status",dependencies:["Solid Server","API Server"]}:t==="css"?{endpoint:s.CSS_PORT?`http://127.0.0.1:${s.CSS_PORT}`:"Internal endpoint not reported",healthCheck:"TCP readiness + Solid root request",dependencies:["Authority storage","Identity service"]}:{endpoint:s.API_INTERNAL_URL||(s.API_PORT?`http://127.0.0.1:${s.API_PORT}`:"Internal endpoint not reported"),healthCheck:"GET /health",dependencies:["Solid Server","Configuration store"]}}function B(t,r,s){return s?s.status!=="running"?`${H(r)} is ${s.status}; dependency health is not implied`:`${t} required; direct probe evidence is not reported by this runtime`:"Not reported"}function H(t){return t==="gateway"?"Gateway":t==="css"?"Solid Server":"API Server"}function i({label:t,value:r}){return e.jsxs("div",{className:"rounded-lg border border-border p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:t}),e.jsx("div",{className:"mt-1 break-all font-medium",children:r})]})}function z(t){const r=Math.floor(t/1e3),s=Math.floor(r/3600),d=Math.floor(r%3600/60);return s?`${s}h ${d}m`:`${d}m ${r%60}s`}export{Q as ServiceStatusPanel};
1
+ import{c as L,r as o,j as e,B as N,R as T,C as l,a as u,b as h,d as f,e as m}from"./settings-CyLnISOv.js";import{f as D,a as M,t as _,r as O}from"./admin-C6qCRFiY.js";import{E as q}from"./external-link-BATYaM13.js";const G=[["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"}]],U=L("rotate-cw",G);function Q({serviceId:t,title:r}){const[s,d]=o.useState(),[g,R]=o.useState(),[j,k]=o.useState([]),[v,p]=o.useState(),[b,S]=o.useState(!0),[y,w]=o.useState(!1),[C,$]=o.useState(),c=o.useCallback(async a=>{S(!0);try{const[n,A]=await Promise.all([D({signal:a}),M({source:t,level:"error",limit:5})]);d(t==="gateway"?{name:"gateway",status:"running",pid:n.adminData?.pid,uptime:n.adminData?.uptime?n.adminData.uptime*1e3:void 0,restartCount:0}:n.servicesData?.find(E=>E.name===t)),R(n.configData??void 0),k(A),$(n.checkedAt),p(void 0)}catch(n){n instanceof DOMException&&n.name==="AbortError"||p("Service status could not be loaded. The previous snapshot is retained.")}finally{S(!1)}},[t]);o.useEffect(()=>{const a=new AbortController;let n=!0;return Promise.resolve().then(()=>{n&&c(a.signal)}),()=>{n=!1,a.abort()}},[c]);const x=o.useMemo(()=>X(t,g),[g,t]),P=async()=>{const a=t==="gateway"?"the whole Xpod runtime":`${r} only`;if(!window.confirm(`Restart ${a}? Active requests may be interrupted.`))return;w(!0);const n=t==="gateway"?await _():await O(t);w(!1),n?setTimeout(()=>{c()},750):p(`Restart request for ${r} was not accepted by this runtime.`)};return e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{"aria-live":"polite",className:"text-xs text-muted-foreground",children:b?"Refreshing service evidence…":C?`Checked ${C.toLocaleString()}`:"Not checked"}),e.jsxs(N,{type:"button",size:"sm",variant:"outline",onClick:()=>{c()},disabled:b,children:[e.jsx(T,{className:"mr-2 h-4 w-4"}),"Refresh"]})]}),v&&e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:v}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:r}),e.jsx(f,{children:"Observed state, endpoint, health evidence, dependencies, and explicitly scoped lifecycle action."})]}),e.jsxs(m,{className:"grid gap-3 text-sm sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(i,{label:"State",value:s?.status??"Unknown"}),e.jsx(i,{label:"PID",value:s?.pid?.toString()??"Not reported"}),e.jsx(i,{label:"Uptime",value:s?.uptime?z(s.uptime):"Not reported"}),e.jsx(i,{label:"Restart count",value:s?.restartCount?.toString()??"Not reported"}),e.jsx(i,{label:"Internal endpoint",value:x.endpoint}),e.jsx(i,{label:"Health check",value:x.healthCheck})]})]}),e.jsxs(l,{children:[e.jsx(u,{children:e.jsx(h,{children:"Dependencies"})}),e.jsx(m,{className:"grid gap-3 text-sm sm:grid-cols-2",children:x.dependencies.map(a=>e.jsx(i,{label:a,value:B(a,t,s)},a))})]}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Recent errors"}),e.jsxs(f,{children:["Latest supervisor errors scoped to ",r,"."]})]}),e.jsxs(m,{className:"space-y-2",children:[j.length?j.map(a=>e.jsxs("div",{className:"rounded-lg border border-border p-3 text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(a.timestamp).toLocaleString()}),e.jsx("div",{className:"mt-1 break-words",children:a.message})]},`${a.timestamp}-${a.message}`)):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No recent errors reported."}),e.jsxs("a",{className:"inline-flex items-center text-sm font-medium text-primary hover:underline",href:`/status/logs?source=${t}`,children:[e.jsx(q,{className:"mr-1.5 h-4 w-4"}),"Open related logs"]})]})]}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Lifecycle"}),e.jsx(f,{children:t==="gateway"?"Gateway is the parent process, so this action restarts the whole Xpod runtime.":`This action restarts ${r} only; dependent requests may briefly fail.`})]}),e.jsx(m,{children:e.jsxs(N,{type:"button",variant:"destructive",onClick:()=>{P()},disabled:y,children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),y?"Restarting…":t==="gateway"?"Restart Xpod runtime…":`Restart ${r}…`]})})]})]})}function X(t,r){const s=r?.env??{};return t==="gateway"?{endpoint:window.location.origin,healthCheck:"GET /service/status",dependencies:["Solid Server","API Server"]}:t==="css"?{endpoint:s.CSS_PORT?`http://127.0.0.1:${s.CSS_PORT}`:"Internal endpoint not reported",healthCheck:"TCP readiness + Solid root request",dependencies:["Authority storage","Identity service"]}:{endpoint:s.API_INTERNAL_URL||(s.API_PORT?`http://127.0.0.1:${s.API_PORT}`:"Internal endpoint not reported"),healthCheck:"GET /health",dependencies:["Solid Server","Configuration store"]}}function B(t,r,s){return s?s.status!=="running"?`${H(r)} is ${s.status}; dependency health is not implied`:`${t} required; direct probe evidence is not reported by this runtime`:"Not reported"}function H(t){return t==="gateway"?"Gateway":t==="css"?"Solid Server":"API Server"}function i({label:t,value:r}){return e.jsxs("div",{className:"rounded-lg border border-border p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:t}),e.jsx("div",{className:"mt-1 break-all font-medium",children:r})]})}function z(t){const r=Math.floor(t/1e3),s=Math.floor(r/3600),d=Math.floor(r%3600/60);return s?`${s}h ${d}m`:`${d}m ${r%60}s`}export{Q as ServiceStatusPanel};
@@ -1 +1 @@
1
- import{c as r,D as l,T as x,U as h,v,j as a,O as y,N as p,w as m,x as k}from"./settings-BvqY7K96.js";import{A as u}from"./activity-CtBc9cNy.js";import{W as f,N as w}from"./waypoints-C4WbspTb.js";import{P as g}from"./PaneListHeader-BGOqGec4.js";import{T as N,u as j}from"./workspace-layout-B9H1Tqrk.js";const b=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],I=r("boxes",b);const S=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],M=r("braces",S);const L=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],_=r("hard-drive",L);const z=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],d=r("scroll-text",z);const D=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],H=r("server",D);const O=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],V=r("timer",O);function s(i,t,e,n,o){return{id:i,label:t,path:e,href:`/status/${e}`,end:!0,group:n,icon:o}}const c=[s("overview","Overview","overview","Overview",u),s("gateway","Gateway","services/gateway","Services",f),s("solid-server","Solid Server","services/solid-server","Services",l),s("api-server","API Server","services/api-server","Services",H),s("logs","Logs","logs","Diagnostics",d),s("index-overview","Index Overview","index","Index",I),s("rdf","RDF","index/rdf","Index",M),s("fts","FTS","index/fts","Index",d),s("vector","Vector","index/vector","Index",x),s("retrieval-points","Retrieval Points","index/retrieval-points","Index",w),s("cache","Cache","index/cache","Index",_),s("slow-queries","Slow Queries","index/slow-queries","Index",V),s("benchmark","Benchmark","index/benchmark","Index",h)],q=["Overview","Services","Diagnostics","Index"];function C(){const i=v(),t=[...c].sort((e,n)=>n.path.length-e.path.length).find(e=>i.pathname.endsWith(e.path))??c[0];return a.jsx(N,{mode:"auto",listHeader:a.jsx(g,{title:"Status"}),list:a.jsx(A,{}),mainHeader:a.jsx("div",{className:"flex h-full items-center px-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-sm font-semibold",children:["Status · ",t.label]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Observed state and operational evidence"})]})}),main:a.jsx("section",{className:"min-h-full bg-background",children:a.jsx(y,{})}),className:"min-h-full"})}function A(){const i=j();return a.jsx("aside",{"data-list-navigation":!0,className:"h-full overflow-y-auto border-r border-border bg-muted/20 py-2",children:q.map(t=>a.jsxs("section",{className:"mb-3",children:[a.jsx("h2",{className:"px-5 py-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:t}),c.filter(e=>e.group===t).map(e=>{const n=e.icon;return a.jsxs(p,{to:e.path,end:e.end,onKeyDown:m,onClick:()=>i.openMain(),className:({isActive:o})=>k(o,{compact:!1}),children:[a.jsx(n,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),e.label]},e.id)})]},t))})}export{C as default};
1
+ import{c as r,D as l,T as x,U as h,v,j as a,O as y,N as p,w as m,x as k}from"./settings-CyLnISOv.js";import{A as u}from"./activity-DGpLfsQB.js";import{W as f,N as w}from"./waypoints-BSdfNvEb.js";import{P as g}from"./PaneListHeader-Cpe39N76.js";import{T as N,u as j}from"./workspace-layout-BOQnl_3d.js";const b=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],I=r("boxes",b);const S=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],M=r("braces",S);const L=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],_=r("hard-drive",L);const z=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],d=r("scroll-text",z);const D=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],H=r("server",D);const O=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],V=r("timer",O);function s(i,t,e,n,o){return{id:i,label:t,path:e,href:`/status/${e}`,end:!0,group:n,icon:o}}const c=[s("overview","Overview","overview","Overview",u),s("gateway","Gateway","services/gateway","Services",f),s("solid-server","Solid Server","services/solid-server","Services",l),s("api-server","API Server","services/api-server","Services",H),s("logs","Logs","logs","Diagnostics",d),s("index-overview","Index Overview","index","Index",I),s("rdf","RDF","index/rdf","Index",M),s("fts","FTS","index/fts","Index",d),s("vector","Vector","index/vector","Index",x),s("retrieval-points","Retrieval Points","index/retrieval-points","Index",w),s("cache","Cache","index/cache","Index",_),s("slow-queries","Slow Queries","index/slow-queries","Index",V),s("benchmark","Benchmark","index/benchmark","Index",h)],q=["Overview","Services","Diagnostics","Index"];function C(){const i=v(),t=[...c].sort((e,n)=>n.path.length-e.path.length).find(e=>i.pathname.endsWith(e.path))??c[0];return a.jsx(N,{mode:"auto",listHeader:a.jsx(g,{title:"Status"}),list:a.jsx(A,{}),mainHeader:a.jsx("div",{className:"flex h-full items-center px-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-sm font-semibold",children:["Status · ",t.label]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Observed state and operational evidence"})]})}),main:a.jsx("section",{className:"min-h-full bg-background",children:a.jsx(y,{})}),className:"min-h-full"})}function A(){const i=j();return a.jsx("aside",{"data-list-navigation":!0,className:"h-full overflow-y-auto border-r border-border bg-muted/20 py-2",children:q.map(t=>a.jsxs("section",{className:"mb-3",children:[a.jsx("h2",{className:"px-5 py-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:t}),c.filter(e=>e.group===t).map(e=>{const n=e.icon;return a.jsxs(p,{to:e.path,end:e.end,onKeyDown:m,onClick:()=>i.openMain(),className:({isActive:o})=>k(o,{compact:!1}),children:[a.jsx(n,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),e.label]},e.id)})]},t))})}export{C as default};
@@ -1 +1 @@
1
- import{c as l,D as h,v as u,r as c,j as e,O as x,N as b,w as y,x as g}from"./settings-BvqY7K96.js";import{K as f}from"./key-round-CvuhloKV.js";import{b as v,c as k}from"./admin-C6qCRFiY.js";import{p as j}from"./settings-projection-CUkyprDQ.js";import{P as N}from"./PaneListHeader-BGOqGec4.js";import{T as S,u as w}from"./workspace-layout-B9H1Tqrk.js";const M=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],P=l("box",M);const L=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],C=l("cloud",L);const A=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],_=l("server-cog",A);const D=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],H=l("wrench",D),I=[{scope:"account",label:"Account",description:"Your Pod and its session.",items:[{id:"pod",label:"Pod",path:"pod",description:"Current Pod identity and data boundary.",icon:P},{id:"identity-access",label:"Identity & Access",path:"identity-access",description:"Session, WebID, and account access.",icon:f}]},{scope:"node",label:"This node",description:"Shared by every Pod on this machine.",items:[{id:"storage",label:"Storage",path:"storage",description:"Authority storage backend and limits.",icon:h},{id:"runtime",label:"Runtime",path:"runtime",description:"Low-frequency runtime configuration.",icon:_},{id:"cloud",label:"Cloud",path:"cloud",description:"Cloud coordination settings when supported.",icon:C},{id:"advanced",label:"Advanced",path:"advanced",description:"Expert and compatibility controls.",icon:H}]}];function q(){const r=u(),[n,s]=c.useState(!1);c.useEffect(()=>{let t=!1;return Promise.all([v(),k()]).then(([d,p])=>{t||s(j({registered:d?.registered===!0,managed:d?.managed===!0,domainAllocated:p?.allocated===!0}).cloud)}),()=>{t=!0}},[]);const a=c.useMemo(()=>I.map(t=>({...t,items:t.items.filter(d=>d.id!=="cloud"||n)})).filter(t=>t.items.length>0),[n]),o=c.useMemo(()=>a.flatMap(t=>t.items),[a]),i=o.find(t=>r.pathname.endsWith(`/${t.path}`))??o[0],m=a.find(t=>t.items.includes(i))?.scope;return e.jsx(S,{mode:"auto",listHeader:e.jsx(N,{title:"Settings"}),list:e.jsx(z,{groups:a}),mainHeader:e.jsx("div",{className:"flex h-full items-center px-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-sm font-semibold",children:["Settings · ",i.label]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:i.description}),m==="node"?e.jsx("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:"Applies to every Pod on this machine."}):null]})}),main:e.jsx("section",{className:"min-h-full bg-background",children:e.jsx(x,{})}),className:"min-h-full"})}function z({groups:r}){const n=w();return e.jsx("aside",{className:"h-full border-r border-border bg-muted/20 py-2",children:e.jsx("nav",{"aria-label":"Settings sections","data-list-navigation":!0,children:r.map(s=>e.jsxs("div",{children:[e.jsxs("div",{className:"px-4 pb-1 pt-3",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s.label}),e.jsx("div",{className:"text-xs leading-4 text-muted-foreground",children:s.description})]}),s.items.map(a=>{const o=a.icon;return e.jsxs(b,{to:a.path,"aria-label":a.label,onKeyDown:y,onClick:()=>n.openMain(),className:({isActive:i})=>g(i,{compact:!1}),children:[e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:a.label}),e.jsx("span",{className:"block text-xs leading-4 text-muted-foreground",children:a.description})]})]},a.id)})]},s.scope))})})}export{q as default};
1
+ import{c as l,D as h,v as u,r as c,j as e,O as x,N as b,w as y,x as g}from"./settings-CyLnISOv.js";import{K as f}from"./key-round-ZTVU_1O1.js";import{b as v,c as k}from"./admin-C6qCRFiY.js";import{p as j}from"./settings-projection-CUkyprDQ.js";import{P as N}from"./PaneListHeader-Cpe39N76.js";import{T as S,u as w}from"./workspace-layout-BOQnl_3d.js";const M=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],P=l("box",M);const L=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],C=l("cloud",L);const A=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],_=l("server-cog",A);const D=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],H=l("wrench",D),I=[{scope:"account",label:"Account",description:"Your Pod and its session.",items:[{id:"pod",label:"Pod",path:"pod",description:"Current Pod identity and data boundary.",icon:P},{id:"identity-access",label:"Identity & Access",path:"identity-access",description:"Session, WebID, and account access.",icon:f}]},{scope:"node",label:"This node",description:"Shared by every Pod on this machine.",items:[{id:"storage",label:"Storage",path:"storage",description:"Authority storage backend and limits.",icon:h},{id:"runtime",label:"Runtime",path:"runtime",description:"Low-frequency runtime configuration.",icon:_},{id:"cloud",label:"Cloud",path:"cloud",description:"Cloud coordination settings when supported.",icon:C},{id:"advanced",label:"Advanced",path:"advanced",description:"Expert and compatibility controls.",icon:H}]}];function q(){const r=u(),[n,s]=c.useState(!1);c.useEffect(()=>{let t=!1;return Promise.all([v(),k()]).then(([d,p])=>{t||s(j({registered:d?.registered===!0,managed:d?.managed===!0,domainAllocated:p?.allocated===!0}).cloud)}),()=>{t=!0}},[]);const a=c.useMemo(()=>I.map(t=>({...t,items:t.items.filter(d=>d.id!=="cloud"||n)})).filter(t=>t.items.length>0),[n]),o=c.useMemo(()=>a.flatMap(t=>t.items),[a]),i=o.find(t=>r.pathname.endsWith(`/${t.path}`))??o[0],m=a.find(t=>t.items.includes(i))?.scope;return e.jsx(S,{mode:"auto",listHeader:e.jsx(N,{title:"Settings"}),list:e.jsx(z,{groups:a}),mainHeader:e.jsx("div",{className:"flex h-full items-center px-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-sm font-semibold",children:["Settings · ",i.label]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:i.description}),m==="node"?e.jsx("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:"Applies to every Pod on this machine."}):null]})}),main:e.jsx("section",{className:"min-h-full bg-background",children:e.jsx(x,{})}),className:"min-h-full"})}function z({groups:r}){const n=w();return e.jsx("aside",{className:"h-full border-r border-border bg-muted/20 py-2",children:e.jsx("nav",{"aria-label":"Settings sections","data-list-navigation":!0,children:r.map(s=>e.jsxs("div",{children:[e.jsxs("div",{className:"px-4 pb-1 pt-3",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s.label}),e.jsx("div",{className:"text-xs leading-4 text-muted-foreground",children:s.description})]}),s.items.map(a=>{const o=a.icon;return e.jsxs(b,{to:a.path,"aria-label":a.label,onKeyDown:y,onClick:()=>n.openMain(),className:({isActive:i})=>g(i,{compact:!1}),children:[e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:a.label}),e.jsx("span",{className:"block text-xs leading-4 text-muted-foreground",children:a.description})]})]},a.id)})]},s.scope))})})}export{q as default};
@@ -1,4 +1,4 @@
1
- import{y as Z,z as ee,A as te,E as I,F as ie,G as T,H as ce,I as G,J as de,K as le,L as ue,M as he,u as pe,r as u,j as s,B as C,R as fe,C as ge,a as me,b as we,d as be,e as ve,Q as xe,S as ye}from"./settings-BvqY7K96.js";import{d as Ae,e as Se,b as Ce,c as Ie,h as Ne,i as _e,t as je,u as Ee}from"./admin-C6qCRFiY.js";import{a as Re}from"./settings-projection-CUkyprDQ.js";import{e as Ue,a as H}from"./ai-connections-C6yaE6WQ.js";import{R as Pe}from"./rotate-ccw-DgFKDaz7.js";import{S as X}from"./skeleton-D3OeFDF6.js";import{E as ke}from"./external-link-Bz7NckNO.js";class v extends Error{code;constructor(t,r){super(r),this.name="AccountStorageBindingsError",this.code=t}}async function Oe(e){const t=De(e.origin),r=e.controls?.account?.bindings;if(typeof r!="string"||r.trim()==="")throw new v("missing-control","Account storage bindings control is unavailable");const n=e.fetchImpl??fetch,a=Te(r,t),o=a.origin===t?a.href:await Z(a.href,n,e.trustedAccountIndex);if(!o)throw new v("cross-origin","Account storage bindings control is not hosted by this Xpod");const c=ee({Accept:"application/json",...e.headers});let i;try{i=await n(o,{headers:c,credentials:"include"})}catch(l){throw new v("request-failed",l instanceof Error?l.message:"Failed to load Account storage bindings")}if(i.status===401||i.status===403)throw new v("forbidden","Account storage bindings require an authenticated Account");if(!i.ok)throw new v("request-failed",`Account storage bindings request failed (${i.status})`);let d;try{d=await i.json()}catch{throw new v("invalid-response","Account storage bindings response is not valid JSON")}return Le(d,a.origin,We(a,e.trustedAccountIndex,t))}function Le(e,t,r=!1){if(!z(e)||!Array.isArray(e.bindings))throw new v("invalid-response","Account storage bindings response is malformed");const n=[],a=new Set;for(const o of e.bindings){if(!z(o)||typeof o.webId!="string"||typeof o.storageUrl!="string")throw new v("invalid-response","Account storage binding row is malformed");const c=Be(o.webId),i=Fe(o.storageUrl,r?void 0:t);if(!c||!i)throw new v("cross-origin","Account storage binding is outside the trusted storage scope");const d={webId:c,storageUrl:i,...typeof o.label=="string"?{label:o.label}:{}},l=`${d.webId}
1
+ import{y as Z,z as ee,A as te,E as I,F as ie,G as T,H as ce,I as G,J as de,K as le,L as ue,M as he,u as pe,r as u,j as s,B as C,R as fe,C as ge,a as me,b as we,d as be,e as ve,Q as xe,S as ye}from"./settings-CyLnISOv.js";import{d as Ae,e as Se,b as Ce,c as Ie,h as Ne,i as _e,t as je,u as Ee}from"./admin-C6qCRFiY.js";import{a as Re}from"./settings-projection-CUkyprDQ.js";import{e as Ue,a as H}from"./ai-connections-DexTPyfC.js";import{R as Pe}from"./rotate-ccw-DDdw8PTU.js";import{S as X}from"./skeleton-DEzA3hc2.js";import{E as ke}from"./external-link-BATYaM13.js";class v extends Error{code;constructor(t,r){super(r),this.name="AccountStorageBindingsError",this.code=t}}async function Oe(e){const t=De(e.origin),r=e.controls?.account?.bindings;if(typeof r!="string"||r.trim()==="")throw new v("missing-control","Account storage bindings control is unavailable");const n=e.fetchImpl??fetch,a=Te(r,t),o=a.origin===t?a.href:await Z(a.href,n,e.trustedAccountIndex);if(!o)throw new v("cross-origin","Account storage bindings control is not hosted by this Xpod");const c=ee({Accept:"application/json",...e.headers});let i;try{i=await n(o,{headers:c,credentials:"include"})}catch(l){throw new v("request-failed",l instanceof Error?l.message:"Failed to load Account storage bindings")}if(i.status===401||i.status===403)throw new v("forbidden","Account storage bindings require an authenticated Account");if(!i.ok)throw new v("request-failed",`Account storage bindings request failed (${i.status})`);let d;try{d=await i.json()}catch{throw new v("invalid-response","Account storage bindings response is not valid JSON")}return Le(d,a.origin,We(a,e.trustedAccountIndex,t))}function Le(e,t,r=!1){if(!z(e)||!Array.isArray(e.bindings))throw new v("invalid-response","Account storage bindings response is malformed");const n=[],a=new Set;for(const o of e.bindings){if(!z(o)||typeof o.webId!="string"||typeof o.storageUrl!="string")throw new v("invalid-response","Account storage binding row is malformed");const c=Be(o.webId),i=Fe(o.storageUrl,r?void 0:t);if(!c||!i)throw new v("cross-origin","Account storage binding is outside the trusted storage scope");const d={webId:c,storageUrl:i,...typeof o.label=="string"?{label:o.label}:{}},l=`${d.webId}
2
2
  ${d.storageUrl}`;a.has(l)||(a.add(l),n.push(d))}return n}function De(e){try{return new URL(e??(typeof window>"u"?"http://localhost":window.location.origin)).origin}catch{throw new v("cross-origin","Current Xpod origin is invalid")}}function Te(e,t){try{const r=new URL(e,t);if(!["http:","https:"].includes(r.protocol)||r.username||r.password||r.hash)throw new Error("unsafe control URL");return r}catch{throw new v("cross-origin","Account storage bindings control is not a valid URL")}}function Be(e){if(!te(e))try{const t=new URL(e);return!["http:","https:"].includes(t.protocol)||t.username||t.password?void 0:e}catch{return}}function Fe(e,t){try{const r=new URL(e.trim());return t!==void 0&&r.origin!==t||!["http:","https:"].includes(r.protocol)||r.username||r.password||r.search||r.hash?void 0:(r.pathname=r.pathname.endsWith("/")?r.pathname:`${r.pathname}/`,r.href)}catch{return}}function We(e,t,r){if(!t)return!1;try{const n=new URL(t,r);return n.pathname.startsWith("/.account/")&&e.origin===n.origin&&e.pathname.startsWith("/.account/")}catch{return!1}}function z(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}const q="co.undefineds.ai-connections",Me={providerCredentials:"settings/credentials.ttl",providerDefinitions:"settings/providers/__service_access__.ttl",gatewayAccessKeys:".data/ai/gateway/access-keys.ttl",quotaSnapshots:".data/ai/gateway/quota.ttl"},$e=new Set(Ue);function V(e,t){if(!U(e))throw new Error("invalid_descriptor");if(e.appletId!==q)throw new Error("invalid_applet_id");const r=e.service;if(!U(r)||typeof r.webId!="string"||typeof r.label!="string"||!Je(r.webId))throw new Error("invalid_service");if(!Array.isArray(e.resources)||e.resources.length===0)throw new Error("invalid_empty_resources");const n=Ve(t),a=new Set,o=e.resources.map(c=>Ge(c,n,a));return{appletId:q,service:{webId:r.webId,label:r.label},resources:o}}function Ge(e,t,r){if(!U(e)||typeof e.id!="string"||typeof e.url!="string"||e.mediaType!=="text/turtle"||!U(e.access))throw new Error("invalid_resource");const n=He(e.id,t);if(!n||r.has(e.id))throw new Error("invalid_resource");Xe(e.url);let a;try{a=new URL(e.url)}catch{throw new Error("invalid_resource")}if(!Ke(a,t))throw new Error("invalid_resource");if(a.href!==n)throw new Error("invalid_resource");return r.add(e.id),{id:e.id,url:a.href,mediaType:"text/turtle",access:qe(e.access)}}function He(e,t){const r=Me[e];if(r)return new URL(r,t).href;const n=e.startsWith("providerDocument:")?e.slice(17):void 0;if(n&&$e.has(n))return new URL(`settings/providers/${n}.ttl`,t).href}function Xe(e){if(/%(?![0-9a-fA-F]{2})/.test(e)||/%(?:2f|5c)/i.test(e)||e.includes("\\"))throw new Error("invalid_resource");const t=ze(e);if(K(t))throw new Error("invalid_resource");try{const r=decodeURIComponent(t);if(r.includes("\\")||K(r))throw new Error("invalid_resource")}catch{throw new Error("invalid_resource")}}function ze(e){const t=e.split("#",1)[0]??e;return(t.split("?",1)[0]??t).replace(/^[a-z][a-z0-9+.-]*:\/\/[^/\\?#]*/i,"")}function K(e){return e.split("/").some(t=>t==="."||t==="..")}function qe(e){if(Object.keys(e).some(r=>r!=="read"&&r!=="append"&&r!=="write")||e.read!==!0||e.append!==!0||e.write!==!0)throw new Error("invalid_resource");return{read:!0,append:!0,write:!0}}function Ve(e){const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("invalid_current_pod");return t.pathname.endsWith("/")||(t.pathname=`${t.pathname}/`),t}function Ke(e,t){return(e.protocol==="http:"||e.protocol==="https:")&&e.origin===t.origin&&e.pathname.startsWith(t.pathname)}function Je(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function U(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}const Qe=3,Ye=63,Ze=/^[a-z0-9-]+$/;function B(e){return e.trim().toLowerCase()}function re(e){const t=B(e);if(!t)return I.usernameRequired;if(t.length<Qe||t.length>Ye)return I.usernameLength;if(!Ze.test(t))return I.usernameCharset;if(t.startsWith("-")||t.endsWith("-"))return I.usernameHyphen}const et="已有 Pod 的身份绑定尚未确认。请重试读取绑定或返回账号,不需要重新创建 Pod。",tt="暂时无法确认已有 Pod,请重试读取或返回账号。";class x extends Error{code;constructor(t){super(t==="binding-missing"?et:t==="inventory-unavailable"?tt:"账号已切换,请返回当前账号重新操作。"),this.name="FirstPodReadinessError",this.code=t}}function rt(e){const t=G(),r=de(t,{...e.headers}),n=new Headers(r).get("Authorization"),a=()=>{try{e.assertCurrentAccount?.()}catch{throw new x("account-changed")}if(G()!==t||n?.startsWith("CSS-Account-Token ")&&n!==(t?`CSS-Account-Token ${t}`:void 0))throw new x("account-changed")},o=e.fetchImpl??fetch;return{headers:r,assertCurrentAccount:a,fetch:async(i,d)=>{a();const l=await o(i,d);try{a()}catch(b){throw l.body?.cancel().catch(()=>{}),b}const g=async b=>{a();const y=await b();return a(),y},m=l.json.bind(l),w=l.text.bind(l);return l.json=()=>g(m),l.text=()=>g(w),l}}}async function nt(e,t,r,n){n.assertCurrentAccount();let a;try{const i=await e(T(t),{headers:{...n.headers,Accept:"application/json"},credentials:"include"});if(!i.ok)throw new x("inventory-unavailable");a=await i.json()}catch{throw n.assertCurrentAccount(),new x("inventory-unavailable")}if(n.assertCurrentAccount(),!D(a)||!D(a.pods))throw new x("inventory-unavailable");const o=Object.entries(a.pods);if(o.some(([i,d])=>!ae(i)||typeof d!="string"||!d))throw new x("inventory-unavailable");const c=le(r);if(o.some(([i])=>!c||ue(i,c.storageRoot)))throw new x("binding-missing")}function st(e){for(const t of e){if(!t)continue;const r=ut(t);if(!r)continue;const n=B(r).replace(/[^a-z0-9-]/gu,"-").replace(/-+/gu,"-").replace(/^-+|-+$/gu,"");if(n&&!re(n))return n}return""}async function at(e){const t=rt(e),r=t.fetch,n=B(e.username),a=re(n);if(a)throw new Error(a);const o=await ie(e.provisionCode),c=await Z(e.createPodUrl,r,e.trustedAccountIndex);if(!c)throw new Error("Pod creation control is not hosted by this Xpod");await nt(r,c,o,t);const i=await dt(r,n,o);t.assertCurrentAccount();const d=await r(T(c),{method:"POST",headers:{...t.headers,Accept:"application/json","Content-Type":"application/json"},credentials:"include",body:JSON.stringify(ce(n,i?.provisionCode??o,i?.provisionReceipt))});if(t.assertCurrentAccount(),!d.ok){const w=await ct(d);throw d.status===409||ne(w)?new Error(I.podNameTaken):new Error(w||"Failed to create Pod")}const l=await d.json().catch(P);t.assertCurrentAccount();const g=lt(l);if(!e.pickWebIdUrl)return g;const m=await ot({fetchImpl:r,headers:t.headers,maxAttempts:e.maxAttempts,pickWebIdUrl:e.pickWebIdUrl,pollIntervalMs:e.pollIntervalMs});return t.assertCurrentAccount(),m.length>0?m:g}async function ot(e){const t=e.fetchImpl??fetch,r=Math.max(1,e.maxAttempts??30),n=Math.max(0,e.pollIntervalMs??500);for(let a=0;a<r;a+=1){const o=await it(t,e.pickWebIdUrl,e.headers);if(o.length>0)return o;a<r-1&&n>0&&await new Promise(c=>setTimeout(c,n))}return[]}function P(e){if(e instanceof x)throw e}async function it(e,t,r){const n=await e(T(t),{headers:r,credentials:"include"}).catch(P);if(!n?.ok)return[];const a=await n.json().catch(P);if(!Array.isArray(a?.entries))return[];const o=new Set,c=[];for(const i of a.entries){if(!D(i)||typeof i.webId!="string"||typeof i.storageUrl!="string")continue;const d=se(i.webId,i.storageUrl);if(!d)continue;const l=`${d.webId}
3
3
  ${d.storageUrl}`;o.has(l)||(o.add(l),c.push(d))}return c}async function ct(e){const t=await e.text?.().catch(P);if(t)try{const r=JSON.parse(t);return typeof r.message=="string"?r.message:typeof r.error=="string"?r.error:t}catch{return t}}function ne(e){return e?/already (?:is )?(?:a )?resource/iu.test(e)||/already taken/iu.test(e)||/already exists/iu.test(e):!1}async function dt(e,t,r){try{return await he(e,t,r)}catch(n){const a=n instanceof Error?n.message:String(n);throw ne(a)?new Error(I.podNameTaken):n}}function lt(e){if(typeof e?.podUrl!="string")return[];const t=ae(e.podUrl);if(!t)return[];const r=new Set;if(typeof e.webId=="string"&&e.webId.length>0&&r.add(e.webId),Array.isArray(e.webIds))for(const n of e.webIds)typeof n=="string"&&n.length>0&&r.add(n);return Array.from(r).map(n=>se(n,t)).filter(n=>!!n)}function ut(e){try{return new URL(e).pathname.split("/").filter(Boolean)[0]}catch{return e.includes("@")?e.split("@",1)[0]:e}}function se(e,t){if(!te(e))try{const r=new URL(e),n=new URL(t);return!["http:","https:"].includes(r.protocol)||!["http:","https:"].includes(n.protocol)?void 0:(n.pathname=n.pathname.endsWith("/")?n.pathname:`${n.pathname}/`,{webId:e,storageUrl:n.href})}catch{return}}function ae(e){try{const t=new URL(e);return!["http:","https:"].includes(t.protocol)||t.username||t.password||t.hash||t.search?void 0:(t.pathname=t.pathname.endsWith("/")?t.pathname:`${t.pathname}/`,t.href)}catch{return}}function D(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function ht(e,t){if(e)try{return new URL(new URL(e).pathname,t).toString()}catch{return}}const pt="http://www.w3.org/ns/solid/acp#",ft="http://www.w3.org/ns/auth/acl#";function J(e,{ownerWebId:t,serviceWebId:r},n=!0){const a=n?`
4
4
  <#serviceAccess>
@@ -1,3 +1,3 @@
1
- import{q as h,k as f,s as w,h as J,t as pe}from"./settings-BvqY7K96.js";import{r as me,a as he,b as be}from"./index-browser-Dq7omlpY.js";import{A as ae,s as M,d as B,c as k,o as X,p as ye,b as we,C as L}from"./ai-connections-C6yaE6WQ.js";function ve(e){const t=new TextEncoder().encode(JSON.stringify(e));let r="";for(const o of t)r+=String.fromCharCode(o);return btoa(r)}function Ie(e){const t=atob(e),r=Uint8Array.from(t,o=>o.charCodeAt(0));return JSON.parse(new TextDecoder().decode(r))}function ge(e){return JSON.stringify({algorithm:"PLAINTEXT",encoding:"base64",ciphertext:ve(e.secret),webId:e.webId,credentialIri:e.credentialIri,provider:e.provider})}function Se(e){if(!(typeof e.envelope!="string"||!e.envelope.trim()))try{const t=JSON.parse(e.envelope);if(t.algorithm!=="PLAINTEXT"||t.webId!==e.webId||t.provider!==e.provider||t.credentialIri!==e.credentialIri)return;const r=t.encoding==="base64"?Ie(String(t.ciphertext)):JSON.parse(String(t.ciphertext));return typeof r=="object"&&r!==null&&!Array.isArray(r)?r:void 0}catch{return}}function _e(e){return h.buildId({id:e})}function Re(e){return h.buildId({id:`custom-instance-${encodeURIComponent(e)}.ttl#this`})}function Q(e,t){const r=crypto.randomUUID();return t==="local"?`${e}-local-${r}`:`${e}-${r}`}function et(e){const t=(e.split("#",1)[0]??e).split("/").filter(Boolean).at(-1)??"",r=t.endsWith(".ttl")?t.slice(0,-4):t;if(r)return r.startsWith("custom-")||r==="custom"?"custom":ae.find(o=>r===o||r.startsWith(`${o}-`))}function A(e){if(!e)return;const t=e.split("#",1)[0]??e,r=t.split("/").filter(Boolean).at(-1)??t;if(!r)return;const o=r.endsWith(".ttl")?r:`${r}.ttl`,n=e.indexOf("#");return n<0?o:`${o}${e.slice(n)}`}function R(e){const t=A(e);if(t)return(t.split("#",1)[0]??t).replace(/\.ttl$/u,"")}const xe={"api-key":"添加 API Key","browser-login":"浏览器登录","browser-oauth":"浏览器登录","device-code":"设备码登录","local-session-import":"已有登录态","local-service":"本地服务"};function Ee(e){return e.label??xe[e.id]}function tt(e){return e.map(t=>{const r=Ee(t);return r===t.label?t:{...t,label:r}})}function z(e){switch(e){case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"kimi":return"Kimi";case"bailian":return"百炼";case"deepseek":return"DeepSeek";case"zhipu":return"智谱 AI";case"ollama":return"Ollama";case"custom":return"Custom"}}var Ae=me(),Ce=he();const O=Array.from(new Set([...ae,"zhipu","ollama","custom"])),G=new WeakMap,Pe=J.storage.base.slice(J.storage.base.lastIndexOf("/")+1);function Ue(e){const t=e.indexOf("#");return t<0?e:e.slice(0,t)}function rt(e){Me(),pe({createQueryEngine:async()=>new be.QueryEngine});const t=new URL("settings/-/sparql",e.podUrl).toString();return f.setSparqlEndpoint(t),h.setSparqlEndpoint(t),w.setSparqlEndpoint(t),{credentialsTableDocument(){return f.buildIri(e.podUrl,{id:Pe})},providerTableDocument(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");const i=n==="custom"&&o?j(o):x(n);return h.buildIri(e.podUrl,{id:Ue(i)})},async listModels(){return await e.database.init?.(w),(await e.database.select().from(w).execute()).map(ze).filter(U)},async listProviders(){await e.database.init?.(f,h,w);const r=await e.database.select().from(f).execute(),o=await e.database.select().from(h).execute(),n=await e.database.select().from(w).execute();return ke(e,r,o,n)},async createApiKeyCredential(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");await e.database.init?.(f,h);const i=c(o.id),a=i??f.buildId({id:Q(n,"apiKey")}),s=1,u=M(n,o.offeringId??B(n,"apiKey")),l=o.baseUrl??X(n,u),d=F(o.proxyUrl),p={id:a,provider:n==="custom"?j(a):x(n),service:"ai",authMode:"apiKey",offeringId:u,status:"active",accountLabel:o.label,label:o.label,baseUrl:l,proxyUrl:d,keyVersion:String(s),reauthRequired:!1,encryptedSecret:$(e,n,a,{type:"apiKey",apiKey:o.apiKey}),encryptionAlgorithm:"PLAINTEXT",metadata:{...k({offeringId:u,baseUrl:l,priority:o.priority}),...o.compatibility?{compatibility:o.compatibility}:{}}};return await ee(e,a,p,i!==void 0),y(e,n,p)},async createLocalCredential(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");await e.database.init?.(f,h);const i=c(o.id),a=i??f.buildId({id:Q(n,"local")}),s=M(n,o.offeringId??B(n,"local")),u=o.baseUrl??X(n,s),l={id:a,provider:x(n),service:"ai",authMode:"local",offeringId:s,status:"active",accountLabel:o.label??"Local",label:o.label??"Local",baseUrl:u,keyVersion:"1",reauthRequired:!1,encryptedSecret:$(e,n,a,{type:"local"}),encryptionAlgorithm:"PLAINTEXT",metadata:k({offeringId:s,baseUrl:u,priority:o.priority})};return await ee(e,a,l,i!==void 0),y(e,n,l)},async saveOAuthCredential(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");const a=(G.get(e.database)??Promise.resolve()).then(async()=>{await e.database.init?.(f,h);const s=M(n,o.offeringId??B(n,"deviceCode")),l=(await e.database.select().from(f).execute()).find(_=>{const C=y(e,n,_);if(!C||C.authMode!=="deviceCode"&&C.authMode!=="oauth"||re(n,C.offeringId)!==re(n,s)||_.status!=="active"&&_.status!=="disabled")return!1;const fe=T(e,n,C.id,_.encryptedSecret);return Le(o,I(_.metadata),fe)}),d=l&&y(e,n,l),p=I(l?.metadata),m=d&&T(e,n,d.id,l?.encryptedSecret),b=d?.id??f.buildId({id:`${n}-oauth-${crypto.randomUUID()}`}),g=o.accountLabel??"OAuth",S=o.accountId??c(p?.accountId)??c(m?.accountId),H=o.accountSubject??c(p?.authoritativeSubject)??c(m?.accountSubject)??c(m?.authoritativeSubject),N={...l,id:b,provider:x(n),service:"ai",authMode:"deviceCodeOAuth",offeringId:s,status:d?.enabled===!1?"disabled":"active",accountLabel:l?.accountLabel??g,label:l?.label??g,expiresAt:o.expiresAt,scopes:o.scope?o.scope.split(/\s+/u).filter(Boolean):void 0,keyVersion:String((d?.version??0)+1),reauthRequired:!1,encryptedSecret:$(e,n,b,{type:"deviceCodeOAuth",accessToken:o.accessToken,refreshToken:o.refreshToken,expiresAt:o.expiresAt,scope:o.scope,idToken:o.idToken,accountId:S,accountSubject:H,accountLabel:o.accountLabel,offeringId:s,authorizationMethodId:o.authorizationMethodId}),encryptionAlgorithm:"PLAINTEXT",metadata:{...p,...k({offeringId:s,priority:d?.priority,enabled:d?.enabled,health:"healthy"}),authoritativeSubject:H,accountId:S,authorizationMethodId:o.authorizationMethodId}};if(l){const _={...N};if(delete _.id,!await e.database.updateById(f,b,_))throw new Error("credential_version_conflict")}else await e.database.insert(f).values(N).execute();return y(e,n,N)});return G.set(e.database,a.then(()=>{},()=>{})),a},async updateOAuthCredential(r,o,n,i){const a=v(r);if(!a)throw new Error("unsupported_provider");await e.database.init?.(f,h);const s=await e.database.findById(f,o),u=s&&y(e,a,s);if(!s||!u||u.authMode!=="deviceCode")throw new Error("oauth_credential_not_found");if(u.version!==n)throw new Error("credential_version_conflict");const l=T(e,a,o,s.encryptedSecret),d=i.accountId??c(I(s.metadata)?.accountId)??c(l?.accountId),p=i.accountSubject??c(I(s.metadata)?.authoritativeSubject)??c(l?.accountSubject)??c(l?.authoritativeSubject),m=M(a,i.offeringId??u.offeringId),b={expiresAt:i.expiresAt,scopes:i.scope?i.scope.split(/\s+/u).filter(Boolean):void 0,keyVersion:String(n+1),reauthRequired:!1,status:"active",encryptedSecret:$(e,a,o,{type:"deviceCodeOAuth",accessToken:i.accessToken,refreshToken:i.refreshToken,expiresAt:i.expiresAt,scope:i.scope,idToken:i.idToken,accountId:d,accountSubject:p,accountLabel:i.accountLabel??c(s.accountLabel),offeringId:m,authorizationMethodId:i.authorizationMethodId??c(I(s.metadata)?.authorizationMethodId)}),accountLabel:i.accountLabel??c(s.accountLabel),label:i.accountLabel??c(s.label),offeringId:m,metadata:{...I(s.metadata),...k({offeringId:m,health:"healthy"}),authoritativeSubject:p,accountId:d,authorizationMethodId:i.authorizationMethodId??c(I(s.metadata)?.authorizationMethodId)}},g=await e.database.updateById(f,o,b);if(!g)throw new Error("credential_version_conflict");return y(e,a,g)},async updateProviderCredential(r,o,n){const i=v(r);if(!i)throw new Error("unsupported_provider");await e.database.init?.(f,h);const a=await e.database.findById(f,o),s=a&&y(e,i,a);if(!a||!s)throw new Error("credential_not_found");if(s.version!==n.expectedVersion)throw new Error("credential_version_conflict");const u={...I(a.metadata),...n.priority===void 0?{}:{priority:n.priority},...n.enabled===void 0?{}:{enabled:n.enabled},...n.baseUrl===void 0?{}:{baseUrl:n.baseUrl},...n.proxyUrl===void 0?{}:{proxyUrl:F(n.proxyUrl)}},l={...n.label===void 0?{}:{accountLabel:n.label,label:n.label},...n.baseUrl===void 0?{}:{baseUrl:n.baseUrl},...n.proxyUrl===void 0?{}:{proxyUrl:F(n.proxyUrl)},...n.enabled===void 0?{}:{status:n.enabled?"active":"disabled"},keyVersion:String(s.version+1),metadata:u},d=await e.database.updateById(f,o,l);if(!d)throw new Error("credential_update_failed");const p=y(e,i,d);if(!p)throw new Error("credential_update_failed");return p},async markCredentialHealth(r,o,n,i){const a=v(r);if(!a)throw new Error("unsupported_provider");await e.database.init?.(f);const s=await e.database.findById(f,o),u=s&&y(e,a,s);if(!s||!u)throw new Error("credential_not_found");if(u.version!==i)throw new Error("credential_version_conflict");const l=await e.database.updateById(f,o,{keyVersion:String(u.version+1),metadata:{...I(s.metadata),health:n}});if(!l)throw new Error("credential_update_failed");const d=y(e,a,l);if(!d)throw new Error("credential_update_failed");return d},async deleteProviderCredential(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");await e.database.init?.(f,h);const i=await e.database.findById(f,o),a=i&&y(e,n,i);if(a)return await e.database.deleteById(f,o),a},async readCredentialSecret(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");const i=await e.database.findById(f,o);if(!i||!y(e,n,i))throw new Error("credential_not_found");const a=T(e,n,o,i.encryptedSecret);if(!a)throw new Error("credential_secret_unavailable");return a},async saveDiscoveredModels(r,o,n){const i=v(r);if(!i)throw new Error("unsupported_provider");await e.database.init?.(f,h,w);const a=await Y(e,o),s=te(i,a);await oe(e.database,s,z(i));const u=await e.database.select().from(w).execute(),l=new Set(u.map(m=>c(m.id)).filter(U)),d=n.map(Ne).filter(U),p=new Set(d.map(m=>m.id));for(const m of u.filter(b=>De(b,s,i))){const b=E(c(m.id),s)??se(c(m.id));b&&!p.has(b)&&c(m.status)!=="unavailable"&&await e.database.updateById(w,String(m.id),{status:"unavailable"})}for(const m of d)await Fe(e.database,s,m,l)},async saveModelSelection(r,o,n){const i=v(r);if(!i)throw new Error("unsupported_provider");await e.database.init?.(h,w);const a=i==="custom"&&n?await Y(e,n):null;if(i==="custom"&&n&&!a)throw new Error("credential_not_found");const s=a?te(i,a):x(i);await oe(e.database,s,z(i));const l=(await e.database.select().from(h).execute()).find(S=>P(c(S.id),s)),d=c(l?.id)??s,p=le(l?.hasModel),m=await e.database.select().from(w).execute(),b=[...new Set(o.map(S=>Ke(i,S,m,a?s:void 0)))];if(!await e.database.updateById(h,d,{hasModel:b}))throw new Error("provider_model_selection_update_failed");e.authenticatedFetch&&await Oe(e,d,p,b)}}}const Te="https://undefineds.co/ns#hasModel";async function Oe(e,t,r,o){const n=D(h,e.podUrl,t),i=r.map(d=>D(w,e.podUrl,d)),a=o.map(d=>D(w,e.podUrl,d)),s=d=>d.map(p=>`<${n}> <${Te}> <${p}> .`).join(`
1
+ import{q as h,k as f,s as w,h as J,t as pe}from"./settings-CyLnISOv.js";import{r as me,a as he,b as be}from"./index-browser-DFFWN3Kr.js";import{A as ae,s as M,d as B,c as k,o as X,p as ye,b as we,C as L}from"./ai-connections-DexTPyfC.js";function ve(e){const t=new TextEncoder().encode(JSON.stringify(e));let r="";for(const o of t)r+=String.fromCharCode(o);return btoa(r)}function Ie(e){const t=atob(e),r=Uint8Array.from(t,o=>o.charCodeAt(0));return JSON.parse(new TextDecoder().decode(r))}function ge(e){return JSON.stringify({algorithm:"PLAINTEXT",encoding:"base64",ciphertext:ve(e.secret),webId:e.webId,credentialIri:e.credentialIri,provider:e.provider})}function Se(e){if(!(typeof e.envelope!="string"||!e.envelope.trim()))try{const t=JSON.parse(e.envelope);if(t.algorithm!=="PLAINTEXT"||t.webId!==e.webId||t.provider!==e.provider||t.credentialIri!==e.credentialIri)return;const r=t.encoding==="base64"?Ie(String(t.ciphertext)):JSON.parse(String(t.ciphertext));return typeof r=="object"&&r!==null&&!Array.isArray(r)?r:void 0}catch{return}}function _e(e){return h.buildId({id:e})}function Re(e){return h.buildId({id:`custom-instance-${encodeURIComponent(e)}.ttl#this`})}function Q(e,t){const r=crypto.randomUUID();return t==="local"?`${e}-local-${r}`:`${e}-${r}`}function et(e){const t=(e.split("#",1)[0]??e).split("/").filter(Boolean).at(-1)??"",r=t.endsWith(".ttl")?t.slice(0,-4):t;if(r)return r.startsWith("custom-")||r==="custom"?"custom":ae.find(o=>r===o||r.startsWith(`${o}-`))}function A(e){if(!e)return;const t=e.split("#",1)[0]??e,r=t.split("/").filter(Boolean).at(-1)??t;if(!r)return;const o=r.endsWith(".ttl")?r:`${r}.ttl`,n=e.indexOf("#");return n<0?o:`${o}${e.slice(n)}`}function R(e){const t=A(e);if(t)return(t.split("#",1)[0]??t).replace(/\.ttl$/u,"")}const xe={"api-key":"添加 API Key","browser-login":"浏览器登录","browser-oauth":"浏览器登录","device-code":"设备码登录","local-session-import":"已有登录态","local-service":"本地服务"};function Ee(e){return e.label??xe[e.id]}function tt(e){return e.map(t=>{const r=Ee(t);return r===t.label?t:{...t,label:r}})}function z(e){switch(e){case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"kimi":return"Kimi";case"bailian":return"百炼";case"deepseek":return"DeepSeek";case"zhipu":return"智谱 AI";case"ollama":return"Ollama";case"custom":return"Custom"}}var Ae=me(),Ce=he();const O=Array.from(new Set([...ae,"zhipu","ollama","custom"])),G=new WeakMap,Pe=J.storage.base.slice(J.storage.base.lastIndexOf("/")+1);function Ue(e){const t=e.indexOf("#");return t<0?e:e.slice(0,t)}function rt(e){Me(),pe({createQueryEngine:async()=>new be.QueryEngine});const t=new URL("settings/-/sparql",e.podUrl).toString();return f.setSparqlEndpoint(t),h.setSparqlEndpoint(t),w.setSparqlEndpoint(t),{credentialsTableDocument(){return f.buildIri(e.podUrl,{id:Pe})},providerTableDocument(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");const i=n==="custom"&&o?j(o):x(n);return h.buildIri(e.podUrl,{id:Ue(i)})},async listModels(){return await e.database.init?.(w),(await e.database.select().from(w).execute()).map(ze).filter(U)},async listProviders(){await e.database.init?.(f,h,w);const r=await e.database.select().from(f).execute(),o=await e.database.select().from(h).execute(),n=await e.database.select().from(w).execute();return ke(e,r,o,n)},async createApiKeyCredential(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");await e.database.init?.(f,h);const i=c(o.id),a=i??f.buildId({id:Q(n,"apiKey")}),s=1,u=M(n,o.offeringId??B(n,"apiKey")),l=o.baseUrl??X(n,u),d=F(o.proxyUrl),p={id:a,provider:n==="custom"?j(a):x(n),service:"ai",authMode:"apiKey",offeringId:u,status:"active",accountLabel:o.label,label:o.label,baseUrl:l,proxyUrl:d,keyVersion:String(s),reauthRequired:!1,encryptedSecret:$(e,n,a,{type:"apiKey",apiKey:o.apiKey}),encryptionAlgorithm:"PLAINTEXT",metadata:{...k({offeringId:u,baseUrl:l,priority:o.priority}),...o.compatibility?{compatibility:o.compatibility}:{}}};return await ee(e,a,p,i!==void 0),y(e,n,p)},async createLocalCredential(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");await e.database.init?.(f,h);const i=c(o.id),a=i??f.buildId({id:Q(n,"local")}),s=M(n,o.offeringId??B(n,"local")),u=o.baseUrl??X(n,s),l={id:a,provider:x(n),service:"ai",authMode:"local",offeringId:s,status:"active",accountLabel:o.label??"Local",label:o.label??"Local",baseUrl:u,keyVersion:"1",reauthRequired:!1,encryptedSecret:$(e,n,a,{type:"local"}),encryptionAlgorithm:"PLAINTEXT",metadata:k({offeringId:s,baseUrl:u,priority:o.priority})};return await ee(e,a,l,i!==void 0),y(e,n,l)},async saveOAuthCredential(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");const a=(G.get(e.database)??Promise.resolve()).then(async()=>{await e.database.init?.(f,h);const s=M(n,o.offeringId??B(n,"deviceCode")),l=(await e.database.select().from(f).execute()).find(_=>{const C=y(e,n,_);if(!C||C.authMode!=="deviceCode"&&C.authMode!=="oauth"||re(n,C.offeringId)!==re(n,s)||_.status!=="active"&&_.status!=="disabled")return!1;const fe=T(e,n,C.id,_.encryptedSecret);return Le(o,I(_.metadata),fe)}),d=l&&y(e,n,l),p=I(l?.metadata),m=d&&T(e,n,d.id,l?.encryptedSecret),b=d?.id??f.buildId({id:`${n}-oauth-${crypto.randomUUID()}`}),g=o.accountLabel??"OAuth",S=o.accountId??c(p?.accountId)??c(m?.accountId),H=o.accountSubject??c(p?.authoritativeSubject)??c(m?.accountSubject)??c(m?.authoritativeSubject),N={...l,id:b,provider:x(n),service:"ai",authMode:"deviceCodeOAuth",offeringId:s,status:d?.enabled===!1?"disabled":"active",accountLabel:l?.accountLabel??g,label:l?.label??g,expiresAt:o.expiresAt,scopes:o.scope?o.scope.split(/\s+/u).filter(Boolean):void 0,keyVersion:String((d?.version??0)+1),reauthRequired:!1,encryptedSecret:$(e,n,b,{type:"deviceCodeOAuth",accessToken:o.accessToken,refreshToken:o.refreshToken,expiresAt:o.expiresAt,scope:o.scope,idToken:o.idToken,accountId:S,accountSubject:H,accountLabel:o.accountLabel,offeringId:s,authorizationMethodId:o.authorizationMethodId}),encryptionAlgorithm:"PLAINTEXT",metadata:{...p,...k({offeringId:s,priority:d?.priority,enabled:d?.enabled,health:"healthy"}),authoritativeSubject:H,accountId:S,authorizationMethodId:o.authorizationMethodId}};if(l){const _={...N};if(delete _.id,!await e.database.updateById(f,b,_))throw new Error("credential_version_conflict")}else await e.database.insert(f).values(N).execute();return y(e,n,N)});return G.set(e.database,a.then(()=>{},()=>{})),a},async updateOAuthCredential(r,o,n,i){const a=v(r);if(!a)throw new Error("unsupported_provider");await e.database.init?.(f,h);const s=await e.database.findById(f,o),u=s&&y(e,a,s);if(!s||!u||u.authMode!=="deviceCode")throw new Error("oauth_credential_not_found");if(u.version!==n)throw new Error("credential_version_conflict");const l=T(e,a,o,s.encryptedSecret),d=i.accountId??c(I(s.metadata)?.accountId)??c(l?.accountId),p=i.accountSubject??c(I(s.metadata)?.authoritativeSubject)??c(l?.accountSubject)??c(l?.authoritativeSubject),m=M(a,i.offeringId??u.offeringId),b={expiresAt:i.expiresAt,scopes:i.scope?i.scope.split(/\s+/u).filter(Boolean):void 0,keyVersion:String(n+1),reauthRequired:!1,status:"active",encryptedSecret:$(e,a,o,{type:"deviceCodeOAuth",accessToken:i.accessToken,refreshToken:i.refreshToken,expiresAt:i.expiresAt,scope:i.scope,idToken:i.idToken,accountId:d,accountSubject:p,accountLabel:i.accountLabel??c(s.accountLabel),offeringId:m,authorizationMethodId:i.authorizationMethodId??c(I(s.metadata)?.authorizationMethodId)}),accountLabel:i.accountLabel??c(s.accountLabel),label:i.accountLabel??c(s.label),offeringId:m,metadata:{...I(s.metadata),...k({offeringId:m,health:"healthy"}),authoritativeSubject:p,accountId:d,authorizationMethodId:i.authorizationMethodId??c(I(s.metadata)?.authorizationMethodId)}},g=await e.database.updateById(f,o,b);if(!g)throw new Error("credential_version_conflict");return y(e,a,g)},async updateProviderCredential(r,o,n){const i=v(r);if(!i)throw new Error("unsupported_provider");await e.database.init?.(f,h);const a=await e.database.findById(f,o),s=a&&y(e,i,a);if(!a||!s)throw new Error("credential_not_found");if(s.version!==n.expectedVersion)throw new Error("credential_version_conflict");const u={...I(a.metadata),...n.priority===void 0?{}:{priority:n.priority},...n.enabled===void 0?{}:{enabled:n.enabled},...n.baseUrl===void 0?{}:{baseUrl:n.baseUrl},...n.proxyUrl===void 0?{}:{proxyUrl:F(n.proxyUrl)}},l={...n.label===void 0?{}:{accountLabel:n.label,label:n.label},...n.baseUrl===void 0?{}:{baseUrl:n.baseUrl},...n.proxyUrl===void 0?{}:{proxyUrl:F(n.proxyUrl)},...n.enabled===void 0?{}:{status:n.enabled?"active":"disabled"},keyVersion:String(s.version+1),metadata:u},d=await e.database.updateById(f,o,l);if(!d)throw new Error("credential_update_failed");const p=y(e,i,d);if(!p)throw new Error("credential_update_failed");return p},async markCredentialHealth(r,o,n,i){const a=v(r);if(!a)throw new Error("unsupported_provider");await e.database.init?.(f);const s=await e.database.findById(f,o),u=s&&y(e,a,s);if(!s||!u)throw new Error("credential_not_found");if(u.version!==i)throw new Error("credential_version_conflict");const l=await e.database.updateById(f,o,{keyVersion:String(u.version+1),metadata:{...I(s.metadata),health:n}});if(!l)throw new Error("credential_update_failed");const d=y(e,a,l);if(!d)throw new Error("credential_update_failed");return d},async deleteProviderCredential(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");await e.database.init?.(f,h);const i=await e.database.findById(f,o),a=i&&y(e,n,i);if(a)return await e.database.deleteById(f,o),a},async readCredentialSecret(r,o){const n=v(r);if(!n)throw new Error("unsupported_provider");const i=await e.database.findById(f,o);if(!i||!y(e,n,i))throw new Error("credential_not_found");const a=T(e,n,o,i.encryptedSecret);if(!a)throw new Error("credential_secret_unavailable");return a},async saveDiscoveredModels(r,o,n){const i=v(r);if(!i)throw new Error("unsupported_provider");await e.database.init?.(f,h,w);const a=await Y(e,o),s=te(i,a);await oe(e.database,s,z(i));const u=await e.database.select().from(w).execute(),l=new Set(u.map(m=>c(m.id)).filter(U)),d=n.map(Ne).filter(U),p=new Set(d.map(m=>m.id));for(const m of u.filter(b=>De(b,s,i))){const b=E(c(m.id),s)??se(c(m.id));b&&!p.has(b)&&c(m.status)!=="unavailable"&&await e.database.updateById(w,String(m.id),{status:"unavailable"})}for(const m of d)await Fe(e.database,s,m,l)},async saveModelSelection(r,o,n){const i=v(r);if(!i)throw new Error("unsupported_provider");await e.database.init?.(h,w);const a=i==="custom"&&n?await Y(e,n):null;if(i==="custom"&&n&&!a)throw new Error("credential_not_found");const s=a?te(i,a):x(i);await oe(e.database,s,z(i));const l=(await e.database.select().from(h).execute()).find(S=>P(c(S.id),s)),d=c(l?.id)??s,p=le(l?.hasModel),m=await e.database.select().from(w).execute(),b=[...new Set(o.map(S=>Ke(i,S,m,a?s:void 0)))];if(!await e.database.updateById(h,d,{hasModel:b}))throw new Error("provider_model_selection_update_failed");e.authenticatedFetch&&await Oe(e,d,p,b)}}}const Te="https://undefineds.co/ns#hasModel";async function Oe(e,t,r,o){const n=D(h,e.podUrl,t),i=r.map(d=>D(w,e.podUrl,d)),a=o.map(d=>D(w,e.podUrl,d)),s=d=>d.map(p=>`<${n}> <${Te}> <${p}> .`).join(`
2
2
  `),u=[i.length>0?`DELETE DATA { ${s(i)} }`:void 0,a.length>0?`INSERT DATA { ${s(a)} }`:void 0].filter(d=>!!d);if(u.length===0)return;const l=await e.authenticatedFetch(n.split("#",1)[0],{method:"PATCH",headers:{"content-type":"application/sparql-update"},body:u.join(`;
3
3
  `)});if(!l.ok)throw new Error(`provider_model_selection_persist_failed:${l.status}`)}function D(e,t,r){return/^https?:\/\//u.test(r)?r:e.buildIri(t,{id:r})}async function Y(e,t){const r=await e.database.findById(f,t);return r||((await e.database.select().from(f).execute()).find(n=>{const i=c(n.id);return i===t||(i?f.buildIri(e.podUrl,{id:i})===t:!1)})??null)}function Me(){Z(Ae.ActionObserverHttp.prototype),Z(Ce.ActionObserverHttp.prototype)}function Z(e){const t=e;if(t.__xpodObservedActorsPatch)return;const r=t.onRun;t.onRun=function(o,n,i){return Array.isArray(this.observedActors)||(this.observedActors=[]),r.call(this,o,n,i)},t.__xpodObservedActorsPatch=!0}function ke(e,t,r,o){const n=t.filter(i=>c(i.service)==="ai").filter(i=>c(i.status)!=="revoked");return O.map(i=>{const a=n.map(d=>y(e,i,d)).filter(U).sort((d,p)=>d.priority-p.priority||d.id.localeCompare(p.id)),s=r.find(d=>R(c(d.id))===i),l=le(s?.hasModel).map(d=>Be(i,d,o));return{id:i,name:i==="custom"?a.find(d=>d.label)?.label??z(i):z(i),offerings:i==="custom"?Ve(n.filter(d=>y(e,i,d))):ye(i,e.openAiSubscriptionImportAvailable===!0),credentials:a,selectedModels:l,status:qe(a)}})}async function ee(e,t,r,o){if(!(o?await e.database.findById(f,t):null)){await e.database.insert(f).values(r).execute();return}const i={...r};if(delete i.id,!await e.database.updateById(f,t,i))throw new Error("credential_create_failed")}function $(e,t,r,o){return ge({webId:e.webId,provider:t,credentialIri:f.buildIri(e.podUrl,{id:r}),secret:o})}function Le(e,t,r){let o=!1;for(const[n,i]of[[e.accountId,[t?.accountId,r?.accountId]],[e.accountSubject,[t?.authoritativeSubject,r?.accountSubject,r?.authoritativeSubject]]]){const a=[...new Set(i.map(c).filter(U).filter(s=>s.trim()))];if(a.length>1)return!1;if(!(!n?.trim()||!a.length)){if(a[0]!==n)return!1;o=!0}}return o}function y(e,t,r){const o=c(r.id);if(!o)return;const n=q(c(r.provider))??He(o);if(n!==t)return;const i=I(r.metadata),a=ue(r.authMode);if(a)return{id:o,provider:n,offeringId:ce(r,n,a),authMode:a,label:c(r.accountLabel)??c(r.label),enabled:ie(i?.enabled)??c(r.status)==="active",priority:ne(i?.priority)??100,health:Xe(i?.health)??(ie(r.reauthRequired)?"expired":"healthy"),maskedHint:We(e,n,o,r.encryptedSecret),baseUrl:c(r.baseUrl),proxyUrl:Je(c(r.proxyUrl)??c(i?.proxyUrl)),compatibility:$e(i?.compatibility),expiresAt:Qe(r.expiresAt),version:ne(r.keyVersion)??0}}function $e(e){return e==="auto"||e==="openai"||e==="anthropic"?e:void 0}function ce(e,t,r){return c(e.offeringId)??c(I(e.metadata)?.offeringId)??W(c(e.provider))??B(t,r)}function Be(e,t,r){const o=r.find(s=>A(c(s.id))===A(t)),n=c(o?.isProvidedBy),i=o?E(t,n??e)??t:E(t,e)??t,a=o??r.find(s=>{const u=c(s.id),l=c(s.isProvidedBy);return u===t||E(u,e)===i||q(l)===e&&E(u,l??e)===i});return{id:i,provider:e,offeringId:W(c(a?.isProvidedBy)),credentialId:V(n),resourceId:c(a?.id)??t,displayName:c(a?.displayName),availability:c(a?.status)==="unavailable"||!a?"unavailable":"available"}}function ze(e){const t=c(e.isProvidedBy),r=q(t),o=r&&E(c(e.id),t??r);if(!(!r||!o))return{id:o,provider:r,offeringId:W(t),credentialId:V(t),resourceId:c(e.id),displayName:c(e.displayName),availability:c(e.status)==="unavailable"?"unavailable":"available",...je(e)}}function Ne(e){const t=I(e),r=c(t?.id);if(r)return{id:r,displayName:c(t?.displayName),modelType:de(t?.modelType)}}function te(e,t){const r=V(c(t?.provider));return r?j(r):x(e)}function x(e){return _e(e)}function j(e){return Re(e)}function V(e){const t=R(e),r=t?.startsWith("custom-instance-")?t.slice(16):void 0;if(r)try{return decodeURIComponent(r)}catch{return}}function re(e,t){if(!t)return;const r=t.trim().toLowerCase();if(e==="bailian"){if(r==="token-plan")return"token-plan-personal";if(r==="coding-plan")return"coding-plan-pro";if(r==="payg")return"pay-as-you-go"}return r}function P(e,t){const r=A(e),o=A(t);return r!==void 0&&r===o}function De(e,t,r){const o=c(e.isProvidedBy);return P(o,t)?!0:r==="custom"?!1:R(o)?.startsWith(`${r}-`)===!0}function se(e){if(!e)return;const t=e.lastIndexOf("#");if(t<0||t===e.length-1)return;const r=e.slice(t+1);try{return decodeURIComponent(r)}catch{return r}}async function oe(e,t,r){(await e.select().from(h).execute()).some(n=>P(c(n.id),t))||await e.insert(h).values({id:t,displayName:r}).execute()}async function Fe(e,t,r,o){const n=K(t,r.id),i={displayName:r.displayName??r.id,isProvidedBy:t,status:"active",...r.modelType?{modelType:r.modelType}:{}};if(o.has(n)){await e.updateById(w,n,i);return}await e.insert(w).values({id:n,...i}).execute(),o.add(n)}function je(e){const t=de(e.modelType);return t?{modelType:t,...t==="embedding"?{capabilities:["embedding"]}:{}}:{}}function de(e){const t=c(e)?.trim().toLowerCase();return t==="chat"||t==="embedding"?t:void 0}function K(e,t){const r=A(e)??`${e}.ttl`;return`${r.split("#",1)[0]??r}#${encodeURIComponent(t)}`}function Ke(e,t,r,o){const n=c(t.resourceId),i=o??x(e),a=c(t.id),s=a?r.filter(l=>{const d=c(l.isProvidedBy),p=R(d);return(o?P(d,o):p===e||p?.startsWith(`${e}-`)===!0)&&E(c(l.id),d??i)===a}):[],u=o||s.length===1?s[0]:void 0;if(n){const l=r.find(b=>c(b.id)===n);if(!l&&u)return String(u.id);const d=c(l?.isProvidedBy),p=R(d),m=o?P(d,o):p===e||p?.startsWith(`${e}-`)===!0;if(l&&!m)throw new Error("invalid_model_selection_resource");if(!l){const b=a??se(n),g=R(n),S=o?P(g,o):g===e||g?.startsWith(`${e}-`)===!0;if(!b||!S)throw new Error("invalid_model_selection_resource");return K(i,b)}return n}if(!a)throw new Error("invalid_model_selection_resource");return c(u?.id)??K(i,a)}function E(e,t){if(!e)return;const o=A(t)?.split("#",1)[0]??t,n=o.endsWith(".ttl")?`${o}#`:`${o}.ttl#`,i=e.lastIndexOf(n);if(!(i<0))try{return decodeURIComponent(e.slice(i+n.length))}catch{return e.slice(i+n.length)}}function le(e){if(Array.isArray(e))return e.map(c).filter(U);const t=c(e);return t?[t]:[]}function Ve(e){const t=new Map;for(const r of e){const o=I(r.metadata),n=ce(r,"custom",ue(r.authMode)??"apiKey"),i=we(o?.compatibility,n),a=c(r.baseUrl)??c(o?.baseUrl),s=L.find(u=>u.id===n)??L.find(u=>u.id===`${i}-compatible`)??L[0];t.set(n,{...s,id:n,endpoints:a?[{protocol:i==="anthropic"?"anthropic":"chatCompletions",baseUrl:a}]:s.endpoints,modelDiscovery:i==="anthropic"?{strategy:"anthropic",path:"/models",endpointProtocol:"anthropic"}:{strategy:"openaiCompatible",path:"/models",endpointProtocol:"chatCompletions"}})}return t.size>0?[...t.values()]:L}function qe(e){return e.some(t=>t.health==="expired"||t.health==="invalid")?"attention":e.some(t=>t.enabled)?"available":e.length>0?"configured":"unconfigured"}function We(e,t,r,o){const n=T(e,t,r,o),i=c(n?.apiKey);if(i)return i.length<=8?`${i.slice(0,2)}…`:`${i.slice(0,3)}...${i.slice(-4)}`}function T(e,t,r,o){return Se({webId:e.webId,provider:t,credentialIri:f.buildIri(e.podUrl,{id:r}),envelope:o})}function q(e){const t=R(e),r=v(t);return r||O.find(o=>t?.startsWith(`${o}-`))}function W(e){const t=R(e);if(t&&!t.startsWith("custom-instance-")){if(t==="bailian-token-plan-personal")return"token-plan";if(t==="bailian-token-plan-team")return"token-plan-team";if(t==="bailian-coding-plan-pro")return"coding-plan";if(t==="bailian-pay-as-you-go")return"pay-as-you-go";for(const r of O)if(t.startsWith(`${r}-`))return t.slice(r.length+1)}}function He(e){const t=/\/([^/#]+)\.ttl#/u.exec(e);return v(t?.[1])}function v(e){if(typeof e!="string"||!e.trim())return;const t=e.trim().toLowerCase();if(t==="zhipu"||t.startsWith("zhipu-"))return"zhipu";if(O.includes(t))return t;for(const r of O)if(t.startsWith(`${r}-`)||r==="bailian"&&(t==="bailian-token-plan"||t==="bailian-coding-plan"))return r}function F(e){if(e==null||!e.trim())return;let t;try{t=new URL(e.trim())}catch{throw new Error("invalid_proxy_url")}if(!["http:","https:"].includes(t.protocol)||t.username||t.password||t.hash||!t.hostname)throw new Error("invalid_proxy_url");return t.toString().replace(/\/$/u,"")}function Je(e){if(e==null||!e.trim())return;let t;try{t=new URL(e.trim())}catch{return}if(!(!["http:","https:"].includes(t.protocol)||!t.hostname))return t.username="",t.password="",t.search="",t.hash="",t.toString().replace(/\/$/u,"")}function ue(e){if(e==="oauth"||e==="deviceCode"||e==="apiKey"||e==="local")return e;if(e==="deviceCodeOAuth")return"deviceCode"}function Xe(e){if(e==="healthy"||e==="expired"||e==="invalid"||e==="unknown")return e;if(e==="reauthRequired")return"expired";if(e==="disabled")return"unknown"}function I(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function c(e){return typeof e=="string"&&e.trim()?e:void 0}function ne(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function ie(e){if(typeof e=="boolean")return e;if(e==="true")return!0;if(e==="false")return!1}function Qe(e){return e instanceof Date?e.toISOString():c(e)}function U(e){return e!==void 0}export{Re as a,_e as b,Q as c,rt as d,et as e,R as p,tt as w};
@@ -1 +1 @@
1
- import{c as t}from"./settings-BvqY7K96.js";const c=[["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"}]],o=t("activity",c);export{o as A};
1
+ import{c as t}from"./settings-CyLnISOv.js";const c=[["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"}]],o=t("activity",c);export{o as A};
@@ -0,0 +1 @@
1
+ const H=["openai","anthropic","kimi","bailian","deepseek","zhipu","ollama","custom"];function Tt(e){if(e==null||!e.trim())return;let t;try{t=new URL(e.trim())}catch{throw new Error("invalid_proxy_url")}if(!["http:","https:"].includes(t.protocol)||t.username||t.password||t.hash)throw new Error("invalid_proxy_url");if(!t.hostname)throw new Error("invalid_proxy_url");return t.href.replace(/\/$/u,"")}class T extends Error{constructor(t,n,a={}){const c=te(t);super(c?`AI Connection request failed: ${c}`:`AI Connection request failed (HTTP ${n})`),this.name="AiConnectionsRequestError",this.code=c,this.status=n,this.providerStatus=u(t)&&typeof t.providerStatus=="number"?t.providerStatus:void 0,this.payload=t,this.provider=a.provider,this.authMode=a.authMode}}function te(e){if(u(e)){if(typeof e.code=="string")return e.code;if(typeof e.errorCode=="string")return e.errorCode;if(typeof e.error=="string"&&/^[a-z][a-z0-9_:-]{0,80}$/i.test(e.error))return e.error}}async function F(e){const t=await e.text();if(t)try{return JSON.parse(t)}catch{throw new Error(`AI Connection returned invalid JSON (${e.status})`)}}function be(e){if(!H.includes(e))throw new Error(`Unsupported AI provider: ${e}`)}function L(e){if(!(!u(e)||typeof e.id!="string"||typeof e.owner!="string"||!Array.isArray(e.scopes)||!e.scopes.every(t=>typeof t=="string")||typeof e.createdAt!="string"))return y({id:e.id,kind:e.kind==="client-credentials"?e.kind:void 0,credentialResource:o(e.credentialResource),fingerprint:o(e.fingerprint),owner:e.owner,scopes:e.scopes,createdAt:e.createdAt,expiresAt:o(e.expiresAt),lastUsedAt:o(e.lastUsedAt),disabledAt:o(e.disabledAt),revokedAt:o(e.revokedAt),name:o(e.name),maskedHint:o(e.maskedHint),plaintextAvailable:typeof e.plaintextAvailable=="boolean"?e.plaintextAvailable:void 0,clientCredentialId:o(e.clientCredentialId),appliedTo:o(e.appliedTo),appliedOn:o(e.appliedOn),appliedAt:o(e.appliedAt),appliedClients:U(e.appliedClients)})}function V(e){if(!Array.isArray(e))throw new Error("AI Connection returned an invalid custom models response");const t=[];for(const n of e)!u(n)||typeof n.id!="string"||!n.id||t.push(y({id:n.id,displayName:o(n.displayName),inputModalities:U(n.inputModalities),outputModalities:U(n.outputModalities),capabilities:U(n.capabilities)}));return t}function U(e){if(!Array.isArray(e))return;const t=e.filter(n=>typeof n=="string");return t.length>0?t:void 0}function ne(e){if(!u(e)||typeof e.id!="string"||Ae(e.id))return;const t=g(e.provider)??g(e.providerId)??g(e.owned_by)??Pe(e.id);if(!t)return;const n=u(e.capabilities)?e.capabilities.imageInput:void 0;return y({id:e.id,provider:t,offeringId:o(e.offeringId),resourceId:o(e.resourceId),displayName:o(e.displayName)??o(e.display_name)??o(e.name),contextWindow:W(e.contextWindow)??W(e.context_window),protocols:Array.isArray(e.protocols)?e.protocols.filter(a=>typeof a=="string"):void 0,custom:e.custom===!0?!0:void 0,inputModalities:J(e.modalities,"input")??(n===!0?["text","image"]:n===!1?["text"]:void 0),outputModalities:J(e.modalities,"output"),capabilities:Ie(e)})}function J(e,t){if(!u(e))return;const n=e[t];if(!Array.isArray(n))return;const a=n.filter(c=>typeof c=="string");return a.length>0?a:void 0}function Ie(e){if(Array.isArray(e.custom_capabilities)){const n=e.custom_capabilities.filter(a=>typeof a=="string");if(n.length>0)return n}if(!u(e.capabilities))return;const t=[];return e.capabilities.imageInput===!0&&t.push("image"),e.capabilities.toolCalls===!0&&t.push("tool_call"),e.capabilities.reasoningEffort===!0&&t.push("reasoning"),e.capabilities.fast===!0&&t.push("fast"),e.capabilities.embedding===!0&&t.push("embedding"),t.length>0?t:void 0}function Ae(e){const t=e.toLowerCase();return t==="linx"||t==="linx-lite"||t==="undefineds/linx"||t==="undefineds/linx-lite"}function g(e){if(typeof e!="string")return;const t=e.toLowerCase().trim();return t==="alibaba"||t==="dashscope"||t==="alibaba-bailian"||t==="bailian-coding-plan"||t==="bailian-token-plan"?"bailian":H.includes(t)?t:void 0}function Pe(e){const t=e.split("/",1)[0];return e.includes("/")?g(t):void 0}function W(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function we(e){const t=new Map;for(const n of e){const a=Ue(n);if(!a)continue;const c=t.get(a.id);t.set(a.id,c?xe(c,a):a)}return[...t.values()]}function Ue(e){return _e(e)??Ce(e)}function Ce(e){if(!u(e)||typeof e.provider!="string"||!We(e.status)||!u(e.connect)||!Array.isArray(e.connect.modes)||!e.connect.modes.every(K)||typeof e.connect.configured!="boolean")return;const t=g(e.provider);if(!t)return;const n=Ne(e,t);return{id:t,name:de(t),offerings:[],credentials:n?[n]:[],selectedModels:[],status:qe(e.status)}}function _e(e){if(!u(e))return;const t=g(e.id)??g(e.provider);if(!t||!Ke(e.status))return;const n=I(e.offerings,ke),a=I(e.credentials,C),c=I(e.selectedModels,ne);return{id:t,name:o(e.name)??de(t),offerings:n,credentials:a,selectedModels:c,status:e.status}}function ke(e){if(!u(e)||typeof e.id!="string"||!e.id)return;const t=I(e.authModes,se);return y({id:e.id,label:o(e.label),kind:o(e.kind),lifecycle:Ee(e.lifecycle),authModes:t,authorizationMethods:I(e.authorizationMethods,ie),runtimeProviderIds:U(e.runtimeProviderIds),productLabel:o(e.productLabel),credentialPrefixHints:U(e.credentialPrefixHints),consoleUrl:o(e.consoleUrl),subscriptionUrl:o(e.subscriptionUrl),endpoints:I(e.endpoints,re),modelDiscovery:Oe(e.modelDiscovery),quota:Te(e.quota),usagePolicyUrl:o(e.usagePolicyUrl),region:o(e.region)})}function Se(e){if(!u(e)||typeof e.offeringId!="string"||!e.offeringId)return;const t=g(e.provider);if(!t)return;const n=I(e.authorizationMethods,ie);return{provider:t,offeringId:e.offeringId,...Array.isArray(e.endpoints)?{endpoints:I(e.endpoints,re)}:{},authorizationMethods:n}}function ie(e){if(!u(e)||typeof e.id!="string"||!e.id)return;const t=se(e.authMode),n=Me(e.lifecycle);if(!t||!n)return;const a=K(e.connectMode)?e.connectMode:void 0;return y({id:e.id,authMode:t,connectMode:a,label:o(e.label),lifecycle:n,reason:o(e.reason)})}function Me(e){return e==="active"||e==="unavailable"?e:void 0}function Ee(e){return e==="active"||e==="legacy"||e==="unavailable"?e:void 0}function re(e){if(!u(e))return;const t=o(e.protocol),n=o(e.baseUrl);if(!(!t||!n))return y({protocol:t,baseUrl:n,region:o(e.region)})}function Oe(e){if(!u(e))return;const t=o(e.strategy),n=o(e.path),a=o(e.endpointProtocol);return t&&n&&a?{strategy:t,path:n,endpointProtocol:a}:void 0}function Te(e){if(!u(e))return;const t=o(e.strategy),n=o(e.url);return t&&n?{strategy:t,url:n}:void 0}function C(e){if(!(!u(e)||typeof e.id!="string"||!e.id||typeof e.offeringId!="string"||!e.offeringId||!ce(e.authMode)||typeof e.enabled!="boolean"||typeof e.priority!="number"||!Number.isFinite(e.priority)||!He(e.health)||typeof e.version!="number"||!Number.isFinite(e.version)))return y({id:e.id,provider:g(e.provider),offeringId:e.offeringId,authMode:e.authMode,label:o(e.label),enabled:e.enabled,priority:e.priority,health:e.health,maskedHint:o(e.maskedHint),baseUrl:o(e.baseUrl),proxyUrl:o(e.proxyUrl),expiresAt:o(e.expiresAt),version:e.version})}function oe(e){return u(e)?Object.fromEntries(Object.entries(e).filter(([t])=>!Re(t)).map(([t,n])=>[t,ae(n)])):{}}function ae(e){return Array.isArray(e)?e.map(ae):u(e)?oe(e):e}function Re(e){const t=e.toLocaleLowerCase();return t.includes("secret")||t.includes("token")||t.includes("apikey")||t==="api_key"||t==="key"||t==="authorization"}function xe(e,t){const n=q([...e.credentials,...t.credentials],d=>d.id),a=q([...e.offerings,...t.offerings],d=>d.id),c=q([...e.selectedModels,...t.selectedModels],Le);return{id:e.id,name:e.name??t.name,offerings:a,credentials:n,selectedModels:c,status:$e(e.status,t.status)}}function Le(e){return e.resourceId??`${e.provider}:${e.offeringId??""}:${e.id}`}function qe(e){return e==="connected"?"available":e==="reauthRequired"?"attention":"unconfigured"}function $e(e,t){return e==="available"||t==="available"?"available":e==="attention"||t==="attention"?"attention":e==="configured"||t==="configured"?"configured":e==="unconfigured"||t==="unconfigured"?"unconfigured":"unavailable"}function Ne(e,t){if(e.status==="disconnected")return;const n=De(e.authMode);return y({id:o(e.credentialIri)??`${t}:current`,offeringId:ze(t,n),authMode:n,label:o(e.accountLabel),enabled:e.status==="connected",priority:0,health:e.status==="reauthRequired"||e.reauthRequired===!0?"expired":"healthy",maskedHint:o(e.maskedHint),baseUrl:o(e.baseUrl),proxyUrl:o(e.proxyUrl),expiresAt:o(e.expiresAt),version:typeof e.version=="number"?e.version:0})}function De(e){return e==="deviceCodeOAuth"?"deviceCode":"apiKey"}function ze(e,t){return e==="kimi"&&(t==="deviceCode"||t==="oauth")?"subscription-key":t==="deviceCode"||t==="oauth"?"official-subscription":"api-platform"}function se(e){return ce(e)?e:void 0}function ce(e){return e==="oauth"||e==="deviceCode"||e==="apiKey"||e==="local"}function He(e){return e==="healthy"||e==="expired"||e==="invalid"||e==="unknown"}function Ke(e){return e==="unconfigured"||e==="configured"||e==="available"||e==="attention"||e==="unavailable"}function I(e,t){return Array.isArray(e)?e.map(t).filter(_):[]}function q(e,t){const n=new Set,a=[];for(const c of e){const d=t(c);n.has(d)||(n.add(d),a.push(c))}return a}function de(e){switch(e){case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"kimi":return"Kimi";case"bailian":return"Alibaba Bailian";case"deepseek":return"DeepSeek";case"zhipu":return"Zhipu";case"ollama":return"Ollama";case"custom":return"Custom"}}function je(e){if(!u(e)||typeof e.id!="string"||typeof e.credentialIri!="string"||typeof e.webId!="string"||typeof e.provider!="string"||typeof e.authMode!="string"||typeof e.status!="string")return;const t=g(e.provider);if(t)return y({id:e.id,credentialIri:e.credentialIri,webId:e.webId,provider:t,authMode:e.authMode,status:e.status,accountLabel:o(e.accountLabel),expiresAt:o(e.expiresAt),version:typeof e.version=="number"?e.version:void 0,reauthRequired:typeof e.reauthRequired=="boolean"?e.reauthRequired:void 0})}function Ge(e,t){if(!u(e)||!K(e.mode)||!Je(e.status)||e.provider!==t)throw new Error("AI Connection returned an invalid Connect response");return y({mode:e.mode,status:e.status,provider:t,attemptId:o(e.attemptId),state:o(e.state),signature:o(e.signature),expiresAt:o(e.expiresAt),authorizationUrl:$(e.authorizationUrl),userCode:o(e.userCode),verificationUri:$(e.verificationUri),verificationUriComplete:$(e.verificationUriComplete),intervalSeconds:typeof e.intervalSeconds=="number"?e.intervalSeconds:void 0,apiKeyManagementSupported:typeof e.apiKeyManagementSupported=="boolean"?e.apiKeyManagementSupported:void 0,credentialId:o(e.credentialId),offeringId:o(e.offeringId),authorizationMethodId:o(e.authorizationMethodId),oauthCredential:Be(e.oauthCredential),message:o(e.message)})}function Be(e){if(e!==void 0){if(!u(e)||typeof e.accessToken!="string"||!e.accessToken||typeof e.refreshToken!="string"||!e.refreshToken)throw new Error("AI Connection returned an invalid OAuth credential payload");return y({accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:o(e.expiresAt),scope:o(e.scope),idToken:o(e.idToken),accountSubject:o(e.accountSubject),accountId:o(e.accountId),accountLabel:o(e.accountLabel),offeringId:o(e.offeringId),authorizationMethodId:o(e.authorizationMethodId),expectedVersion:typeof e.expectedVersion=="number"?e.expectedVersion:void 0})}}function Fe(e,t){if(!u(e)||!Array.isArray(e.models))throw new Error("AI Connection returned an invalid model discovery response");const n=e.models.map(a=>{if(!u(a)||typeof a.id!="string"||!a.id)return;const c=Array.isArray(a.capabilities)?a.capabilities.filter(f=>typeof f=="string"):void 0,d=Ve(a.modelType);return y({id:a.id,displayName:o(a.displayName),capabilities:c??(d==="embedding"?["embedding"]:void 0),modelType:d})}).filter(_);return{provider:t,credential:typeof e.credential=="string"?e.credential:"",models:n,observedAt:typeof e.observedAt=="string"?e.observedAt:new Date(0).toISOString(),source:typeof e.source=="string"?e.source:""}}function y(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function Ve(e){return e==="chat"||e==="embedding"?e:void 0}function o(e){return typeof e=="string"?e:void 0}function $(e){if(typeof e=="string")try{const t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"?t.href:void 0}catch{return}}function K(e){return e==="browserAssistedApiKey"||e==="deviceCodeOAuth"||e==="authorizationCodeOAuth"||e==="connectUnsupported"}function Je(e){return e==="pending"||e==="authorization_pending"||e==="slow_down"||e==="completed"||e==="expired"||e==="cancelled"||e==="unsupported"}function We(e){return e==="connected"||e==="disconnected"||e==="reauthRequired"}function u(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function _(e){return e!==void 0}function j(e){const t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")throw new Error("Current Pod URL must use HTTP or HTTPS");return t.origin}function Ye({webId:e,podBaseUrl:t,authenticatedFetch:n}){const a=j(t),c=async(r,i,s,p={})=>{const l=await n(`${a}${r}`,{method:i,credentials:"omit",mode:"cors",headers:{accept:"application/json",...s?{"content-type":"application/json"}:{}},...s?{body:JSON.stringify(s)}:{}}),m=await F(l);if(!l.ok)throw new T(m,l.status,p);return m},d=r=>(be(r),`/api/ai/gateway/providers/${r}`),f=async(r,i,s,p)=>{const l=await c(`${d(r)}${i}`,s,p,{provider:r});return Ge(l,r)},h=async()=>{const r=await c("/v1/models","GET");return Array.isArray(r.data)?r.data.map(ne).filter(_):[]};return{webId:e,apiBase:a,getServiceAccess(){return c("/api/applets/service-access/ai-connections","GET")},async listProviders(){const r=await c("/api/ai/providers","GET");return Array.isArray(r.data)?we(r.data):[]},async listAuthorizationMethods(){const r=await n(`${a}/api/ai/connections/authorization-methods`,{method:"GET",credentials:"omit",mode:"cors",headers:{accept:"application/json"}});if(r.status===404)return[];const i=await F(r);if(!r.ok)throw new T(i,r.status);return u(i)&&Array.isArray(i.data)?i.data.map(Se).filter(_):[]},listModels:h,listGatewayModels:h,async listGatewayKeys(){const r=await c("/api/ai/gateway/keys","GET");return Array.isArray(r.data)?r.data.map(L).filter(_):[]},async createGatewayKey(r){const i=await c("/api/ai/gateway/keys","POST",y(r));if(typeof i.key!="string"||!i.key)throw new Error("Xpod did not return the new API Key");const s=L(i.record);if(!s)throw new Error("Xpod returned an invalid API Key record");return{plaintext:i.key,record:s}},async updateGatewayKey(r,i){const s=await c(`/api/ai/gateway/keys/${encodeURIComponent(r)}`,"PATCH",i),p=L(s.record);if(!p)throw new Error("Xpod returned an invalid API Key record");return p},async deleteGatewayKey(r){await c(`/api/ai/gateway/keys/${encodeURIComponent(r)}`,"DELETE")},async beginConnect(r,i,s){return await f(r,"/connect/begin","POST",y({mode:i,offeringId:s?.offeringId,authorizationMethodId:s?.authorizationMethodId}))},connectStatus(r,i){if(!i.attemptId)throw new Error("Connect attempt id is required");const s=new URLSearchParams({state:i.state??"",signature:i.signature??""});return i.mode&&s.set("mode",i.mode),f(r,`/connect/status/${encodeURIComponent(i.attemptId)}?${s}`,"GET")},completeApiKey(r,i,s,p,l){return f(r,"/connect/complete-api-key","POST",y({attemptId:i.attemptId,state:i.state,signature:i.signature,offeringId:i.offeringId,apiKey:s,accountLabel:p,baseUrl:l}))},pollDevice(r,i){return f(r,"/connect/poll","POST",y({mode:i.mode,attemptId:i.attemptId,state:i.state,signature:i.signature,offeringId:i.offeringId}))},cancelConnect(r,i){return f(r,"/connect/cancel","POST",y({mode:i.mode,attemptId:i.attemptId,state:i.state,signature:i.signature,offeringId:i.offeringId}))},refreshOAuthCredential(r,i,s,p,l,m){return f(r,"/connect/refresh","POST",{credentialId:i,refreshToken:s,expectedVersion:p,...l?{offeringId:l}:{},...m?{mode:m}:{}})},async disconnect(r,i){const s=i?`?${new URLSearchParams({credentialId:i})}`:"",p=await c(`${d(r)}/connect${s}`,"DELETE");return je(p.record)},async createApiKeyCredential(r,i){const s=await c(`/api/ai/providers/${r}/credentials/api-key`,"POST",y({...i}),{provider:r}),p=C(s.credential);if(!p)throw new Error("AI Connection returned an invalid Provider credential");return p},async createLocalCredential(r,i){const s=await c(`/api/ai/providers/${r}/credentials/local`,"POST",y(i),{provider:r}),p=C(s.credential);if(!p)throw new Error("AI Connection returned an invalid Provider credential");return p},async updateProviderCredential(r,i,s){const p=await c(`/api/ai/providers/${r}/credentials/${encodeURIComponent(i)}`,"PATCH",y({...s}),{provider:r}),l=C(p.credential);if(!l)throw new Error("AI Connection returned an invalid Provider credential");return l},async deleteProviderCredential(r,i){const s=await c(`/api/ai/providers/${r}/credentials/${encodeURIComponent(i)}`,"DELETE",void 0,{provider:r});return C(s.credential)},async testProviderCredential(r,i){const s=await c(`/api/ai/providers/${r}/credentials/test`,"POST",y({...i}),{provider:r});return oe(s.result)},quota(r,i=!1,s){const p=!i&&s?.credentialIri?`?credentialIri=${encodeURIComponent(s.credentialIri)}${s.offeringId?`&offeringId=${encodeURIComponent(s.offeringId)}`:""}`:"";return c(`${d(r)}/quota/${i?"refresh":"status"}${p}`,i?"POST":"GET",i?y({offeringId:s?.offeringId,credentialId:s?.credentialId,credentialIri:s?.credentialIri}):void 0,{provider:r})},quotaFromSecret(r,i){return c(`${d(r)}/quota/refresh`,"POST",y(i),{provider:r})},async discoverModels(r,i){const s=await c(`${d(r)}/models/refresh`,"POST",y({...i}),{provider:r,authMode:i?.authMode});return Fe(s,r)},async saveProviderModel(r,i){const s=await c(d(r)+"/models","POST",y({id:i.id,displayName:i.displayName,inputModalities:i.inputModalities,outputModalities:i.outputModalities,capabilities:i.capabilities}),{provider:r});return V(s.data)},async deleteProviderModel(r,i){const s=await c(`${d(r)}/models/${encodeURIComponent(i)}`,"DELETE",void 0,{provider:r});return V(s.data)}}}const pe="AI Connection request failed. Please try again.";function S(e){return typeof e=="object"&&e!==null}const le="订阅登录态自动刷新失败,请稍后重试。",ue="订阅登录态已失效,请在原客户端重新登录后重读,或使用设备码登录。",fe="订阅登录态不可用,请重读登录态或重新登录后再同步模型。",ye=new Set([fe,le,ue,"密钥不可用。请检查密钥是否填写正确,或换一个密钥后重试。","模型服务地址不正确。请检查服务地址后重试。","请求太频繁。请稍等一会儿再试。","模型服务暂时没有响应。请稍后重试。","模型列表获取失败。请检查密钥、服务地址或网络后重试。"]);function Y(e){if(e.startsWith("provider_models_response_error:"))return G(e.slice(31))??"模型列表获取失败。请检查密钥、服务地址或网络后重试。";const t=R(e);if(t)return t;const n=e.split(":",1)[0]?.trim(),a=n?R(n):void 0;return a||(e==="AI Connection service identity is unavailable"||ye.has(e)||et(e)?e:e.startsWith("invalid_")?"AI Connection returned an invalid response.":pe)}function Xe(e){return e instanceof T?Ze(e.payload,e.status,{provider:e.provider,authMode:e.authMode}):e instanceof Error?Y(e.message):Y(String(e))}function Ze(e,t,n={}){const a=te(e);if(a==="provider_models_response_error"){const f=S(e)&&typeof e.message=="string"?G(e.message):void 0;return f||"模型列表获取失败。请检查密钥、服务地址或网络后重试。"}if(a==="provider_models_fetch_failed"){const f=S(e)&&typeof e.providerStatus=="number"?e.providerStatus:void 0,h=S(e)&&typeof e.providerMessage=="string"?e.providerMessage.trim():void 0;return ve(Qe(f,n.authMode),h)}const c=a?R(a,n.provider):void 0;if(c)return c;const d=S(e)&&typeof e.error=="string"?e.error:void 0;if(d){const f=R(d,n.provider);if(f)return f;if(d==="AI Connection service identity is unavailable")return d;if(d==="Provider credential not found for current identity")return"当前身份没有可用的额度凭证。";if(d==="Provider quota adapter not found"||d==="Provider quota lookup failed")return"该接入方式不支持查询官方额度。"}return t===401?"Please sign in again to continue.":t===403?"AI Connection permission was denied.":t===404&&n.provider?`${D(n.provider)} connection is not configured.`:t===429?"AI Connection is rate limited. Please try again later.":t===503?"AI Connection service is unavailable.":pe}function R(e,t){switch(e.trim().toLowerCase().replace(/-/g,"_")){case"not_configured":case"notconfigured":return t?`${D(t)} connection is not configured.`:"AI provider connection is not configured.";case"unsupported":return t?`${D(t)} does not support this operation.`:"This AI Connection operation is not supported.";case"service_access_missing":case"pod_interface_key_missing":case"pod_interface_key_rejected":case"caller_dpop_replay_unsupported":return"Xpod 尚未获得这个 Pod 的接口访问密钥。请在「客户端访问」中创建 API Key 并应用到客户端后重试。";case"unauthorized":return"Please sign in again to continue.";case"forbidden":case"permission_denied":return"AI Connection permission was denied.";case"rate_limited":return"AI Connection is rate limited. Please try again later.";case"service_unavailable":return"AI Connection service is unavailable.";case"unsafe_provider_base_url":return"该服务地址指向 Xpod 不允许访问的网络,请改用公网 HTTPS 地址。";case"invalid_proxy_url":return"代理地址必须是无账号密码的 HTTP 或 HTTPS 地址。";case"oauth_refresh_failed":case"oauth_refresh_unavailable":case"local_session_refresh_failed":return le;case"oauth_session_reauth_required":case"oauth_refresh_token_required":case"local_session_reauth_required":case"local_session_missing_refresh_token":return ue;case"models_persistence_failed":return"模型已获取,但保存到 Pod 失败。请重试同步模型。";case"quota_credential_not_found":return"当前身份没有可用的额度凭证。";case"credential_secret_unavailable":return"当前凭证密钥不可用,请重新保存后再查询额度。";case"gateway_api_key_plaintext_unavailable":return"Pod 中未找到此 API Key 的原文,无法复制配置。请创建新的 Key,更新客户端后再删除旧 Key。";case"quota_adapter_not_found":return"该接入方式不支持查询官方额度。";default:return}}function Qe(e,t){return e===401||e===403?t==="deviceCodeOAuth"?fe:"密钥不可用。请检查密钥是否填写正确,或换一个密钥后重试。":e===404?"模型服务地址不正确。请检查服务地址后重试。":e===429?"请求太频繁。请稍等一会儿再试。":e!==void 0&&e>=500?"模型服务暂时没有响应。请稍后重试。":"模型列表获取失败。请检查密钥、服务地址或网络后重试。"}function ve(e,t){const n=t?G(t):void 0;return n?`${e} 上游返回:${n}`:e}function et(e){const n=e.indexOf(" 上游返回:");return n<=0?!1:ye.has(e.slice(0,n))}function G(e){return e.replace(/[\u0000-\u001f\u007f]/gu," ").replace(/\bBearer\s+[^\s,;]+/giu,"Bearer [REDACTED]").replace(/(?:sk|id)[._-][A-Za-z0-9._-]{8,}/gu,"[REDACTED]").replace(/https?:\/\/[^\s]+/giu,"[URL]").trim().slice(0,240)||void 0}function D(e){switch(e){case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"kimi":return"Kimi";case"bailian":return"Bailian";case"deepseek":return"DeepSeek";case"zhipu":return"Zhipu";case"ollama":return"Ollama";case"custom":return"Custom"}}function tt(e){const t={...e};for(const[n,a]of Object.entries(e))typeof a=="function"&&(t[n]=async(...c)=>{try{return await a.apply(e,c)}catch(d){throw d instanceof T&&(d.message=Xe(d)),d}});return t}const me=[{id:"api-platform",label:"API Platform",kind:"api-platform",lifecycle:"active",authModes:["apiKey"]}],nt={id:"api-key",authMode:"apiKey",lifecycle:"active"},it={id:"browser-login",authMode:"apiKey",connectMode:"browserAssistedApiKey",lifecycle:"active"},w=[nt,it],rt=[{id:"openai-compatible",label:"OpenAI Compatible",kind:"api-platform",lifecycle:"active",authModes:["apiKey"],runtimeProviderIds:["custom"],consoleUrl:"https://undefineds.co",subscriptionUrl:"https://undefineds.co",endpoints:[{protocol:"chatCompletions",baseUrl:"https://example.invalid/v1"}],modelDiscovery:{strategy:"openaiCompatible",path:"/models",endpointProtocol:"chatCompletions"},quota:{strategy:"unsupported",url:"https://undefineds.co"}},{id:"anthropic-compatible",label:"Anthropic Compatible",kind:"api-platform",lifecycle:"active",authModes:["apiKey"],runtimeProviderIds:["custom"],consoleUrl:"https://undefineds.co",subscriptionUrl:"https://undefineds.co",endpoints:[{protocol:"anthropic",baseUrl:"https://example.invalid/v1"}],modelDiscovery:{strategy:"anthropic",path:"/models",endpointProtocol:"anthropic"},quota:{strategy:"unsupported",url:"https://undefineds.co"}}],N="https://www.kimi.com/code",ot="https://www.kimi.com/user/agreement",at="https://api.kimi.com/coding/v1",st="https://api.kimi.com/coding/",ct="https://platform.moonshot.cn/console/api-keys",X="https://platform.moonshot.cn/console/account",dt="https://platform.moonshot.cn/docs/intro",pt="https://api.moonshot.ai/v1",M="https://bailian.console.aliyun.com/",E="https://help.aliyun.com/zh/model-studio/",Z="https://open.bigmodel.cn/usercenter/apikeys",Q="https://open.bigmodel.cn/",lt="https://open.bigmodel.cn/api/paas/v4",ut="https://open.bigmodel.cn/api/coding/paas/v4",he={openai:[{id:"official-subscription",label:"OpenAI Subscription",kind:"oauth-subscription",lifecycle:"unavailable",authModes:["oauth","local"],productLabel:"OpenAI",runtimeProviderIds:["openai"],credentialPrefixHints:[],consoleUrl:"https://chatgpt.com/codex",subscriptionUrl:"https://chatgpt.com/codex",endpoints:[{protocol:"responses",baseUrl:"https://chatgpt.com/backend-api/codex"}],modelDiscovery:{strategy:"unsupported",path:"/models",endpointProtocol:"responses"},quota:{strategy:"subscription",url:"https://chatgpt.com/codex"},usagePolicyUrl:"https://openai.com/policies/usage-policies/",region:"global"},{id:"api-platform",label:"API Platform",kind:"api-platform",lifecycle:"active",authModes:["apiKey"],authorizationMethods:w,productLabel:"OpenAI",runtimeProviderIds:["openai"],credentialPrefixHints:["sk-"],consoleUrl:"https://platform.openai.com/api-keys",subscriptionUrl:"https://platform.openai.com/settings/organization/billing/overview",endpoints:[{protocol:"responses",baseUrl:"https://api.openai.com/v1"},{protocol:"chatCompletions",baseUrl:"https://api.openai.com/v1"}],modelDiscovery:{strategy:"openaiCompatible",path:"/models",endpointProtocol:"responses"},quota:{strategy:"providerApi",url:"https://platform.openai.com/usage"},usagePolicyUrl:"https://openai.com/policies/usage-policies/",region:"global"}],anthropic:[{id:"official-subscription",label:"Claude Code Subscription",kind:"oauth-subscription",lifecycle:"unavailable",authModes:["oauth"],productLabel:"Anthropic",runtimeProviderIds:["anthropic"],credentialPrefixHints:[],consoleUrl:"https://claude.ai/",subscriptionUrl:"https://claude.ai/settings/billing",endpoints:[],modelDiscovery:{strategy:"unsupported",path:"/models",endpointProtocol:"anthropic"},quota:{strategy:"subscription",url:"https://claude.ai/settings/usage"},usagePolicyUrl:"https://www.anthropic.com/legal/aup",region:"global"},{id:"api-platform",label:"API Platform",kind:"api-platform",lifecycle:"active",authModes:["apiKey"],authorizationMethods:w,productLabel:"Anthropic",runtimeProviderIds:["anthropic"],credentialPrefixHints:["sk-ant-"],consoleUrl:"https://console.anthropic.com/settings/keys",subscriptionUrl:"https://console.anthropic.com/settings/plans",endpoints:[{protocol:"anthropic",baseUrl:"https://api.anthropic.com/v1"}],modelDiscovery:{strategy:"anthropic",path:"/models",endpointProtocol:"anthropic"},quota:{strategy:"console",url:"https://console.anthropic.com/settings/limits"},usagePolicyUrl:"https://www.anthropic.com/legal/aup",region:"global"}],kimi:[v({id:"subscription-key",label:"Token Plan",kind:"token-plan",authModes:["apiKey"],productLabel:"Kimi Coding",runtimeProviderIds:["kimi"],credentialPrefixHints:["sk-kimi-"],baseUrl:at,anthropicBaseUrl:st,quotaStrategy:"subscription",quotaUrl:N,consoleUrl:N,subscriptionUrl:N,usagePolicyUrl:ot,supportsDeveloperMessages:!1}),v({id:"api-platform",label:"API Platform",kind:"api-platform",authModes:["apiKey"],productLabel:"Moonshot AI",runtimeProviderIds:["kimi"],credentialPrefixHints:["sk-"],baseUrl:pt,quotaStrategy:"console",quotaUrl:X,consoleUrl:ct,subscriptionUrl:X,usagePolicyUrl:dt})],bailian:[O({id:"pay-as-you-go",label:"Pay as You Go",kind:"api-platform",runtimeProviderIds:["bailian"],credentialPrefixHints:["sk-"],region:"cn",baseUrl:"https://dashscope.aliyuncs.com/compatible-mode/v1",anthropicBaseUrl:"https://dashscope.aliyuncs.com/apps/anthropic",quotaStrategy:"console",consoleUrl:M,usagePolicyUrl:E}),O({id:"token-plan",label:"Token Plan Personal",kind:"token-plan",runtimeProviderIds:["bailian-token-plan"],credentialPrefixHints:["sk-"],region:"cn-beijing",baseUrl:"https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",anthropicBaseUrl:"https://token-plan.cn-beijing.maas.aliyuncs.com/apps/anthropic",quotaStrategy:"subscription",consoleUrl:M,usagePolicyUrl:E}),O({id:"token-plan-team",label:"Token Plan Team",kind:"token-plan",runtimeProviderIds:["bailian-token-plan"],credentialPrefixHints:["sk-"],region:"cn-beijing",baseUrl:"https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",anthropicBaseUrl:"https://token-plan.cn-beijing.maas.aliyuncs.com/apps/anthropic",quotaStrategy:"subscription",consoleUrl:M,usagePolicyUrl:E}),O({id:"coding-plan",label:"Coding Plan Pro",kind:"token-plan",runtimeProviderIds:["bailian-coding-plan"],credentialPrefixHints:["sk-sp-"],region:"cn",baseUrl:"https://coding.dashscope.aliyuncs.com/v1",anthropicBaseUrl:"https://coding.dashscope.aliyuncs.com/apps/anthropic",quotaStrategy:"subscription",consoleUrl:M,usagePolicyUrl:E})],deepseek:[{id:"api-platform",label:"API Platform",kind:"api-platform",lifecycle:"active",authModes:["apiKey"],productLabel:"DeepSeek",runtimeProviderIds:["deepseek"],credentialPrefixHints:["sk-"],consoleUrl:"https://platform.deepseek.com/api_keys",subscriptionUrl:"https://platform.deepseek.com/usage",endpoints:[{protocol:"chatCompletions",baseUrl:"https://api.deepseek.com/v1"}],modelDiscovery:{strategy:"openaiCompatible",path:"/models",endpointProtocol:"chatCompletions"},quota:{strategy:"console",url:"https://platform.deepseek.com/usage"},usagePolicyUrl:"https://cdn.deepseek.com/policies/en-US/deepseek-open-platform-terms-of-use.html",region:"global"}],ollama:[{id:"local",label:"Local Ollama",kind:"local",lifecycle:"active",authModes:["local"],productLabel:"Ollama",runtimeProviderIds:["ollama"],credentialPrefixHints:[],consoleUrl:"https://ollama.com",subscriptionUrl:"https://ollama.com",endpoints:[{protocol:"chatCompletions",baseUrl:"http://localhost:11434/v1"}],modelDiscovery:{strategy:"openaiCompatible",path:"/models",endpointProtocol:"chatCompletions"},quota:{strategy:"unsupported",url:"https://ollama.com"},usagePolicyUrl:"https://ollama.com",region:"local"}],zhipu:[{id:"api-platform",label:"API Platform",kind:"api-platform",lifecycle:"active",authModes:["apiKey"],authorizationMethods:w,productLabel:"智谱 AI",runtimeProviderIds:["zhipu"],credentialPrefixHints:["id."],consoleUrl:Z,subscriptionUrl:"https://open.bigmodel.cn/finance-center/expense-manage",endpoints:[{protocol:"chatCompletions",baseUrl:lt,region:"cn"}],modelDiscovery:{strategy:"openaiCompatible",path:"/models",endpointProtocol:"chatCompletions"},quota:{strategy:"console",url:"https://open.bigmodel.cn/finance-center/expense-manage"},usagePolicyUrl:Q,region:"cn"},{id:"coding-plan",label:"GLM Coding Plan",kind:"token-plan",lifecycle:"active",authModes:["apiKey"],authorizationMethods:w,productLabel:"智谱 AI",runtimeProviderIds:["zhipu"],credentialPrefixHints:["id."],consoleUrl:Z,subscriptionUrl:"https://bigmodel.cn/glm-coding",endpoints:[{protocol:"chatCompletions",baseUrl:ut,region:"cn"}],modelDiscovery:{strategy:"openaiCompatible",path:"/models",endpointProtocol:"chatCompletions"},quota:{strategy:"subscription",url:"https://bigmodel.cn/glm-coding"},usagePolicyUrl:Q,region:"cn"}]};function v(e){return{id:e.id,label:e.label,kind:e.kind,lifecycle:"active",authModes:e.authModes,authorizationMethods:w,productLabel:e.productLabel,runtimeProviderIds:e.runtimeProviderIds,credentialPrefixHints:e.credentialPrefixHints,consoleUrl:e.consoleUrl,subscriptionUrl:e.subscriptionUrl,endpoints:ge(e.baseUrl,e.anthropicBaseUrl,"cn",e.supportsDeveloperMessages),modelDiscovery:{strategy:"openaiCompatible",path:"/models",endpointProtocol:"chatCompletions"},quota:{strategy:e.quotaStrategy,url:e.quotaUrl},usagePolicyUrl:e.usagePolicyUrl,region:"cn"}}function O(e){return{id:e.id,label:e.label,lifecycle:"active",productLabel:"Alibaba Bailian",kind:e.kind,authModes:["apiKey"],authorizationMethods:w,runtimeProviderIds:e.runtimeProviderIds,credentialPrefixHints:e.credentialPrefixHints,consoleUrl:e.consoleUrl,subscriptionUrl:e.consoleUrl,endpoints:ge(e.baseUrl,e.anthropicBaseUrl,e.region),modelDiscovery:{strategy:"openaiCompatible",path:"/models",endpointProtocol:"chatCompletions"},quota:{strategy:e.quotaStrategy,url:e.consoleUrl},usagePolicyUrl:e.usagePolicyUrl,region:e.region}}function ge(e,t,n,a){return[{protocol:"chatCompletions",baseUrl:e,region:n,...a===void 0?{}:{supportsDeveloperMessages:a}},...t?[{protocol:"anthropic",baseUrl:t,region:n}]:[]]}function ft(e,t=!1){return(he[e]??me).map(n=>e==="openai"&&n.id==="official-subscription"&&t?{...n,lifecycle:"active",authModes:Array.from(new Set([...n.authModes??[],"local"])),authorizationMethods:[{id:"device-code",authMode:"deviceCode",connectMode:"deviceCodeOAuth",lifecycle:"active"},{id:"local-session-import",authMode:"local",lifecycle:"active"}]}:{...n})}const Rt=H.flatMap(e=>[e,...yt(e).map(t=>`${e}-${t.id}`)]);function yt(e){return e==="custom"?rt:he[e]??me}function xt(e,t){return e==="anthropic"||t==="anthropic-compatible"?"anthropic":"openai"}function mt(e,t){return e==="openai"&&(t==="local"||t==="oauth"||t==="deviceCode")?"official-subscription":e==="kimi"&&(t==="oauth"||t==="deviceCode")?"subscription-key":e==="bailian"?"pay-as-you-go":e==="ollama"?"local":e==="custom"?"openai-compatible":"api-platform"}function Lt(e,t){const n=ft(e).find(c=>c.id===(t??mt(e,"apiKey")));if(!n)return;const a=n.modelDiscovery?.endpointProtocol;return n.endpoints?.find(c=>c.protocol===a)?.baseUrl??n.endpoints?.[0]?.baseUrl}function qt(e,t){const n=t.trim().toLowerCase();if(e==="bailian"){if(n==="token-plan-personal")return"token-plan";if(n==="coding-plan-pro")return"coding-plan"}return n}function $t(e){return{offeringId:e.offeringId,priority:e.priority??100,enabled:e.enabled??!0,health:e.health??"unknown",...e.baseUrl?{baseUrl:e.baseUrl}:{}}}const ht=3e4;function Nt({webId:e,podUrl:t,authenticatedFetch:n}){return tt(Ye({webId:e,podBaseUrl:t,authenticatedFetch:gt(n)}))}function gt(e){return(async(t,n)=>z(await e(t,n)))}function bt({podUrl:e,authenticatedFetch:t,invocationFetch:n=t,now:a=()=>new Date,invocationSelector:c=wt}){const d=j(e);let f,h;const r=async(l,m)=>{const b=await t(l,m);return f=await Pt(b.clone(),c),b},i=async()=>{if(Ct(f,a()))return f;if(h)return h;h=s();try{return await h}finally{h=void 0}},s=async()=>{if(!(await r(`${d}/api/applets/service-access/ai-connections`,{method:"GET",credentials:"include",headers:{accept:"application/json"}})).ok)throw new Error("AI Connection request failed. Please try again.");const m=f;if(!m?.token)throw new Error("AI Connection request failed. Please try again.");return m},p=async(l,m)=>{const b=await i(),k=_t(b);if(!k)throw new Error("AI Connection request failed. Please try again.");const B=new Headers(m?.headers);return B.set("Authorization",`Bearer ${k}`),n(l,{...m,credentials:"omit",headers:B})};return(async(l,m)=>{if(It(l,d))return r(l,m);if(!At(l,d))return t(l,m);const b=await p(l,m);if(b.status!==401)return z(b);await b.arrayBuffer(),f=void 0;const k=await p(l,m);return z(k)})}function Dt({podUrl:e,controlPlaneOrigin:t,authenticatedFetch:n,invocationFetch:a,now:c}){const d=j(e),f=a??n,r=bt({podUrl:e,authenticatedFetch:n,invocationFetch:(i,s)=>{const p=new URL(i instanceof Request?i.url:String(i),d);if(t&&p.origin===d&&p.pathname.startsWith("/api/ai/client-configuration/")){const l=new URL(`${p.pathname}${p.search}`,t);return f(i instanceof Request?new Request(l,i):l.href,s)}return f(i,s)},now:c,invocationSelector:Ut});return{inspect:async i=>{const s=await r(A(d,i),{method:"GET",credentials:"omit",headers:{accept:"application/json"}});return s.status===403||s.status===404||s.status===503?(await s.arrayBuffer(),ee()):P(s)},plan:async i=>P(await r(`${A(d,i.client)}/plan`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({endpoint:t?new URL(t).origin:i.endpoint,...i.activeModels!==void 0?{activeModels:i.activeModels}:{}})})),apply:async i=>P(await r(`${A(d,i.client)}/apply`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({planId:i.planId,apiKey:i.apiKey,confirmation:i.confirmation})})),verify:async i=>P(await r(`${A(d,i.client)}/verify`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({planId:i.planId})})),launch:async i=>P(await r(`${A(d,i)}/launch`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({})})),restore:async i=>{const s=await r(`${A(d,i)}/restore`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({})});return s.status===403||s.status===404||s.status===503?(await s.arrayBuffer(),ee()):P(s)}}}function It(e,t){try{const n=new URL(String(e),t),a=new URL(t);return n.origin===a.origin&&n.pathname==="/api/applets/service-access/ai-connections"}catch{return!1}}function At(e,t){try{const n=new URL(String(e),t),a=new URL(t);return n.origin===a.origin&&(n.pathname.startsWith("/api/ai/")||n.pathname.startsWith("/v1/"))}catch{return!1}}async function Pt(e,t){if(!(!e.ok||!e.headers.get("content-type")?.includes("application/json")))try{const n=await e.json();return kt(t(n))}catch{return}}function wt(e){return e.invocation}function Ut(e){const t=e.aiClientConfiguration;return x(t)?t.invocation:void 0}function Ct(e,t){if(!e?.token)return!1;if(!e.expiresAt)return!0;const n=Date.parse(e.expiresAt);return Number.isFinite(n)&&n-t.getTime()>ht}function _t(e){return e?.token}function kt(e){if(!x(e))return;const t=["gateway","Key"].join("");return{token:typeof e.token=="string"?e.token:typeof e.apiKey=="string"?e.apiKey:typeof e[t]=="string"?e[t]:void 0,baseUrl:typeof e.baseUrl=="string"?e.baseUrl:void 0,expiresAt:typeof e.expiresAt=="string"?e.expiresAt:void 0}}async function z(e){return e.ok?e:e.headers.get("content-type")?.includes("application/json")?Mt(e):(await e.arrayBuffer(),new Response(JSON.stringify({error:"internal_error"}),{status:e.status,statusText:e.statusText,headers:{"content-type":"application/json"}}))}function A(e,t){return`${e}/api/ai/client-configuration/${encodeURIComponent(t)}`}async function P(e){if(!e.ok)throw await St(e);if(!e.headers.get("content-type")?.includes("application/json"))throw await e.arrayBuffer(),new Error("AI client configuration request failed. Please try again.");return await e.json()}async function St(e){let t;try{t=e.headers.get("content-type")?.includes("application/json")?await e.json():void 0}catch{t=void 0}if(x(t)){const n=typeof t.code=="string"?t.code:typeof t.error=="string"?t.error:void 0,a=typeof t.message=="string"?t.message:"AI client configuration request failed. Please try again.",c=new Error(a);return c.code=n,c.status=e.status,c.details=t.details,c}return await e.arrayBuffer().catch(()=>{}),new Error("AI client configuration request failed. Please try again.")}function ee(){return{status:"unavailable",message:"Host does not support local client configuration. Use the manual setup instructions for your client."}}async function Mt(e){let t;try{t=await e.clone().json()}catch{return e}const n=Ot(t);return n?new Response(JSON.stringify({code:n}),{status:e.status,statusText:e.statusText,headers:{"content-type":"application/json"}}):Et(t)?new Response(JSON.stringify({code:t.error.code,error:t.error.message}),{status:e.status,statusText:e.statusText,headers:{"content-type":"application/json"}}):e}function Et(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e.error;return!!(t&&typeof t=="object"&&!Array.isArray(t)&&typeof t.code=="string"&&typeof t.message=="string"&&typeof t.status=="number")}function Ot(e){if(!(!x(e)||typeof e.error!="string")&&e.error==="Gateway API Key plaintext is not available")return"gateway_api_key_plaintext_unavailable"}function x(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}export{H as A,rt as C,Nt as a,xt as b,$t as c,mt as d,Rt as e,Ye as f,T as g,Xe as h,Dt as i,Tt as n,Lt as o,ft as p,qt as s};
@@ -1 +1 @@
1
- import{j as a,f as s,g as o,i as d}from"./settings-BvqY7K96.js";const n=o(`inline-flex items-center rounded-lg border px-2.5 py-0.5 text-xs font-semibold transition-all duration-200 ${d}`,{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-sm shadow-primary/20 hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-sm shadow-destructive/20 hover:bg-destructive/90",outline:"border-border/40 text-foreground bg-muted/30 backdrop-blur-sm"}},defaultVariants:{variant:"default"}});function u({className:r,variant:e,...t}){return a.jsx("div",{className:s(n({variant:e}),r),...t})}export{u as B};
1
+ import{j as a,f as s,g as o,i as d}from"./settings-CyLnISOv.js";const n=o(`inline-flex items-center rounded-lg border px-2.5 py-0.5 text-xs font-semibold transition-all duration-200 ${d}`,{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-sm shadow-primary/20 hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-sm shadow-destructive/20 hover:bg-destructive/90",outline:"border-border/40 text-foreground bg-muted/30 backdrop-blur-sm"}},defaultVariants:{variant:"default"}});function u({className:r,variant:e,...t}){return a.jsx("div",{className:s(n({variant:e}),r),...t})}export{u as B};
@@ -1 +1 @@
1
- import{h as u,k as b}from"./settings-BvqY7K96.js";import{c as p}from"./ModelsPage-DZpTlTZ3.js";import{s as L,d as x,o as P,n as R,c as _}from"./ai-connections-C6yaE6WQ.js";import{c as m,a as O,b as I}from"./XpodAiConnectionsPodStore-owBQc5nY.js";import{r as K}from"./layout-DB3pMyTl.js";import"./workspace-layout-B9H1Tqrk.js";import"./index-CkGda_Pg.js";import"./index-Vv-8Vslg.js";import"./dialog-B7ZRsjN7.js";import"./badge--r-FDIhU.js";import"./index-browser-Dq7omlpY.js";async function D(o){const a=o.capabilities.podCollections;if(a)try{return a.load?{collection:await a.load(u,{table:b})}:{collection:a.define(u,{table:b})}}catch{return}}function h(o){return o.includes("#")?K(u,{id:o}):o}async function M(o,a){await o.insert(a).isPersisted.promise}async function C(o,a,l){await o.update(a,d=>{Object.assign(d,l)}).isPersisted.promise}async function U(o,a){await o.delete(a).isPersisted.promise}function g(o,a){const{provider:l}=a,d=L(l,a.offeringId??x(l,a.authMode)),c=a.baseUrl??P(l,d),f=R(a.proxyUrl);return{id:o,service:"ai",provider:l==="custom"?O(o):I(l),authMode:a.authMode,status:"active",accountLabel:a.accountLabel,label:a.accountLabel,keyVersion:"1",reauthRequired:!1,encryptionAlgorithm:"PLAINTEXT",offeringId:d,...c?{baseUrl:c}:{},...f?{proxyUrl:f}:{},metadata:_({offeringId:d,baseUrl:c})}}function N(o,a){const{collection:l}=o,d=async r=>{await U(l,r).catch(()=>{})},c=(r,t)=>{const e=l.get(r);return e?p(e,t):void 0},f=async(r,t,e,n)=>{await M(l,e);try{const s=await n(b.buildId({id:t}))??c(t,r);if(!s)throw new Error("credential_create_failed");return s}catch(i){throw await d(t),i}};return{async createApiKeyCredential(r,t){if(!a.createApiKeyCredential)throw new Error("credential_store_unavailable");const e=m(r,"apiKey"),n=t.label??r;return await f(r,e,g(e,{provider:r,authMode:"apiKey",accountLabel:n,offeringId:t.offeringId,baseUrl:t.baseUrl,proxyUrl:t.proxyUrl}),i=>a.createApiKeyCredential(r,{...t,label:n,id:i}))},async createLocalCredential(r,t){if(!a.createLocalCredential)throw new Error("credential_store_unavailable");const e=m(r,"local"),n=t.label??"Local";return await f(r,e,g(e,{provider:r,authMode:"local",accountLabel:n,offeringId:t.offeringId,baseUrl:t.baseUrl}),i=>a.createLocalCredential(r,{...t,label:n,id:i}))},async updateProviderCredential(r,t,e){const n=h(t);if(!n)throw new Error("credential_not_found");const i={...e.label===void 0?{}:{label:e.label,accountLabel:e.label},...e.enabled===void 0?{}:{status:e.enabled?"active":"disabled"}},s=l.get(n);Object.keys(i).length>0&&await C(l,n,i);const y={...e.priority===void 0?{}:{priority:e.priority},...e.baseUrl===void 0?{}:{baseUrl:e.baseUrl},...e.proxyUrl===void 0?{}:{proxyUrl:e.proxyUrl}};if(Object.keys(y).length===0)return c(n,r);if(!a.updateProviderCredential)throw new Error("credential_store_unavailable");try{return await a.updateProviderCredential(r,t,{expectedVersion:e.expectedVersion,...y})??c(n,r)}catch(w){throw s&&Object.keys(i).length>0&&await C(l,n,{...i.label===void 0?{}:{label:s.label,accountLabel:s.accountLabel},...i.status===void 0?{}:{status:s.status}}).catch(()=>{}),w}},async deleteProviderCredential(r,t){const e=h(t);if(!e)return;const n=c(e,r);return await U(l,e),n}}}export{N as collectionCredentialMutations,h as credentialRowKey,D as openCredentialCollection};
1
+ import{h as u,k as b}from"./settings-CyLnISOv.js";import{c as p}from"./ModelsPage-CzTnPs_G.js";import{s as L,d as x,o as P,n as R,c as _}from"./ai-connections-DexTPyfC.js";import{c as m,a as O,b as I}from"./XpodAiConnectionsPodStore-VU5Bsz1a.js";import{r as K}from"./layout-DB3pMyTl.js";import"./workspace-layout-BOQnl_3d.js";import"./index-Ckh4h9jj.js";import"./index-DOiwLF4B.js";import"./dialog-DTr2JkHn.js";import"./badge-_hCrrWRP.js";import"./index-browser-DFFWN3Kr.js";async function D(o){const a=o.capabilities.podCollections;if(a)try{return a.load?{collection:await a.load(u,{table:b})}:{collection:a.define(u,{table:b})}}catch{return}}function h(o){return o.includes("#")?K(u,{id:o}):o}async function M(o,a){await o.insert(a).isPersisted.promise}async function C(o,a,l){await o.update(a,d=>{Object.assign(d,l)}).isPersisted.promise}async function U(o,a){await o.delete(a).isPersisted.promise}function g(o,a){const{provider:l}=a,d=L(l,a.offeringId??x(l,a.authMode)),c=a.baseUrl??P(l,d),f=R(a.proxyUrl);return{id:o,service:"ai",provider:l==="custom"?O(o):I(l),authMode:a.authMode,status:"active",accountLabel:a.accountLabel,label:a.accountLabel,keyVersion:"1",reauthRequired:!1,encryptionAlgorithm:"PLAINTEXT",offeringId:d,...c?{baseUrl:c}:{},...f?{proxyUrl:f}:{},metadata:_({offeringId:d,baseUrl:c})}}function N(o,a){const{collection:l}=o,d=async r=>{await U(l,r).catch(()=>{})},c=(r,t)=>{const e=l.get(r);return e?p(e,t):void 0},f=async(r,t,e,n)=>{await M(l,e);try{const s=await n(b.buildId({id:t}))??c(t,r);if(!s)throw new Error("credential_create_failed");return s}catch(i){throw await d(t),i}};return{async createApiKeyCredential(r,t){if(!a.createApiKeyCredential)throw new Error("credential_store_unavailable");const e=m(r,"apiKey"),n=t.label??r;return await f(r,e,g(e,{provider:r,authMode:"apiKey",accountLabel:n,offeringId:t.offeringId,baseUrl:t.baseUrl,proxyUrl:t.proxyUrl}),i=>a.createApiKeyCredential(r,{...t,label:n,id:i}))},async createLocalCredential(r,t){if(!a.createLocalCredential)throw new Error("credential_store_unavailable");const e=m(r,"local"),n=t.label??"Local";return await f(r,e,g(e,{provider:r,authMode:"local",accountLabel:n,offeringId:t.offeringId,baseUrl:t.baseUrl}),i=>a.createLocalCredential(r,{...t,label:n,id:i}))},async updateProviderCredential(r,t,e){const n=h(t);if(!n)throw new Error("credential_not_found");const i={...e.label===void 0?{}:{label:e.label,accountLabel:e.label},...e.enabled===void 0?{}:{status:e.enabled?"active":"disabled"}},s=l.get(n);Object.keys(i).length>0&&await C(l,n,i);const y={...e.priority===void 0?{}:{priority:e.priority},...e.baseUrl===void 0?{}:{baseUrl:e.baseUrl},...e.proxyUrl===void 0?{}:{proxyUrl:e.proxyUrl}};if(Object.keys(y).length===0)return c(n,r);if(!a.updateProviderCredential)throw new Error("credential_store_unavailable");try{return await a.updateProviderCredential(r,t,{expectedVersion:e.expectedVersion,...y})??c(n,r)}catch(w){throw s&&Object.keys(i).length>0&&await C(l,n,{...i.label===void 0?{}:{label:s.label,accountLabel:s.accountLabel},...i.status===void 0?{}:{status:s.status}}).catch(()=>{}),w}},async deleteProviderCredential(r,t){const e=h(t);if(!e)return;const n=c(e,r);return await U(l,e),n}}}export{N as collectionCredentialMutations,h as credentialRowKey,D as openCredentialCollection};
@@ -1 +1 @@
1
- import{j as n,r as i,P as x,l as b,m as _,n as z,o as G,X as H,f as g,i as K}from"./settings-BvqY7K96.js";import{P as R,a as U,c as p,h as V,u as X,R as Y,b as Z,F as q,D as B,d as J,e as C}from"./index-CkGda_Pg.js";var Q=Object.defineProperty,d=(s,e)=>Q(s,"name",{value:e,configurable:!0}),y="Dialog",[O,_e]=z(y),[W,f]=O(y),ee=d(s=>{const{__scopeDialog:e,children:o,open:r,defaultOpen:l,onOpenChange:a,modal:t=!0}=s,c=i.useRef(null),u=i.useRef(null),[P,v]=J({prop:r,defaultProp:l??!1,onChange:a,caller:y}),[A,S]=i.useState(0),[k,L]=i.useState(0);return n.jsx(W,{scope:e,triggerRef:c,contentRef:u,contentId:C(),titleId:C(),descriptionId:C(),titlePresent:A>0,descriptionPresent:k>0,setTitleCount:S,setDescriptionCount:L,open:P,onOpenChange:v,onOpenToggle:i.useCallback(()=>v($=>!$),[v]),modal:t,children:o})},"Dialog"),te="DialogTrigger",oe=i.forwardRef(d(function(e,o){const{__scopeDialog:r,...l}=e,a=f(te,r),t=_(o,a.triggerRef);return n.jsx(x.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":m(a.open),...l,ref:t,onClick:p(e.onClick,a.onOpenToggle)})},"DialogTrigger")),j="DialogPortal",[ae,N]=O(j,{forceMount:void 0}),ne=d(s=>{const{__scopeDialog:e,forceMount:o,children:r,container:l}=s,a=f(j,e);return n.jsx(ae,{scope:e,forceMount:o,children:i.Children.map(r,t=>n.jsx(R,{present:o||a.open,children:n.jsx(U,{asChild:!0,container:l,children:t})}))})},"DialogPortal"),h="DialogOverlay",w=i.forwardRef(d(function(e,o){const r=N(h,e.__scopeDialog),{forceMount:l=r.forceMount,...a}=e,t=f(h,e.__scopeDialog);return t.modal?n.jsx(R,{present:l||t.open,children:n.jsx(re,{...a,ref:o})}):null},"DialogOverlay")),se=G("DialogOverlay.RemoveScroll"),re=i.forwardRef(d(function(e,o){const{__scopeDialog:r,...l}=e,a=f(h,r),t=X(),c=_(o,t);return n.jsx(Y,{as:se,allowPinchZoom:!0,shards:[a.contentRef],children:n.jsx(x.div,{"data-state":m(a.open),...l,ref:c,style:{pointerEvents:"auto",...l.style}})})},"DialogOverlayImpl")),D="DialogContent",E=i.forwardRef(d(function(e,o){const r=N(D,e.__scopeDialog),{forceMount:l=r.forceMount,...a}=e,t=f(D,e.__scopeDialog);return n.jsx(R,{present:l||t.open,children:t.modal?n.jsx(le,{...a,ref:o}):n.jsx(ie,{...a,ref:o})})},"DialogContent")),le=i.forwardRef(d(function(e,o){const r=f(D,e.__scopeDialog),l=i.useRef(null),a=_(o,r.contentRef,l);return i.useEffect(()=>{const t=l.current;if(t)return V(t)},[]),n.jsx(I,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:p(e.onCloseAutoFocus,t=>{t.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,t=>{const c=t.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&t.preventDefault()}),onFocusOutside:p(e.onFocusOutside,t=>t.preventDefault())})},"DialogContentModal")),ie=i.forwardRef(d(function(e,o){const r=f(D,e.__scopeDialog),l=i.useRef(!1),a=i.useRef(!1);return n.jsx(I,{...e,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(l.current||r.triggerRef.current?.focus(),t.preventDefault()),l.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(l.current=!0,t.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=t.target;r.triggerRef.current?.contains(c)&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&a.current&&t.preventDefault()}})},"DialogContentNonModal")),I=i.forwardRef(d(function(e,o){const{__scopeDialog:r,trapFocus:l,onOpenAutoFocus:a,onCloseAutoFocus:t,...c}=e,u=f(D,r);return Z(),n.jsx(n.Fragment,{children:n.jsx(q,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:a,onUnmountAutoFocus:t,children:n.jsx(B,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionPresent?u.descriptionId:void 0,"aria-labelledby":u.titlePresent?u.titleId:void 0,"data-state":m(u.open),...c,ref:o,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})},"DialogContentImpl")),ce="DialogTitle",T=i.forwardRef(d(function(e,o){const{__scopeDialog:r,...l}=e,a=f(ce,r),{setTitleCount:t}=a;return b(()=>(t(c=>c+1),()=>t(c=>c-1)),[t]),n.jsx(x.h2,{id:a.titleId,...l,ref:o})},"DialogTitle")),de="DialogDescription",M=i.forwardRef(d(function(e,o){const{__scopeDialog:r,...l}=e,a=f(de,r),{setDescriptionCount:t}=a;return b(()=>(t(c=>c+1),()=>t(c=>c-1)),[t]),n.jsx(x.p,{id:a.descriptionId,...l,ref:o})},"DialogDescription")),ue="DialogClose",fe=i.forwardRef(d(function(e,o){const{__scopeDialog:r,...l}=e,a=f(ue,r);return n.jsx(x.button,{type:"button",...l,ref:o,onClick:p(e.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function m(s){return s?"open":"closed"}d(m,"getState");const Re=ee,ye=oe,ge=ne,F=i.forwardRef(({className:s,...e},o)=>n.jsx(w,{ref:o,className:g("fixed inset-0 z-50 bg-black/40","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...e}));F.displayName=w.displayName;const pe=i.forwardRef(({className:s,children:e,variant:o="center",...r},l)=>n.jsxs(ge,{children:[n.jsx(F,{}),n.jsxs(E,{ref:l,className:g(o==="sheet-left"?"fixed inset-y-0 left-0 z-50 flex h-dvh w-[min(88vw,320px)] flex-col border-r bg-background p-0 shadow-[16px_0_30px_rgba(15,23,42,0.08)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-left-full data-[state=open]:slide-in-from-left-full rounded-none":o==="sheet-right"?"fixed inset-y-0 right-0 z-50 flex h-dvh w-full max-w-4xl flex-col border-l bg-background p-0 shadow-[-16px_0_30px_rgba(15,23,42,0.08)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-right-full rounded-none":"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",s),...r,children:[e,n.jsxs(fe,{className:g("absolute right-4 top-4 rounded-xl opacity-70 transition-all hover:opacity-100 hover:bg-muted/50 p-1 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",K),children:[n.jsx(H,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));pe.displayName=E.displayName;const De=({className:s,...e})=>n.jsx("div",{className:g("flex flex-col space-y-1.5 text-center sm:text-left",s),...e});De.displayName="DialogHeader";const xe=({className:s,...e})=>n.jsx("div",{className:g("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...e});xe.displayName="DialogFooter";const me=i.forwardRef(({className:s,...e},o)=>n.jsx(T,{ref:o,className:g("text-lg font-semibold leading-none tracking-tight",s),...e}));me.displayName=T.displayName;const ve=i.forwardRef(({className:s,...e},o)=>n.jsx(M,{ref:o,className:g("text-sm text-muted-foreground",s),...e}));ve.displayName=M.displayName;export{Re as D,pe as a,De as b,me as c,ve as d,xe as e,ye as f};
1
+ import{j as n,r as i,P as x,l as b,m as _,n as z,o as G,X as H,f as g,i as K}from"./settings-CyLnISOv.js";import{P as R,a as U,c as p,h as V,u as X,R as Y,b as Z,F as q,D as B,d as J,e as C}from"./index-Ckh4h9jj.js";var Q=Object.defineProperty,d=(s,e)=>Q(s,"name",{value:e,configurable:!0}),y="Dialog",[O,_e]=z(y),[W,f]=O(y),ee=d(s=>{const{__scopeDialog:e,children:o,open:r,defaultOpen:l,onOpenChange:a,modal:t=!0}=s,c=i.useRef(null),u=i.useRef(null),[P,v]=J({prop:r,defaultProp:l??!1,onChange:a,caller:y}),[A,S]=i.useState(0),[k,L]=i.useState(0);return n.jsx(W,{scope:e,triggerRef:c,contentRef:u,contentId:C(),titleId:C(),descriptionId:C(),titlePresent:A>0,descriptionPresent:k>0,setTitleCount:S,setDescriptionCount:L,open:P,onOpenChange:v,onOpenToggle:i.useCallback(()=>v($=>!$),[v]),modal:t,children:o})},"Dialog"),te="DialogTrigger",oe=i.forwardRef(d(function(e,o){const{__scopeDialog:r,...l}=e,a=f(te,r),t=_(o,a.triggerRef);return n.jsx(x.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":m(a.open),...l,ref:t,onClick:p(e.onClick,a.onOpenToggle)})},"DialogTrigger")),j="DialogPortal",[ae,N]=O(j,{forceMount:void 0}),ne=d(s=>{const{__scopeDialog:e,forceMount:o,children:r,container:l}=s,a=f(j,e);return n.jsx(ae,{scope:e,forceMount:o,children:i.Children.map(r,t=>n.jsx(R,{present:o||a.open,children:n.jsx(U,{asChild:!0,container:l,children:t})}))})},"DialogPortal"),h="DialogOverlay",w=i.forwardRef(d(function(e,o){const r=N(h,e.__scopeDialog),{forceMount:l=r.forceMount,...a}=e,t=f(h,e.__scopeDialog);return t.modal?n.jsx(R,{present:l||t.open,children:n.jsx(re,{...a,ref:o})}):null},"DialogOverlay")),se=G("DialogOverlay.RemoveScroll"),re=i.forwardRef(d(function(e,o){const{__scopeDialog:r,...l}=e,a=f(h,r),t=X(),c=_(o,t);return n.jsx(Y,{as:se,allowPinchZoom:!0,shards:[a.contentRef],children:n.jsx(x.div,{"data-state":m(a.open),...l,ref:c,style:{pointerEvents:"auto",...l.style}})})},"DialogOverlayImpl")),D="DialogContent",E=i.forwardRef(d(function(e,o){const r=N(D,e.__scopeDialog),{forceMount:l=r.forceMount,...a}=e,t=f(D,e.__scopeDialog);return n.jsx(R,{present:l||t.open,children:t.modal?n.jsx(le,{...a,ref:o}):n.jsx(ie,{...a,ref:o})})},"DialogContent")),le=i.forwardRef(d(function(e,o){const r=f(D,e.__scopeDialog),l=i.useRef(null),a=_(o,r.contentRef,l);return i.useEffect(()=>{const t=l.current;if(t)return V(t)},[]),n.jsx(I,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:p(e.onCloseAutoFocus,t=>{t.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,t=>{const c=t.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&t.preventDefault()}),onFocusOutside:p(e.onFocusOutside,t=>t.preventDefault())})},"DialogContentModal")),ie=i.forwardRef(d(function(e,o){const r=f(D,e.__scopeDialog),l=i.useRef(!1),a=i.useRef(!1);return n.jsx(I,{...e,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(l.current||r.triggerRef.current?.focus(),t.preventDefault()),l.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(l.current=!0,t.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=t.target;r.triggerRef.current?.contains(c)&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&a.current&&t.preventDefault()}})},"DialogContentNonModal")),I=i.forwardRef(d(function(e,o){const{__scopeDialog:r,trapFocus:l,onOpenAutoFocus:a,onCloseAutoFocus:t,...c}=e,u=f(D,r);return Z(),n.jsx(n.Fragment,{children:n.jsx(q,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:a,onUnmountAutoFocus:t,children:n.jsx(B,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionPresent?u.descriptionId:void 0,"aria-labelledby":u.titlePresent?u.titleId:void 0,"data-state":m(u.open),...c,ref:o,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})},"DialogContentImpl")),ce="DialogTitle",T=i.forwardRef(d(function(e,o){const{__scopeDialog:r,...l}=e,a=f(ce,r),{setTitleCount:t}=a;return b(()=>(t(c=>c+1),()=>t(c=>c-1)),[t]),n.jsx(x.h2,{id:a.titleId,...l,ref:o})},"DialogTitle")),de="DialogDescription",M=i.forwardRef(d(function(e,o){const{__scopeDialog:r,...l}=e,a=f(de,r),{setDescriptionCount:t}=a;return b(()=>(t(c=>c+1),()=>t(c=>c-1)),[t]),n.jsx(x.p,{id:a.descriptionId,...l,ref:o})},"DialogDescription")),ue="DialogClose",fe=i.forwardRef(d(function(e,o){const{__scopeDialog:r,...l}=e,a=f(ue,r);return n.jsx(x.button,{type:"button",...l,ref:o,onClick:p(e.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function m(s){return s?"open":"closed"}d(m,"getState");const Re=ee,ye=oe,ge=ne,F=i.forwardRef(({className:s,...e},o)=>n.jsx(w,{ref:o,className:g("fixed inset-0 z-50 bg-black/40","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...e}));F.displayName=w.displayName;const pe=i.forwardRef(({className:s,children:e,variant:o="center",...r},l)=>n.jsxs(ge,{children:[n.jsx(F,{}),n.jsxs(E,{ref:l,className:g(o==="sheet-left"?"fixed inset-y-0 left-0 z-50 flex h-dvh w-[min(88vw,320px)] flex-col border-r bg-background p-0 shadow-[16px_0_30px_rgba(15,23,42,0.08)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-left-full data-[state=open]:slide-in-from-left-full rounded-none":o==="sheet-right"?"fixed inset-y-0 right-0 z-50 flex h-dvh w-full max-w-4xl flex-col border-l bg-background p-0 shadow-[-16px_0_30px_rgba(15,23,42,0.08)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-right-full rounded-none":"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",s),...r,children:[e,n.jsxs(fe,{className:g("absolute right-4 top-4 rounded-xl opacity-70 transition-all hover:opacity-100 hover:bg-muted/50 p-1 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",K),children:[n.jsx(H,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));pe.displayName=E.displayName;const De=({className:s,...e})=>n.jsx("div",{className:g("flex flex-col space-y-1.5 text-center sm:text-left",s),...e});De.displayName="DialogHeader";const xe=({className:s,...e})=>n.jsx("div",{className:g("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...e});xe.displayName="DialogFooter";const me=i.forwardRef(({className:s,...e},o)=>n.jsx(T,{ref:o,className:g("text-lg font-semibold leading-none tracking-tight",s),...e}));me.displayName=T.displayName;const ve=i.forwardRef(({className:s,...e},o)=>n.jsx(M,{ref:o,className:g("text-sm text-muted-foreground",s),...e}));ve.displayName=M.displayName;export{Re as D,pe as a,De as b,me as c,ve as d,xe as e,ye as f};
@@ -1 +1 @@
1
- import{c as o}from"./settings-BvqY7K96.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],e=o("download",a);export{e as D};
1
+ import{c as o}from"./settings-CyLnISOv.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],e=o("download",a);export{e as D};
@@ -1 +1 @@
1
- import{c as a}from"./settings-BvqY7K96.js";const e=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],n=a("external-link",e);export{n as E};
1
+ import{c as a}from"./settings-CyLnISOv.js";const e=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],n=a("external-link",e);export{n as E};