@epam/ai-dial-chat-hooks 1.1.0-dev.383 → 1.1.0-dev.390

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 (319) hide show
  1. package/api-error-DuLNy43N.js +45 -0
  2. package/attachment-types-AAoN9E95.js +7760 -0
  3. package/{attachment/useAttachmentValidation/useAttachmentValidation.d.ts → attachments.d.ts} +88 -44
  4. package/attachments.js +2 -0
  5. package/browser-Btsa0Lmr.js +607 -0
  6. package/catalog.d.ts +946 -0
  7. package/catalog.js +3 -0
  8. package/{conversation-sources/useConversationSources/useConversationSources.d.ts → conversation-sources.d.ts} +25 -20
  9. package/conversation-sources.js +2 -0
  10. package/conversation-transfer.d.ts +189 -0
  11. package/conversation-transfer.js +3 -0
  12. package/conversation.d.ts +907 -0
  13. package/conversation.js +2 -0
  14. package/cron-weekday-B4w29eAC.js +4 -0
  15. package/date-BeuD8G79.js +4 -0
  16. package/deployment-id-CxWgJTs9.js +6 -0
  17. package/file-manager.d.ts +1344 -0
  18. package/file-manager.js +4 -0
  19. package/formatting-CZyyxBG3.js +4 -0
  20. package/index.d.ts +4945 -126
  21. package/index.js +27 -19152
  22. package/oauth.d.ts +440 -0
  23. package/oauth.js +3 -0
  24. package/package.json +142 -21
  25. package/prompt-resource-Bt1I-8ri.js +41 -0
  26. package/scheduled-task-trigger-D9RZCk52.js +145 -0
  27. package/{scheduled-task/scheduled-task-trigger.d.ts → scheduled-tasks.d.ts} +51 -27
  28. package/scheduled-tasks.js +2 -0
  29. package/{conversation/useConversationScroll/useConversationScroll.d.ts → scroll-anchoring.d.ts} +50 -46
  30. package/scroll-anchoring.js +2 -0
  31. package/{useShareRecipientsCount/useShareRecipientsCount.d.ts → sharing.d.ts} +65 -36
  32. package/sharing.js +3 -0
  33. package/skill-editor.d.ts +503 -0
  34. package/skill-editor.js +3 -0
  35. package/skill-manifest-CCX8s4nn.js +4035 -0
  36. package/{skill/useSkillsState/useSkillsState.d.ts → skills-state.d.ts} +40 -35
  37. package/skills-state.js +2 -0
  38. package/string-utils-iBi2Y55C.js +10 -0
  39. package/toolset-id-CkxRHyU0.js +10 -0
  40. package/useAttachmentValidation-CkMTd5lA.js +102 -0
  41. package/useConversationImport-C2h1GBY4.js +807 -0
  42. package/useConversationScroll-CliIMnjP.js +122 -0
  43. package/useConversationSources-DKaKvjXZ.js +47 -0
  44. package/useDialFileManagerTabConfig-DGQw8H8H.js +2289 -0
  45. package/usePanelMaxWidth-BEZYuqF9.js +44 -0
  46. package/useShareLink-xkiaxATt.js +44 -0
  47. package/useShareRecipientsCount-BgwCLKY0.js +37 -0
  48. package/useSkillFileActions-BU5PzZ_8.js +373 -0
  49. package/useSkillFilePreview-BYfZUJhr.js +1005 -0
  50. package/useSkillsState-BoLlwmzb.js +52 -0
  51. package/useToolsMenu-BXdahO0i.js +1874 -0
  52. package/useToolsetLogin-GhFtKs4D.js +276 -0
  53. package/useUsageData-D7BxloKZ.js +201 -0
  54. package/utils.d.ts +373 -0
  55. package/utils.js +7 -0
  56. package/{usePageFileDrag/usePageFileDrag.d.ts → viewport-layout.d.ts} +27 -16
  57. package/viewport-layout.js +2 -0
  58. package/api-error/api-error.d.ts +0 -18
  59. package/api-error/api-error.d.ts.map +0 -1
  60. package/api-transport/create-csrf-middleware.d.ts +0 -15
  61. package/api-transport/create-csrf-middleware.d.ts.map +0 -1
  62. package/api-transport/create-unauthorized-middleware.d.ts +0 -40
  63. package/api-transport/create-unauthorized-middleware.d.ts.map +0 -1
  64. package/attachment/useAttachmentAction/useAttachmentAction.d.ts +0 -32
  65. package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +0 -1
  66. package/attachment/useAttachmentValidation/useAttachmentValidation.d.ts.map +0 -1
  67. package/catalog/catalog-derivations.d.ts +0 -27
  68. package/catalog/catalog-derivations.d.ts.map +0 -1
  69. package/catalog/catalog-primary-action.d.ts +0 -47
  70. package/catalog/catalog-primary-action.d.ts.map +0 -1
  71. package/catalog/create-publish-api.d.ts +0 -32
  72. package/catalog/create-publish-api.d.ts.map +0 -1
  73. package/catalog/deployment-endpoint-url.d.ts +0 -19
  74. package/catalog/deployment-endpoint-url.d.ts.map +0 -1
  75. package/catalog/deployment-id.d.ts +0 -21
  76. package/catalog/deployment-id.d.ts.map +0 -1
  77. package/catalog/entity-details.d.ts +0 -132
  78. package/catalog/entity-details.d.ts.map +0 -1
  79. package/catalog/map-deployment-limits-to-catalog.d.ts +0 -33
  80. package/catalog/map-deployment-limits-to-catalog.d.ts.map +0 -1
  81. package/catalog/map-deployment-limits-to-input.d.ts +0 -15
  82. package/catalog/map-deployment-limits-to-input.d.ts.map +0 -1
  83. package/catalog/map-deployment-to-catalog-item.d.ts +0 -60
  84. package/catalog/map-deployment-to-catalog-item.d.ts.map +0 -1
  85. package/catalog/map-entity-details-to-catalog.d.ts +0 -23
  86. package/catalog/map-entity-details-to-catalog.d.ts.map +0 -1
  87. package/catalog/map-prompt-to-catalog-item.d.ts +0 -43
  88. package/catalog/map-prompt-to-catalog-item.d.ts.map +0 -1
  89. package/catalog/map-skill-to-catalog-item.d.ts +0 -87
  90. package/catalog/map-skill-to-catalog-item.d.ts.map +0 -1
  91. package/catalog/mcp-endpoint-url.d.ts +0 -18
  92. package/catalog/mcp-endpoint-url.d.ts.map +0 -1
  93. package/catalog/publish.d.ts +0 -17
  94. package/catalog/publish.d.ts.map +0 -1
  95. package/catalog/useCatalogItemDetails.d.ts +0 -73
  96. package/catalog/useCatalogItemDetails.d.ts.map +0 -1
  97. package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.d.ts +0 -37
  98. package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.d.ts.map +0 -1
  99. package/catalog/usePublishFolders/usePublishFolders.d.ts +0 -73
  100. package/catalog/usePublishFolders/usePublishFolders.d.ts.map +0 -1
  101. package/conversation/announcement-message.d.ts +0 -34
  102. package/conversation/announcement-message.d.ts.map +0 -1
  103. package/conversation/conversation-transfer/async.d.ts +0 -10
  104. package/conversation/conversation-transfer/async.d.ts.map +0 -1
  105. package/conversation/conversation-transfer/attachment-refs.d.ts +0 -12
  106. package/conversation/conversation-transfer/attachment-refs.d.ts.map +0 -1
  107. package/conversation/conversation-transfer/build-upload-path.d.ts +0 -40
  108. package/conversation/conversation-transfer/build-upload-path.d.ts.map +0 -1
  109. package/conversation/conversation-transfer/date.d.ts +0 -5
  110. package/conversation/conversation-transfer/date.d.ts.map +0 -1
  111. package/conversation/conversation-transfer/dial-file-resolve.d.ts +0 -10
  112. package/conversation/conversation-transfer/dial-file-resolve.d.ts.map +0 -1
  113. package/conversation/conversation-transfer/export-conversation.d.ts +0 -8
  114. package/conversation/conversation-transfer/export-conversation.d.ts.map +0 -1
  115. package/conversation/conversation-transfer/import-conversation.d.ts +0 -82
  116. package/conversation/conversation-transfer/import-conversation.d.ts.map +0 -1
  117. package/conversation/conversation-transfer/progress.d.ts +0 -60
  118. package/conversation/conversation-transfer/progress.d.ts.map +0 -1
  119. package/conversation/conversation-transfer/queue.d.ts +0 -54
  120. package/conversation/conversation-transfer/queue.d.ts.map +0 -1
  121. package/conversation/conversation-transfer/types.d.ts +0 -36
  122. package/conversation/conversation-transfer/types.d.ts.map +0 -1
  123. package/conversation/conversation-transfer/zip-export.d.ts +0 -31
  124. package/conversation/conversation-transfer/zip-export.d.ts.map +0 -1
  125. package/conversation/conversation-transfer/zip-import.d.ts +0 -17
  126. package/conversation/conversation-transfer/zip-import.d.ts.map +0 -1
  127. package/conversation/create-chat-stream-api.d.ts +0 -38
  128. package/conversation/create-chat-stream-api.d.ts.map +0 -1
  129. package/conversation/deriveConversationRowActionState/deriveConversationRowActionState.d.ts +0 -39
  130. package/conversation/deriveConversationRowActionState/deriveConversationRowActionState.d.ts.map +0 -1
  131. package/conversation/display-name-watch.d.ts +0 -4
  132. package/conversation/display-name-watch.d.ts.map +0 -1
  133. package/conversation/footer-message.d.ts +0 -10
  134. package/conversation/footer-message.d.ts.map +0 -1
  135. package/conversation/get-model-id-from-conversation-id.d.ts +0 -27
  136. package/conversation/get-model-id-from-conversation-id.d.ts.map +0 -1
  137. package/conversation/greeting.d.ts +0 -18
  138. package/conversation/greeting.d.ts.map +0 -1
  139. package/conversation/message-factory.d.ts +0 -7
  140. package/conversation/message-factory.d.ts.map +0 -1
  141. package/conversation/message-utils.d.ts +0 -27
  142. package/conversation/message-utils.d.ts.map +0 -1
  143. package/conversation/overlay-messages.d.ts +0 -5
  144. package/conversation/overlay-messages.d.ts.map +0 -1
  145. package/conversation/quick-app-conversation-starters.d.ts +0 -10
  146. package/conversation/quick-app-conversation-starters.d.ts.map +0 -1
  147. package/conversation/starter-option.d.ts +0 -21
  148. package/conversation/starter-option.d.ts.map +0 -1
  149. package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts +0 -34
  150. package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts.map +0 -1
  151. package/conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.d.ts +0 -46
  152. package/conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.d.ts.map +0 -1
  153. package/conversation/useAttachmentUpload/useAttachmentUpload.d.ts +0 -26
  154. package/conversation/useAttachmentUpload/useAttachmentUpload.d.ts.map +0 -1
  155. package/conversation/useConversationExport/useConversationExport.d.ts +0 -72
  156. package/conversation/useConversationExport/useConversationExport.d.ts.map +0 -1
  157. package/conversation/useConversationHandlers/attachment-to-dto.d.ts +0 -7
  158. package/conversation/useConversationHandlers/attachment-to-dto.d.ts.map +0 -1
  159. package/conversation/useConversationHandlers/message-factory.d.ts +0 -9
  160. package/conversation/useConversationHandlers/message-factory.d.ts.map +0 -1
  161. package/conversation/useConversationHandlers/message-utils.d.ts +0 -14
  162. package/conversation/useConversationHandlers/message-utils.d.ts.map +0 -1
  163. package/conversation/useConversationHandlers/starter-option.d.ts +0 -14
  164. package/conversation/useConversationHandlers/starter-option.d.ts.map +0 -1
  165. package/conversation/useConversationHandlers/useConversationHandlers.d.ts +0 -66
  166. package/conversation/useConversationHandlers/useConversationHandlers.d.ts.map +0 -1
  167. package/conversation/useConversationImport/useConversationImport.d.ts +0 -53
  168. package/conversation/useConversationImport/useConversationImport.d.ts.map +0 -1
  169. package/conversation/useConversationLookupMaps/useConversationLookupMaps.d.ts +0 -24
  170. package/conversation/useConversationLookupMaps/useConversationLookupMaps.d.ts.map +0 -1
  171. package/conversation/useConversationPanelItems/useConversationPanelItems.d.ts +0 -58
  172. package/conversation/useConversationPanelItems/useConversationPanelItems.d.ts.map +0 -1
  173. package/conversation/useConversationScroll/useConversationScroll.d.ts.map +0 -1
  174. package/conversation/useConversationStream/apply-chunk.d.ts +0 -20
  175. package/conversation/useConversationStream/apply-chunk.d.ts.map +0 -1
  176. package/conversation/useConversationStream/buffered-generation.d.ts +0 -15
  177. package/conversation/useConversationStream/buffered-generation.d.ts.map +0 -1
  178. package/conversation/useConversationStream/conversation-path.d.ts +0 -7
  179. package/conversation/useConversationStream/conversation-path.d.ts.map +0 -1
  180. package/conversation/useConversationStream/generation-resume.d.ts +0 -39
  181. package/conversation/useConversationStream/generation-resume.d.ts.map +0 -1
  182. package/conversation/useConversationStream/useConversationStream.d.ts +0 -92
  183. package/conversation/useConversationStream/useConversationStream.d.ts.map +0 -1
  184. package/conversation/useImportFilePicker/useImportFilePicker.d.ts +0 -32
  185. package/conversation/useImportFilePicker/useImportFilePicker.d.ts.map +0 -1
  186. package/conversation-sources/useConversationSources/useConversationSources.d.ts.map +0 -1
  187. package/files/annotation.d.ts +0 -10
  188. package/files/annotation.d.ts.map +0 -1
  189. package/files/attachment-canvas.d.ts +0 -104
  190. package/files/attachment-canvas.d.ts.map +0 -1
  191. package/files/attachment-dto-to-display.d.ts +0 -10
  192. package/files/attachment-dto-to-display.d.ts.map +0 -1
  193. package/files/attachment-types.d.ts +0 -14
  194. package/files/attachment-types.d.ts.map +0 -1
  195. package/files/create-files-api.d.ts +0 -52
  196. package/files/create-files-api.d.ts.map +0 -1
  197. package/files/create-upload-file-with-progress.d.ts +0 -24
  198. package/files/create-upload-file-with-progress.d.ts.map +0 -1
  199. package/files/dial-file-manager-copy-move.util.d.ts +0 -15
  200. package/files/dial-file-manager-copy-move.util.d.ts.map +0 -1
  201. package/files/dial-file-manager-mapping.util.d.ts +0 -35
  202. package/files/dial-file-manager-mapping.util.d.ts.map +0 -1
  203. package/files/dial-file-manager-path.util.d.ts +0 -39
  204. package/files/dial-file-manager-path.util.d.ts.map +0 -1
  205. package/files/dial-file-manager.model.d.ts +0 -26
  206. package/files/dial-file-manager.model.d.ts.map +0 -1
  207. package/files/dial-file-manager.types.d.ts +0 -317
  208. package/files/dial-file-manager.types.d.ts.map +0 -1
  209. package/files/dial-file-to-attachment.d.ts +0 -26
  210. package/files/dial-file-to-attachment.d.ts.map +0 -1
  211. package/files/dial-file.d.ts +0 -17
  212. package/files/dial-file.d.ts.map +0 -1
  213. package/files/dial-files-api.d.ts +0 -71
  214. package/files/dial-files-api.d.ts.map +0 -1
  215. package/files/download-destination.d.ts +0 -31
  216. package/files/download-destination.d.ts.map +0 -1
  217. package/files/file-manager-variant.d.ts +0 -4
  218. package/files/file-manager-variant.d.ts.map +0 -1
  219. package/files/file-name.d.ts +0 -19
  220. package/files/file-name.d.ts.map +0 -1
  221. package/files/prepare-download-destination.d.ts +0 -8
  222. package/files/prepare-download-destination.d.ts.map +0 -1
  223. package/files/resolve-dial-file-api-path.d.ts +0 -13
  224. package/files/resolve-dial-file-api-path.d.ts.map +0 -1
  225. package/files/useDialFileListing/useDialFileListing.d.ts +0 -73
  226. package/files/useDialFileListing/useDialFileListing.d.ts.map +0 -1
  227. package/files/useDialFileManager/useDialFileManager.d.ts +0 -16
  228. package/files/useDialFileManager/useDialFileManager.d.ts.map +0 -1
  229. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.d.ts +0 -14
  230. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.d.ts.map +0 -1
  231. package/files/useDialFileMetadata/useDialFileMetadata.d.ts +0 -28
  232. package/files/useDialFileMetadata/useDialFileMetadata.d.ts.map +0 -1
  233. package/files/useDialFileMutations/useDialFileMutations.d.ts +0 -68
  234. package/files/useDialFileMutations/useDialFileMutations.d.ts.map +0 -1
  235. package/files/useDialFileSharing/useDialFileSharing.d.ts +0 -30
  236. package/files/useDialFileSharing/useDialFileSharing.d.ts.map +0 -1
  237. package/files/useDialFileUploadBatch/useDialFileUploadBatch.d.ts +0 -45
  238. package/files/useDialFileUploadBatch/useDialFileUploadBatch.d.ts.map +0 -1
  239. package/index.d.ts.map +0 -1
  240. package/oauth/authorize-url.d.ts +0 -16
  241. package/oauth/authorize-url.d.ts.map +0 -1
  242. package/oauth/handshake.d.ts +0 -30
  243. package/oauth/handshake.d.ts.map +0 -1
  244. package/oauth/models.d.ts +0 -81
  245. package/oauth/models.d.ts.map +0 -1
  246. package/oauth/popup.d.ts +0 -30
  247. package/oauth/popup.d.ts.map +0 -1
  248. package/oauth/toolset-id.d.ts +0 -23
  249. package/oauth/toolset-id.d.ts.map +0 -1
  250. package/oauth/types.d.ts +0 -84
  251. package/oauth/types.d.ts.map +0 -1
  252. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.d.ts +0 -54
  253. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.d.ts.map +0 -1
  254. package/oauth/useToolsetLogin/useToolsetLogin.d.ts +0 -79
  255. package/oauth/useToolsetLogin/useToolsetLogin.d.ts.map +0 -1
  256. package/prompt/export-prompt.d.ts +0 -31
  257. package/prompt/export-prompt.d.ts.map +0 -1
  258. package/prompt/prompt-resource.d.ts +0 -30
  259. package/prompt/prompt-resource.d.ts.map +0 -1
  260. package/prompt/prompt.d.ts +0 -34
  261. package/prompt/prompt.d.ts.map +0 -1
  262. package/prompt/usePromptsState/usePromptsState.d.ts +0 -34
  263. package/prompt/usePromptsState/usePromptsState.d.ts.map +0 -1
  264. package/scheduled-task/scheduled-task-mapping.d.ts +0 -19
  265. package/scheduled-task/scheduled-task-mapping.d.ts.map +0 -1
  266. package/scheduled-task/scheduled-task-trigger.d.ts.map +0 -1
  267. package/shared/application-schema.d.ts +0 -10
  268. package/shared/application-schema.d.ts.map +0 -1
  269. package/shared/browser-timezone.d.ts +0 -7
  270. package/shared/browser-timezone.d.ts.map +0 -1
  271. package/shared/cron-weekday.d.ts +0 -5
  272. package/shared/cron-weekday.d.ts.map +0 -1
  273. package/shared/custom-apps.d.ts +0 -7
  274. package/shared/custom-apps.d.ts.map +0 -1
  275. package/shared/external-services.d.ts +0 -16
  276. package/shared/external-services.d.ts.map +0 -1
  277. package/shared/formatting.d.ts +0 -5
  278. package/shared/formatting.d.ts.map +0 -1
  279. package/shared/locale.d.ts +0 -45
  280. package/shared/locale.d.ts.map +0 -1
  281. package/shared/string-utils.d.ts +0 -9
  282. package/shared/string-utils.d.ts.map +0 -1
  283. package/shared/toolset-login-events.d.ts +0 -15
  284. package/shared/toolset-login-events.d.ts.map +0 -1
  285. package/skill/skill-file-batch-validation.d.ts +0 -70
  286. package/skill/skill-file-batch-validation.d.ts.map +0 -1
  287. package/skill/skill-file-preview.d.ts +0 -25
  288. package/skill/skill-file-preview.d.ts.map +0 -1
  289. package/skill/skill-manifest.d.ts +0 -28
  290. package/skill/skill-manifest.d.ts.map +0 -1
  291. package/skill/skill-types.d.ts +0 -42
  292. package/skill/skill-types.d.ts.map +0 -1
  293. package/skill/skill.d.ts +0 -114
  294. package/skill/skill.d.ts.map +0 -1
  295. package/skill/useSkillEditorLoad.d.ts +0 -74
  296. package/skill/useSkillEditorLoad.d.ts.map +0 -1
  297. package/skill/useSkillEditorSubmit.d.ts +0 -105
  298. package/skill/useSkillEditorSubmit.d.ts.map +0 -1
  299. package/skill/useSkillFileActions.d.ts +0 -53
  300. package/skill/useSkillFileActions.d.ts.map +0 -1
  301. package/skill/useSkillFilePreview.d.ts +0 -38
  302. package/skill/useSkillFilePreview.d.ts.map +0 -1
  303. package/skill/useSkillsState/useSkillsState.d.ts.map +0 -1
  304. package/test-setup.d.ts +0 -2
  305. package/test-setup.d.ts.map +0 -1
  306. package/usage/useUsageData/useUsageData.d.ts +0 -20
  307. package/usage/useUsageData/useUsageData.d.ts.map +0 -1
  308. package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts +0 -128
  309. package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts.map +0 -1
  310. package/usePageFileDrag/usePageFileDrag.d.ts.map +0 -1
  311. package/usePanelMaxWidth/usePanelMaxWidth.d.ts +0 -6
  312. package/usePanelMaxWidth/usePanelMaxWidth.d.ts.map +0 -1
  313. package/useShareLink/useShareLink.d.ts +0 -23
  314. package/useShareLink/useShareLink.d.ts.map +0 -1
  315. package/useShareRecipientsCount/useShareRecipientsCount.d.ts.map +0 -1
  316. package/useToolsMenu/useToolsMenu.d.ts +0 -31
  317. package/useToolsMenu/useToolsMenu.d.ts.map +0 -1
  318. package/useViewportWidth/useViewportWidth.d.ts +0 -3
  319. package/useViewportWidth/useViewportWidth.d.ts.map +0 -1
