@undefineds.co/xpod 0.4.10 → 0.4.12

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 (402) hide show
  1. package/config/components-ignore.json +5 -1
  2. package/config/notifications.json +68 -0
  3. package/config/xpod.base.json +9 -11
  4. package/dist/ai/service/AiCredentialSecret.d.ts +30 -0
  5. package/dist/ai/service/AiCredentialSecret.js +120 -0
  6. package/dist/ai/service/CredentialReaderImpl.d.ts +18 -0
  7. package/dist/ai/service/CredentialReaderImpl.js +81 -5
  8. package/dist/ai/service/CredentialReaderImpl.jsonld +42 -2
  9. package/dist/ai/service/EmbeddingModelPolicy.d.ts +79 -0
  10. package/dist/ai/service/EmbeddingModelPolicy.js +134 -0
  11. package/dist/ai/service/EmbeddingProviderError.js +6 -0
  12. package/dist/ai/service/EmbeddingServiceImpl.d.ts +13 -1
  13. package/dist/ai/service/EmbeddingServiceImpl.js +18 -5
  14. package/dist/ai/service/EmbeddingServiceImpl.jsonld +35 -0
  15. package/dist/ai/service/index.d.ts +2 -0
  16. package/dist/ai/service/index.js +2 -0
  17. package/dist/api/ai-gateway/connect/index.d.ts +20 -2
  18. package/dist/api/ai-gateway/connect/index.js +162 -16
  19. package/dist/api/ai-gateway/credentials/AiCredentialSecretDecoder.d.ts +12 -0
  20. package/dist/api/ai-gateway/credentials/AiCredentialSecretDecoder.js +30 -0
  21. package/dist/api/ai-gateway/errors.d.ts +1 -1
  22. package/dist/api/ai-gateway/models/GatewayEmbeddingModelCatalog.d.ts +11 -0
  23. package/dist/api/ai-gateway/models/GatewayEmbeddingModelCatalog.js +31 -0
  24. package/dist/api/ai-gateway/models/PodModelSelectionRepository.js +7 -3
  25. package/dist/api/ai-gateway/models/ProviderCustomModelsService.d.ts +18 -0
  26. package/dist/api/ai-gateway/models/ProviderCustomModelsService.js +23 -0
  27. package/dist/api/ai-gateway/models/ProviderModelDiscoveryAdapters.d.ts +3 -1
  28. package/dist/api/ai-gateway/models/ProviderModelDiscoveryAdapters.js +2 -45
  29. package/dist/api/ai-gateway/models/ProviderModelSelectionService.d.ts +10 -0
  30. package/dist/api/ai-gateway/models/ProviderModelSelectionService.js +57 -20
  31. package/dist/api/ai-gateway/models/ProviderModelType.d.ts +28 -0
  32. package/dist/api/ai-gateway/models/ProviderModelType.js +34 -0
  33. package/dist/api/ai-gateway/models/ProviderModelsAdapter.d.ts +10 -0
  34. package/dist/api/ai-gateway/models/ProviderModelsAdapter.js +3 -4
  35. package/dist/api/ai-gateway/models/index.d.ts +1 -0
  36. package/dist/api/ai-gateway/models/index.js +3 -1
  37. package/dist/api/ai-gateway/providers/CustomRuntimeAdapter.d.ts +7 -0
  38. package/dist/api/ai-gateway/providers/CustomRuntimeAdapter.js +9 -2
  39. package/dist/api/ai-gateway/providers/ModelsDevCatalog.d.ts +7 -1
  40. package/dist/api/ai-gateway/providers/ModelsDevCatalog.js +4 -10
  41. package/dist/api/ai-gateway/providers/ProviderRegistry.d.ts +107 -0
  42. package/dist/api/ai-gateway/providers/ProviderRegistry.js +244 -21
  43. package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.d.ts +5 -0
  44. package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.js +5 -1
  45. package/dist/api/ai-gateway/quota/SubscriptionQuotaAdapters.d.ts +12 -4
  46. package/dist/api/ai-gateway/quota/SubscriptionQuotaAdapters.js +11 -11
  47. package/dist/api/ai-gateway/routing/ModelRouter.d.ts +14 -0
  48. package/dist/api/ai-gateway/routing/ModelRouter.js +43 -4
  49. package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.d.ts +9 -1
  50. package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.js +3 -27
  51. package/dist/api/auth/ClientCredentialsAuthenticator.d.ts +0 -1
  52. package/dist/api/auth/ClientCredentialsAuthenticator.js +0 -3
  53. package/dist/api/auth/index.d.ts +1 -0
  54. package/dist/api/auth/index.js +1 -1
  55. package/dist/api/chatkit/pod-store.d.ts +31 -0
  56. package/dist/api/chatkit/pod-store.js +132 -8
  57. package/dist/api/container/common.js +24 -4
  58. package/dist/api/container/routes.js +17 -2
  59. package/dist/api/container/types.d.ts +3 -1
  60. package/dist/api/handlers/AdminHandler.d.ts +13 -0
  61. package/dist/api/handlers/AdminHandler.js +47 -18
  62. package/dist/api/handlers/AiConfigHandler.d.ts +6 -0
  63. package/dist/api/handlers/AiConfigHandler.js +28 -0
  64. package/dist/api/handlers/AiGatewayManagementHandler.js +36 -0
  65. package/dist/api/runs/RdfRunContextRetriever.d.ts +14 -0
  66. package/dist/api/runs/RdfRunContextRetriever.js +41 -5
  67. package/dist/api/runtime.js +2 -1
  68. package/dist/cli/commands/secret.d.ts +1 -0
  69. package/dist/cli/commands/secret.js +25 -7
  70. package/dist/components/components.jsonld +3 -1
  71. package/dist/components/context.jsonld +53 -1
  72. package/dist/http/SubgraphSparqlHttpHandler.d.ts +59 -2
  73. package/dist/http/SubgraphSparqlHttpHandler.js +145 -13
  74. package/dist/http/SubgraphSparqlHttpHandler.jsonld +37 -0
  75. package/dist/identity/drizzle/AccountRoleRepository.d.ts +30 -2
  76. package/dist/identity/drizzle/AccountRoleRepository.js +163 -15
  77. package/dist/identity/drizzle/EdgeNodeRepository.d.ts +0 -12
  78. package/dist/identity/drizzle/EdgeNodeRepository.js +5 -13
  79. package/dist/identity/drizzle/PodLookupRepository.d.ts +58 -4
  80. package/dist/identity/drizzle/PodLookupRepository.js +248 -105
  81. package/dist/identity/drizzle/db.d.ts +19 -0
  82. package/dist/identity/drizzle/db.js +39 -4
  83. package/dist/index.d.ts +2 -1
  84. package/dist/index.js +7 -3
  85. package/dist/logging/log-file.d.ts +17 -0
  86. package/dist/logging/log-file.js +69 -0
  87. package/dist/main.js +2 -1
  88. package/dist/notifications/NotificationChannelSweeper.d.ts +50 -0
  89. package/dist/notifications/NotificationChannelSweeper.js +131 -0
  90. package/dist/notifications/NotificationChannelSweeper.jsonld +136 -0
  91. package/dist/notifications/ReclaimingWebSocket2023Storer.d.ts +25 -0
  92. package/dist/notifications/ReclaimingWebSocket2023Storer.js +56 -0
  93. package/dist/notifications/ReclaimingWebSocket2023Storer.jsonld +77 -0
  94. package/dist/notifications/index.d.ts +2 -0
  95. package/dist/notifications/index.js +2 -0
  96. package/dist/runtime/Proxy.d.ts +37 -0
  97. package/dist/runtime/Proxy.js +88 -16
  98. package/dist/runtime/bootstrap.js +2 -1
  99. package/dist/runtime/upgrade/BunNativeUpgradeRelay.d.ts +116 -0
  100. package/dist/runtime/upgrade/BunNativeUpgradeRelay.js +423 -0
  101. package/dist/runtime/upgrade/UpgradeHandshake.d.ts +63 -0
  102. package/dist/runtime/upgrade/UpgradeHandshake.js +199 -0
  103. package/dist/runtime/upgrade/WebSocketFrames.d.ts +67 -0
  104. package/dist/runtime/upgrade/WebSocketFrames.js +224 -0
  105. package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.js +8 -1
  106. package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.d.ts +11 -2
  107. package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.js +27 -10
  108. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.d.ts +7 -0
  109. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.js +13 -11
  110. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectDialog.js +1 -1
  111. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsList.js +10 -6
  112. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMain.d.ts +15 -0
  113. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMain.js +29 -3
  114. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMainHeader.js +18 -3
  115. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.d.ts +16 -1
  116. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +92 -20
  117. package/node_modules/@undefineds.co/ai-connections/dist/AiCopyButton.d.ts +35 -0
  118. package/node_modules/@undefineds.co/ai-connections/dist/AiCopyButton.js +45 -0
  119. package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.js +71 -11
  120. package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialRow.js +9 -7
  121. package/node_modules/@undefineds.co/ai-connections/dist/AiEndpointList.d.ts +23 -0
  122. package/node_modules/@undefineds.co/ai-connections/dist/AiEndpointList.js +24 -0
  123. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +13 -4
  124. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +35 -38
  125. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.d.ts +21 -0
  126. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.js +51 -0
  127. package/node_modules/@undefineds.co/ai-connections/dist/AiInfoTooltip.d.ts +15 -0
  128. package/node_modules/@undefineds.co/ai-connections/dist/AiInfoTooltip.js +16 -0
  129. package/node_modules/@undefineds.co/ai-connections/dist/AiModelCatalog.d.ts +175 -0
  130. package/node_modules/@undefineds.co/ai-connections/dist/AiModelCatalog.js +133 -0
  131. package/node_modules/@undefineds.co/ai-connections/dist/AiOfferingDetails.js +2 -2
  132. package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.js +13 -64
  133. package/node_modules/@undefineds.co/ai-connections/dist/AiProviderHeader.d.ts +21 -0
  134. package/node_modules/@undefineds.co/ai-connections/dist/AiProviderHeader.js +12 -0
  135. package/node_modules/@undefineds.co/ai-connections/dist/AiRowAction.d.ts +15 -0
  136. package/node_modules/@undefineds.co/ai-connections/dist/AiRowAction.js +12 -0
  137. package/node_modules/@undefineds.co/ai-connections/dist/AiSortableCredentialList.js +2 -1
  138. package/node_modules/@undefineds.co/ai-connections/dist/ai-connections-client.d.ts +7 -0
  139. package/node_modules/@undefineds.co/ai-connections/dist/ai-connections-client.js +6 -0
  140. package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.d.ts +36 -5
  141. package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.js +52 -9
  142. package/node_modules/@undefineds.co/ai-connections/dist/client/normalize.js +30 -3
  143. package/node_modules/@undefineds.co/ai-connections/dist/client/types.d.ts +21 -1
  144. package/node_modules/@undefineds.co/ai-connections/dist/client-config/base-adapter.d.ts +1 -3
  145. package/node_modules/@undefineds.co/ai-connections/dist/client-config/base-adapter.js +3 -7
  146. package/node_modules/@undefineds.co/ai-connections/dist/client-config/index.cjs +9 -7
  147. package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.d.ts +46 -0
  148. package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.js +231 -0
  149. package/node_modules/@undefineds.co/ai-connections/dist/collections.d.ts +119 -0
  150. package/node_modules/@undefineds.co/ai-connections/dist/collections.js +173 -0
  151. package/node_modules/@undefineds.co/ai-connections/dist/controller.d.ts +71 -5
  152. package/node_modules/@undefineds.co/ai-connections/dist/controller.js +285 -16
  153. package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.d.ts +5 -0
  154. package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.js +8 -3
  155. package/node_modules/@undefineds.co/ai-connections/dist/credential-storage.d.ts +59 -0
  156. package/node_modules/@undefineds.co/ai-connections/dist/credential-storage.js +131 -0
  157. package/node_modules/@undefineds.co/ai-connections/dist/endpoint-urls.d.ts +15 -0
  158. package/node_modules/@undefineds.co/ai-connections/dist/endpoint-urls.js +20 -0
  159. package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.d.ts +14 -0
  160. package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.js +20 -0
  161. package/node_modules/@undefineds.co/ai-connections/dist/index.d.ts +8 -0
  162. package/node_modules/@undefineds.co/ai-connections/dist/index.js +8 -0
  163. package/node_modules/@undefineds.co/ai-connections/dist/manifest.js +1 -1
  164. package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.d.ts +14 -0
  165. package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.js +17 -0
  166. package/node_modules/@undefineds.co/ai-connections/dist/provider-catalog.cjs +68 -1
  167. package/node_modules/@undefineds.co/ai-connections/dist/provider-catalog.d.ts +75 -1
  168. package/node_modules/@undefineds.co/ai-connections/dist/provider-catalog.js +119 -0
  169. package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.d.ts +5 -0
  170. package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.js +5 -0
  171. package/node_modules/@undefineds.co/ai-connections/dist/service-access.js +2 -27
  172. package/node_modules/@undefineds.co/ai-connections/package.json +1 -0
  173. package/node_modules/@undefineds.co/extension-sdk/dist/manifest.d.ts +1 -1
  174. package/node_modules/@undefineds.co/extension-sdk/dist/manifest.js +2 -0
  175. package/node_modules/@undefineds.co/extension-sdk/dist/web.d.ts +150 -0
  176. package/node_modules/@undefineds.co/extension-sdk/package.json +2 -1
  177. package/node_modules/@undefineds.co/models/README.md +1 -1
  178. package/node_modules/@undefineds.co/models/dist/ai-config/index.d.ts +3 -3
  179. package/node_modules/@undefineds.co/models/dist/ai-gateway.schema.d.ts +5 -0
  180. package/node_modules/@undefineds.co/models/dist/ai-gateway.schema.js +9 -0
  181. package/node_modules/@undefineds.co/models/dist/ai-runtime.repository.d.ts +1 -1
  182. package/node_modules/@undefineds.co/models/dist/approval.repository.d.ts +2 -2
  183. package/node_modules/@undefineds.co/models/dist/audit.presentation.d.ts +2 -2
  184. package/node_modules/@undefineds.co/models/dist/capture.repository.d.ts +1 -1
  185. package/node_modules/@undefineds.co/models/dist/chat-project.repository.d.ts +1 -1
  186. package/node_modules/@undefineds.co/models/dist/chat.repository.d.ts +2 -2
  187. package/node_modules/@undefineds.co/models/dist/control-request.repository.d.ts +2 -2
  188. package/node_modules/@undefineds.co/models/dist/conversation-share.repository.d.ts +1 -1
  189. package/node_modules/@undefineds.co/models/dist/credential.schema.d.ts +12 -0
  190. package/node_modules/@undefineds.co/models/dist/credential.schema.js +15 -1
  191. package/node_modules/@undefineds.co/models/dist/discovery/index.d.ts +2 -2
  192. package/node_modules/@undefineds.co/models/dist/discovery/providers.json +248 -7
  193. package/node_modules/@undefineds.co/models/dist/discovery/types.d.ts +31 -0
  194. package/node_modules/@undefineds.co/models/dist/extension/index.d.ts +1 -1
  195. package/node_modules/@undefineds.co/models/dist/favorite/index.d.ts +2 -2
  196. package/node_modules/@undefineds.co/models/dist/fixtures/contracts-chat-contact.d.ts +5 -5
  197. package/node_modules/@undefineds.co/models/dist/import/index.d.ts +1 -1
  198. package/node_modules/@undefineds.co/models/dist/index.d.ts +73 -73
  199. package/node_modules/@undefineds.co/models/dist/index.js +1 -1
  200. package/node_modules/@undefineds.co/models/dist/input-request.repository.d.ts +2 -2
  201. package/node_modules/@undefineds.co/models/dist/knowledge/index.d.ts +1 -1
  202. package/node_modules/@undefineds.co/models/dist/message.repository.d.ts +1 -1
  203. package/node_modules/@undefineds.co/models/dist/namespaces.js +5 -0
  204. package/node_modules/@undefineds.co/models/dist/pod-storage-descriptor.d.ts +4815 -26
  205. package/node_modules/@undefineds.co/models/dist/pod-storage-descriptor.js +482 -132
  206. package/node_modules/@undefineds.co/models/dist/schema.d.ts +4 -0
  207. package/node_modules/@undefineds.co/models/dist/session/index.d.ts +1 -1
  208. package/node_modules/@undefineds.co/models/dist/settings/index.d.ts +1 -1
  209. package/node_modules/@undefineds.co/models/dist/sidecar/persistence-mapping.d.ts +5 -5
  210. package/node_modules/@undefineds.co/models/dist/thread.repository.d.ts +2 -2
  211. package/node_modules/@undefineds.co/models/dist/types/message-block.d.ts +1 -1
  212. package/node_modules/@undefineds.co/models/dist/vocab/_namespaces.d.ts +1 -1
  213. package/node_modules/@undefineds.co/models/dist/vocab/index.d.ts +10 -10
  214. package/node_modules/@undefineds.co/models/dist/vocab/sidecar.vocab.d.ts +1 -0
  215. package/node_modules/@undefineds.co/models/dist/vocab/sidecar.vocab.js +1 -0
  216. package/node_modules/@undefineds.co/models/package.json +4 -2
  217. package/node_modules/@undefineds.co/pod-collections/README.md +71 -0
  218. package/node_modules/@undefineds.co/pod-collections/dist/diff.d.ts +85 -0
  219. package/node_modules/@undefineds.co/pod-collections/dist/diff.js +166 -0
  220. package/node_modules/@undefineds.co/pod-collections/dist/feed.d.ts +17 -0
  221. package/node_modules/@undefineds.co/pod-collections/dist/feed.js +27 -0
  222. package/node_modules/@undefineds.co/pod-collections/dist/index.cjs +1042 -0
  223. package/node_modules/@undefineds.co/pod-collections/dist/index.d.ts +37 -0
  224. package/node_modules/@undefineds.co/pod-collections/dist/index.js +89 -0
  225. package/node_modules/@undefineds.co/pod-collections/dist/layout.d.ts +75 -0
  226. package/node_modules/@undefineds.co/pod-collections/dist/layout.js +173 -0
  227. package/node_modules/@undefineds.co/pod-collections/dist/mapping.d.ts +78 -0
  228. package/node_modules/@undefineds.co/pod-collections/dist/mapping.js +287 -0
  229. package/node_modules/@undefineds.co/pod-collections/dist/mutations.d.ts +83 -0
  230. package/node_modules/@undefineds.co/pod-collections/dist/mutations.js +273 -0
  231. package/node_modules/@undefineds.co/pod-collections/dist/react.d.ts +21 -0
  232. package/node_modules/@undefineds.co/pod-collections/dist/react.js +22 -0
  233. package/node_modules/@undefineds.co/pod-collections/dist/read.d.ts +65 -0
  234. package/node_modules/@undefineds.co/pod-collections/dist/read.js +31 -0
  235. package/node_modules/@undefineds.co/pod-collections/dist/sync.d.ts +66 -0
  236. package/node_modules/@undefineds.co/pod-collections/dist/sync.js +260 -0
  237. package/node_modules/@undefineds.co/pod-collections/dist/types.d.ts +155 -0
  238. package/node_modules/@undefineds.co/pod-collections/dist/types.js +9 -0
  239. package/node_modules/@undefineds.co/pod-collections/package.json +42 -0
  240. package/node_modules/@undefineds.co/shared-ui/dist/index.d.ts +0 -1
  241. package/node_modules/@undefineds.co/shared-ui/dist/index.js +0 -1
  242. package/package.json +15 -7
  243. package/static/app/assets/main.css +1 -1
  244. package/static/app/assets/main.js +12 -13
  245. package/static/auth-callback/assets/AiConfigContext-DnQs1ZpW.js +1 -0
  246. package/static/auth-callback/assets/AiConfigPage-DOtvlxH0.js +1 -0
  247. package/static/auth-callback/assets/DocumentProcessingPanel-BS2voQgL.js +1 -0
  248. package/static/auth-callback/assets/IndexLifecyclePanel-Cvt0cJtN.js +1 -0
  249. package/static/auth-callback/assets/{IndexSubjectPanel-C4YG0whI.js → IndexSubjectPanel-Dhf01GqF.js} +1 -1
  250. package/static/auth-callback/assets/ModelAssignmentsPanel-BJutWaAF.js +1 -0
  251. package/static/auth-callback/assets/ModelsPage-BRS0sje3.js +11 -0
  252. package/static/auth-callback/assets/{NetworkPage-Cbdn_P1e.js → NetworkPage-B3qBfANA.js} +2 -2
  253. package/static/auth-callback/assets/{PaneListHeader-jy70Q00L.js → PaneListHeader-QQeJGTp4.js} +1 -1
  254. package/static/auth-callback/assets/SearchIndexingPanel-MyNUSEwT.js +1 -0
  255. package/static/auth-callback/assets/{StatusSubjectPanel-hfjoB5aS.js → StatusSubjectPanel-DQkEVsFs.js} +1 -1
  256. package/static/{settings/assets/StatusWorkspace-CKD_Rzdr.js → auth-callback/assets/StatusWorkspace-Dkv63Uwk.js} +1 -1
  257. package/static/auth-callback/assets/SystemSettingsPage-TIsUfX5d.js +1 -0
  258. package/static/auth-callback/assets/SystemSettingsSubjectPanel-BJWEt2-7.js +33 -0
  259. package/static/auth-callback/assets/XpodAiConnectionsPodStore-BJiXm-PF.js +3 -0
  260. package/static/auth-callback/assets/{activity-BcsZZxxw.js → activity-5hNeNKnL.js} +1 -1
  261. package/static/auth-callback/assets/admin-C6qCRFiY.js +1 -0
  262. package/static/auth-callback/assets/ai-connections-CryuHGKW.js +1 -0
  263. package/static/auth-callback/assets/{auth-callback-atKg_oig.js → auth-callback-CAFZ3R0B.js} +80 -84
  264. package/static/auth-callback/assets/auth-callback-rk080mvG.css +1 -0
  265. package/static/auth-callback/assets/{badge-BWbRHThQ.js → badge-CAIPI0CB.js} +1 -1
  266. package/static/auth-callback/assets/collection-runtime-D9s7h9YA.js +1 -0
  267. package/static/auth-callback/assets/dialog-BjA109aX.js +1 -0
  268. package/static/auth-callback/assets/{download-BmvG1Vya.js → download-B3Up5W2G.js} +1 -1
  269. package/static/auth-callback/assets/{external-link-DZ34d3g3.js → external-link-BTXgSPzB.js} +1 -1
  270. package/static/auth-callback/assets/index-BppXlxcp.js +41 -0
  271. package/static/auth-callback/assets/index-CirW4CJf.js +1 -0
  272. package/static/auth-callback/assets/index-DlLYWOhw.js +4 -0
  273. package/static/auth-callback/assets/{index-browser-B9Z7GU-T.js → index-browser-DtU38ni3.js} +1 -1
  274. package/static/auth-callback/assets/{key-round-tjP76Se-.js → key-round-CQCOrZ7x.js} +1 -1
  275. package/static/auth-callback/assets/layout-DB3pMyTl.js +1 -0
  276. package/static/auth-callback/assets/pod-collections-host-KnnGFZHL.js +8 -0
  277. package/static/auth-callback/assets/{rotate-ccw-C_L5ZLx1.js → rotate-ccw-C1zM2KtS.js} +1 -1
  278. package/static/auth-callback/assets/settings-projection-CUkyprDQ.js +1 -0
  279. package/static/auth-callback/assets/{skeleton-C7tGDQIs.js → skeleton-Cqp7_M9-.js} +1 -1
  280. package/static/auth-callback/assets/{waypoints-VMNQlWdU.js → waypoints-Bj6gAUSQ.js} +1 -1
  281. package/static/auth-callback/assets/{workspace-layout-SAp6BtYK.js → workspace-layout-DK8mDzrY.js} +1 -1
  282. package/static/auth-callback/auth-callback.html +2 -2
  283. package/static/dashboard/assets/AiConfigContext-BsE7MqX8.js +1 -0
  284. package/static/dashboard/assets/AiConfigPage-DvM-lRXa.js +1 -0
  285. package/static/dashboard/assets/DocumentProcessingPanel-BPfdlfuf.js +1 -0
  286. package/static/dashboard/assets/IndexLifecyclePanel--m0AGxvh.js +1 -0
  287. package/static/dashboard/assets/{IndexSubjectPanel-DQFPP6-p.js → IndexSubjectPanel-Bb7m1k3d.js} +1 -1
  288. package/static/dashboard/assets/ModelAssignmentsPanel-BLi_zbMa.js +1 -0
  289. package/static/dashboard/assets/ModelsPage-CxdpgnfR.js +11 -0
  290. package/static/dashboard/assets/{NetworkPage-CHQ3YxIB.js → NetworkPage-BAIPw-D_.js} +2 -2
  291. package/static/dashboard/assets/{PaneListHeader-DsXemAdR.js → PaneListHeader-BBCMei0r.js} +1 -1
  292. package/static/dashboard/assets/SearchIndexingPanel-Ck4Y-xjR.js +1 -0
  293. package/static/dashboard/assets/{StatusSubjectPanel-D3PGEYT4.js → StatusSubjectPanel-D1KWfAXE.js} +1 -1
  294. package/static/dashboard/assets/{StatusWorkspace-BcpePYUW.js → StatusWorkspace-JbA5gzXx.js} +1 -1
  295. package/static/dashboard/assets/SystemSettingsPage-BbwQWsSR.js +1 -0
  296. package/static/dashboard/assets/SystemSettingsSubjectPanel-N117nMt5.js +33 -0
  297. package/static/dashboard/assets/XpodAiConnectionsPodStore-CdDOb4SV.js +18 -0
  298. package/static/dashboard/assets/{activity-j5zrznu-.js → activity-DX1I96o_.js} +1 -1
  299. package/static/dashboard/assets/admin-C6qCRFiY.js +1 -0
  300. package/static/dashboard/assets/ai-connections-DwCRqOQa.js +1 -0
  301. package/static/dashboard/assets/{badge-CzeBdG7h.js → badge-k2vhtDqH.js} +1 -1
  302. package/static/dashboard/assets/collection-runtime-BFQ8teQJ.js +1 -0
  303. package/static/dashboard/assets/{dashboard-D-xANHk1.js → dashboard-DWZ-fmCT.js} +105 -109
  304. package/static/dashboard/assets/dashboard-rk080mvG.css +1 -0
  305. package/static/dashboard/assets/dialog-1CCw-iHT.js +1 -0
  306. package/static/dashboard/assets/{download-IcNdEZWi.js → download-C6-SNY1q.js} +1 -1
  307. package/static/dashboard/assets/{external-link-DxBxK8Vu.js → external-link-BgPcZ_j2.js} +1 -1
  308. package/static/dashboard/assets/index-6LcIUIYO.js +1 -0
  309. package/static/dashboard/assets/index-D7A8U6Pt.js +41 -0
  310. package/static/dashboard/assets/index-UD6QOE7H.js +4 -0
  311. package/static/dashboard/assets/{key-round-D1K7warM.js → key-round-BOd7Jo0Q.js} +1 -1
  312. package/static/dashboard/assets/layout-DB3pMyTl.js +1 -0
  313. package/static/dashboard/assets/pod-collections-host-KnnGFZHL.js +8 -0
  314. package/static/dashboard/assets/{rotate-ccw-CcN1N6p9.js → rotate-ccw-CCgJqsvx.js} +1 -1
  315. package/static/dashboard/assets/settings-projection-CUkyprDQ.js +1 -0
  316. package/static/dashboard/assets/{skeleton-CKnmJMUH.js → skeleton-Bc7abAn5.js} +1 -1
  317. package/static/dashboard/assets/{waypoints-DuZPO_wu.js → waypoints-s-opmJxx.js} +1 -1
  318. package/static/dashboard/assets/{workspace-layout-BUj3wZ_m.js → workspace-layout-DqIQeTBV.js} +1 -1
  319. package/static/dashboard/dashboard.html +2 -2
  320. package/static/settings/assets/AiConfigContext-BB9KZySa.js +1 -0
  321. package/static/settings/assets/AiConfigPage-DGSXUkLs.js +1 -0
  322. package/static/settings/assets/DocumentProcessingPanel-Da2Re6Rg.js +1 -0
  323. package/static/settings/assets/IndexLifecyclePanel-BSZuIzgr.js +1 -0
  324. package/static/settings/assets/{IndexSubjectPanel-73sM16Ma.js → IndexSubjectPanel-CFd0ay-r.js} +1 -1
  325. package/static/settings/assets/ModelAssignmentsPanel-CSAryvWJ.js +1 -0
  326. package/static/settings/assets/ModelsPage-BQwCwLHU.js +11 -0
  327. package/static/settings/assets/{NetworkPage-i6j-M2RY.js → NetworkPage-BKymvsQc.js} +2 -2
  328. package/static/settings/assets/{PaneListHeader-DpqC0jd5.js → PaneListHeader-Bjh3hRdQ.js} +1 -1
  329. package/static/settings/assets/SearchIndexingPanel-MjKL5QLU.js +1 -0
  330. package/static/settings/assets/{StatusSubjectPanel-Dv4q3PGh.js → StatusSubjectPanel-Bvl6K4mx.js} +1 -1
  331. package/static/settings/assets/StatusWorkspace-B0NzrP--.js +1 -0
  332. package/static/settings/assets/SystemSettingsPage-D2z6Z4FE.js +1 -0
  333. package/static/settings/assets/SystemSettingsSubjectPanel-4sxma4X4.js +33 -0
  334. package/static/settings/assets/XpodAiConnectionsPodStore-BkNQ8fZx.js +3 -0
  335. package/static/settings/assets/{activity-DaFkk8f3.js → activity-CgJJGpjx.js} +1 -1
  336. package/static/settings/assets/admin-C6qCRFiY.js +1 -0
  337. package/static/settings/assets/ai-connections-CryuHGKW.js +1 -0
  338. package/static/settings/assets/{badge-d5SHdc-x.js → badge-C4NypVyT.js} +1 -1
  339. package/static/settings/assets/collection-runtime-CTLCDxAi.js +1 -0
  340. package/static/settings/assets/dialog-Csq0vWUi.js +1 -0
  341. package/static/settings/assets/{download-CpkwomDr.js → download-DaLJJ-Wp.js} +1 -1
  342. package/static/settings/assets/{external-link-_4YT42Mf.js → external-link--w_iW5Au.js} +1 -1
  343. package/static/settings/assets/index-B0mQa59b.js +4 -0
  344. package/static/settings/assets/index-BukHiu4y.js +1 -0
  345. package/static/settings/assets/index-COmVnZi2.js +41 -0
  346. package/static/settings/assets/{index-browser-B06xjBdZ.js → index-browser-BGpvHwD0.js} +1 -1
  347. package/static/settings/assets/{key-round-Dlqmp1Kq.js → key-round-Bk4YRjBu.js} +1 -1
  348. package/static/settings/assets/layout-DB3pMyTl.js +1 -0
  349. package/static/settings/assets/pod-collections-host-KnnGFZHL.js +8 -0
  350. package/static/settings/assets/{rotate-ccw-TAY65xWT.js → rotate-ccw-TCabbqsr.js} +1 -1
  351. package/static/settings/assets/{settings-ExBXGgbj.js → settings-CJWpdbNC.js} +105 -109
  352. package/static/settings/assets/settings-projection-CUkyprDQ.js +1 -0
  353. package/static/settings/assets/settings-rk080mvG.css +1 -0
  354. package/static/settings/assets/{skeleton-DKIWjNr9.js → skeleton-JDHYVe7t.js} +1 -1
  355. package/static/settings/assets/{waypoints-9erLIxyR.js → waypoints-DDvEl-MU.js} +1 -1
  356. package/static/settings/assets/{workspace-layout-CYXfYIa3.js → workspace-layout-DV5QU30U.js} +1 -1
  357. package/static/settings/settings.html +2 -2
  358. package/node_modules/@undefineds.co/shared-ui/dist/oidc-consent.d.ts +0 -54
  359. package/node_modules/@undefineds.co/shared-ui/dist/oidc-consent.js +0 -21
  360. package/static/auth-callback/assets/AiConfigContext-C81deMM9.js +0 -1
  361. package/static/auth-callback/assets/AiConfigPage-evWI8T56.js +0 -1
  362. package/static/auth-callback/assets/DocumentProcessingPanel-B9GrDEMe.js +0 -1
  363. package/static/auth-callback/assets/IndexLifecyclePanel-qCo8ABQZ.js +0 -1
  364. package/static/auth-callback/assets/ModelAssignmentsPanel-DG7Lxh3t.js +0 -1
  365. package/static/auth-callback/assets/ModelsPage-CgEuqE6p.js +0 -10
  366. package/static/auth-callback/assets/SearchIndexingPanel-ByU3u7kp.js +0 -1
  367. package/static/auth-callback/assets/StatusWorkspace-BZd617sV.js +0 -1
  368. package/static/auth-callback/assets/SystemSettingsPage-BirzWAQM.js +0 -1
  369. package/static/auth-callback/assets/SystemSettingsSubjectPanel-CmsVWNCx.js +0 -31
  370. package/static/auth-callback/assets/admin-BU4m6Ko2.js +0 -1
  371. package/static/auth-callback/assets/ai-connections-CHNTKemd.js +0 -1
  372. package/static/auth-callback/assets/auth-callback-C_7MUXJb.css +0 -1
  373. package/static/auth-callback/assets/index-BpV1hsqs.js +0 -4
  374. package/static/auth-callback/assets/index-D9oE6FXK.js +0 -41
  375. package/static/dashboard/assets/AiConfigContext-De-OtAWo.js +0 -1
  376. package/static/dashboard/assets/AiConfigPage-macP4Mop.js +0 -1
  377. package/static/dashboard/assets/DocumentProcessingPanel-C5ObvCCl.js +0 -1
  378. package/static/dashboard/assets/IndexLifecyclePanel-xVNa2l40.js +0 -1
  379. package/static/dashboard/assets/ModelAssignmentsPanel-DMOATFpQ.js +0 -1
  380. package/static/dashboard/assets/ModelsPage-91UbnETA.js +0 -25
  381. package/static/dashboard/assets/SearchIndexingPanel-Dh70PNFZ.js +0 -1
  382. package/static/dashboard/assets/SystemSettingsPage-BiN5GcKx.js +0 -1
  383. package/static/dashboard/assets/SystemSettingsSubjectPanel-B9QrSiFp.js +0 -31
  384. package/static/dashboard/assets/admin-BU4m6Ko2.js +0 -1
  385. package/static/dashboard/assets/ai-connections-CHNTKemd.js +0 -1
  386. package/static/dashboard/assets/dashboard-C_7MUXJb.css +0 -1
  387. package/static/dashboard/assets/index-FWZ-s52O.js +0 -41
  388. package/static/dashboard/assets/index-ZiQZ96oC.js +0 -4
  389. package/static/settings/assets/AiConfigContext-C0cQMPfG.js +0 -1
  390. package/static/settings/assets/AiConfigPage-CPhB4iFb.js +0 -1
  391. package/static/settings/assets/DocumentProcessingPanel-sYI7OpuH.js +0 -1
  392. package/static/settings/assets/IndexLifecyclePanel-yj8iyiT8.js +0 -1
  393. package/static/settings/assets/ModelAssignmentsPanel-BFIgUX5v.js +0 -1
  394. package/static/settings/assets/ModelsPage-BdppXl7E.js +0 -10
  395. package/static/settings/assets/SearchIndexingPanel-BlPnrkT3.js +0 -1
  396. package/static/settings/assets/SystemSettingsPage-CiOm2NzV.js +0 -1
  397. package/static/settings/assets/SystemSettingsSubjectPanel-Cd-GECon.js +0 -31
  398. package/static/settings/assets/admin-BU4m6Ko2.js +0 -1
  399. package/static/settings/assets/ai-connections-CHNTKemd.js +0 -1
  400. package/static/settings/assets/index-BFi9yn7_.js +0 -41
  401. package/static/settings/assets/index-BGgEhIUy.js +0 -4
  402. package/static/settings/assets/settings-C_7MUXJb.css +0 -1