@@ -0,0 +1,276 @@
1
+ import { generateUUID as e } from "@epam/ai-dial-chat-shared";
2
+ import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
3
+ //#region src/oauth/authorize-url.ts
4
+ var a = (e) => `${window.location.origin}${e}`, o = (e) => e === "localhost" || e === "[::1]" || /^127(?:\.\d{1,3}){3}$/.test(e), s = (e) => e.protocol === "https:" ? !0 : e.protocol === "http:" && o(e.hostname), c = (e, t, n) => {
5
+ if (!e.authorizationEndpoint?.trim() || !e.clientId?.trim()) return null;
6
+ try {
7
+ let r = new URL(e.authorizationEndpoint.trim());
8
+ return s(r) ? (r.searchParams.set("response_type", "code"), r.searchParams.set("client_id", e.clientId.trim()), r.searchParams.set("redirect_uri", t), e.codeChallenge && r.searchParams.set("code_challenge", e.codeChallenge), e.codeChallengeMethod && r.searchParams.set("code_challenge_method", e.codeChallengeMethod), r.searchParams.set("state", n), e.scopes && e.scopes.length > 0 && r.searchParams.set("scope", e.scopes.join(" ")), r.toString()) : null;
9
+ } catch {
10
+ return null;
11
+ }
12
+ }, l = /* @__PURE__ */ function(e) {
13
+ return e.None = "NONE", e.ApiKey = "API_KEY", e.OAuth = "OAUTH", e;
14
+ }({}), u = /* @__PURE__ */ function(e) {
15
+ return e.SignedIn = "SIGNED_IN", e.SignedOut = "SIGNED_OUT", e.Failed = "FAILED", e;
16
+ }({}), d = /* @__PURE__ */ function(e) {
17
+ return e.Global = "GLOBAL", e.User = "USER", e.App = "APP", e;
18
+ }({}), f = /* @__PURE__ */ function(e) {
19
+ return e.WithLogin = "with-login", e.WithoutLogin = "without-login", e.WithConfig = "with-config", e;
20
+ }({}), p = /* @__PURE__ */ function(e) {
21
+ return e.Toolset = "toolset", e.ExternalService = "external-service", e.OfflineCredentials = "offline-credentials", e;
22
+ }({}), m = /* @__PURE__ */ function(e) {
23
+ return e.Started = "started", e.Blocked = "blocked", e.InvalidConfig = "invalid-config", e;
24
+ }({}), h = /* @__PURE__ */ function(e) {
25
+ return e.Success = "success", e.Failure = "failure", e.Cancelled = "cancelled", e;
26
+ }({}), g = /* @__PURE__ */ function(e) {
27
+ return e.MissingCode = "missing-code", e.MissingRedirectState = "missing-redirect-state", e.StateMismatch = "state-mismatch", e.LoginRequestFailed = "login-request-failed", e;
28
+ }({}), _ = /* @__PURE__ */ function(e) {
29
+ return e.ResultAcknowledged = "result-acknowledged", e;
30
+ }({}), v = /* @__PURE__ */ function(e) {
31
+ return e.Result = "toolsetOAuthResult", e.FailureReason = "toolsetOAuthFailureReason", e;
32
+ }({}), y = "toolset-redirect-state", b = "toolset-oauth-", x = (e) => `${b}${e}`, S = 300 * 1e3, C = 500, w = (e) => {
33
+ switch (e) {
34
+ case g.MissingCode:
35
+ case g.MissingRedirectState:
36
+ case g.StateMismatch:
37
+ case g.LoginRequestFailed: return e;
38
+ default: return g.LoginRequestFailed;
39
+ }
40
+ }, T = (e) => typeof e == "object" && !!e && "type" in e && (e.type === h.Success || e.type === h.Failure), E = (e, t, { toolsetId: n, credentialsLevel: r, callbackPath: i, timeoutMs: a = S, pollIntervalMs: o = C }) => new Promise((s) => {
41
+ let c, l = !1, u = () => {
42
+ let e = c;
43
+ c = void 0, e != null && setTimeout(() => e.close(), 0);
44
+ }, d = (e) => {
45
+ l || (l = !0, clearInterval(g), clearTimeout(y), window.removeEventListener("focus", m), u(), s(e));
46
+ }, f = (t) => {
47
+ c?.postMessage({ type: _.ResultAcknowledged });
48
+ try {
49
+ e.close();
50
+ } catch {}
51
+ d(t);
52
+ }, p = () => {
53
+ try {
54
+ let t = new URL(e.location.href);
55
+ if (t.origin !== window.location.origin || t.pathname !== i) return null;
56
+ let a = t.searchParams.get(v.Result);
57
+ if (a === h.Success) return {
58
+ type: h.Success,
59
+ toolsetId: n,
60
+ credentialsLevel: r
61
+ };
62
+ if (a === h.Failure) return {
63
+ type: h.Failure,
64
+ reason: w(t.searchParams.get(v.FailureReason))
65
+ };
66
+ } catch {}
67
+ return null;
68
+ }, m = () => {
69
+ let t = p();
70
+ if (t != null) {
71
+ f(t);
72
+ return;
73
+ }
74
+ e.closed && d({ type: h.Cancelled });
75
+ };
76
+ try {
77
+ c = new BroadcastChannel(x(t)), c.onmessage = (e) => {
78
+ T(e.data) && f(e.data);
79
+ };
80
+ } catch {}
81
+ window.addEventListener("focus", m);
82
+ let g = setInterval(() => {
83
+ let e = p();
84
+ if (e != null) {
85
+ f(e);
86
+ return;
87
+ }
88
+ }, o), y = setTimeout(() => {
89
+ e.close(), d({ type: h.Cancelled });
90
+ }, a), b = p();
91
+ b != null && f(b);
92
+ }), D = (e, t, n, r, i, a, o = p.Toolset, s) => {
93
+ let c = {
94
+ toolsetId: r,
95
+ credentialsLevel: i,
96
+ redirectUri: a,
97
+ state: n,
98
+ resourceKind: o,
99
+ offlineUsageConsent: s
100
+ };
101
+ return e.sessionStorage.setItem(y, JSON.stringify(c)), e.opener = null, e.location.href = t, {
102
+ type: m.Started,
103
+ popup: e,
104
+ flowId: n
105
+ };
106
+ }, O = () => window.open("", "_blank"), k = (t, n, r, i, o = d.User, s = p.Toolset, l) => {
107
+ let u = a(i), f = e(), h = c(n, u, f);
108
+ return h ? D(t, h, f, r, o, u, s, l) : (t.close(), { type: m.InvalidConfig });
109
+ }, A = (t, n, r, i = d.User, o) => {
110
+ let s = a(r), l = e(), u = c(t, s, l);
111
+ if (!u) return { type: m.InvalidConfig };
112
+ let f = O();
113
+ return f ? D(f, u, l, n, i, s, p.Toolset, o) : { type: m.Blocked };
114
+ }, j = 500, M = (e) => typeof e == "object" && !!e && "type" in e && e.type === _.ResultAcknowledged, N = () => {
115
+ let e = sessionStorage.getItem(y);
116
+ if (!e) return null;
117
+ try {
118
+ return JSON.parse(e);
119
+ } catch {
120
+ return null;
121
+ }
122
+ }, P = (e) => {
123
+ try {
124
+ window.history.replaceState({}, document.title, `${e.pathname}${e.search}`);
125
+ } catch {}
126
+ }, F = (e, t) => {
127
+ let n = new URL(window.location.pathname, window.location.origin);
128
+ if (n.searchParams.set(v.Result, t.type), t.type === h.Failure && n.searchParams.set(v.FailureReason, t.reason), P(n), !e) {
129
+ window.close();
130
+ return;
131
+ }
132
+ try {
133
+ let n = new BroadcastChannel(x(e));
134
+ n.postMessage(t);
135
+ let r = setInterval(() => {
136
+ n.postMessage(t);
137
+ }, j);
138
+ n.onmessage = (e) => {
139
+ M(e.data) && (clearInterval(r), n.close(), window.close());
140
+ };
141
+ } catch {}
142
+ }, I = ({ searchParams: e, callbackPath: t, exchange: a }) => {
143
+ let [o, s] = i(!0), [c, l] = i(null), u = r(!1), f = r(a);
144
+ f.current = a;
145
+ let p = r(t);
146
+ return p.current = t, n(() => {
147
+ if (u.current) return;
148
+ u.current = !0;
149
+ let t = (e, t) => {
150
+ F(e, t), s(!1), l(t.type === h.Failure ? t.reason : null);
151
+ };
152
+ (async () => {
153
+ let n = e.get("code"), r = e.get("state"), i = N();
154
+ sessionStorage.removeItem(y);
155
+ let a = i?.state ?? r ?? void 0;
156
+ if (P(new URL(window.location.pathname, window.location.origin)), !n || !i?.toolsetId) {
157
+ t(a, {
158
+ type: h.Failure,
159
+ reason: i?.toolsetId ? g.MissingCode : g.MissingRedirectState
160
+ });
161
+ return;
162
+ }
163
+ if (i.state != null && i.state !== r) {
164
+ t(a, {
165
+ type: h.Failure,
166
+ reason: g.StateMismatch
167
+ });
168
+ return;
169
+ }
170
+ let o = i.credentialsLevel ?? d.User, s = i.redirectUri ?? `${window.location.origin}${p.current}`;
171
+ try {
172
+ let e = await f.current({
173
+ code: n,
174
+ redirectUri: s,
175
+ credentialsLevel: o,
176
+ redirectState: i
177
+ });
178
+ if (e != null) {
179
+ t(a, {
180
+ type: h.Failure,
181
+ reason: e
182
+ });
183
+ return;
184
+ }
185
+ t(a, {
186
+ type: h.Success,
187
+ toolsetId: i.toolsetId,
188
+ credentialsLevel: o
189
+ });
190
+ } catch {
191
+ t(a, {
192
+ type: h.Failure,
193
+ reason: g.LoginRequestFailed
194
+ });
195
+ }
196
+ })();
197
+ }, [e]), {
198
+ isInProgress: o,
199
+ failureReason: c
200
+ };
201
+ }, L = "toolset-login-success", R = new EventTarget(), z = (e) => {
202
+ R.dispatchEvent(new CustomEvent(L, { detail: e }));
203
+ }, B = (e) => {
204
+ let t = (t) => {
205
+ e(t.detail);
206
+ };
207
+ return R.addEventListener(L, t), () => {
208
+ R.removeEventListener(L, t);
209
+ };
210
+ }, V = /* @__PURE__ */ function(e) {
211
+ return e.Success = "success", e.Failure = "failure", e.PopupBlocked = "popup-blocked", e.Cancelled = "cancelled", e;
212
+ }({}), H = ({ callbackPath: e, loginToolset: n, logoutToolset: r, getToolset: i }) => {
213
+ let a = t(async (e, t, n) => {
214
+ try {
215
+ await r(e, {
216
+ url: e,
217
+ credentialsLevel: t,
218
+ authenticationType: n
219
+ });
220
+ } catch {}
221
+ }, [r]), o = t(async (t) => {
222
+ let { toolsetId: n, credentialsLevel: r, oauthSettings: o, forceStale: s, offlineUsageConsent: c } = t, f = {
223
+ clientId: o?.clientId,
224
+ authorizationEndpoint: o?.authorizationEndpoint,
225
+ scopes: o?.scopes,
226
+ codeChallenge: o?.codeChallenge,
227
+ codeChallengeMethod: o?.codeChallengeMethod
228
+ }, g = s ? await (async () => {
229
+ let t = O();
230
+ return t ? (await a(n, r, l.OAuth), k(t, f, n, e, r, p.Toolset, c)) : { type: m.Blocked };
231
+ })() : A(f, n, e, r, c);
232
+ if (g.type === m.Blocked) return { type: "popup-blocked" };
233
+ if (g.type !== m.Started) return { type: "failure" };
234
+ let _ = await E(g.popup, g.flowId, {
235
+ toolsetId: n,
236
+ credentialsLevel: r,
237
+ callbackPath: e
238
+ });
239
+ if (_.type === h.Success) return z({
240
+ toolsetId: n,
241
+ credentialsLevel: r
242
+ }), { type: "success" };
243
+ if (_.type === h.Failure) return { type: "failure" };
244
+ try {
245
+ let e = await i(n);
246
+ if ((r === d.User ? e.authSettings?.userLevelAuthStatus : e.authSettings?.globalAuthStatus) === u.SignedIn) return z({
247
+ toolsetId: n,
248
+ credentialsLevel: r
249
+ }), { type: "success" };
250
+ } catch {}
251
+ return { type: "cancelled" };
252
+ }, [
253
+ e,
254
+ i,
255
+ a
256
+ ]), s = t(async (e) => {
257
+ let { toolsetId: t, credentialsLevel: r, authenticationType: i, apiKey: o, isCurrentlyFailed: s, forceStale: c, offlineUsageConsent: l } = e;
258
+ try {
259
+ return (c || s) && await a(t, r, i), await n(t, {
260
+ url: t,
261
+ credentialsLevel: r,
262
+ authenticationType: i,
263
+ apiKey: o?.trim(),
264
+ offlineUsageConsent: l
265
+ }), z({
266
+ toolsetId: t,
267
+ credentialsLevel: r
268
+ }), { type: "success" };
269
+ } catch {
270
+ return { type: "failure" };
271
+ }
272
+ }, [n, a]);
273
+ return { login: t((e) => e.authenticationType === l.OAuth ? o(e) : s(e), [o, s]) };
274
+ };
275
+ //#endregion
276
+ export { a as C, c as S, _, I as a, h as b, O as c, p as d, y as f, v as g, d as h, B as i, x as l, l as m, H as n, A as o, u as p, z as r, k as s, V as t, E as u, g as v, f as x, m as y };
@@ -0,0 +1,201 @@
1
+ import { n as e } from "./date-BeuD8G79.js";
2
+ import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
3
+ //#region src/api-transport/create-csrf-middleware.ts
4
+ var a = (e) => ({
5
+ pre: async (t) => {
6
+ let n = e.getCsrfToken();
7
+ if (t.init.method === "GET" || n === null) return t;
8
+ let r = new Headers(t.init.headers);
9
+ return r.set("X-CSRF-Token", n), {
10
+ ...t,
11
+ init: {
12
+ ...t.init,
13
+ headers: r
14
+ }
15
+ };
16
+ },
17
+ post: async (t) => {
18
+ let n = t.response.headers.get("x-csrf-token");
19
+ return n && e.setCsrfToken(n), t.response;
20
+ }
21
+ }), o = async (e) => {
22
+ try {
23
+ return await e.clone().text();
24
+ } catch {
25
+ return "";
26
+ }
27
+ }, s = (e) => new Headers(e.headers).get("X-CSRF-Token"), c = (e, t) => {
28
+ let n = new Headers(e.init.headers);
29
+ return e.init.method !== "GET" && n.set("X-CSRF-Token", t), fetch(e.url, {
30
+ ...e.init,
31
+ headers: n
32
+ });
33
+ }, l = (e) => {
34
+ let t = async (t) => {
35
+ let n = s(t.init), r = e.getCsrfToken();
36
+ if (r !== null && r !== n) return c(t, r);
37
+ let i = await e.refreshCsrfToken();
38
+ if (i.status === "unauthorized") throw e.notifyUnauthorized(t.url), e.createUnauthorizedError(t.url);
39
+ if (i.status !== "ok") throw Error(`CSRF refresh failed for ${t.url}`);
40
+ return c(t, i.token);
41
+ }, n = async (t, n) => {
42
+ let r = n.headers.get("x-csrf-token");
43
+ if (r && e.setCsrfToken(r), n.status === 401) throw e.notifyUnauthorized(t.url), e.createUnauthorizedError(t.url);
44
+ if (!n.ok) {
45
+ let r = await o(n);
46
+ throw n.status === 403 && e.isInvalidCsrfErrorBody(r) ? (e.notifyUnauthorized(t.url), e.createUnauthorizedError(t.url)) : Error(`Request failed with status ${n.status} for ${t.init.method ?? "GET"} ${t.url}: ${r}`);
47
+ }
48
+ return n;
49
+ };
50
+ return { post: async (r) => {
51
+ if (r.response.status === 401) throw e.notifyUnauthorized(r.url), e.createUnauthorizedError(r.url);
52
+ if (r.response.status === 403) {
53
+ let i = await o(r.response);
54
+ if (e.isInvalidCsrfErrorBody(i)) return n(r, await t(r));
55
+ }
56
+ return r.response;
57
+ } };
58
+ }, u = (e) => {
59
+ let t = e.split("/").filter(Boolean);
60
+ return t.map((e, n) => {
61
+ let r = t.slice(0, n).join("/");
62
+ return {
63
+ id: t.slice(0, n + 1).join("/"),
64
+ name: e,
65
+ ...r ? { folderId: r } : void 0
66
+ };
67
+ });
68
+ }, d = (e) => ({
69
+ version: 5,
70
+ prompts: [{
71
+ id: e.id,
72
+ name: e.name,
73
+ description: e.description ?? "",
74
+ content: e.content,
75
+ ...e.folderId ? { folderId: e.folderId } : void 0
76
+ }],
77
+ folders: u(e.folderId)
78
+ }), f = (e) => new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), p = /[^a-zA-Z0-9._-]+/g, m = (t, n, r = /* @__PURE__ */ new Date()) => {
79
+ let i = t.replace(p, "_");
80
+ return `${e(r)}_${n}_prompt_${i}.json`;
81
+ }, h = /* @__PURE__ */ function(e) {
82
+ return e.Required = "required", e.TooLong = "tooLong", e.InvalidName = "invalidName", e.Conflict = "conflict", e;
83
+ }({}), g = /^(?!\.{1,2}$)[a-zA-Z0-9 _.-]+$/, _ = 256, v = 2e3, y = 5e4, b = 10, x = (e) => {
84
+ let t = e.trim();
85
+ return t.length === 0 ? "required" : t.length > 256 ? "tooLong" : g.test(t) ? null : "invalidName";
86
+ }, S = (e) => e.length > 2e3 ? "tooLong" : null, C = (e) => e.trim().length === 0 ? "required" : e.length > 5e4 ? "tooLong" : null, w = (e, t) => {
87
+ let n = t - e.length;
88
+ return n <= 10 ? n : null;
89
+ }, T = (e, t) => e ? `${e}/${t}` : t, E = ({ listPrompts: e }) => {
90
+ let [a, o] = i([]), [s, c] = i([]), [l, u] = i([]), [d, f] = i([]), [p, m] = i([]), [h, g] = i(!0), [_, v] = i(null), y = t(async () => {
91
+ try {
92
+ let t = await e();
93
+ o(t.prompts), c(t.folders), u(t.sharedWithMe), f(t.publicPrompts ?? []), m(t.publicFolders ?? []), v(null);
94
+ } catch (e) {
95
+ v(e);
96
+ }
97
+ }, [e]);
98
+ return n(() => {
99
+ let t = { value: !1 };
100
+ return (async () => {
101
+ let n = await e().catch((e) => (t.value || v(e), null));
102
+ t.value || (n != null && (o(n.prompts), c(n.folders), u(n.sharedWithMe), f(n.publicPrompts ?? []), m(n.publicFolders ?? []), v(null)), g(!1));
103
+ })(), () => {
104
+ t.value = !0;
105
+ };
106
+ }, [e]), r(() => ({
107
+ prompts: a,
108
+ folders: s,
109
+ sharedWithMe: l,
110
+ publicPrompts: d,
111
+ publicFolders: p,
112
+ isLoading: h,
113
+ error: _,
114
+ refetch: y,
115
+ refetchPublicPrompts: y
116
+ }), [
117
+ a,
118
+ s,
119
+ l,
120
+ d,
121
+ p,
122
+ h,
123
+ _,
124
+ y
125
+ ]);
126
+ }, D = "custom_app", O = (e) => !!e && e.id === D, k = (e) => !!e && (!!e.id?.endsWith("quickapps2") || e.displayName === "Quick app 2.0"), A = () => {
127
+ try {
128
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || void 0;
129
+ } catch {
130
+ return;
131
+ }
132
+ }, j = (e) => {
133
+ let t = e.trim();
134
+ if (!t || !/^https?:\/\//.test(t)) return !1;
135
+ try {
136
+ return !!new URL(t);
137
+ } catch {
138
+ return !1;
139
+ }
140
+ }, M = (e) => {
141
+ let t = e.trim();
142
+ if (t) try {
143
+ return JSON.parse(t);
144
+ } catch {
145
+ return;
146
+ }
147
+ }, N = ["rate_endpoint", "configuration_endpoint"], P = (e) => {
148
+ let t = e.trim();
149
+ if (!t) return !0;
150
+ try {
151
+ let e = JSON.parse(t);
152
+ if (typeof e != "object" || !e || Array.isArray(e)) return !1;
153
+ let n = Object.keys(e);
154
+ return n.length > 0 && n.every((e) => N.includes(e));
155
+ } catch {
156
+ return !1;
157
+ }
158
+ }, F = "/external_services/", I = (e) => {
159
+ let t = e.indexOf(F);
160
+ if (t === -1) return null;
161
+ let n = e.slice(0, t), r = e.slice(t + 19);
162
+ return !n || !r ? null : {
163
+ appId: n,
164
+ serviceName: r
165
+ };
166
+ }, L = (e, t) => `${e}${F}${t}`, R = (e) => {
167
+ try {
168
+ return decodeURIComponent(e);
169
+ } catch {
170
+ return e;
171
+ }
172
+ }, z = (e) => e instanceof Error ? e : Error(String(e)), B = (e, t = !0) => {
173
+ let [r, a] = i(), [o, s] = i(t), [c, l] = i();
174
+ return n(() => {
175
+ if (!t) {
176
+ s(!1);
177
+ return;
178
+ }
179
+ let n = !1;
180
+ return s(!0), (async () => {
181
+ try {
182
+ let t = await e();
183
+ if (n) return;
184
+ a(t);
185
+ } catch (e) {
186
+ if (n) return;
187
+ l(z(e));
188
+ } finally {
189
+ n || s(!1);
190
+ }
191
+ })(), () => {
192
+ n = !0;
193
+ };
194
+ }, [t, e]), {
195
+ usage: r,
196
+ isLoading: o,
197
+ usageError: c
198
+ };
199
+ };
200
+ //#endregion
201
+ export { m as C, a as E, d as S, l as T, T as _, j as a, S as b, A as c, E as d, y as f, h as g, _ as h, I as i, O as l, v as m, L as n, P as o, b as p, R as r, M as s, B as t, k as u, w as v, f as w, x, C as y };