@@ -1 +0,0 @@
1
- import{r as g,j as n}from"./settings-ExBXGgbj.js";import{i as p,A as f}from"./ModelAssignmentsPanel-BFIgUX5v.js";import{u as k}from"./AiConfigContext-C0cQMPfG.js";import"./ai-connections-CHNTKemd.js";function I(){const{config:s,capabilities:d,save:o,rebuild:c,saveAndRebuild:i,saving:l,rebuilding:r}=k(),[e,a]=g.useState(s?.searchIndexing);if(g.useEffect(()=>{let t=!1;return queueMicrotask(()=>{t||a(s?.searchIndexing)}),()=>{t=!0}},[s]),!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,s?.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||r,dirty:m,footerActions:n.jsx("button",{type:"button",disabled:!b||l||r,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:r?"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:s,enabled:d,onEnabled:o,backend:c,onBackend:i,backends:l}){const r=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:[s,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:r.length===0,onChange:a=>i(a.target.checked?r[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:r.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(s){return s!=="auto"}export{I as SearchIndexingPanel,v as isManualBackendSelection};
@@ -1 +0,0 @@
1
- import{c as i,D as r,k as h,r as c,j as e,O as p,N as u,l as m,m as x}from"./settings-ExBXGgbj.js";import{K as y}from"./key-round-Dlqmp1Kq.js";import{b}from"./admin-BU4m6Ko2.js";import{P as g}from"./PaneListHeader-DpqC0jd5.js";import{T as f,u as k}from"./workspace-layout-CYXfYIa3.js";const v=[["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"}]],N=i("box",v);const j=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],S=i("cloud",j);const w=[["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"}]],M=i("server-cog",w);const L=[["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"}]],_=i("wrench",L),C=[{id:"pod",label:"Pod",path:"pod",description:"Current Pod identity and data boundary.",icon:N},{id:"identity-access",label:"Identity & Access",path:"identity-access",description:"Session, WebID, and account access.",icon:y},{id:"storage",label:"Storage",path:"storage",description:"Authority storage backend and limits.",icon:r},{id:"runtime",label:"Runtime",path:"runtime",description:"Low-frequency runtime configuration.",icon:M},{id:"cloud",label:"Cloud",path:"cloud",description:"Cloud coordination settings when supported.",icon:S},{id:"advanced",label:"Advanced",path:"advanced",description:"Expert and compatibility controls.",icon:_}];function z(){const d=h(),[n,t]=c.useState(!1);c.useEffect(()=>{let a=!1;return b().then(l=>{a||t(l?.env.XPOD_EDITION==="cloud")}),()=>{a=!0}},[]);const s=c.useMemo(()=>C.filter(a=>a.id!=="cloud"||n),[n]),o=s.find(a=>d.pathname.endsWith(`/${a.path}`))??s[0];return e.jsx(f,{mode:"auto",listHeader:e.jsx(g,{title:"Settings"}),list:e.jsx(I,{items:s}),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 · ",o.label]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:o.description})]})}),main:e.jsx("section",{className:"min-h-full bg-background",children:e.jsx(p,{})}),className:"min-h-full"})}function I({items:d}){const n=k();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:d.map(t=>{const s=t.icon;return e.jsxs(u,{to:t.path,"aria-label":t.label,onKeyDown:m,onClick:()=>n.openMain(),className:({isActive:o})=>x(o,{compact:!1}),children:[e.jsx(s,{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:t.label}),e.jsx("span",{className:"block text-xs leading-4 text-muted-foreground",children:t.description})]})]},t.id)})})})}export{z as default};
@@ -1,31 +0,0 @@
1
- import{u as T,r as i,j as r,B as h,R as F,C as W,a as G,b as X,d as B,e as M}from"./settings-ExBXGgbj.js";import{b as H,c as $,t as Q,u as z}from"./admin-BU4m6Ko2.js";import{c as N}from"./ai-connections-CHNTKemd.js";import{R as K}from"./rotate-ccw-TAY65xWT.js";import{S as A}from"./skeleton-DKIWjNr9.js";import{E as V}from"./external-link-_4YT42Mf.js";const E="co.undefineds.ai-connections",q={providerCredentials:"settings/credentials.ttl",providerDefinitions:"settings/providers/__service_access__.ttl",gatewayAccessKeys:".data/ai/gateway/access-keys.ttl",quotaSnapshots:".data/ai/gateway/quota.ttl"},Y=["openai","openai-official-subscription","openai-api-platform","anthropic","anthropic-official-subscription","anthropic-api-platform","kimi","kimi-subscription-key","kimi-api-platform","bailian","bailian-pay-as-you-go","bailian-token-plan","bailian-token-plan-team","bailian-coding-plan","deepseek","deepseek-api-platform","zhipu","zhipu-api-platform","zhipu-coding-plan","ollama","ollama-local","custom","custom-openai-compatible","custom-anthropic-compatible"],J=new Set(Y);function R(e,t){if(!w(e))throw new Error("invalid_descriptor");if(e.appletId!==E)throw new Error("invalid_applet_id");const a=e.service;if(!w(a)||typeof a.webId!="string"||typeof a.label!="string"||!oe(a.webId))throw new Error("invalid_service");if(!Array.isArray(e.resources)||e.resources.length===0)throw new Error("invalid_empty_resources");const s=se(t),n=new Set,o=e.resources.map(c=>Z(c,s,n));return{appletId:E,service:{webId:a.webId,label:a.label},resources:o}}function Z(e,t,a){if(!w(e)||typeof e.id!="string"||typeof e.url!="string"||e.mediaType!=="text/turtle"||!w(e.access))throw new Error("invalid_resource");const s=ee(e.id,t);if(!s||a.has(e.id))throw new Error("invalid_resource");te(e.url);let n;try{n=new URL(e.url)}catch{throw new Error("invalid_resource")}if(!ne(n,t))throw new Error("invalid_resource");if(n.href!==s)throw new Error("invalid_resource");return a.add(e.id),{id:e.id,url:n.href,mediaType:"text/turtle",access:ae(e.access)}}function ee(e,t){const a=q[e];if(a)return new URL(a,t).href;const s=e.startsWith("providerDocument:")?e.slice(17):void 0;if(s&&J.has(s))return new URL(`settings/providers/${s}.ttl`,t).href}function te(e){if(/%(?![0-9a-fA-F]{2})/.test(e)||/%(?:2f|5c)/i.test(e)||e.includes("\\"))throw new Error("invalid_resource");const t=re(e);if(j(t))throw new Error("invalid_resource");try{const a=decodeURIComponent(t);if(a.includes("\\")||j(a))throw new Error("invalid_resource")}catch{throw new Error("invalid_resource")}}function re(e){const t=e.split("#",1)[0]??e;return(t.split("?",1)[0]??t).replace(/^[a-z][a-z0-9+.-]*:\/\/[^/\\?#]*/i,"")}function j(e){return e.split("/").some(t=>t==="."||t==="..")}function ae(e){if(Object.keys(e).some(a=>a!=="read"&&a!=="append"&&a!=="write")||e.read!==!0||e.append!==!0||e.write!==!0)throw new Error("invalid_resource");return{read:!0,append:!0,write:!0}}function se(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 ne(e,t){return(e.protocol==="http:"||e.protocol==="https:")&&e.origin===t.origin&&e.pathname.startsWith(t.pathname)}function oe(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function w(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ie(e,t={}){return[{label:"Files",value:e.CSS_ROOT_FILE_PATH||"Runtime default",detail:"Authority file storage root"},{label:"Object storage",value:e.MINIO_ENDPOINT||e.XPOD_STORAGE_S3_ENDPOINT?"Configured":"Not configured",detail:e.MINIO_ENDPOINT||e.XPOD_STORAGE_S3_ENDPOINT||"Filesystem fallback"},{label:"Identity database",value:v(e,t,"CSS_IDENTITY_DB_URL"),detail:ce(e.CSS_IDENTITY_DB_URL)},{label:"Cache / coordination",value:v(e,t,"REDIS_URL"),detail:e.REDIS_URL?"Redis":"Runtime fallback"},{label:"RDF / Quadstore",value:v(e,t,"CSS_SPARQL_ENDPOINT"),detail:e.CSS_SPARQL_ENDPOINT?"PostgreSQL RDF":"Local Quadstore"}]}function v(e,t,a){return e[a]||t[a]?.configured?"Configured":"Runtime default"}function ce(e){return e?.startsWith("postgres")?"PostgreSQL":e?"SQLite / configured database":"SQLite default"}const le="http://www.w3.org/ns/solid/acp#",de="http://www.w3.org/ns/auth/acl#";function O(e,{ownerWebId:t,serviceWebId:a},s=!0){const n=s?`
2
- <#serviceAccess>
3
- a acp:AccessControl;
4
- acp:apply [
5
- a acp:Policy;
6
- acp:allow acl:Read, acl:Write;
7
- acp:anyOf [
8
- a acp:Matcher;
9
- acp:agent <${a}>
10
- ]
11
- ].
12
- `:"",o=s?"<#ownerAccess>, <#serviceAccess>":"<#ownerAccess>";return`@prefix acl: <${de}>.
13
- @prefix acp: <${le}>.
14
-
15
- <#managed>
16
- a acp:AccessControlResource;
17
- acp:resource <${e}>;
18
- acp:accessControl ${o};
19
- acp:memberAccessControl ${o}.
20
-
21
- <#ownerAccess>
22
- a acp:AccessControl;
23
- acp:apply [
24
- a acp:Policy;
25
- acp:allow acl:Read, acl:Write, acl:Control;
26
- acp:anyOf [
27
- a acp:Matcher;
28
- acp:agent <${t}>
29
- ]
30
- ].
31
- ${n}`}function ue(e){const t=new URL(e);return t.pathname.endsWith("/")||(t.pathname=t.pathname.slice(0,t.pathname.lastIndexOf("/")+1)),t.toString()}function C(e){return new URL(".acr",e).toString()}function I(e){return[...new Set(e.resources.map(t=>ue(t.url)))]}async function D(e,t,a){const s=await e(t,{method:"PUT",headers:{"content-type":"text/turtle"},body:a});if(!s.ok)throw await s.arrayBuffer().catch(()=>{}),new Error(`service_acr_write_failed:${s.status}`)}function m(e,t,a){return{status:t?"granted":"missing",resources:e.resources}}function P(e){const t=()=>{if(!e.ownerWebId)throw new Error("service_acr_owner_missing");return e.ownerWebId};return{async ensureAgentAccess(a){const s=t();for(const n of I(a))await D(e.authenticatedFetch,C(n),O(n,{ownerWebId:s,serviceWebId:a.service.webId}));return{status:"granted",resources:a.resources}},async inspectAgentAccess(a){try{for(const s of I(a)){const n=await e.authenticatedFetch(C(s),{headers:{accept:"text/turtle"}});if(!n.ok)return await n.arrayBuffer().catch(()=>{}),m(a,!1);const o=await n.text();if(!o.includes(`<${a.service.webId}>`)||!o.includes("acp:AccessControlResource"))return m(a,!1)}return m(a,!0)}catch{return m(a,!1)}},async revokeAgentAccess(a){const s=t();for(const n of I(a))await D(e.authenticatedFetch,C(n),O(n,{ownerWebId:s,serviceWebId:a.service.webId},!1));return{status:"missing",resources:a.resources}}}}function Ne({kind:e}){const t=T(),[a,s]=i.useState(null),[n,o]=i.useState(null),[c,d]=i.useState(!0),[l,p]=i.useState(""),[S,_]=i.useState(""),x=i.useCallback(async()=>{d(!0),p("");try{const[u,f]=await Promise.all([H(),$()]);if(!u||!f)throw new Error("unavailable");s(u),o(f)}catch{p("Settings evidence could not be loaded.")}finally{d(!1)}},[]);i.useEffect(()=>{let u=!1;return queueMicrotask(()=>{u||x()}),()=>{u=!0}},[x]);const U=async u=>{if(p(""),!await z(u)){p("Configuration could not be saved.");return}o(f=>f&&{...f,env:{...f.env,...u}}),_("Saved · restart required")},L=we[e];return r.jsxs("div",{className:"space-y-4 p-6",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(h,{type:"button",size:"sm",variant:"outline",onClick:x,disabled:c,children:[r.jsx(F,{className:"mr-2 h-4 w-4"}),"Refresh"]})}),l?r.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:l}):null,S?r.jsxs("div",{role:"status",className:"flex flex-wrap items-center justify-between gap-3 rounded-md border border-amber-300 bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-200",children:[r.jsx("span",{children:S}),r.jsxs(h,{type:"button",size:"sm",variant:"outline",onClick:()=>{Q()},children:[r.jsx(K,{className:"mr-2 h-4 w-4"}),"Restart Xpod"]})]}):null,r.jsxs(W,{children:[r.jsxs(G,{children:[r.jsx(X,{children:L}),r.jsx(B,{children:Se[e]})]}),r.jsx(M,{className:"space-y-4",children:c&&!n?r.jsx("div",{role:"status","aria-label":"Loading settings",className:"grid gap-3 sm:grid-cols-2","aria-live":"polite",children:[0,1,2,3].map(u=>r.jsxs("div",{className:"rounded-lg border border-border p-3","aria-hidden":"true",children:[r.jsx(A,{className:"h-3 w-24"}),r.jsx(A,{className:"mt-2 h-5 w-36"})]},u))}):r.jsx(pe,{kind:e,runtime:t,admin:a,configuration:n,save:U})})]})]})}function pe({kind:e,runtime:t,admin:a,configuration:s,save:n}){const o=s?.env??{};return e==="pod"?r.jsxs(r.Fragment,{children:[r.jsx(b,{rows:[{label:"Pod name",value:k(t.podUrl)},{label:"Pod URL",value:t.podUrl??"Not discovered"},{label:"Storage provider",value:me(o)},{label:"Created",value:"Not reported by this runtime"}]}),r.jsxs(h,{type:"button",variant:"outline",disabled:!t.podUrl,onClick:()=>t.podUrl&&window.open(t.podUrl,"_blank","noopener,noreferrer"),children:[r.jsx(V,{className:"mr-2 h-4 w-4"}),"Open Pod"]})]}):e==="identity-access"?r.jsx(fe,{runtime:t}):e==="storage"?r.jsxs(r.Fragment,{children:[r.jsx(b,{rows:ie(o,s?.secrets)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Measured storage and bandwidth are intentionally shown in Status → Usage, not here. Storage migration is unavailable because this runtime does not report a migration capability."})]}):e==="runtime"?r.jsx(he,{env:o,admin:a,save:n}):e==="cloud"?r.jsx(be,{env:o,save:n}):r.jsx(ge,{env:o,save:n})}function fe({runtime:e}){const[t,a]=i.useState("checking"),[s,n]=i.useState(!1),o=i.useCallback(async()=>{if(!e.webId||!e.podUrl||e.state.status!=="authenticated"){a("unavailable");return}a("checking");try{const l=N({webId:e.webId,podUrl:e.podUrl,authenticatedFetch:e.fetch}),p=R(await l.getServiceAccess(),e.podUrl),_=await P({authenticatedFetch:e.fetch,ownerWebId:e.webId}).inspectAgentAccess(p);a(_.status==="granted"?"granted":"missing")}catch{a("error")}},[e.fetch,e.podUrl,e.state.status,e.webId]);i.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||o()}),()=>{l=!0}},[o]);const c=async()=>{if(!(!e.webId||!e.podUrl||!window.confirm("Revoke AI Gateway service access to Xpod settings resources? Provider credentials remain stored but the service can no longer use them."))){n(!0);try{const l=N({webId:e.webId,podUrl:e.podUrl,authenticatedFetch:e.fetch}),p=R(await l.getServiceAccess(),e.podUrl);await P({authenticatedFetch:e.fetch,ownerWebId:e.webId}).revokeAgentAccess(p),a("missing")}catch{a("error")}finally{n(!1)}}},d=t==="granted"?"Granted":t==="missing"?"Not granted":t==="checking"?"Checking…":t==="unavailable"?"Unavailable while signed out":"Could not inspect";return r.jsxs(r.Fragment,{children:[r.jsx(b,{rows:[{label:"WebID",value:e.webId??"Signed out"},{label:"OIDC issuer",value:e.issuer??"Not reported"},{label:"Current account",value:e.webId?k(e.webId):"Signed out"},{label:"Session",value:e.state.status},{label:"ACP / ACR",value:t==="error"?"Capability unavailable or permission denied":"Managed ACR capability available"},{label:"AI Gateway service access",value:d,detail:"Inspected from the managed ACRs for declared settings resources"}]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(h,{type:"button",variant:"outline",onClick:()=>{o()},disabled:t==="checking",children:"Recheck access"}),r.jsx(h,{type:"button",variant:"destructive",onClick:()=>{c()},disabled:t!=="granted"||s,children:s?"Revoking…":"Revoke service access"})]})]})}function he({env:e,admin:t,save:a}){const[s,n]=i.useState(e.CSS_BASE_URL??""),[o,c]=i.useState(e.CSS_ROOT_FILE_PATH??"");return i.useEffect(()=>{let d=!1;return queueMicrotask(()=>{d||(n(e.CSS_BASE_URL??""),c(e.CSS_ROOT_FILE_PATH??""))}),()=>{d=!0}},[e]),r.jsxs("div",{className:"space-y-4",children:[r.jsx(b,{rows:[{label:"Edition",value:t?.env.XPOD_EDITION??e.XPOD_EDITION??"local"},{label:"Configuration source",value:".env.local / runtime bootstrap"},{label:"Service startup",value:"Gateway supervises Solid Server and API Server"},{label:"Automatic restart",value:"Enabled for managed child services"}]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsx(g,{label:"Base URL",value:s,onChange:n}),r.jsx(g,{label:"Data directory",value:o,onChange:c})]}),r.jsx(y,{onClick:()=>a({CSS_BASE_URL:s,CSS_ROOT_FILE_PATH:o})})]})}function be({env:e,save:t}){const[a,s]=i.useState(e.XPOD_CLOUD_API_ENDPOINT??""),[n,o]=i.useState(e.XPOD_NODE_ID??""),[c,d]=i.useState(e.XPOD_SP_DOMAIN??"");return i.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||(s(e.XPOD_CLOUD_API_ENDPOINT??""),o(e.XPOD_NODE_ID??""),d(e.XPOD_SP_DOMAIN??""))}),()=>{l=!0}},[e]),r.jsxs("div",{className:"space-y-4",children:[r.jsx(b,{rows:[{label:"Node registration",value:n||"Not registered"},{label:"Heartbeat",value:a?"Runtime managed":"Not configured"},{label:"Cluster coordination",value:a?"Configured":"Unavailable"}]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsx(g,{label:"Cloud endpoint",value:a,onChange:s}),r.jsx(g,{label:"Node ID",value:n,onChange:o}),r.jsx(g,{label:"Service-provider domain",value:c,onChange:d})]}),r.jsx(y,{onClick:()=>t({XPOD_CLOUD_API_ENDPOINT:a,XPOD_NODE_ID:n,XPOD_SP_DOMAIN:c})})]})}function ge({env:e,save:t}){const[a,s]=i.useState(e.CSS_LOGGING_LEVEL??"info"),[n,o]=i.useState(e.CSS_SHOW_STACK_TRACE==="true");return i.useEffect(()=>{let c=!1;return queueMicrotask(()=>{c||(s(e.CSS_LOGGING_LEVEL??"info"),o(e.CSS_SHOW_STACK_TRACE==="true"))}),()=>{c=!0}},[e]),r.jsxs("div",{className:"space-y-4",children:[r.jsx(b,{rows:[{label:"Log retention",value:"30 days",detail:"Runtime logging profile"},{label:"Configuration provenance",value:".env.local allowlist"},{label:"Restart requirement",value:"Required after save"}]}),r.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Logging level",r.jsxs("select",{value:a,onChange:c=>s(c.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-xs",children:[r.jsx("option",{children:"debug"}),r.jsx("option",{children:"info"}),r.jsx("option",{children:"warn"}),r.jsx("option",{children:"error"})]})]}),r.jsxs("label",{className:"flex items-center justify-between gap-3 rounded-md border border-border p-3 text-sm font-medium",children:["Show stack traces",r.jsx("input",{type:"checkbox",checked:n,onChange:c=>o(c.target.checked)})]}),r.jsx(y,{onClick:()=>t({CSS_LOGGING_LEVEL:a,CSS_SHOW_STACK_TRACE:String(n)})})]})}function b({rows:e}){return r.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:e.map(t=>r.jsxs("div",{className:"rounded-lg border border-border p-3",children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:t.label}),r.jsx("div",{className:"mt-1 break-all text-sm font-medium",children:t.value}),t.detail?r.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.detail}):null]},t.label))})}function g({label:e,value:t,onChange:a}){return r.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[e,r.jsx("input",{value:t,onChange:s=>a(s.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3"})]})}function y({onClick:e}){return r.jsx("div",{className:"flex justify-end",children:r.jsx(h,{type:"button",onClick:e,children:"Save configuration"})})}function k(e){if(!e)return"Not discovered";try{return new URL(e).pathname.split("/").filter(Boolean).at(-1)||new URL(e).hostname}catch{return e}}function me(e){return e.MINIO_ENDPOINT||e.XPOD_STORAGE_S3_ENDPOINT?"Object storage":e.CSS_ROOT_FILE_PATH?"Filesystem":"Runtime default"}const we={pod:"Pod","identity-access":"Identity & Access",storage:"Storage",runtime:"Runtime",cloud:"Cloud",advanced:"Advanced"},Se={pod:"Current Pod identity and authority boundary.","identity-access":"Session, account, and app/service access.",storage:"Authority storage backends and health configuration.",runtime:"Edition, startup, paths, and restart behavior.",cloud:"Node registration and cluster coordination.",advanced:"Bounded logging and runtime compatibility controls."};export{Ne as PodSettingsSubjectPanel};
@@ -1 +0,0 @@
1
- const n="/api/admin";async function i(t={}){try{const e=await fetch(`${n}/status`,{signal:t.signal});if(e.ok)return await e.json()}catch(e){console.error("Failed to get admin status:",e)}return null}async function l(t={}){try{const e=await fetch(`${n}/config`,{signal:t.signal});if(e.ok)return await e.json()}catch(e){console.error("Failed to get admin config:",e)}return null}async function f(t,e={}){try{const a=t?"?baseUrl="+encodeURIComponent(t):"",r=await fetch(n+"/public-ip"+a,{signal:e.signal});if(r.ok)return await r.json()}catch(a){console.error("Failed to get public ip check:",a)}return null}async function w(t){try{return(await fetch(`${n}/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})})).ok}catch(e){return console.error("Failed to update admin config:",e),!1}}async function p(){try{return(await fetch(`${n}/restart`,{method:"POST"})).ok}catch(t){return console.error("Failed to trigger restart:",t),!1}}async function P(t){try{return(await fetch(`/service/restart/${t}`,{method:"POST"})).ok}catch(e){return console.error(`Failed to restart ${t}:`,e),!1}}async function u(t={}){try{const e=await fetch("/service/status",{signal:t.signal});if(e.ok)return await e.json()}catch(e){console.error("Failed to get gateway status:",e)}return null}async function $(t={}){try{const a=h(t).toString(),r=await fetch(`${n}/rdf/stats${a?`?${a}`:""}`);if(r.ok)return await r.json()}catch(e){console.error("Failed to get RDF stats:",e)}return null}function h(t){const e=new URLSearchParams;return c(e,"cacheScopeQuery",t.cacheScopeQuery),c(e,"cacheScopePrincipal",t.cacheScopePrincipal),c(e,"cacheScopeBasePath",t.cacheScopeBasePath),c(e,"cacheScopeMode",t.cacheScopeMode),c(e,"cacheScopeAuthorizationModel",t.cacheScopeAuthorizationModel),c(e,"cacheScopePermissionVersion",t.cacheScopePermissionVersion),c(e,"cacheScopeLimit",t.cacheScopeLimit),e}function c(t,e,a){a!==void 0&&a!==""&&t.set(e,String(a))}async function d(t){try{const e=new URLSearchParams;t?.limit&&e.set("limit",t.limit.toString()),t?.level&&t.level!=="all"&&e.set("level",t.level),t?.source&&t.source!=="all"&&e.set("source",t.source);const a=e.toString(),r=await fetch(`${n}/logs${a?`?${a}`:""}`);if(r.ok){const s=await r.json();return Array.isArray(s)?s:s.logs??[]}}catch(e){console.error("Failed to get logs:",e)}return[]}async function S(t){try{const e=new URLSearchParams;t?.lines&&e.set("lines",t.lines.toString());const a=e.toString(),r=await fetch(`${n}/logs/file${a?`?${a}`:""}`);if(r.ok)return await r.json()}catch(e){console.error("Failed to get log file tail:",e)}return null}async function k(){const[t,e,a,r,s,o]=await Promise.all([u(),i(),l(),g(),d({limit:200}),S({lines:120})]);return{generatedAt:new Date().toISOString(),gatewayStatus:t,adminStatus:e,sanitizedConfig:{env:a?.env??{},secrets:a?.secrets??{}},ddnsStatus:r,recentLogs:s,logFile:o}}function F(t,e){const a=new EventSource(`${n}/logs/stream`);return a.onmessage=r=>{try{const s=JSON.parse(r.data);s.logs&&t(s.logs)}catch(s){console.error("Failed to parse log data:",s)}},a.onerror=r=>{console.error("Log stream error:",r),e?.(r)},()=>{a.close()}}function m(t){return t?t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}/`:""}function y(t,e,a=""){return e?.baseUrl||m(e?.fqdn)||t.CSS_BASE_URL||a}async function g(t={}){try{const e=await fetch(`${n}/ddns`,{signal:t.signal});if(e.ok)return await e.json()}catch(e){console.error("Failed to get ddns status:",e)}return null}async function A(t={}){const[e,a,r,s]=await Promise.all([u(t),i(t),l(t),g(t)]),o=await f(y(r?.env??{},s),t);return{servicesData:e,adminData:a,configData:r,ddnsData:s,publicCheck:o,checkedAt:new Date}}export{d as a,i as b,l as c,y as d,k as e,A as f,$ as g,S as h,g as i,f as j,P as r,F as s,p as t,w as u};
@@ -1 +0,0 @@
1
- const H=["openai","anthropic","kimi","bailian","deepseek","zhipu","ollama","custom"],B="AI Connection request failed. Please try again.";function tn(e){if(e==null||!e.trim())return;let n;try{n=new URL(e.trim())}catch{throw new Error("invalid_proxy_url")}if(!["http:","https:"].includes(n.protocol)||n.username||n.password||n.hash)throw new Error("invalid_proxy_url");if(!n.hostname)throw new Error("invalid_proxy_url");return n.href.replace(/\/$/u,"")}class oe extends Error{constructor(n,t){super(n),this.name="AiConnectionsRequestError",this.code=Z(t),this.providerStatus=u(t)&&typeof t.providerStatus=="number"?t.providerStatus:void 0}}function rn(e){return e instanceof Error?j(e.message):j(String(e))}function q(e,n,t={}){const a=Z(e);if(a==="provider_models_response_error"){const l=u(e)&&typeof e.message=="string"?U(e.message):void 0;return l||"模型列表获取失败。请检查密钥、服务地址或网络后重试。"}if(a==="provider_models_fetch_failed"){const l=u(e)&&typeof e.providerStatus=="number"?e.providerStatus:void 0,h=u(e)&&typeof e.providerMessage=="string"?e.providerMessage.trim():void 0;return ae(se(l,t.authMode),h)}const c=a?M(a,t.provider):void 0;if(c)return c;const d=u(e)&&typeof e.error=="string"?e.error:void 0;if(d){const l=M(d,t.provider);if(l)return l;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 n===401?"Please sign in again to continue.":n===403?"AI Connection permission was denied.":n===404&&t.provider?`${x(t.provider)} connection is not configured.`:n===429?"AI Connection is rate limited. Please try again later.":n===503?"AI Connection service is unavailable.":B}const V="订阅登录态自动刷新失败,请稍后重试。",J="订阅登录态已失效,请在原客户端重新登录后重读,或使用设备码登录。",W="订阅登录态不可用,请重读登录态或重新登录后再同步模型。",X=new Set([W,V,J,"密钥不可用。请检查密钥是否填写正确,或换一个密钥后重试。","模型服务地址不正确。请检查服务地址后重试。","请求太频繁。请稍等一会儿再试。","模型服务暂时没有响应。请稍后重试。","模型列表获取失败。请检查密钥、服务地址或网络后重试。"]);function j(e){if(e.startsWith("provider_models_response_error:"))return U(e.slice(31))??"模型列表获取失败。请检查密钥、服务地址或网络后重试。";const n=M(e);if(n)return n;const t=e.split(":",1)[0]?.trim(),a=t?M(t):void 0;return a||(e==="AI Connection service identity is unavailable"||X.has(e)||ce(e)?e:e.startsWith("invalid_")?"AI Connection returned an invalid response.":B)}function Z(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}}function M(e,n){switch(e.trim().toLowerCase().replace(/-/g,"_")){case"not_configured":case"notconfigured":return n?`${x(n)} connection is not configured.`:"AI provider connection is not configured.";case"unsupported":return n?`${x(n)} does not support this operation.`:"This AI Connection operation is not supported.";case"service_identity_unavailable":return"AI Connection service identity is unavailable";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 V;case"oauth_session_reauth_required":case"oauth_refresh_token_required":case"local_session_reauth_required":case"local_session_missing_refresh_token":return J;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 se(e,n){return e===401||e===403?n==="deviceCodeOAuth"?W:"密钥不可用。请检查密钥是否填写正确,或换一个密钥后重试。":e===404?"模型服务地址不正确。请检查服务地址后重试。":e===429?"请求太频繁。请稍等一会儿再试。":e!==void 0&&e>=500?"模型服务暂时没有响应。请稍后重试。":"模型列表获取失败。请检查密钥、服务地址或网络后重试。"}function ae(e,n){const t=n?U(n):void 0;return t?`${e} 上游返回:${t}`:e}function ce(e){const t=e.indexOf(" 上游返回:");return t<=0?!1:X.has(e.slice(0,t))}function U(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 x(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"}}async function N(e){const n=await e.text();if(n)try{return JSON.parse(n)}catch{throw new Error(`AI Connection returned invalid JSON (${e.status})`)}}function de(e){if(!H.includes(e))throw new Error(`Unsupported AI provider: ${e}`)}function k(e){if(!(!u(e)||typeof e.id!="string"||typeof e.owner!="string"||!Array.isArray(e.scopes)||!e.scopes.every(n=>typeof n=="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:C(e.appliedClients)})}function D(e){if(!Array.isArray(e))throw new Error("AI Connection returned an invalid custom models response");const n=[];for(const t of e)!u(t)||typeof t.id!="string"||!t.id||n.push(y({id:t.id,displayName:o(t.displayName),inputModalities:C(t.inputModalities),outputModalities:C(t.outputModalities),capabilities:C(t.capabilities)}));return n}function C(e){if(!Array.isArray(e))return;const n=e.filter(t=>typeof t=="string");return n.length>0?n:void 0}function Q(e){if(!u(e)||typeof e.id!="string"||ue(e.id))return;const n=m(e.provider)??m(e.providerId)??m(e.owned_by)??pe(e.id);if(!n)return;const t=u(e.capabilities)?e.capabilities.imageInput:void 0;return y({id:e.id,provider:n,offeringId:o(e.offeringId),resourceId:o(e.resourceId),displayName:o(e.displayName)??o(e.display_name)??o(e.name),contextWindow:K(e.contextWindow)??K(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:G(e.modalities,"input")??(t===!0?["text","image"]:t===!1?["text"]:void 0),outputModalities:G(e.modalities,"output"),capabilities:fe(e)})}function G(e,n){if(!u(e))return;const t=e[n];if(!Array.isArray(t))return;const a=t.filter(c=>typeof c=="string");return a.length>0?a:void 0}function fe(e){if(Array.isArray(e.custom_capabilities)){const t=e.custom_capabilities.filter(a=>typeof a=="string");if(t.length>0)return t}if(!u(e.capabilities))return;const n=[];return e.capabilities.imageInput===!0&&n.push("image"),e.capabilities.toolCalls===!0&&n.push("tool_call"),e.capabilities.reasoningEffort===!0&&n.push("reasoning"),n.length>0?n:void 0}function ue(e){const n=e.toLowerCase();return n==="linx"||n==="linx-lite"||n==="undefineds/linx"||n==="undefineds/linx-lite"}function m(e){if(typeof e!="string")return;const n=e.toLowerCase().trim();return n==="alibaba"||n==="dashscope"||n==="alibaba-bailian"||n==="bailian-coding-plan"||n==="bailian-token-plan"?"bailian":H.includes(n)?n:void 0}function pe(e){const n=e.split("/",1)[0];return e.includes("/")?m(n):void 0}function K(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function ye(e){const n=new Map;for(const t of e){const a=le(t);if(!a)continue;const c=n.get(a.id);n.set(a.id,c?Ee(c,a):a)}return[...n.values()]}function le(e){return he(e)??ge(e)}function ge(e){if(!u(e)||typeof e.provider!="string"||!Ne(e.status)||!u(e.connect)||!Array.isArray(e.connect.modes)||!e.connect.modes.every($)||typeof e.connect.configured!="boolean")return;const n=m(e.provider);if(!n)return;const t=Te(e,n);return{id:n,name:ie(n),offerings:[],credentials:t?[t]:[],selectedModels:[],status:Pe(e.status)}}function he(e){if(!u(e))return;const n=m(e.id)??m(e.provider);if(!n||!Ue(e.status))return;const t=w(e.offerings,me),a=w(e.credentials,S),c=w(e.selectedModels,Q);return{id:n,name:o(e.name)??ie(n),offerings:t,credentials:a,selectedModels:c,status:e.status}}function me(e){if(!u(e)||typeof e.id!="string"||!e.id)return;const n=w(e.authModes,te);return y({id:e.id,label:o(e.label),kind:o(e.kind),lifecycle:be(e.lifecycle),authModes:n,authorizationMethods:w(e.authorizationMethods,Y),runtimeProviderIds:C(e.runtimeProviderIds),productLabel:o(e.productLabel),credentialPrefixHints:C(e.credentialPrefixHints),consoleUrl:o(e.consoleUrl),subscriptionUrl:o(e.subscriptionUrl),endpoints:w(e.endpoints,v),modelDiscovery:Ce(e.modelDiscovery),quota:Se(e.quota),usagePolicyUrl:o(e.usagePolicyUrl),region:o(e.region)})}function Ae(e){if(!u(e)||typeof e.offeringId!="string"||!e.offeringId)return;const n=m(e.provider);if(!n)return;const t=w(e.authorizationMethods,Y);return{provider:n,offeringId:e.offeringId,...Array.isArray(e.endpoints)?{endpoints:w(e.endpoints,v)}:{},authorizationMethods:t}}function Y(e){if(!u(e)||typeof e.id!="string"||!e.id)return;const n=te(e.authMode),t=we(e.lifecycle);if(!n||!t)return;const a=$(e.connectMode)?e.connectMode:void 0;return y({id:e.id,authMode:n,connectMode:a,label:o(e.label)??Ie(e.id,n),lifecycle:t,reason:o(e.reason)})}function we(e){return e==="active"||e==="unavailable"?e:void 0}function Ie(e,n){return e==="device-code"?"设备码登录":e==="local-session-import"?"已有登录态":e==="local-service"?"本地服务":e==="api-key"||n==="apiKey"?"API Key":n==="local"?"本地服务":"浏览器登录"}function be(e){return e==="active"||e==="legacy"||e==="unavailable"?e:void 0}function v(e){if(!u(e))return;const n=o(e.protocol),t=o(e.baseUrl);if(!(!n||!t))return y({protocol:n,baseUrl:t,region:o(e.region)})}function Ce(e){if(!u(e))return;const n=o(e.strategy),t=o(e.path),a=o(e.endpointProtocol);return n&&t&&a?{strategy:n,path:t,endpointProtocol:a}:void 0}function Se(e){if(!u(e))return;const n=o(e.strategy),t=o(e.url);return n&&t?{strategy:n,url:t}:void 0}function S(e){if(!(!u(e)||typeof e.id!="string"||!e.id||typeof e.offeringId!="string"||!e.offeringId||!re(e.authMode)||typeof e.enabled!="boolean"||typeof e.priority!="number"||!Number.isFinite(e.priority)||!Re(e.health)||typeof e.version!="number"||!Number.isFinite(e.version)))return y({id:e.id,provider:m(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 ee(e){return u(e)?Object.fromEntries(Object.entries(e).filter(([n])=>!_e(n)).map(([n,t])=>[n,ne(t)])):{}}function ne(e){return Array.isArray(e)?e.map(ne):u(e)?ee(e):e}function _e(e){const n=e.toLocaleLowerCase();return n.includes("secret")||n.includes("token")||n.includes("apikey")||n==="api_key"||n==="key"||n==="authorization"}function Ee(e,n){const t=T([...e.credentials,...n.credentials],d=>d.id),a=T([...e.offerings,...n.offerings],d=>d.id),c=T([...e.selectedModels,...n.selectedModels],Me);return{id:e.id,name:e.name??n.name,offerings:a,credentials:t,selectedModels:c,status:ke(e.status,n.status)}}function Me(e){return e.resourceId??`${e.provider}:${e.offeringId??""}:${e.id}`}function Pe(e){return e==="connected"?"available":e==="reauthRequired"?"attention":"unconfigured"}function ke(e,n){return e==="available"||n==="available"?"available":e==="attention"||n==="attention"?"attention":e==="configured"||n==="configured"?"configured":e==="unconfigured"||n==="unconfigured"?"unconfigured":"unavailable"}function Te(e,n){if(e.status==="disconnected")return;const t=Oe(e.authMode);return y({id:o(e.credentialIri)??`${n}:current`,offeringId:xe(n,t),authMode:t,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 Oe(e){return e==="deviceCodeOAuth"?"deviceCode":"apiKey"}function xe(e,n){return e==="kimi"&&(n==="deviceCode"||n==="oauth")?"subscription-key":n==="deviceCode"||n==="oauth"?"official-subscription":"api-platform"}function te(e){return re(e)?e:void 0}function re(e){return e==="oauth"||e==="deviceCode"||e==="apiKey"||e==="local"}function Re(e){return e==="healthy"||e==="expired"||e==="invalid"||e==="unknown"}function Ue(e){return e==="unconfigured"||e==="configured"||e==="available"||e==="attention"||e==="unavailable"}function w(e,n){return Array.isArray(e)?e.map(n).filter(_):[]}function T(e,n){const t=new Set,a=[];for(const c of e){const d=n(c);t.has(d)||(t.add(d),a.push(c))}return a}function ie(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 $e(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 n=m(e.provider);if(n)return y({id:e.id,credentialIri:e.credentialIri,webId:e.webId,provider:n,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 Le(e,n){if(!u(e)||!$(e.mode)||!je(e.status)||e.provider!==n)throw new Error("AI Connection returned an invalid Connect response");return y({mode:e.mode,status:e.status,provider:n,attemptId:o(e.attemptId),state:o(e.state),signature:o(e.signature),expiresAt:o(e.expiresAt),authorizationUrl:O(e.authorizationUrl),userCode:o(e.userCode),verificationUri:O(e.verificationUri),verificationUriComplete:O(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:ze(e.oauthCredential),message:o(e.message)})}function ze(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 qe(e,n){if(!u(e)||!Array.isArray(e.models))throw new Error("AI Connection returned an invalid model discovery response");const t=e.models.map(a=>{if(!(!u(a)||typeof a.id!="string"||!a.id))return y({id:a.id,displayName:o(a.displayName),capabilities:Array.isArray(a.capabilities)?a.capabilities.filter(c=>typeof c=="string"):void 0})}).filter(_);return{provider:n,credential:typeof e.credential=="string"?e.credential:"",models:t,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(([,n])=>n!==void 0))}function o(e){return typeof e=="string"?e:void 0}function O(e){if(typeof e=="string")try{const n=new URL(e);return n.protocol==="https:"||n.protocol==="http:"?n.href:void 0}catch{return}}function $(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 Ne(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 L(e){const n=new URL(e);if(n.protocol!=="https:"&&n.protocol!=="http:")throw new Error("Current Pod URL must use HTTP or HTTPS");return n.origin}function De({webId:e,podBaseUrl:n,authenticatedFetch:t}){const a=L(n),c=async(i,r,s,f={})=>{const p=await t(`${a}${i}`,{method:r,credentials:"omit",mode:"cors",headers:{accept:"application/json",...s?{"content-type":"application/json"}:{}},...s?{body:JSON.stringify(s)}:{}}),g=await N(p);if(!p.ok)throw new oe(q(g,p.status,f),g);return g},d=i=>(de(i),`/api/ai/gateway/providers/${i}`),l=async(i,r,s,f)=>{const p=await c(`${d(i)}${r}`,s,f,{provider:i});return Le(p,i)},h=async()=>{const i=await c("/v1/models","GET");return Array.isArray(i.data)?i.data.map(Q).filter(_):[]};return{webId:e,apiBase:a,getServiceAccess(){return c("/api/applets/service-access/ai-connections","GET")},async listProviders(){const i=await c("/api/ai/providers","GET");return Array.isArray(i.data)?ye(i.data):[]},async listAuthorizationMethods(){const i=await t(`${a}/api/ai/connections/authorization-methods`,{method:"GET",credentials:"omit",mode:"cors",headers:{accept:"application/json"}});if(i.status===404)return[];const r=await N(i);if(!i.ok)throw new Error(q(r,i.status));return u(r)&&Array.isArray(r.data)?r.data.map(Ae).filter(_):[]},listModels:h,listGatewayModels:h,async listGatewayKeys(){const i=await c("/api/ai/gateway/keys","GET");return Array.isArray(i.data)?i.data.map(k).filter(_):[]},async createGatewayKey(i){const r=await c("/api/ai/gateway/keys","POST",y(i));if(typeof r.key!="string"||!r.key)throw new Error("Xpod did not return the new API Key");const s=k(r.record);if(!s)throw new Error("Xpod returned an invalid API Key record");return{plaintext:r.key,record:s}},async updateGatewayKey(i,r){const s=await c(`/api/ai/gateway/keys/${encodeURIComponent(i)}`,"PATCH",r),f=k(s.record);if(!f)throw new Error("Xpod returned an invalid API Key record");return f},async deleteGatewayKey(i){await c(`/api/ai/gateway/keys/${encodeURIComponent(i)}`,"DELETE")},async beginConnect(i,r,s){return await l(i,"/connect/begin","POST",y({mode:r,offeringId:s?.offeringId,authorizationMethodId:s?.authorizationMethodId}))},connectStatus(i,r){if(!r.attemptId)throw new Error("Connect attempt id is required");const s=new URLSearchParams({state:r.state??"",signature:r.signature??""});return r.mode&&s.set("mode",r.mode),l(i,`/connect/status/${encodeURIComponent(r.attemptId)}?${s}`,"GET")},completeApiKey(i,r,s,f,p){return l(i,"/connect/complete-api-key","POST",y({attemptId:r.attemptId,state:r.state,signature:r.signature,offeringId:r.offeringId,apiKey:s,accountLabel:f,baseUrl:p}))},pollDevice(i,r){return l(i,"/connect/poll","POST",y({mode:r.mode,attemptId:r.attemptId,state:r.state,signature:r.signature,offeringId:r.offeringId}))},cancelConnect(i,r){return l(i,"/connect/cancel","POST",y({mode:r.mode,attemptId:r.attemptId,state:r.state,signature:r.signature,offeringId:r.offeringId}))},refreshOAuthCredential(i,r,s,f,p,g){return l(i,"/connect/refresh","POST",{credentialId:r,refreshToken:s,expectedVersion:f,...p?{offeringId:p}:{},...g?{mode:g}:{}})},async disconnect(i,r){const s=r?`?${new URLSearchParams({credentialId:r})}`:"",f=await c(`${d(i)}/connect${s}`,"DELETE");return $e(f.record)},async createApiKeyCredential(i,r){const s=await c(`/api/ai/providers/${i}/credentials/api-key`,"POST",y({...r}),{provider:i}),f=S(s.credential);if(!f)throw new Error("AI Connection returned an invalid Provider credential");return f},async createLocalCredential(i,r){const s=await c(`/api/ai/providers/${i}/credentials/local`,"POST",y(r),{provider:i}),f=S(s.credential);if(!f)throw new Error("AI Connection returned an invalid Provider credential");return f},async updateProviderCredential(i,r,s){const f=await c(`/api/ai/providers/${i}/credentials/${encodeURIComponent(r)}`,"PATCH",y({...s}),{provider:i}),p=S(f.credential);if(!p)throw new Error("AI Connection returned an invalid Provider credential");return p},async deleteProviderCredential(i,r){const s=await c(`/api/ai/providers/${i}/credentials/${encodeURIComponent(r)}`,"DELETE",void 0,{provider:i});return S(s.credential)},async testProviderCredential(i,r){const s=await c(`/api/ai/providers/${i}/credentials/test`,"POST",y({...r}),{provider:i});return ee(s.result)},quota(i,r=!1,s){const f=!r&&s?.credentialIri?`?credentialIri=${encodeURIComponent(s.credentialIri)}${s.offeringId?`&offeringId=${encodeURIComponent(s.offeringId)}`:""}`:"";return c(`${d(i)}/quota/${r?"refresh":"status"}${f}`,r?"POST":"GET",r?y({offeringId:s?.offeringId,credentialId:s?.credentialId,credentialIri:s?.credentialIri}):void 0,{provider:i})},quotaFromSecret(i,r){return c(`${d(i)}/quota/refresh`,"POST",y(r),{provider:i})},async discoverModels(i,r){const s=await c(`${d(i)}/models/refresh`,"POST",y({...r}),{provider:i,authMode:r?.authMode});return qe(s,i)},async saveProviderModel(i,r){const s=await c(d(i)+"/models","POST",y({id:r.id,displayName:r.displayName,inputModalities:r.inputModalities,outputModalities:r.outputModalities,capabilities:r.capabilities}),{provider:i});return D(s.data)},async deleteProviderModel(i,r){const s=await c(`${d(i)}/models/${encodeURIComponent(r)}`,"DELETE",void 0,{provider:i});return D(s.data)}}}const Ge=3e4;function on({webId:e,podUrl:n,authenticatedFetch:t}){return De({webId:e,podBaseUrl:n,authenticatedFetch:Ke(t)})}function Ke(e){return(async(n,t)=>R(await e(n,t)))}function Fe({podUrl:e,authenticatedFetch:n,invocationFetch:t=n,now:a=()=>new Date,invocationSelector:c=Je}){const d=L(e);let l,h;const i=async(p,g)=>{const A=await n(p,g);return l=await Ve(A.clone(),c),A},r=async()=>{if(Xe(l,a()))return l;if(h)return h;h=s();try{return await h}finally{h=void 0}},s=async()=>{if(!(await i(`${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 g=l;if(!g?.token)throw new Error("AI Connection request failed. Please try again.");return g},f=async(p,g)=>{const A=await r(),E=Ze(A);if(!E)throw new Error("AI Connection request failed. Please try again.");const z=new Headers(g?.headers);return z.set("Authorization",`Bearer ${E}`),t(p,{...g,credentials:"omit",headers:z})};return(async(p,g)=>{if(He(p,d))return i(p,g);if(!Be(p,d))return n(p,g);const A=await f(p,g);if(A.status!==401)return R(A);await A.arrayBuffer(),l=void 0;const E=await f(p,g);return R(E)})}function sn({podUrl:e,controlPlaneOrigin:n,authenticatedFetch:t,invocationFetch:a,now:c}){const d=L(e),l=a??t,i=Fe({podUrl:e,authenticatedFetch:t,invocationFetch:(r,s)=>{const f=new URL(r instanceof Request?r.url:String(r),d);if(n&&f.origin===d&&f.pathname.startsWith("/api/ai/client-configuration/")){const p=new URL(`${f.pathname}${f.search}`,n);return l(r instanceof Request?new Request(p,r):p.href,s)}return l(r,s)},now:c,invocationSelector:We});return{inspect:async r=>{const s=await i(I(d,r),{method:"GET",credentials:"omit",headers:{accept:"application/json"}});return s.status===403||s.status===404||s.status===503?(await s.arrayBuffer(),F()):b(s)},plan:async r=>b(await i(`${I(d,r.client)}/plan`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({endpoint:n?new URL(n).origin:r.endpoint,...r.activeModels!==void 0?{activeModels:r.activeModels}:{}})})),apply:async r=>b(await i(`${I(d,r.client)}/apply`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({planId:r.planId,apiKey:r.apiKey,confirmation:r.confirmation})})),verify:async r=>b(await i(`${I(d,r.client)}/verify`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({planId:r.planId})})),launch:async r=>b(await i(`${I(d,r)}/launch`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({})})),restore:async r=>{const s=await i(`${I(d,r)}/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(),F()):b(s)}}}function He(e,n){try{const t=new URL(String(e),n),a=new URL(n);return t.origin===a.origin&&t.pathname==="/api/applets/service-access/ai-connections"}catch{return!1}}function Be(e,n){try{const t=new URL(String(e),n),a=new URL(n);return t.origin===a.origin&&(t.pathname.startsWith("/api/ai/")||t.pathname.startsWith("/v1/"))}catch{return!1}}async function Ve(e,n){if(!(!e.ok||!e.headers.get("content-type")?.includes("application/json")))try{const t=await e.json();return Qe(n(t))}catch{return}}function Je(e){return e.invocation}function We(e){const n=e.aiClientConfiguration;return P(n)?n.invocation:void 0}function Xe(e,n){if(!e?.token)return!1;if(!e.expiresAt)return!0;const t=Date.parse(e.expiresAt);return Number.isFinite(t)&&t-n.getTime()>Ge}function Ze(e){return e?.token}function Qe(e){if(!P(e))return;const n=["gateway","Key"].join("");return{token:typeof e.token=="string"?e.token:typeof e.apiKey=="string"?e.apiKey:typeof e[n]=="string"?e[n]:void 0,baseUrl:typeof e.baseUrl=="string"?e.baseUrl:void 0,expiresAt:typeof e.expiresAt=="string"?e.expiresAt:void 0}}async function R(e){return e.ok?e:e.headers.get("content-type")?.includes("application/json")?ve(e):(await e.arrayBuffer(),new Response(JSON.stringify({error:"internal_error"}),{status:e.status,statusText:e.statusText,headers:{"content-type":"application/json"}}))}function I(e,n){return`${e}/api/ai/client-configuration/${encodeURIComponent(n)}`}async function b(e){if(!e.ok)throw await Ye(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 Ye(e){let n;try{n=e.headers.get("content-type")?.includes("application/json")?await e.json():void 0}catch{n=void 0}if(P(n)){const t=typeof n.code=="string"?n.code:typeof n.error=="string"?n.error:void 0,a=typeof n.message=="string"?n.message:"AI client configuration request failed. Please try again.",c=new Error(a);return c.code=t,c.status=e.status,c.details=n.details,c}return await e.arrayBuffer().catch(()=>{}),new Error("AI client configuration request failed. Please try again.")}function F(){return{status:"unavailable",message:"Host does not support local client configuration. Use the manual setup instructions for your client."}}async function ve(e){let n;try{n=await e.clone().json()}catch{return e}const t=nn(n);return t?new Response(JSON.stringify({code:t}),{status:e.status,statusText:e.statusText,headers:{"content-type":"application/json"}}):en(n)?new Response(JSON.stringify({code:n.error.code,error:n.error.message}),{status:e.status,statusText:e.statusText,headers:{"content-type":"application/json"}}):e}function en(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const n=e.error;return!!(n&&typeof n=="object"&&!Array.isArray(n)&&typeof n.code=="string"&&typeof n.message=="string"&&typeof n.status=="number")}function nn(e){if(!(!P(e)||typeof e.error!="string")&&e.error==="Gateway API Key plaintext is not available")return"gateway_api_key_plaintext_unavailable"}function P(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}export{H as A,De as a,oe as b,on as c,tn as d,sn as e,rn as n};
@@ -1,41 +0,0 @@
1
- import{r as f,o as V,p as ke,q as Ie,s as me,j as Y,P as he,v as Yn,w as zt,x as Kn}from"./settings-ExBXGgbj.js";var Gn=Object.defineProperty,ve=(e,t)=>Gn(e,"name",{value:t,configurable:!0}),Xt=!!(typeof window<"u"&&window.document&&window.document.createElement);function Ae(e,t,{checkForDefaultPrevented:n=!0}={}){return ve(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}ve(Ae,"composeEventHandlers");function Zn(e){if(!Xt)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}ve(Zn,"getOwnerWindow");function tt(e){if(!Xt)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}ve(tt,"getOwnerDocument");function Yt(e,t=!1){const{activeElement:n}=tt(e);if(!n?.nodeName)return null;if(Kt(n)&&n.contentDocument)return Yt(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=tt(n).getElementById(r);if(o)return o}}return n}ve(Yt,"getActiveElement");function Kt(e){return e.tagName==="IFRAME"}ve(Kt,"isFrame");var qn=Object.defineProperty,Qn=(e,t)=>qn(e,"name",{value:t,configurable:!0}),Jn=ke[" useId ".trim().toString()]||(()=>{}),er=0;function tr(e){const[t,n]=f.useState(Jn());return V(()=>{e||n(r=>r??String(er++))},[e]),e||(t?`radix-${t}`:"")}Qn(tr,"useId");var nr=Object.defineProperty,rr=(e,t)=>nr(e,"name",{value:t,configurable:!0}),Ct=ke[" useEffectEvent ".trim().toString()],Rt=ke[" useInsertionEffect ".trim().toString()];function Gt(e){if(typeof Ct=="function")return Ct(e);const t=f.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Rt=="function"?Rt(()=>{t.current=e}):V(()=>{t.current=e}),f.useMemo(()=>((...n)=>t.current?.(...n)),[])}rr(Gt,"useEffectEvent");var or=Object.defineProperty,be=(e,t)=>or(e,"name",{value:t,configurable:!0}),ir=ke[" useInsertionEffect ".trim().toString()]||V;function sr({prop:e,defaultProp:t,onChange:n=be(()=>{},"onChange"),caller:r}){const[o,i,s]=Zt({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:o,u=f.useCallback(m=>{if(c){const a=qt(m)?m(e):m;a!==e&&s.current?.(a)}else i(m)},[c,e,i,s]);return[l,u]}be(sr,"useControllableState");function Zt({defaultProp:e,onChange:t}){const[n,r]=f.useState(e),o=f.useRef(n),i=f.useRef(t);return ir(()=>{i.current=t},[t]),f.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}be(Zt,"useUncontrolledState");function qt(e){return typeof e=="function"}be(qt,"isFunction");var Pt=Symbol("RADIX:SYNC_STATE");function cr(e,t,n,r){const{prop:o,defaultProp:i,onChange:s,caller:c}=t,l=o!==void 0,u=Gt(s),m=[{...n,state:i}];r&&m.push(r);const[a,d]=f.useReducer((g,w)=>{if(w.type===Pt)return{...g,state:w.state};const y=e(g,w);return l&&!Object.is(y.state,g.state)&&u(y.state),y},...m),p=a.state,h=f.useRef(p);f.useEffect(()=>{h.current!==p&&(h.current=p,l||u(p))},[p,h,l]);const v=f.useMemo(()=>o!==void 0?{...a,state:o}:a,[a,o]);return f.useEffect(()=>{l&&!Object.is(o,a.state)&&d({type:Pt,state:o})},[o,a.state,l]),[v,d]}be(cr,"useControllableStateReducer");var ar=Object.defineProperty,_=(e,t)=>ar(e,"name",{value:t,configurable:!0}),nt="dismissableLayer.update",lr="dismissableLayer.pointerDownOutside",ur="dismissableLayer.focusOutside",Ot,Qt=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Pi=f.forwardRef(_(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:l,onDismiss:u,...m}=t,a=f.useContext(Qt),[d,p]=f.useState(null),h=d?.ownerDocument??globalThis?.document,[,v]=f.useState({}),g=Ie(n,p),w=Array.from(a.layers),[y]=[...a.layersWithOutsidePointerEventsDisabled].slice(-1),b=y?w.indexOf(y):-1,E=d?w.indexOf(d):-1,x=a.layersWithOutsidePointerEventsDisabled.size>0,S=E>=b,C=f.useRef(!1),A=Jt(R=>{s?.(R),l?.(R),R.defaultPrevented||u?.()},{ownerDocument:h,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:a.dismissableSurfaces,shouldHandlePointerDownOutside:f.useCallback(R=>{if(!(R instanceof Node))return!1;const T=[...a.branches].some(D=>D.contains(R));return S&&!T},[a.branches,S])}),L=en(R=>{if(o&&C.current)return;const T=R.target;[...a.branches].some(I=>I.contains(T))||(c?.(R),l?.(R),R.defaultPrevented||u?.())},h),O=d?E===w.length-1:!1,N=me(R=>{R.key==="Escape"&&(i?.(R),!R.defaultPrevented&&u&&(R.preventDefault(),u()))});return f.useEffect(()=>{if(O)return h.addEventListener("keydown",N,{capture:!0}),()=>h.removeEventListener("keydown",N,{capture:!0})},[h,O,N]),f.useEffect(()=>{if(d)return r&&(a.layersWithOutsidePointerEventsDisabled.size===0&&(Ot=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),a.layersWithOutsidePointerEventsDisabled.add(d)),a.layers.add(d),rt(),()=>{r&&(a.layersWithOutsidePointerEventsDisabled.delete(d),a.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=Ot))}},[d,h,r,a]),f.useEffect(()=>()=>{d&&(a.layers.delete(d),a.layersWithOutsidePointerEventsDisabled.delete(d),rt())},[d,a]),f.useEffect(()=>{const R=_(()=>v({}),"handleUpdate");return document.addEventListener(nt,R),()=>document.removeEventListener(nt,R)},[]),Y.jsx(he.div,{...m,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...t.style},onFocusCapture:Ae(t.onFocusCapture,L.onFocusCapture),onBlurCapture:Ae(t.onBlurCapture,L.onBlurCapture),onPointerDownCapture:Ae(t.onPointerDownCapture,A.onPointerDownCapture)})},"DismissableLayer"));function fr(){const e=f.useContext(Qt),[t,n]=f.useState(null);return f.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}_(fr,"useDismissableLayerSurface");var dr=_(()=>!0,"IS_TRUE");function Jt(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:i,shouldHandlePointerDownOutside:s=dr}=t,c=me(e),l=f.useRef(!1),u=f.useRef(!1),m=f.useRef(new Map),a=f.useRef(()=>{});return f.useEffect(()=>{function d(){u.current=!1,o.current=!1,m.current.clear()}_(d,"resetOutsideInteraction");function p(){return Array.from(m.current.values()).some(Boolean)}_(p,"isOutsideInteractionIntercepted");function h(b){if(!u.current)return;const E=b.target;E instanceof Node&&[...i].some(S=>S.contains(E))||m.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{u.current&&a.current()},0)}_(h,"handleInteractionCapture");function v(b){u.current&&m.current.set(b.type,!1)}_(v,"handleInteractionBubble");const g=_(b=>{if(b.target&&!l.current){let E=function(){n.removeEventListener("click",a.current);const S=p();d(),S||ft(lr,c,x,{discrete:!0})};if(_(E,"handleAndDispatchPointerDownOutsideEvent"),!s(b.target)){n.removeEventListener("click",a.current),d(),l.current=!1;return}const x={originalEvent:b};u.current=!0,o.current=r&&b.button===0,m.current.clear(),!r||b.button!==0?E():(n.removeEventListener("click",a.current),a.current=E,n.addEventListener("click",a.current,{once:!0}))}else n.removeEventListener("click",a.current),d();l.current=!1},"handlePointerDown"),w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of w)n.addEventListener(b,h,!0),n.addEventListener(b,v);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",g)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",g),n.removeEventListener("click",a.current);for(const b of w)n.removeEventListener(b,h,!0),n.removeEventListener(b,v)}},[n,c,r,o,i,s]),{onPointerDownCapture:_(()=>l.current=!0,"onPointerDownCapture")}}_(Jt,"usePointerDownOutside");function en(e,t=globalThis?.document){const n=me(e),r=f.useRef(!1);return f.useEffect(()=>{const o=_(i=>{i.target&&!r.current&&ft(ur,n,{originalEvent:i},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:_(()=>r.current=!0,"onFocusCapture"),onBlurCapture:_(()=>r.current=!1,"onBlurCapture")}}_(en,"useFocusOutside");function rt(){const e=new CustomEvent(nt);document.dispatchEvent(e)}_(rt,"dispatchUpdate");function ft(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Yn(o,i):o.dispatchEvent(i)}_(ft,"handleAndDispatchCustomEvent");var mr=Object.defineProperty,k=(e,t)=>mr(e,"name",{value:t,configurable:!0}),Xe="focusScope.autoFocusOnMount",Ye="focusScope.autoFocusOnUnmount",At={bubbles:!1,cancelable:!0},Oi=f.forwardRef(k(function(t,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...c}=t,[l,u]=f.useState(null),m=me(i),a=me(s),d=f.useRef(null),p=Ie(n,u),h=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(o){let g=function(E){if(h.paused||!l)return;const x=E.target;l.contains(x)?d.current=x:X(d.current,{select:!0})},w=function(E){if(h.paused||!l)return;const x=E.relatedTarget;x!==null&&(l.contains(x)||X(d.current,{select:!0}))},y=function(E){if(document.activeElement===document.body)for(const S of E)S.removedNodes.length>0&&X(l)};k(g,"handleFocusIn"),k(w,"handleFocusOut"),k(y,"handleMutations"),document.addEventListener("focusin",g),document.addEventListener("focusout",w);const b=new MutationObserver(y);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",w),b.disconnect()}}},[o,l,h.paused]),f.useEffect(()=>{if(l){Dt.add(h);const g=document.activeElement;if(!l.contains(g)){const y=new CustomEvent(Xe,At);l.addEventListener(Xe,m),l.dispatchEvent(y),y.defaultPrevented||(tn(cn(dt(l)),{select:!0}),document.activeElement===g&&X(l))}return()=>{l.removeEventListener(Xe,m),setTimeout(()=>{const y=new CustomEvent(Ye,At);l.addEventListener(Ye,a),l.dispatchEvent(y),y.defaultPrevented||X(g??document.body,{select:!0}),l.removeEventListener(Ye,a),Dt.remove(h)},0)}}},[l,m,a,h]);const v=f.useCallback(g=>{if(!r&&!o||h.paused)return;const w=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,y=document.activeElement;if(w&&y){const b=g.currentTarget,[E,x]=nn(b);E&&x?!g.shiftKey&&y===x?(g.preventDefault(),r&&X(E,{select:!0})):g.shiftKey&&y===E&&(g.preventDefault(),r&&X(x,{select:!0})):y===b&&g.preventDefault()}},[r,o,h.paused]);return Y.jsx(he.div,{tabIndex:-1,...c,ref:p,onKeyDown:v})},"FocusScope"));function tn(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(X(r,{select:t}),document.activeElement!==n)return}k(tn,"focusFirst");function nn(e){const t=dt(e),n=ot(t,e),r=ot(t.reverse(),e);return[n,r]}k(nn,"getTabbableEdges");function dt(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:k(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}k(dt,"getTabbableCandidates");function ot(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):rn(r,{upTo:t})))return r}k(ot,"findVisible");function rn(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}k(rn,"isHidden");function on(e){return e instanceof HTMLInputElement&&"select"in e}k(on,"isSelectableInput");function X(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&on(e)&&t&&e.select()}}k(X,"focus");var Dt=sn();function sn(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=it(e,t),e.unshift(t)},remove(t){e=it(e,t),e[0]?.resume()}}}k(sn,"createFocusScopesStack");function it(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}k(it,"arrayRemove");function cn(e){return e.filter(t=>t.tagName!=="A")}k(cn,"removeLinks");var hr=Object.defineProperty,vr=(e,t)=>hr(e,"name",{value:t,configurable:!0}),Ai=f.forwardRef(vr(function(t,n){const{container:r,...o}=t,[i,s]=f.useState(!1);V(()=>s(!0),[]);const c=r||i&&globalThis?.document?.body;return c?zt.createPortal(Y.jsx(he.div,{...o,ref:n}),c):null},"Portal")),pr=Object.defineProperty,Z=(e,t)=>pr(e,"name",{value:t,configurable:!0});function an(e,t){return f.useReducer((n,r)=>t[n][r]??n,e)}Z(an,"useStateMachine");var Di=Z(e=>{const{present:t,children:n}=e,r=ln(t),o=typeof n=="function"?n({present:r.isPresent}):f.Children.only(n),i=un(r.ref,fn(o));return typeof n=="function"||r.isPresent?f.cloneElement(o,{ref:i}):null},"Presence");function ln(e){const[t,n]=f.useState(),r=f.useRef(null),o=f.useRef(e),i=f.useRef("none"),s=f.useRef(void 0),c=e?"mounted":"unmounted",[l,u]=an(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{l==="mounted"?(i.current=s.current??ue(r.current),s.current=void 0):i.current="none"},[l]),V(()=>{const m=r.current,a=o.current;if(a!==e){const p=i.current,h=ue(m);e?(s.current=h,u("MOUNT")):h==="none"||m?.display==="none"?u("UNMOUNT"):u(a&&p!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),V(()=>{if(t){let m;const a=t.ownerDocument.defaultView??window,d=Z(h=>{const g=ue(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&g&&(u("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",m=a.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},"handleAnimationEnd"),p=Z(h=>{h.target===t&&(i.current=ue(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{a.clearTimeout(m),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(m=>{if(m){const a=getComputedStyle(m);r.current=a,s.current=ue(a)}else r.current=null;n(m)},[])}}Z(ln,"usePresence");function st(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Z(st,"setRef");function un(...e){const t=f.useRef(e);return t.current=e,f.useCallback(n=>{const r=t.current;let o=!1;const i=r.map(s=>{const c=st(s,n);return!o&&typeof c=="function"&&(o=!0),c});if(o)return()=>{for(let s=0;s<i.length;s++){const c=i[s];typeof c=="function"?c():st(r[s],null)}}},[])}Z(un,"useStableComposedRefs");function ue(e){return e?.animationName||"none"}Z(ue,"getAnimationName");function fn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Z(fn,"getElementRef");var gr=Object.defineProperty,mt=(e,t)=>gr(e,"name",{value:t,configurable:!0}),xe=0,se=null;function wr(e){return dn(),e.children}mt(wr,"FocusGuards");function dn(){f.useEffect(()=>{se||(se={start:ct(),end:ct()});const{start:e,end:t}=se;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),xe++,()=>{xe===1&&(se?.start.remove(),se?.end.remove(),se=null),xe=Math.max(0,xe-1)}},[])}mt(dn,"useFocusGuards");function ct(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}mt(ct,"createFocusGuard");var H=function(){return H=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},H.apply(this,arguments)};function mn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function yr(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var De="right-scroll-bar-position",Te="width-before-scroll-bar",br="with-scroll-bars-hidden",Er="--removed-body-scroll-bar-size";function Ke(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function xr(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Sr=typeof window<"u"?f.useLayoutEffect:f.useEffect,Tt=new WeakMap;function Cr(e,t){var n=xr(null,function(r){return e.forEach(function(o){return Ke(o,r)})});return Sr(function(){var r=Tt.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(c){i.has(c)||Ke(c,null)}),i.forEach(function(c){o.has(c)||Ke(c,s)})}Tt.set(n,e)},[e]),n}function Rr(e){return e}function Pr(e,t){t===void 0&&(t=Rr);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(c){return c!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(c){return i(c)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var c=n;n=[],c.forEach(i),s=n}var l=function(){var m=s;s=[],m.forEach(i)},u=function(){return Promise.resolve().then(l)};u(),n={push:function(m){s.push(m),u()},filter:function(m){return s=s.filter(m),n}}}};return o}function Or(e){e===void 0&&(e={});var t=Pr(null);return t.options=H({async:!0,ssr:!1},e),t}var hn=function(e){var t=e.sideCar,n=mn(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return f.createElement(r,H({},n))};hn.isSideCarExport=!0;function Ar(e,t){return e.useMedium(t),hn}var vn=Or(),Ge=function(){},We=f.forwardRef(function(e,t){var n=f.useRef(null),r=f.useState({onScrollCapture:Ge,onWheelCapture:Ge,onTouchMoveCapture:Ge}),o=r[0],i=r[1],s=e.forwardProps,c=e.children,l=e.className,u=e.removeScrollBar,m=e.enabled,a=e.shards,d=e.sideCar,p=e.noRelative,h=e.noIsolation,v=e.inert,g=e.allowPinchZoom,w=e.as,y=w===void 0?"div":w,b=e.gapMode,E=mn(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=d,S=Cr([n,t]),C=H(H({},E),o);return f.createElement(f.Fragment,null,m&&f.createElement(x,{sideCar:vn,removeScrollBar:u,shards:a,noRelative:p,noIsolation:h,inert:v,setCallbacks:i,allowPinchZoom:!!g,lockRef:n,gapMode:b}),s?f.cloneElement(f.Children.only(c),H(H({},C),{ref:S})):f.createElement(y,H({},C,{className:l,ref:S}),c))});We.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};We.classNames={fullWidth:Te,zeroRight:De};var Dr=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Tr(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Dr();return t&&e.setAttribute("nonce",t),e}function Lr(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Nr(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Mr=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Tr())&&(Lr(t,n),Nr(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Fr=function(){var e=Mr();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pn=function(){var e=Fr(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},_r={left:0,top:0,right:0,gap:0},Ze=function(e){return parseInt(e||"",10)||0},kr=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ze(n),Ze(r),Ze(o)]},Ir=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return _r;var t=kr(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Wr=pn(),fe="data-scroll-locked",$r=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,c=e.gap;return n===void 0&&(n="margin"),`
2
- .`.concat(br,` {
3
- overflow: hidden `).concat(r,`;
4
- padding-right: `).concat(c,"px ").concat(r,`;
5
- }
6
- body[`).concat(fe,`] {
7
- overflow: hidden `).concat(r,`;
8
- overscroll-behavior: contain;
9
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
10
- padding-left: `.concat(o,`px;
11
- padding-top: `).concat(i,`px;
12
- padding-right: `).concat(s,`px;
13
- margin-left:0;
14
- margin-top:0;
15
- margin-right: `).concat(c,"px ").concat(r,`;
16
- `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
17
- }
18
-
19
- .`).concat(De,` {
20
- right: `).concat(c,"px ").concat(r,`;
21
- }
22
-
23
- .`).concat(Te,` {
24
- margin-right: `).concat(c,"px ").concat(r,`;
25
- }
26
-
27
- .`).concat(De," .").concat(De,` {
28
- right: 0 `).concat(r,`;
29
- }
30
-
31
- .`).concat(Te," .").concat(Te,` {
32
- margin-right: 0 `).concat(r,`;
33
- }
34
-
35
- body[`).concat(fe,`] {
36
- `).concat(Er,": ").concat(c,`px;
37
- }
38
- `)},Lt=function(){var e=parseInt(document.body.getAttribute(fe)||"0",10);return isFinite(e)?e:0},Br=function(){f.useEffect(function(){return document.body.setAttribute(fe,(Lt()+1).toString()),function(){var e=Lt()-1;e<=0?document.body.removeAttribute(fe):document.body.setAttribute(fe,e.toString())}},[])},Hr=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Br();var i=f.useMemo(function(){return Ir(o)},[o]);return f.createElement(Wr,{styles:$r(i,!t,o,n?"":"!important")})},at=!1;if(typeof window<"u")try{var Se=Object.defineProperty({},"passive",{get:function(){return at=!0,!0}});window.addEventListener("test",Se,Se),window.removeEventListener("test",Se,Se)}catch{at=!1}var ce=at?{passive:!1}:!1,jr=function(e){return e.tagName==="TEXTAREA"},gn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!jr(e)&&n[t]==="visible")},Vr=function(e){return gn(e,"overflowY")},Ur=function(e){return gn(e,"overflowX")},Nt=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=wn(e,r);if(o){var i=yn(e,r),s=i[1],c=i[2];if(s>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},zr=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Xr=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},wn=function(e,t){return e==="v"?Vr(t):Ur(t)},yn=function(e,t){return e==="v"?zr(t):Xr(t)},Yr=function(e,t){return e==="h"&&t==="rtl"?-1:1},Kr=function(e,t,n,r,o){var i=Yr(e,window.getComputedStyle(t).direction),s=i*r,c=n.target,l=t.contains(c),u=!1,m=s>0,a=0,d=0;do{if(!c)break;var p=yn(e,c),h=p[0],v=p[1],g=p[2],w=v-g-i*h;(h||w)&&wn(e,c)&&(a+=w,d+=h);var y=c.parentNode;c=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!l&&c!==document.body||l&&(t.contains(c)||t===c));return(m&&Math.abs(a)<1||!m&&Math.abs(d)<1)&&(u=!0),u},Ce=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Mt=function(e){return[e.deltaX,e.deltaY]},Ft=function(e){return e&&"current"in e?e.current:e},Gr=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Zr=function(e){return`
39
- .block-interactivity-`.concat(e,` {pointer-events: none;}
40
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
- `)},qr=0,ae=[];function Qr(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),o=f.useState(qr++)[0],i=f.useState(pn)[0],s=f.useRef(e);f.useEffect(function(){s.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=yr([e.lockRef.current],(e.shards||[]).map(Ft),!0).filter(Boolean);return v.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=f.useCallback(function(v,g){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var w=Ce(v),y=n.current,b="deltaX"in v?v.deltaX:y[0]-w[0],E="deltaY"in v?v.deltaY:y[1]-w[1],x,S=v.target,C=Math.abs(b)>Math.abs(E)?"h":"v";if("touches"in v&&C==="h"&&S.type==="range")return!1;var A=window.getSelection(),L=A&&A.anchorNode,O=L?L===S||L.contains(S):!1;if(O)return!1;var N=Nt(C,S);if(!N)return!0;if(N?x=C:(x=C==="v"?"h":"v",N=Nt(C,S)),!N)return!1;if(!r.current&&"changedTouches"in v&&(b||E)&&(r.current=x),!x)return!0;var R=r.current||x;return Kr(R,g,v,R==="h"?b:E)},[]),l=f.useCallback(function(v){var g=v;if(!(!ae.length||ae[ae.length-1]!==i)){var w="deltaY"in g?Mt(g):Ce(g),y=t.current.filter(function(x){return x.name===g.type&&(x.target===g.target||g.target===x.shadowParent)&&Gr(x.delta,w)})[0];if(y&&y.should){g.cancelable&&g.preventDefault();return}if(!y){var b=(s.current.shards||[]).map(Ft).filter(Boolean).filter(function(x){return x.contains(g.target)}),E=b.length>0?c(g,b[0]):!s.current.noIsolation;E&&g.cancelable&&g.preventDefault()}}},[]),u=f.useCallback(function(v,g,w,y){var b={name:v,delta:g,target:w,should:y,shadowParent:Jr(w)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(E){return E!==b})},1)},[]),m=f.useCallback(function(v){n.current=Ce(v),r.current=void 0},[]),a=f.useCallback(function(v){u(v.type,Mt(v),v.target,c(v,e.lockRef.current))},[]),d=f.useCallback(function(v){u(v.type,Ce(v),v.target,c(v,e.lockRef.current))},[]);f.useEffect(function(){return ae.push(i),e.setCallbacks({onScrollCapture:a,onWheelCapture:a,onTouchMoveCapture:d}),document.addEventListener("wheel",l,ce),document.addEventListener("touchmove",l,ce),document.addEventListener("touchstart",m,ce),function(){ae=ae.filter(function(v){return v!==i}),document.removeEventListener("wheel",l,ce),document.removeEventListener("touchmove",l,ce),document.removeEventListener("touchstart",m,ce)}},[]);var p=e.removeScrollBar,h=e.inert;return f.createElement(f.Fragment,null,h?f.createElement(i,{styles:Zr(o)}):null,p?f.createElement(Hr,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Jr(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const eo=Ar(vn,Qr);var to=f.forwardRef(function(e,t){return f.createElement(We,H({},e,{ref:t,sideCar:eo}))});to.classNames=We.classNames;var no=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},le=new WeakMap,Re=new WeakMap,Pe={},qe=0,bn=function(e){return e&&(e.host||bn(e.parentNode))},ro=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=bn(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},oo=function(e,t,n,r){var o=ro(t,Array.isArray(e)?e:[e]);Pe[n]||(Pe[n]=new WeakMap);var i=Pe[n],s=[],c=new Set,l=new Set(o),u=function(a){!a||c.has(a)||(c.add(a),u(a.parentNode))};o.forEach(u);var m=function(a){!a||l.has(a)||Array.prototype.forEach.call(a.children,function(d){if(c.has(d))m(d);else try{var p=d.getAttribute(r),h=p!==null&&p!=="false",v=(le.get(d)||0)+1,g=(i.get(d)||0)+1;le.set(d,v),i.set(d,g),s.push(d),v===1&&h&&Re.set(d,!0),g===1&&d.setAttribute(n,"true"),h||d.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",d,w)}})};return m(t),c.clear(),qe++,function(){s.forEach(function(a){var d=le.get(a)-1,p=i.get(a)-1;le.set(a,d),i.set(a,p),d||(Re.has(a)||a.removeAttribute(r),Re.delete(a)),p||a.removeAttribute(n)}),qe--,qe||(le=new WeakMap,le=new WeakMap,Re=new WeakMap,Pe={})}},Ti=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=no(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),oo(r,o,n,"aria-hidden")):function(){return null}},io=Object.defineProperty,so=(e,t)=>io(e,"name",{value:t,configurable:!0});function En(e){const[t,n]=f.useState(void 0);return V(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,c;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,c=u.blockSize}else s=e.offsetWidth,c=e.offsetHeight;n({width:s,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}so(En,"useSize");const co=["top","right","bottom","left"],ee=Math.min,K=Math.max,Ne=Math.round,Oe=Math.floor,G=e=>({x:e,y:e}),ao={left:"right",right:"left",bottom:"top",top:"bottom"};function xn(e,t,n){return K(e,ee(t,n))}function q(e,t){return typeof e=="function"?e(t):e}function te(e){return e.split("-")[0]}function pe(e){return e.split("-")[1]}function ht(e){return e==="x"?"y":"x"}function vt(e){return e==="y"?"height":"width"}function j(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function pt(e){return ht(j(e))}function lo(e,t,n){n===void 0&&(n=!1);const r=pe(e),o=pt(e),i=vt(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Me(s)),[s,Me(s)]}function uo(e){const t=Me(e);return[lt(e),t,lt(t)]}function lt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const _t=["left","right"],kt=["right","left"],fo=["top","bottom"],mo=["bottom","top"];function ho(e,t,n){switch(e){case"top":case"bottom":return n?t?kt:_t:t?_t:kt;case"left":case"right":return t?fo:mo;default:return[]}}function vo(e,t,n,r){const o=pe(e);let i=ho(te(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(lt)))),i}function Me(e){const t=te(e);return ao[t]+e.slice(t.length)}function po(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function Sn(e){return typeof e!="number"?po(e):{top:e,right:e,bottom:e,left:e}}function Fe(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function It(e,t,n){let{reference:r,floating:o}=e;const i=j(t),s=pt(t),c=vt(s),l=te(t),u=i==="y",m=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(l){case"top":p={x:m,y:r.y-o.height};break;case"bottom":p={x:m,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:a};break;case"left":p={x:r.x-o.width,y:a};break;default:p={x:r.x,y:r.y}}const h=pe(t);return h&&(p[s]+=d*(h==="end"?1:-1)*(n&&u?-1:1)),p}async function go(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:c,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:m="viewport",elementContext:a="floating",altBoundary:d=!1,padding:p=0}=q(t,e),h=Sn(p),g=c[d?a==="floating"?"reference":"floating":a],w=Fe(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(g)))==null||n?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:u,rootBoundary:m,strategy:l})),y=a==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),E=await(i.isElement==null?void 0:i.isElement(b))&&await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1},x=Fe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:b,strategy:l}):y);return{top:(w.top-x.top+h.top)/E.y,bottom:(x.bottom-w.bottom+h.bottom)/E.y,left:(w.left-x.left+h.left)/E.x,right:(x.right-w.right+h.right)/E.x}}const wo=50,yo=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:go},l=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:a}=It(u,r,l),d=r,p=0;const h={};for(let v=0;v<i.length;v++){const g=i[v];if(!g)continue;const{name:w,fn:y}=g,{x:b,y:E,data:x,reset:S}=await y({x:m,y:a,initialPlacement:r,placement:d,strategy:o,middlewareData:h,rects:u,platform:c,elements:{reference:e,floating:t}});m=b??m,a=E??a,h[w]={...h[w],...x},S&&p<wo&&(p++,typeof S=="object"&&(S.placement&&(d=S.placement),S.rects&&(u=S.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:m,y:a}=It(u,d,l)),v=-1)}return{x:m,y:a,placement:d,strategy:o,middlewareData:h}},bo=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:c,middlewareData:l}=t,{element:u,padding:m=0}=q(e,t)||{};if(u==null)return{};const a=Sn(m),d={x:n,y:r},p=pt(o),h=vt(p),v=await s.getDimensions(u),g=p==="y",w=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",E=i.reference[h]+i.reference[p]-d[p]-i.floating[h],x=d[p]-i.reference[p],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let C=S?S[b]:0;(!C||!await(s.isElement==null?void 0:s.isElement(S)))&&(C=c.floating[b]||i.floating[h]);const A=E/2-x/2,L=C/2-v[h]/2-1,O=ee(a[w],L),N=ee(a[y],L),R=C-v[h]-N,T=C/2-v[h]/2+A,D=xn(O,T,R),I=!l.arrow&&pe(o)!=null&&T!==D&&i.reference[h]/2-(T<O?O:N)-v[h]/2<0,M=I?T<O?T-O:T-R:0;return{[p]:d[p]+M,data:{[p]:D,centerOffset:T-D-M,...I&&{alignmentOffset:M}},reset:I}}}),Eo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:c,platform:l,elements:u}=t,{mainAxis:m=!0,crossAxis:a=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0,...g}=q(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=te(o),y=j(c),b=te(c)===c,E=await(l.isRTL==null?void 0:l.isRTL(u.floating)),x=d||(b||!v?[Me(c)]:uo(c)),S=h!=="none";!d&&S&&x.push(...vo(c,v,h,E));const C=[c,...x],A=await l.detectOverflow(t,g),L=[];let O=((r=i.flip)==null?void 0:r.overflows)||[];if(m&&L.push(A[w]),a){const D=lo(o,s,E);L.push(A[D[0]],A[D[1]])}if(O=[...O,{placement:o,overflows:L}],!L.every(D=>D<=0)){var N,R;const D=(((N=i.flip)==null?void 0:N.index)||0)+1,I=C[D];if(I&&(!(a==="alignment"?y!==j(I):!1)||O.every(P=>j(P.placement)===y?P.overflows[0]>0:!0)))return{data:{index:D,overflows:O},reset:{placement:I}};let M=(R=O.filter(W=>W.overflows[0]<=0).sort((W,P)=>W.overflows[1]-P.overflows[1])[0])==null?void 0:R.placement;if(!M)switch(p){case"bestFit":{var T;const W=(T=O.filter(P=>{if(S){const F=j(P.placement);return F===y||F==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(F=>F>0).reduce((F,B)=>F+B,0)]).sort((P,F)=>P[1]-F[1])[0])==null?void 0:T[0];W&&(M=W);break}case"initialPlacement":M=c;break}if(o!==M)return{reset:{placement:M}}}return{}}}};function Wt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function $t(e){return co.some(t=>e[t]>=0)}const xo=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=q(e,t);switch(o){case"referenceHidden":{const s=await r.detectOverflow(t,{...i,elementContext:"reference"}),c=Wt(s,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:$t(c)}}}case"escaped":{const s=await r.detectOverflow(t,{...i,altBoundary:!0}),c=Wt(s,n.floating);return{data:{escapedOffsets:c,escaped:$t(c)}}}default:return{}}}}},Cn=new Set(["left","top"]);async function So(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=te(n),c=pe(n),l=j(n)==="y",u=Cn.has(s)?-1:1,m=i&&l?-1:1,a=q(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:h}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return c&&typeof h=="number"&&(p=c==="end"?h*-1:h),l?{x:p*m,y:d*u}:{x:d*u,y:p*m}}const Co=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:c}=t,l=await So(t,e);return s===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},Ro=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:l={fn:y=>{let{x:b,y:E}=y;return{x:b,y:E}}},...u}=q(e,t),m={x:n,y:r},a=await i.detectOverflow(t,u),d=j(o),p=ht(d);let h=m[p],v=m[d];const g=(y,b)=>xn(b+a[y==="y"?"top":"left"],b,b-a[y==="y"?"bottom":"right"]);s&&(h=g(p,h)),c&&(v=g(d,v));const w=l.fn({...t,[p]:h,[d]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[p]:s,[d]:c}}}}}},Po=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:i,placement:s,rects:c,middlewareData:l}=t,{offset:u=0,mainAxis:m=!0,crossAxis:a=!0}=q(e,t),d={x:o,y:i},p=j(s),h=ht(p);let v=d[h],g=d[p];const w=q(u,t),y=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:(n=w.mainAxis)!=null?n:0,crossAxis:(r=w.crossAxis)!=null?r:0};if(m){const x=h==="y"?"height":"width",S=c.reference[h]-c.floating[x]+y.mainAxis,C=c.reference[h]+c.reference[x]-y.mainAxis;v<S?v=S:v>C&&(v=C)}if(a){var b,E;const x=h==="y"?"width":"height",S=Cn.has(te(s)),C=c.reference[p]-c.floating[x]+(S&&((b=l.offset)==null?void 0:b[p])||0)+(S?0:y.crossAxis),A=c.reference[p]+c.reference[x]+(S?0:((E=l.offset)==null?void 0:E[p])||0)-(S?y.crossAxis:0);g<C?g=C:g>A&&(g=A)}return{[h]:v,[p]:g}}}},Oo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...c}=q(e,t),l=await o.detectOverflow(t,c),u=te(n),m=pe(n),a=j(n)==="y",{width:d,height:p}=r.floating;let h,v;u==="top"||u==="bottom"?(h=u,v=m===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(v=u,h=m==="end"?"top":"bottom");const g=p-l.top-l.bottom,w=d-l.left-l.right,y=ee(p-l[h],g),b=ee(d-l[v],w),E=t.middlewareData.shift,x=!E;let S=y,C=b;E!=null&&E.enabled.x&&(C=w),E!=null&&E.enabled.y&&(S=g),x&&!m&&(a?C=d-2*K(l.left,l.right):S=p-2*K(l.top,l.bottom)),await s({...t,availableWidth:C,availableHeight:S});const A=await o.getDimensions(i.floating);return d!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function $e(){return typeof window<"u"}function ge(e){return Rn(e)?(e.nodeName||"").toLowerCase():"#document"}function $(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Q(e){var t;return(t=(Rn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Rn(e){return $e()?e instanceof Node||e instanceof $(e).Node:!1}function U(e){return $e()?e instanceof Element||e instanceof $(e).Element:!1}function ne(e){return $e()?e instanceof HTMLElement||e instanceof $(e).HTMLElement:!1}function Bt(e){return!$e()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof $(e).ShadowRoot}function Be(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Ao(e){return/^(table|td|th)$/.test(ge(e))}function He(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Do=/transform|translate|scale|rotate|perspective|filter/,To=/paint|layout|strict|content/,re=e=>!!e&&e!=="none";let Qe;function gt(e){const t=U(e)?z(e):e;return re(t.transform)||re(t.translate)||re(t.scale)||re(t.rotate)||re(t.perspective)||!wt()&&(re(t.backdropFilter)||re(t.filter))||Do.test(t.willChange||"")||To.test(t.contain||"")}function Lo(e){let t=oe(e);for(;ne(t)&&!we(t);){if(gt(t))return t;if(He(t))return null;t=oe(t)}return null}function wt(){return Qe==null&&(Qe=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Qe}function we(e){return/^(html|body|#document)$/.test(ge(e))}function z(e){return $(e).getComputedStyle(e)}function je(e){return U(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function oe(e){if(ge(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Bt(e)&&e.host||Q(e);return Bt(t)?t.host:t}function Pn(e){const t=oe(e);return we(t)?(e.ownerDocument||e).body:ne(t)&&Be(t)?t:Pn(t)}function ye(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Pn(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=$(o);if(i){const c=ut(s);return t.concat(s,s.visualViewport||[],Be(o)?o:[],c&&n?ye(c):[])}else return t.concat(o,ye(o,[],n))}function ut(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function On(e){const t=z(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ne(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,c=Ne(n)!==i||Ne(r)!==s;return c&&(n=i,r=s),{width:n,height:r,$:c}}function yt(e){return U(e)?e:e.contextElement}function de(e){const t=yt(e);if(!ne(t))return G(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=On(t);let s=(i?Ne(n.width):n.width)/r,c=(i?Ne(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const No=G(0);function An(e){const t=$(e);return!wt()||!t.visualViewport?No:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mo(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===$(e)}function ie(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=yt(e);let s=G(1);t&&(r?U(r)&&(s=de(r)):s=de(e));const c=Mo(i,n,r)?An(i):G(0);let l=(o.left+c.x)/s.x,u=(o.top+c.y)/s.y,m=o.width/s.x,a=o.height/s.y;if(i&&r){const d=$(i),p=U(r)?$(r):r;let h=d,v=ut(h);for(;v&&p!==h;){const g=de(v),w=v.getBoundingClientRect(),y=z(v),b=w.left+(v.clientLeft+parseFloat(y.paddingLeft))*g.x,E=w.top+(v.clientTop+parseFloat(y.paddingTop))*g.y;l*=g.x,u*=g.y,m*=g.x,a*=g.y,l+=b,u+=E,h=$(v),v=ut(h)}}return Fe({width:m,height:a,x:l,y:u})}function Ve(e,t){const n=je(e).scrollLeft;return t?t.left+n:ie(Q(e)).left+n}function Dn(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ve(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Fo(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Q(r),c=t?He(t.floating):!1;if(r===s||c&&i)return n;let l={scrollLeft:0,scrollTop:0},u=G(1);const m=G(0),a=ne(r);if((a||!i)&&((ge(r)!=="body"||Be(s))&&(l=je(r)),a)){const p=ie(r);u=de(r),m.x=p.x+r.clientLeft,m.y=p.y+r.clientTop}const d=s&&!a&&!i?Dn(s,l):G(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+m.x+d.x,y:n.y*u.y-l.scrollTop*u.y+m.y+d.y}}function _o(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ko(e){const t=je(e),n=e.ownerDocument.body,r=K(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=K(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+Ve(e);const s=-t.scrollTop;return z(n).direction==="rtl"&&(i+=K(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:s}}const Io=25;function Wo(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=$(e),i=Q(e),s=o.visualViewport;let c=i.clientWidth,l=i.clientHeight,u=0,m=0;if(s){const d=!wt()||t==="fixed";r?d||(u=-s.offsetLeft,m=-s.offsetTop):(c=s.width,l=s.height,d&&(u=s.offsetLeft,m=s.offsetTop))}if(Ve(i)<=0){const d=i.ownerDocument,p=d.body,h=getComputedStyle(p),v=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,g=Math.abs(i.clientWidth-p.clientWidth-v),w=getComputedStyle(i).scrollbarGutter==="stable both-edges"?g/2:g;w<=Io&&(c-=w)}return{width:c,height:l,x:u,y:m}}function $o(e,t){const n=ie(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=de(e),s=e.clientWidth*i.x,c=e.clientHeight*i.y,l=o*i.x,u=r*i.y;return{width:s,height:c,x:l,y:u}}function Ht(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Wo(e,n,t);else if(t==="document")r=ko(Q(e));else if(U(t))r=$o(t,n);else{const o=An(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Fe(r)}function Bo(e,t){const n=t.get(e);if(n)return n;let r=ye(e,[],!1).filter(c=>U(c)&&ge(c)!=="body"),o=null;const i=z(e).position==="fixed";let s=i?oe(e):e;for(;U(s)&&!we(s);){const c=z(s),l=gt(s),u=o?o.position:i?"fixed":"";!l&&(u==="fixed"||u==="absolute"&&c.position==="static")?r=r.filter(a=>a!==s):o=c,s=oe(s)}return t.set(e,r),r}function Ho(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?He(t)?[]:Bo(t,this._c):[].concat(n),r],c=Ht(t,s[0],o);let l=c.top,u=c.right,m=c.bottom,a=c.left;for(let d=1;d<s.length;d++){const p=Ht(t,s[d],o);l=K(p.top,l),u=ee(p.right,u),m=ee(p.bottom,m),a=K(p.left,a)}return{width:u-a,height:m-l,x:a,y:l}}function jo(e){const{width:t,height:n}=On(e);return{width:t,height:n}}function Vo(e,t,n){const r=ne(t),o=Q(t),i=n==="fixed",s=ie(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const l=G(0);if((r||!i)&&((ge(t)!=="body"||Be(o))&&(c=je(t)),r)){const d=ie(t,!0,i,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}!r&&o&&(l.x=Ve(o));const u=o&&!r&&!i?Dn(o,c):G(0),m=s.left+c.scrollLeft-l.x-u.x,a=s.top+c.scrollTop-l.y-u.y;return{x:m,y:a,width:s.width,height:s.height}}function Je(e){return z(e).position==="static"}function jt(e,t){if(!ne(e)||z(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Q(e)===n&&(n=n.ownerDocument.body),n}function Tn(e,t){const n=$(e);if(He(e))return n;if(!ne(e)){let o=oe(e);for(;o&&!we(o);){if(U(o)&&!Je(o))return o;o=oe(o)}return n}let r=jt(e,t);for(;r&&Ao(r)&&Je(r);)r=jt(r,t);return r&&we(r)&&Je(r)&&!gt(r)?n:r||Lo(e)||n}const Uo=async function(e){const t=this.getOffsetParent||Tn,n=this.getDimensions,r=await n(e.floating);return{reference:Vo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zo(e){return z(e).direction==="rtl"}const Xo={convertOffsetParentRelativeRectToViewportRelativeRect:Fo,getDocumentElement:Q,getClippingRect:Ho,getOffsetParent:Tn,getElementRects:Uo,getClientRects:_o,getDimensions:jo,getScale:de,isElement:U,isRTL:zo};function Ln(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Yo(e,t,n){let r=null,o;const i=Q(e);function s(){var m;clearTimeout(o),(m=r)==null||m.disconnect(),r=null}function c(m,a){m===void 0&&(m=!1),a===void 0&&(a=1),s();const d=e.getBoundingClientRect(),{left:p,top:h,width:v,height:g}=d;if(m||t(),!v||!g)return;const w=Oe(h),y=Oe(i.clientWidth-(p+v)),b=Oe(i.clientHeight-(h+g)),E=Oe(p),S={rootMargin:-w+"px "+-y+"px "+-b+"px "+-E+"px",threshold:K(0,ee(1,a))||1};let C=!0;function A(L){const O=L[0].intersectionRatio;if(!Ln(d,e.getBoundingClientRect()))return c();if(O!==a){if(!C)return c();O?c(!1,O):o=setTimeout(()=>{c(!1,1e-7)},1e3)}C=!1}try{r=new IntersectionObserver(A,{...S,root:i.ownerDocument})}catch{r=new IntersectionObserver(A,S)}r.observe(e)}const l=$(e),u=()=>c(n);return l.addEventListener("resize",u),c(!0),()=>{l.removeEventListener("resize",u),s()}}function Ko(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=yt(e),m=o||i?[...u?ye(u):[],...t?ye(t):[]]:[];m.forEach(w=>{o&&w.addEventListener("scroll",n),i&&w.addEventListener("resize",n)});const a=u&&c?Yo(u,n,i):null;let d=-1,p=null;s&&(p=new ResizeObserver(w=>{let[y]=w;y&&y.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(t)})),n()}),u&&!l&&p.observe(u),t&&p.observe(t));let h,v=l?ie(e):null;l&&g();function g(){const w=ie(e);v&&!Ln(v,w)&&n(),v=w,h=requestAnimationFrame(g)}return n(),()=>{var w;m.forEach(y=>{o&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),a?.(),(w=p)==null||w.disconnect(),p=null,l&&cancelAnimationFrame(h)}}const Go=Co,Zo=Ro,qo=Eo,Qo=Oo,Jo=xo,Vt=bo,ei=Po,ti=(e,t,n)=>{const r=new Map,o=n??{},i={...Xo,...o.platform,_c:r};return yo(e,t,{...o,platform:i})};var ni=typeof document<"u",ri=function(){},Le=ni?f.useLayoutEffect:ri;function _e(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!_e(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!_e(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Nn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ut(e,t){const n=Nn(e);return Math.round(t*n)/n}function et(e){const t=f.useRef(e);return Le(()=>{t.current=e}),t}function oi(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[m,a]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=f.useState(r);_e(d,r)||p(r);const[h,v]=f.useState(null),[g,w]=f.useState(null),y=f.useCallback(P=>{P!==S.current&&(S.current=P,v(P))},[]),b=f.useCallback(P=>{P!==C.current&&(C.current=P,w(P))},[]),E=i||h,x=s||g,S=f.useRef(null),C=f.useRef(null),A=f.useRef(m),L=l!=null,O=et(l),N=et(o),R=et(u),T=f.useCallback(()=>{if(!S.current||!C.current)return;const P={placement:t,strategy:n,middleware:d};N.current&&(P.platform=N.current),ti(S.current,C.current,P).then(F=>{const B={...F,isPositioned:R.current!==!1};D.current&&!_e(A.current,B)&&(A.current=B,zt.flushSync(()=>{a(B)}))})},[d,t,n,N,R]);Le(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,a(P=>({...P,isPositioned:!1})))},[u]);const D=f.useRef(!1);Le(()=>(D.current=!0,()=>{D.current=!1}),[]),Le(()=>{if(E&&(S.current=E),x&&(C.current=x),E&&x){if(O.current)return O.current(E,x,T);T()}},[E,x,T,O,L]);const I=f.useMemo(()=>({reference:S,floating:C,setReference:y,setFloating:b}),[y,b]),M=f.useMemo(()=>({reference:E,floating:x}),[E,x]),W=f.useMemo(()=>{const P={position:n,left:0,top:0};if(!M.floating)return P;const F=Ut(M.floating,m.x),B=Ut(M.floating,m.y);return c?{...P,transform:"translate("+F+"px, "+B+"px)",...Nn(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:B}},[n,c,M.floating,m.x,m.y]);return f.useMemo(()=>({...m,update:T,refs:I,elements:M,floatingStyles:W}),[m,T,I,M,W])}const ii=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Vt({element:r.current,padding:o}).fn(n):{}:r?Vt({element:r,padding:o}).fn(n):{}}}},si=(e,t)=>{const n=Go(e);return{name:n.name,fn:n.fn,options:[e,t]}},ci=(e,t)=>{const n=Zo(e);return{name:n.name,fn:n.fn,options:[e,t]}},ai=(e,t)=>({fn:ei(e).fn,options:[e,t]}),li=(e,t)=>{const n=qo(e);return{name:n.name,fn:n.fn,options:[e,t]}},ui=(e,t)=>{const n=Qo(e);return{name:n.name,fn:n.fn,options:[e,t]}},fi=(e,t)=>{const n=Jo(e);return{name:n.name,fn:n.fn,options:[e,t]}},di=(e,t)=>{const n=ii(e);return{name:n.name,fn:n.fn,options:[e,t]}};var mi=Object.defineProperty,J=(e,t)=>mi(e,"name",{value:t,configurable:!0}),Mn="Popper",[Fn,Li]=Kn(Mn),[hi,_n]=Fn(Mn),vi=J(e=>{const{__scopePopper:t,children:n}=e,[r,o]=f.useState(null),[i,s]=f.useState(void 0);return Y.jsx(hi,{scope:t,anchor:r,onAnchorChange:o,placementState:i,setPlacementState:s,children:n})},"Popper"),pi="PopperAnchor",gi=f.forwardRef(J(function(t,n){const{__scopePopper:r,virtualRef:o,...i}=t,s=_n(pi,r),c=f.useRef(null),l=s.onAnchorChange,u=f.useCallback(v=>{c.current=v,v&&l(v)},[l]),m=Ie(n,u),a=f.useRef(null);f.useEffect(()=>{if(!o)return;const v=a.current;a.current=o.current,v!==a.current&&l(a.current)});const d=s.placementState&&Ue(s.placementState),p=d?.[0],h=d?.[1];return o?null:Y.jsx(he.div,{"data-radix-popper-side":p,"data-radix-popper-align":h,...i,ref:m})},"PopperAnchor")),kn="PopperContent",[wi,Ni]=Fn(kn),yi=f.forwardRef(J(function(t,n){const{__scopePopper:r,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:m=[],collisionPadding:a=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:v,...g}=t,w=_n(kn,r),[y,b]=f.useState(null),E=Ie(n,b),[x,S]=f.useState(null),C=En(x),A=C?.width??0,L=C?.height??0,O=o+(s!=="center"?"-"+s:""),N=typeof a=="number"?a:{top:0,right:0,bottom:0,left:0,...a},R=Array.isArray(m)?m:[m],T=R.length>0,D={padding:N,boundary:R.filter(In),altBoundary:T},{refs:I,floatingStyles:M,placement:W,isPositioned:P,middlewareData:F}=oi({strategy:"fixed",placement:O,whileElementsMounted:J((...ze)=>Ko(...ze,{animationFrame:h==="always"}),"whileElementsMounted"),elements:{reference:w.anchor},middleware:[si({mainAxis:i+L,alignmentAxis:c}),u&&ci({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?ai():void 0,...D}),u&&li({...D}),ui({...D,apply:J(({elements:ze,rects:St,availableWidth:Vn,availableHeight:Un})=>{const{width:zn,height:Xn}=St.reference,Ee=ze.floating.style;Ee.setProperty("--radix-popper-available-width",`${Vn}px`),Ee.setProperty("--radix-popper-available-height",`${Un}px`),Ee.setProperty("--radix-popper-anchor-width",`${zn}px`),Ee.setProperty("--radix-popper-anchor-height",`${Xn}px`)},"apply")}),x&&di({element:x,padding:l}),bi({arrowWidth:A,arrowHeight:L}),p&&fi({strategy:"referenceHidden",...D,boundary:T?D.boundary:void 0})]}),B=w.setPlacementState;V(()=>(B(W),()=>{B(void 0)}),[W,B]);const[bt,Et]=Ue(W),xt=me(v);V(()=>{P&&xt?.()},[P,xt]);const Wn=F.arrow?.x,$n=F.arrow?.y,Bn=F.arrow?.centerOffset!==0,[Hn,jn]=f.useState();return V(()=>{y&&jn(window.getComputedStyle(y).zIndex)},[y]),Y.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:P?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Hn,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:Y.jsx(wi,{scope:r,placedSide:bt,placedAlign:Et,onArrowChange:S,arrowX:Wn,arrowY:$n,shouldHideArrow:Bn,children:Y.jsx(he.div,{"data-side":bt,"data-align":Et,...g,ref:E,style:{...g.style,animation:P?g.style?.animation:"none"}})})})},"PopperContent"));function In(e){return e!==null}J(In,"isNotNull");var bi=J(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,s=o.arrow?.centerOffset!==0,c=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[u,m]=Ue(n),a={start:"0%",center:"50%",end:"100%"}[m],d=(o.arrow?.x??0)+c/2,p=(o.arrow?.y??0)+l/2;let h="",v="";return u==="bottom"?(h=s?a:`${d}px`,v=`${-l}px`):u==="top"?(h=s?a:`${d}px`,v=`${r.floating.height+l}px`):u==="right"?(h=`${-l}px`,v=s?a:`${p}px`):u==="left"&&(h=`${r.floating.width+l}px`,v=s?a:`${p}px`),{data:{x:h,y:v}}}}),"transformOrigin");function Ue(e){const[t,n="center"]=e.split("-");return[t,n]}J(Ue,"getSideAndAlignFromPlacement");var Mi=vi,Fi=gi,_i=yi,Ei=Object.defineProperty,xi=(e,t)=>Ei(e,"name",{value:t,configurable:!0}),Si=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ci=f.forwardRef(xi(function(t,n){return Y.jsx(he.span,{...t,ref:n,style:{...Si,...t.style}})},"VisuallyHidden")),ki=Ci;export{Fi as A,_i as C,Pi as D,Oi as F,Ai as P,to as R,Si as V,Di as a,Li as b,Ae as c,dn as d,sr as e,Mi as f,fr as g,Ti as h,ki as i,tr as u};