@scalar/agent-chat 0.9.11 → 0.9.13

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 (232) hide show
  1. package/dist/App.vue.d.ts +6 -6
  2. package/dist/App.vue.js +7 -0
  3. package/dist/App.vue.js.map +1 -0
  4. package/dist/App.vue.script.js +41 -0
  5. package/dist/App.vue.script.js.map +1 -0
  6. package/dist/Chat.vue.js +7 -0
  7. package/dist/Chat.vue.js.map +1 -0
  8. package/dist/Chat.vue.script.js +48 -0
  9. package/dist/Chat.vue.script.js.map +1 -0
  10. package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
  11. package/dist/api.d.ts +8 -8
  12. package/dist/api.js +75 -0
  13. package/dist/api.js.map +1 -0
  14. package/dist/client-tools/execute-request.d.ts +7 -7
  15. package/dist/client-tools/execute-request.js +88 -0
  16. package/dist/client-tools/execute-request.js.map +1 -0
  17. package/dist/components/ActionsDropdown.vue.js +9 -0
  18. package/dist/components/ActionsDropdown.vue.js.map +1 -0
  19. package/dist/components/ActionsDropdown.vue.script.js +33 -0
  20. package/dist/components/ActionsDropdown.vue.script.js.map +1 -0
  21. package/dist/components/ApprovalSection.vue.js +9 -0
  22. package/dist/components/ApprovalSection.vue.js.map +1 -0
  23. package/dist/components/ApprovalSection.vue.script.js +26 -0
  24. package/dist/components/ApprovalSection.vue.script.js.map +1 -0
  25. package/dist/components/AuthenticationProvided.vue.js +13 -0
  26. package/dist/components/AuthenticationProvided.vue.js.map +1 -0
  27. package/dist/components/AuthenticationRequired.vue.js +13 -0
  28. package/dist/components/AuthenticationRequired.vue.js.map +1 -0
  29. package/dist/components/AutosendPaused.vue.js +13 -0
  30. package/dist/components/AutosendPaused.vue.js.map +1 -0
  31. package/dist/components/BuildingRequest.vue.js +19 -0
  32. package/dist/components/BuildingRequest.vue.js.map +1 -0
  33. package/dist/components/ContextItem.vue.js +9 -0
  34. package/dist/components/ContextItem.vue.js.map +1 -0
  35. package/dist/components/ContextItem.vue.script.js +13 -0
  36. package/dist/components/ContextItem.vue.script.js.map +1 -0
  37. package/dist/components/ErrorMessage.vue.d.ts +1 -1
  38. package/dist/components/ErrorMessage.vue.js +9 -0
  39. package/dist/components/ErrorMessage.vue.js.map +1 -0
  40. package/dist/components/ErrorMessage.vue.script.js +22 -0
  41. package/dist/components/ErrorMessage.vue.script.js.map +1 -0
  42. package/dist/components/FreeMessagesInfoSection.vue.js +9 -0
  43. package/dist/components/FreeMessagesInfoSection.vue.js.map +1 -0
  44. package/dist/components/FreeMessagesInfoSection.vue.script.js +43 -0
  45. package/dist/components/FreeMessagesInfoSection.vue.script.js.map +1 -0
  46. package/dist/components/LoadingMiniOpenAPIDoc.vue.js +13 -0
  47. package/dist/components/LoadingMiniOpenAPIDoc.vue.js.map +1 -0
  48. package/dist/components/LoadingOpenAPISpecsSummary.vue.js +13 -0
  49. package/dist/components/LoadingOpenAPISpecsSummary.vue.js.map +1 -0
  50. package/dist/components/Logo.vue.js +23 -0
  51. package/dist/components/Logo.vue.js.map +1 -0
  52. package/dist/components/PaymentSection.vue.js +9 -0
  53. package/dist/components/PaymentSection.vue.js.map +1 -0
  54. package/dist/components/PaymentSection.vue.script.js +22 -0
  55. package/dist/components/PaymentSection.vue.script.js.map +1 -0
  56. package/dist/components/RequestApproved.vue.js +13 -0
  57. package/dist/components/RequestApproved.vue.js.map +1 -0
  58. package/dist/components/RequestFailed.vue.js +19 -0
  59. package/dist/components/RequestFailed.vue.js.map +1 -0
  60. package/dist/components/RequestPreview.vue.d.ts +1 -1
  61. package/dist/components/RequestPreview.vue.js +9 -0
  62. package/dist/components/RequestPreview.vue.js.map +1 -0
  63. package/dist/components/RequestPreview.vue.script.js +96 -0
  64. package/dist/components/RequestPreview.vue.script.js.map +1 -0
  65. package/dist/components/RequestRejected.vue.js +19 -0
  66. package/dist/components/RequestRejected.vue.js.map +1 -0
  67. package/dist/components/RequestSuccess.vue.js +13 -0
  68. package/dist/components/RequestSuccess.vue.js.map +1 -0
  69. package/dist/components/ResponseBody/ResponseBody.vue.d.ts +1 -1
  70. package/dist/components/ResponseBody/ResponseBody.vue.js +7 -0
  71. package/dist/components/ResponseBody/ResponseBody.vue.js.map +1 -0
  72. package/dist/components/ResponseBody/ResponseBody.vue.script.js +43 -0
  73. package/dist/components/ResponseBody/ResponseBody.vue.script.js.map +1 -0
  74. package/dist/components/ResponseBody/ResponseBodyInfo.vue.js +12 -0
  75. package/dist/components/ResponseBody/ResponseBodyInfo.vue.js.map +1 -0
  76. package/dist/components/ResponseBody/ResponseBodyPreview.vue.d.ts +1 -1
  77. package/dist/components/ResponseBody/ResponseBodyPreview.vue.js +9 -0
  78. package/dist/components/ResponseBody/ResponseBodyPreview.vue.js.map +1 -0
  79. package/dist/components/ResponseBody/ResponseBodyPreview.vue.script.js +59 -0
  80. package/dist/components/ResponseBody/ResponseBodyPreview.vue.script.js.map +1 -0
  81. package/dist/components/ResponseBody/ResponseBodyRaw.vue.js +7 -0
  82. package/dist/components/ResponseBody/ResponseBodyRaw.vue.js.map +1 -0
  83. package/dist/components/ResponseBody/ResponseBodyRaw.vue.script.js +22 -0
  84. package/dist/components/ResponseBody/ResponseBodyRaw.vue.script.js.map +1 -0
  85. package/dist/components/ResponseBody/ResponseBodyToggle.vue.js +7 -0
  86. package/dist/components/ResponseBody/ResponseBodyToggle.vue.js.map +1 -0
  87. package/dist/components/ResponseBody/ResponseBodyToggle.vue.script.js +23 -0
  88. package/dist/components/ResponseBody/ResponseBodyToggle.vue.script.js.map +1 -0
  89. package/dist/components/ResponseBody/helpers/media-types.js +223 -0
  90. package/dist/components/ResponseBody/helpers/media-types.js.map +1 -0
  91. package/dist/components/ResponseBody/helpers/process-response-body.js +33 -0
  92. package/dist/components/ResponseBody/helpers/process-response-body.js.map +1 -0
  93. package/dist/components/SearchPopover.vue.js +9 -0
  94. package/dist/components/SearchPopover.vue.js.map +1 -0
  95. package/dist/components/SearchPopover.vue.script.js +53 -0
  96. package/dist/components/SearchPopover.vue.script.js.map +1 -0
  97. package/dist/components/Selector.vue.js +7 -0
  98. package/dist/components/Selector.vue.js.map +1 -0
  99. package/dist/components/Selector.vue.script.js +62 -0
  100. package/dist/components/Selector.vue.script.js.map +1 -0
  101. package/dist/components/SendingRequest.vue.js +19 -0
  102. package/dist/components/SendingRequest.vue.js.map +1 -0
  103. package/dist/components/ServerSelector.vue.js +7 -0
  104. package/dist/components/ServerSelector.vue.js.map +1 -0
  105. package/dist/components/ServerSelector.vue.script.js +60 -0
  106. package/dist/components/ServerSelector.vue.script.js.map +1 -0
  107. package/dist/components/UploadSection.vue.d.ts +1 -1
  108. package/dist/components/UploadSection.vue.js +9 -0
  109. package/dist/components/UploadSection.vue.js.map +1 -0
  110. package/dist/components/UploadSection.vue.script.js +52 -0
  111. package/dist/components/UploadSection.vue.script.js.map +1 -0
  112. package/dist/consts/urls.js +12 -0
  113. package/dist/consts/urls.js.map +1 -0
  114. package/dist/entities/error/constants.js +6 -0
  115. package/dist/entities/error/constants.js.map +1 -0
  116. package/dist/entities/error/helpers.d.ts +1 -1
  117. package/dist/entities/error/helpers.js +11 -0
  118. package/dist/entities/error/helpers.js.map +1 -0
  119. package/dist/entities/index.d.ts +9 -9
  120. package/dist/entities/index.js +10 -2
  121. package/dist/entities/prompt/constants.js +6 -0
  122. package/dist/entities/prompt/constants.js.map +1 -0
  123. package/dist/entities/registry/document.js +14 -0
  124. package/dist/entities/registry/document.js.map +1 -0
  125. package/dist/entities/tools/ask-for-authentication.js +7 -0
  126. package/dist/entities/tools/ask-for-authentication.js.map +1 -0
  127. package/dist/entities/tools/constants.js +6 -0
  128. package/dist/entities/tools/constants.js.map +1 -0
  129. package/dist/entities/tools/execute-request.d.ts +1 -1
  130. package/dist/entities/tools/execute-request.js +13 -0
  131. package/dist/entities/tools/execute-request.js.map +1 -0
  132. package/dist/entities/tools/get-mini-openapi-spec.js +7 -0
  133. package/dist/entities/tools/get-mini-openapi-spec.js.map +1 -0
  134. package/dist/entities/tools/get-openapi-spec-summary.js +6 -0
  135. package/dist/entities/tools/get-openapi-spec-summary.js.map +1 -0
  136. package/dist/helpers.js +42 -0
  137. package/dist/helpers.js.map +1 -0
  138. package/dist/hooks/use-agent-key-documents.js +24 -0
  139. package/dist/hooks/use-agent-key-documents.js.map +1 -0
  140. package/dist/hooks/use-chat-approvals.d.ts +1 -1
  141. package/dist/hooks/use-chat-approvals.js +38 -0
  142. package/dist/hooks/use-chat-approvals.js.map +1 -0
  143. package/dist/hooks/use-chat-error.js +25 -0
  144. package/dist/hooks/use-chat-error.js.map +1 -0
  145. package/dist/hooks/use-chat-pending-client-tool-parts.js +14 -0
  146. package/dist/hooks/use-chat-pending-client-tool-parts.js.map +1 -0
  147. package/dist/hooks/use-chat-scroll.js +17 -0
  148. package/dist/hooks/use-chat-scroll.js.map +1 -0
  149. package/dist/hooks/use-curated-documents.js +14 -0
  150. package/dist/hooks/use-curated-documents.js.map +1 -0
  151. package/dist/hooks/use-search.d.ts +1 -1
  152. package/dist/hooks/use-search.js +23 -0
  153. package/dist/hooks/use-search.js.map +1 -0
  154. package/dist/hooks/use-signup-link.js +17 -0
  155. package/dist/hooks/use-signup-link.js.map +1 -0
  156. package/dist/hooks/use-term-and-conditions.js +20 -0
  157. package/dist/hooks/use-term-and-conditions.js.map +1 -0
  158. package/dist/hooks/use-upload-tmp-document.js +92 -0
  159. package/dist/hooks/use-upload-tmp-document.js.map +1 -0
  160. package/dist/index.d.ts +2 -2
  161. package/dist/index.js +2 -2065
  162. package/dist/package.json +2 -2
  163. package/dist/plugins/persistance.js +16 -0
  164. package/dist/plugins/persistance.js.map +1 -0
  165. package/dist/registry/add-documents-to-store.d.ts +5 -5
  166. package/dist/registry/add-documents-to-store.js +36 -0
  167. package/dist/registry/add-documents-to-store.js.map +1 -0
  168. package/dist/registry/create-document-name.js +8 -0
  169. package/dist/registry/create-document-name.js.map +1 -0
  170. package/dist/state/state.d.ts +7 -7
  171. package/dist/state/state.js +154 -0
  172. package/dist/state/state.js.map +1 -0
  173. package/dist/views/Catalog/Catalog.vue.js +10 -0
  174. package/dist/views/Catalog/Catalog.vue.js.map +1 -0
  175. package/dist/views/Catalog/Catalog.vue.script.js +50 -0
  176. package/dist/views/Catalog/Catalog.vue.script.js.map +1 -0
  177. package/dist/views/Chat/Chat.vue.js +9 -0
  178. package/dist/views/Chat/Chat.vue.js.map +1 -0
  179. package/dist/views/Chat/Chat.vue.script.js +55 -0
  180. package/dist/views/Chat/Chat.vue.script.js.map +1 -0
  181. package/dist/views/Chat/Messages/AskForAuthentication.vue.d.ts +2 -2
  182. package/dist/views/Chat/Messages/AskForAuthentication.vue.js +9 -0
  183. package/dist/views/Chat/Messages/AskForAuthentication.vue.js.map +1 -0
  184. package/dist/views/Chat/Messages/AskForAuthentication.vue.script.js +72 -0
  185. package/dist/views/Chat/Messages/AskForAuthentication.vue.script.js.map +1 -0
  186. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts +2 -2
  187. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js +9 -0
  188. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js.map +1 -0
  189. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.script.js +26 -0
  190. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.script.js.map +1 -0
  191. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.d.ts +2 -2
  192. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js +9 -0
  193. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js.map +1 -0
  194. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.script.js +39 -0
  195. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.script.js.map +1 -0
  196. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.d.ts +2 -2
  197. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.js +7 -0
  198. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.js.map +1 -0
  199. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.script.js +21 -0
  200. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.script.js.map +1 -0
  201. package/dist/views/Chat/Messages/Text.vue.js +7 -0
  202. package/dist/views/Chat/Messages/Text.vue.js.map +1 -0
  203. package/dist/views/Chat/Messages/Text.vue.script.js +14 -0
  204. package/dist/views/Chat/Messages/Text.vue.script.js.map +1 -0
  205. package/dist/views/Layout.vue.js +9 -0
  206. package/dist/views/Layout.vue.js.map +1 -0
  207. package/dist/views/Layout.vue.script.js +25 -0
  208. package/dist/views/Layout.vue.script.js.map +1 -0
  209. package/dist/views/PromptForm.vue.js +9 -0
  210. package/dist/views/PromptForm.vue.js.map +1 -0
  211. package/dist/views/PromptForm.vue.script.js +202 -0
  212. package/dist/views/PromptForm.vue.script.js.map +1 -0
  213. package/dist/views/Settings/Auth.vue.js +7 -0
  214. package/dist/views/Settings/Auth.vue.js.map +1 -0
  215. package/dist/views/Settings/Auth.vue.script.js +63 -0
  216. package/dist/views/Settings/Auth.vue.script.js.map +1 -0
  217. package/dist/views/Settings/DocSettings.vue.js +9 -0
  218. package/dist/views/Settings/DocSettings.vue.js.map +1 -0
  219. package/dist/views/Settings/DocSettings.vue.script.js +48 -0
  220. package/dist/views/Settings/DocSettings.vue.script.js.map +1 -0
  221. package/dist/views/Settings/Settings.vue.js +10 -0
  222. package/dist/views/Settings/Settings.vue.js.map +1 -0
  223. package/dist/views/Settings/Settings.vue.script.js +59 -0
  224. package/dist/views/Settings/Settings.vue.script.js.map +1 -0
  225. package/dist/views/Start.vue.js +9 -0
  226. package/dist/views/Start.vue.js.map +1 -0
  227. package/dist/views/Start.vue.script.js +41 -0
  228. package/dist/views/Start.vue.script.js.map +1 -0
  229. package/package.json +9 -9
  230. package/dist/entities-NWeuOkBB.js +0 -28
  231. package/dist/entities-NWeuOkBB.js.map +0 -1
  232. package/dist/index.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,2065 +1,2 @@
1
- import { d as e, f as t, i as n, l as r, s as i, u as a } from "./entities-NWeuOkBB.js";
2
- import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createStaticVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, inject as g, isRef as _, nextTick as v, normalizeClass as y, onBeforeUnmount as b, onMounted as x, openBlock as S, provide as C, reactive as w, ref as T, renderList as E, renderSlot as D, shallowRef as O, toDisplayString as k, toRef as A, unref as j, useId as M, useTemplateRef as ee, vModelText as te, vShow as N, watch as P, withCtx as F, withDirectives as ne, withModifiers as I } from "vue";
3
- import { createApiClientModal as re } from "@scalar/api-client/v2/features/modal";
4
- import { useToasts as ie } from "@scalar/use-toasts";
5
- import { Chat as ae } from "@ai-sdk/vue";
6
- import { ScalarButton as oe, ScalarCodeBlock as se, ScalarColorModeToggle as ce, ScalarDropdown as le, ScalarDropdownItem as ue, ScalarIcon as de, ScalarIconButton as fe, ScalarListbox as pe, ScalarLoading as me, ScalarMarkdown as he, ScalarModal as ge, ScalarPopover as _e, ScalarSearchInput as ve, ScalarTextInput as ye, ScalarTooltip as be, useLoadingState as xe, useModal as Se } from "@scalar/components";
7
- import { redirectToProxy as L } from "@scalar/helpers/url/redirect-to-proxy";
8
- import { apiReferenceConfigurationSchema as Ce } from "@scalar/types/api-reference";
9
- import { createWorkspaceStore as we } from "@scalar/workspace-store/client";
10
- import { createWorkspaceEventBus as Te } from "@scalar/workspace-store/events";
11
- import { DefaultChatTransport as Ee, lastAssistantMessageIsCompleteWithToolCalls as De } from "ai";
12
- import { n as R } from "neverpanic";
13
- import z from "zod";
14
- import { buildRequestSecurity as Oe, getResolvedUrl as ke } from "@scalar/api-client/v2/blocks/operation-block";
15
- import Ae from "truncate-json";
16
- import { AuthSelector as je, mergeSecurity as Me } from "@scalar/api-client/v2/blocks/scalar-auth-selector-block";
17
- import { getSecurityRequirements as Ne, getSelectedSecurity as Pe, getSelectedServer as B } from "@scalar/api-client/v2/features/operation";
18
- import { getActiveEnvironment as Fe, getServers as V } from "@scalar/api-client/v2/helpers";
19
- import { REFERENCE_LS_KEYS as Ie, safeLocalStorage as Le } from "@scalar/helpers/object/local-storage";
20
- import { AuthSchema as Re } from "@scalar/workspace-store/entities/auth";
21
- import { coerceValue as ze } from "@scalar/workspace-store/schemas/typebox-coerce";
22
- import { z as H } from "zod/mini";
23
- import { debounce as Be } from "@scalar/helpers/general/debounce";
24
- import { bundle as Ve } from "@scalar/json-magic/bundle";
25
- import { fetchUrls as He } from "@scalar/json-magic/bundle/plugins/browser";
26
- import { ScalarIconArrowRight as Ue, ScalarIconArrowUp as We, ScalarIconCaretDown as U, ScalarIconCaretRight as W, ScalarIconCheck as Ge, ScalarIconInfo as G, ScalarIconLockSimple as Ke, ScalarIconMagnifyingGlass as qe, ScalarIconPlus as Je, ScalarIconUpload as Ye, ScalarIconX as Xe, ScalarIconXCircle as Ze } from "@scalar/icons";
27
- import { useDebounceFn as Qe, useFocusWithin as $e } from "@vueuse/core";
28
- import et from "whatwg-mimetype";
29
- import { ServerVariablesForm as tt } from "@scalar/api-client/components/Server";
30
- //#region src/api.ts
31
- function nt({ getAccessToken: e, getAgentKey: t }) {
32
- let n = e?.(), r = t?.();
33
- return {
34
- ...n && { Authorization: `Bearer ${n}` },
35
- ...r && { "x-scalar-agent-key": r }
36
- };
37
- }
38
- function rt({ baseUrl: n, proxyUrl: r, getAccessToken: i, getAgentKey: a }) {
39
- let o = R.safeFn(async ({ path: e, method: o = "get", query: s, body: c, responseSchema: l }) => {
40
- let u = `${n}${e}${s ? `?${new URLSearchParams(s)}` : ""}`, d = await R.fromUnsafe(async () => fetch(L(r.value, u), {
41
- method: o,
42
- ...c && { body: JSON.stringify(c) },
43
- headers: { ...nt({
44
- getAccessToken: i,
45
- getAgentKey: a
46
- }) }
47
- }), (e) => t("FAILED_TO_FETCH", e));
48
- if (!d.success) return d;
49
- let f = await R.fromUnsafe(async () => d.data.json(), (e) => t("FAILED_TO_FETCH_DATA", e));
50
- if (!f.success) return {
51
- success: !1,
52
- error: t("UNKNOWN_ERROR", "Unknown error occurred. Please contact support.")
53
- };
54
- if (!d.data.ok) {
55
- let e = z.object({
56
- message: z.string(),
57
- code: z.string()
58
- }).safeParse(f.data);
59
- return e.success ? {
60
- success: !1,
61
- error: t(e.data.code, e.data.message)
62
- } : {
63
- success: !1,
64
- error: t("UNKNOWN_ERROR", "Unknown error occurred. Please contact support.")
65
- };
66
- }
67
- let p = l.safeParse(f.data);
68
- return p.success ? {
69
- success: !0,
70
- data: p.data
71
- } : {
72
- success: !1,
73
- error: t("INVALID_RESPONSE", "Invalid response. Please contact support")
74
- };
75
- });
76
- return {
77
- search: async (t) => o({
78
- path: "/vector/registry/search",
79
- query: { query: t },
80
- responseSchema: z.object({ results: e.array() })
81
- }),
82
- getDocument: async (t) => o({
83
- path: `/vector/registry/document/${t.namespace}/${t.slug}`,
84
- responseSchema: e
85
- }),
86
- getKeyDocuments: async () => o({
87
- path: "/vector/registry/documents",
88
- responseSchema: z.object({ documents: e.array() })
89
- }),
90
- getCuratedDocuments: async () => o({
91
- path: "/vector/registry/curated",
92
- responseSchema: z.object({ results: e.array() })
93
- })
94
- };
95
- }
96
- //#endregion
97
- //#region src/registry/create-document-name.ts
98
- function K(e, t) {
99
- return `${e}/${t}`;
100
- }
101
- //#endregion
102
- //#region src/client-tools/execute-request.ts
103
- var it = 5e4, at = R.safeFn(async (e) => e.headers.get("content-type") === "application/json" ? {
104
- success: !0,
105
- data: await e.json()
106
- } : {
107
- success: !0,
108
- data: await e.text()
109
- }, (e) => t("FAILED_TO_PARSE_RESPONSE_BODY", { originalError: e })), ot = (e) => JSON.parse(Ae(JSON.stringify(e), it).jsonString), st = R.safeFn(async (e, n) => {
110
- let r = await fetch(e, n), i = await at(r);
111
- return r.ok ? i.success ? {
112
- success: !0,
113
- data: {
114
- status: r.status,
115
- responseBody: ot(i.data),
116
- headers: Object.fromEntries(r.headers.entries())
117
- }
118
- } : i : {
119
- success: !1,
120
- error: t("REQUEST_NOT_OK", {
121
- status: r.status,
122
- url: r.url,
123
- responseBody: ot(i.success ? i.data : void 0),
124
- headers: Object.fromEntries(r.headers.entries())
125
- })
126
- };
127
- }, (e) => t("FAILED_TO_FETCH", { originalError: e }));
128
- function ct({ path: e, activeServer: t, proxyUrl: n }) {
129
- return L(n, ke({
130
- path: e,
131
- server: t,
132
- pathVariables: {},
133
- environment: {
134
- color: "",
135
- variables: []
136
- }
137
- }));
138
- }
139
- var lt = R.safeFn(async ({ documentSettings: e, toolCallId: r, chat: i, proxyUrl: a, input: { method: o, path: s, body: c, headers: l, documentIdentifier: u } }) => {
140
- let [d, f] = u.split("---");
141
- if (!d || !f) return {
142
- success: !1,
143
- error: t("FAILED_TO_DETERMINE_DOCUMENT", {
144
- namespace: d,
145
- slug: f,
146
- documentIdentifier: u
147
- })
148
- };
149
- let p = K(d, f), m = e[p];
150
- if (!m) return {
151
- success: !1,
152
- error: t("DOCUMENT_SETTINGS_COULD_NOT_BE_DETERMINED", {
153
- documentName: p,
154
- namespace: d,
155
- slug: f
156
- })
157
- };
158
- let h = Oe(m.securitySchemes), g = {
159
- method: o,
160
- body: c,
161
- ...h,
162
- headers: {
163
- ...l,
164
- ...h.headers
165
- }
166
- }, _ = await st(ct({
167
- path: s,
168
- activeServer: m.activeServer,
169
- proxyUrl: a
170
- }), g);
171
- return i.addToolOutput({
172
- tool: n,
173
- toolCallId: r,
174
- output: _,
175
- state: "output-available"
176
- }), _;
177
- }, (e) => t("FAILED_TO_EXECUTE_REQUEST", e)), q = {
178
- DEFAULT_PROXY_URL: "https://proxy.scalar.com",
179
- PRIVACY_POLICY: "https://scalar.com/legal/privacy-policy",
180
- TERMS_AND_CONDITIONS: "https://scalar.com/legal/terms-and-conditions",
181
- AGENT_SCALAR_DOCUMENTATION: "https://scalar.com/products/agent/getting-started",
182
- PROXY_SOURCE_CODE: "https://github.com/scalar/scalar/tree/main/projects/proxy-scalar-com"
183
- };
184
- //#endregion
185
- //#region src/helpers.ts
186
- function ut(e) {
187
- return Object.values(e.paths ?? {}).flatMap((e) => Object.values(e ?? {}));
188
- }
189
- function dt(e, t, n) {
190
- return Object.values(Me(t?.components?.securitySchemes, {}, n, e));
191
- }
192
- function J(e) {
193
- return Object.fromEntries(Object.entries(e.workspace.documents).map(([t, n]) => [t, {
194
- activeServer: B(V(n.servers, { documentUrl: n?.["x-scalar-original-source-url"] }), n["x-scalar-selected-server"]),
195
- securitySchemes: dt(t, n, e.auth)
196
- }]));
197
- }
198
- var ft = Le(), pt = () => {
199
- let e = (e) => `${Ie.AUTH}-${e}`;
200
- return {
201
- getAuth: (t) => ze(Re, JSON.parse(ft.getItem(e(t)) ?? "{}")),
202
- setAuth: (t, n) => {
203
- ft.setItem(e(t), JSON.stringify(n));
204
- }
205
- };
206
- }, mt = ({ documentName: e, workspaceStore: t }) => {
207
- let n = pt().getAuth(e);
208
- t.auth.load({ [e]: n });
209
- };
210
- function ht(e) {
211
- try {
212
- return JSON.parse(e);
213
- } catch {
214
- return;
215
- }
216
- }
217
- //#endregion
218
- //#region src/hooks/use-term-and-conditions.ts
219
- var gt = "scalar/agent-terms-accepted";
220
- function _t() {
221
- let e = T(!1);
222
- x(() => {
223
- e.value = localStorage.getItem(gt) === "true";
224
- });
225
- function t() {
226
- e.value = !0, localStorage.setItem(gt, "true");
227
- }
228
- return {
229
- accepted: e,
230
- accept: t
231
- };
232
- }
233
- //#endregion
234
- //#region src/hooks/use-upload-tmp-document.ts
235
- var vt = 5e3, Y = "scalar-tmp-doc";
236
- function yt({ namespace: e, slug: t }) {
237
- localStorage.setItem(Y, JSON.stringify({
238
- namespace: e,
239
- slug: t
240
- }));
241
- }
242
- function bt() {
243
- let e = localStorage.getItem(Y);
244
- if (e) return H.object({
245
- namespace: H.string(),
246
- slug: H.string()
247
- }).parse(JSON.parse(e));
248
- }
249
- function xt() {
250
- localStorage.getItem(Y) && localStorage.removeItem(Y);
251
- }
252
- function St() {
253
- let e = Z(), t = T();
254
- function n(t) {
255
- let n = `${e.baseUrl}${t}`;
256
- return L(e.proxyUrl.value, n);
257
- }
258
- async function r(r, i = !1) {
259
- try {
260
- t.value = { type: "uploading" };
261
- let a = await fetch(n(`/core/share/upload/apis${i ? "?source=agent" : ""}`), {
262
- method: "POST",
263
- headers: { "Content-Type": "application/json" },
264
- body: JSON.stringify({ document: r })
265
- });
266
- if (!a.ok) {
267
- t.value = {
268
- type: "error",
269
- error: "Failed to upload your OpenAPI document."
270
- };
271
- return;
272
- }
273
- let o = await a.json(), { success: s, data: c } = H.object({
274
- url: H.string(),
275
- namespace: H.string(),
276
- slug: H.string()
277
- }).safeParse(o);
278
- if (!s) {
279
- t.value = {
280
- type: "error",
281
- error: "Failed to process document."
282
- };
283
- return;
284
- }
285
- t.value = { type: "processing" };
286
- let l = await fetch(n(`/vector/registry/embeddings/${c.namespace}/${c.slug}`), { method: "GET" });
287
- if (yt({
288
- namespace: c.namespace,
289
- slug: c.slug
290
- }), await e.addDocument({
291
- namespace: c.namespace,
292
- slug: c.slug,
293
- removable: !1,
294
- tmp: !0
295
- }), !l.ok) {
296
- t.value = {
297
- type: "error",
298
- error: "Failed to embed document."
299
- };
300
- return;
301
- }
302
- return t.value = { type: "done" }, e.uploadedTmpDocumentUrl.value = c.url, setTimeout(() => {
303
- t.value = void 0;
304
- }, vt), c;
305
- } catch {
306
- t.value = {
307
- type: "error",
308
- error: "Failed to upload your OpenAPI document."
309
- };
310
- return;
311
- }
312
- }
313
- return {
314
- uploadTempDocument: r,
315
- uploadState: t
316
- };
317
- }
318
- //#endregion
319
- //#region src/plugins/persistance.ts
320
- var Ct = ({ debounceDelay: e = 500, maxWait: t = 1e4, persistAuth: n = !1 }) => {
321
- let { execute: r } = Be({
322
- delay: e,
323
- maxWait: t
324
- }), i = pt(), a = () => typeof n == "function" ? n() : n;
325
- return { hooks: { onWorkspaceStateChanges(e) {
326
- a() && e.type === "auth" && r("auth", () => i.setAuth(e.documentName, e.value));
327
- } } };
328
- }, wt = R.safeFn(async ({ namespace: e, slug: t, workspaceStore: n, registryDocuments: r, registryUrl: i, config: a, api: o, removable: s }) => {
329
- let c = await o.getDocument({
330
- namespace: e,
331
- slug: t
332
- });
333
- if (!c.success) return c;
334
- r.value.push({
335
- ...c.data,
336
- removable: s
337
- });
338
- let l = await Ve(new URL(`/@${e}/apis/${t}/latest`, i).toString(), {
339
- plugins: [He()],
340
- treeShake: !1
341
- }), u = K(e, t);
342
- return await n.addDocument({
343
- name: u,
344
- document: l
345
- }, a), n.update("x-scalar-active-document", u), mt({
346
- documentName: u,
347
- workspaceStore: n
348
- }), {
349
- success: !0,
350
- data: c.data
351
- };
352
- }, (e) => t("UNABLE_TO_LOAD_DOCUMENT", e)), Tt = Symbol("STATE_SYMBOL"), { toast: X } = ie();
353
- function Et({ registryDocuments: e, workspaceStore: t, baseUrl: n, proxyUrl: r, getAccessToken: i, getAgentKey: a }) {
354
- let o = new ae({
355
- sendAutomaticallyWhen: De,
356
- transport: new Ee({
357
- api: L(r.value, `${n}/vector/openapi/chat`),
358
- headers: () => nt({
359
- getAccessToken: i,
360
- getAgentKey: a
361
- }),
362
- body: () => ({
363
- registryDocuments: e.value,
364
- documentSettings: J(t)
365
- })
366
- }),
367
- async onToolCall({ toolCall: e }) {
368
- e.dynamic || e.toolName === "execute-request" && e.input.method.toLowerCase() === "get" && await lt({
369
- documentSettings: J(t),
370
- input: e.input,
371
- toolCallId: e.toolCallId,
372
- chat: o,
373
- proxyUrl: r.value
374
- });
375
- }
376
- });
377
- return o;
378
- }
379
- function Dt({ initialRegistryDocuments: e, registryUrl: n, dashboardUrl: r, baseUrl: i, mode: a, isLoggedIn: o, getAccessToken: c, getAgentKey: l, getActiveDocumentJson: u, prefilledMessageRef: d, hideAddApi: f }) {
380
- let p = T(d?.value ?? ""), m = T([]), h = w({}), g = T([]), _ = T(q.DEFAULT_PROXY_URL), v = s(() => _.value?.trim() || q.DEFAULT_PROXY_URL), y = T(), b = _t(), x = Te(), S = we({ plugins: [Ct({ persistAuth: !0 })] }), C = s(() => Ce.parse({
381
- proxyUrl: v.value,
382
- persistAuth: !0
383
- })), E = Et({
384
- registryDocuments: m,
385
- workspaceStore: S,
386
- baseUrl: i,
387
- proxyUrl: v,
388
- getAccessToken: c,
389
- getAgentKey: l
390
- }), D = rt({
391
- baseUrl: i,
392
- proxyUrl: v,
393
- getAccessToken: c,
394
- getAgentKey: l
395
- }), O = s(() => E.status === "submitted" || E.status === "streaming" && !E.lastMessage?.parts.some((e) => e.type === "text"));
396
- P(() => E.status, () => {
397
- E.status === "streaming" && (p.value = "");
398
- }), d && P(d, async (e) => {
399
- e && (p.value = e, b.accepted.value && await E.sendMessage({ text: p.value }));
400
- });
401
- let k = Se();
402
- async function A({ namespace: e, slug: t, removable: r = !0, tmp: i = !1 }) {
403
- if (m.value.find((n) => n.namespace === e && n.slug === t)) return;
404
- let a = `@${e}/${t}`;
405
- h[a] = !0;
406
- let o = await wt({
407
- namespace: e,
408
- slug: t,
409
- workspaceStore: S,
410
- registryUrl: n,
411
- registryDocuments: m,
412
- config: C.value,
413
- api: D,
414
- removable: r
415
- });
416
- if (h[a] = !1, !o.success) throw i ? (xt(), o.error) : (console.warn("[AGENT]: Unable to load document", o.error), X(`Unable to load the document @${e}/${t}`, "warn"), o.error);
417
- }
418
- async function j({ namespace: e, slug: r, removable: a = !0 }) {
419
- if (m.value.find((t) => t.namespace === e && t.slug === r)) return;
420
- let o = `@${e}/${r}`;
421
- h[o] = !0;
422
- let s = await R.fromUnsafe(() => fetch(L(v.value, `${i}/vector/registry/embeddings/${e}/${r}`), { method: "GET" }), (e) => t("FAILED_TO_GET_EMBEDDING_STATUS", e));
423
- if (s.success && s.data.ok) {
424
- let t = await wt({
425
- namespace: e,
426
- slug: r,
427
- workspaceStore: S,
428
- registryUrl: n,
429
- registryDocuments: m,
430
- config: C.value,
431
- api: D,
432
- removable: a
433
- });
434
- t.success || (console.warn("[AGENT]: Unable to load document", t.error), X(`Unable to load the document @${e}/${r}`, "warn"));
435
- } else console.warn("[AGENT]: Document could not be embedded"), X(`Unable to embed the document @${e}/${r}`, "warn");
436
- h[o] = !1;
437
- }
438
- function M({ namespace: e, slug: t }) {
439
- m.value = m.value.filter((n) => !(n.namespace === e && n.slug === t)), S.deleteDocument(K(e, t));
440
- }
441
- return e.forEach(({ namespace: e, slug: t }) => A({
442
- namespace: e,
443
- slug: t,
444
- removable: !1
445
- })), {
446
- prompt: p,
447
- chat: E,
448
- workspaceStore: S,
449
- eventBus: x,
450
- loading: O,
451
- settingsModal: k,
452
- config: C,
453
- registryUrl: n,
454
- dashboardUrl: r,
455
- baseUrl: i,
456
- registryDocuments: m,
457
- pendingDocuments: h,
458
- proxyUrl: v,
459
- proxyUrlRaw: _,
460
- mode: a,
461
- terms: b,
462
- isLoggedIn: o,
463
- addDocument: A,
464
- addDocumentAsync: j,
465
- removeDocument: M,
466
- getAccessToken: c,
467
- getAgentKey: l,
468
- api: D,
469
- uploadedTmpDocumentUrl: y,
470
- curatedDocuments: g,
471
- getActiveDocumentJson: u,
472
- hideAddApi: f
473
- };
474
- }
475
- function Z() {
476
- let e = g(Tt);
477
- if (!e) throw Error("No state provided.");
478
- return e;
479
- }
480
- //#endregion
481
- //#region src/hooks/use-agent-key-documents.ts
482
- function Ot() {
483
- let { api: e, addDocument: t, mode: n, getAgentKey: r } = Z(), { toast: i } = ie();
484
- x(async () => {
485
- if (n !== "full" || !r) return;
486
- let a = await e.getKeyDocuments();
487
- if (!a.success) {
488
- i("Failed to fetch your OpenAPI document. The Agent key may be invalid.", "error");
489
- return;
490
- }
491
- a.data.documents.forEach(({ namespace: e, slug: n }) => t({
492
- namespace: e,
493
- slug: n,
494
- removable: !1
495
- }));
496
- });
497
- }
498
- //#endregion
499
- //#region src/hooks/use-chat-scroll.ts
500
- function kt() {
501
- let e = Z();
502
- function t(e) {
503
- let t = e?.parts.at(-1);
504
- if (t && t.type === "text") return t.text;
505
- }
506
- P([() => e.chat.status, () => t(e.chat.lastMessage)], async () => {
507
- await v(), window.scrollTo(0, document.body.scrollHeight);
508
- });
509
- }
510
- //#endregion
511
- //#region src/hooks/use-curated-documents.ts
512
- function At() {
513
- let { api: e, curatedDocuments: t } = Z();
514
- x(async () => {
515
- let n = await e.getCuratedDocuments();
516
- n.success && (t.value = n.data.results);
517
- });
518
- }
519
- //#endregion
520
- //#region \0plugin-vue:export-helper
521
- var Q = (e, t) => {
522
- let n = e.__vccOpts || e;
523
- for (let [e, r] of t) n[e] = r;
524
- return n;
525
- }, jt = {}, Mt = { class: "authenticationProvided" };
526
- function Nt(e, t) {
527
- return S(), u("div", Mt, [...t[0] ||= [f("<svg fill=\"none\" height=\"16\" viewBox=\"0 0 16 16\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\" data-v-e3416cd5><rect height=\"14.25\" rx=\"7.125\" width=\"14.25\" x=\"0.875\" y=\"0.875\" data-v-e3416cd5></rect><rect height=\"14.25\" rx=\"7.125\" stroke=\"currentColor\" stroke-width=\"1.75\" width=\"14.25\" x=\"0.875\" y=\"0.875\" data-v-e3416cd5></rect><g clip-path=\"url(#clip0_74_840)\" data-v-e3416cd5><path d=\"M11.6037 6.841L7.59117 10.8535C7.49742 10.9472 7.37029 10.9998 7.23774 10.9998C7.10519 10.9998 6.97806 10.9472 6.8843 10.8535L4.64617 8.6035C4.55257 8.50975 4.5 8.38269 4.5 8.25022C4.5 8.11774 4.55257 7.99068 4.64617 7.89694L5.27117 7.27194C5.36488 7.17862 5.49174 7.12623 5.62399 7.12623C5.75623 7.12623 5.88309 7.17862 5.9768 7.27194L7.25024 8.50694L10.274 5.52037C10.3677 5.42696 10.4946 5.37451 10.627 5.37451C10.7593 5.37451 10.8862 5.42696 10.9799 5.52037L11.6034 6.131C11.6502 6.17746 11.6875 6.23274 11.7129 6.29366C11.7383 6.35458 11.7514 6.41993 11.7514 6.48593C11.7514 6.55194 11.7384 6.6173 11.713 6.67824C11.6877 6.73918 11.6505 6.7945 11.6037 6.841Z\" fill=\"currentColor\" data-v-e3416cd5></path></g><defs data-v-e3416cd5><clipPath id=\"clip0_74_840\" data-v-e3416cd5><rect height=\"8\" rx=\"4\" width=\"8\" x=\"4\" y=\"4\" data-v-e3416cd5></rect></clipPath></defs></svg> Authorized ", 2)]]);
528
- }
529
- var Pt = /* @__PURE__ */ Q(jt, [["render", Nt], ["__scopeId", "data-v-e3416cd5"]]), Ft = {}, It = { class: "authenticationRequired" };
530
- function Lt(e, t) {
531
- return S(), u("div", It, [...t[0] ||= [f("<svg fill=\"none\" height=\"16\" viewBox=\"0 0 16 16\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\" data-v-d15ef40b><rect height=\"14.25\" rx=\"7.125\" width=\"14.25\" x=\"0.875\" y=\"0.875\" data-v-d15ef40b></rect><rect height=\"14.25\" rx=\"7.125\" stroke=\"currentColor\" stroke-width=\"1.5\" width=\"14.25\" x=\"0.875\" y=\"0.875\" data-v-d15ef40b></rect><g clip-path=\"url(#clip0_74_585)\" data-v-d15ef40b><path d=\"M10.75 5.5V10.5C10.75 10.6326 10.6973 10.7598 10.6036 10.8536C10.5098 10.9473 10.3826 11 10.25 11H9C8.86739 11 8.74021 10.9473 8.64645 10.8536C8.55268 10.7598 8.5 10.6326 8.5 10.5V5.5C8.5 5.36739 8.55268 5.24021 8.64645 5.14645C8.74021 5.05268 8.86739 5 9 5H10.25C10.3826 5 10.5098 5.05268 10.6036 5.14645C10.6973 5.24021 10.75 5.36739 10.75 5.5ZM7 5H5.75C5.61739 5 5.49021 5.05268 5.39645 5.14645C5.30268 5.24021 5.25 5.36739 5.25 5.5V10.5C5.25 10.6326 5.30268 10.7598 5.39645 10.8536C5.49021 10.9473 5.61739 11 5.75 11H7C7.13261 11 7.25979 10.9473 7.35355 10.8536C7.44732 10.7598 7.5 10.6326 7.5 10.5V5.5C7.5 5.36739 7.44732 5.24021 7.35355 5.14645C7.25979 5.05268 7.13261 5 7 5Z\" fill=\"currentColor\" data-v-d15ef40b></path></g><defs data-v-d15ef40b><clipPath id=\"clip0_74_585\" data-v-d15ef40b><rect height=\"8\" rx=\"4\" width=\"8\" x=\"4\" y=\"4\" data-v-d15ef40b></rect></clipPath></defs></svg> Authentication required ", 2)]]);
532
- }
533
- var Rt = /* @__PURE__ */ Q(Ft, [["render", Lt], ["__scopeId", "data-v-d15ef40b"]]), zt = /* @__PURE__ */ h({
534
- __name: "Auth",
535
- props: {
536
- options: {},
537
- name: {},
538
- authStore: {},
539
- document: {},
540
- eventBus: {},
541
- selectedServer: {},
542
- environment: {}
543
- },
544
- setup(e) {
545
- let { workspaceStore: t } = Z(), n = s(() => Ne(e.document?.security)), r = s(() => Pe(e.authStore.getAuthSelectedSchemas({
546
- type: "document",
547
- documentName: e.name
548
- }), void 0, n.value)), i = O(), { focused: a } = $e(i), o = s(() => Me(e.document?.components?.securitySchemes ?? {}, e.options.authentication?.securitySchemes, e.authStore, e.name));
549
- return P(a, (n) => {
550
- n && t.update("x-scalar-active-document", e.name);
551
- }), (t, a) => (S(), u("div", {
552
- ref_key: "focusRef",
553
- ref: i,
554
- tabindex: "0"
555
- }, [Object.keys(o.value).length ? (S(), c(j(je), {
556
- key: 0,
557
- authStore: e.authStore,
558
- documentSlug: e.name,
559
- environment: e.environment,
560
- eventBus: e.eventBus,
561
- isReadOnly: "",
562
- isStatic: "",
563
- layout: "reference",
564
- meta: { type: "document" },
565
- persistAuth: e.options.persistAuth,
566
- proxyUrl: e.options.proxyUrl ?? "",
567
- securityRequirements: n.value,
568
- securitySchemes: o.value,
569
- selectedSecurity: r.value,
570
- server: e.selectedServer,
571
- title: "Authentication"
572
- }, null, 8, [
573
- "authStore",
574
- "documentSlug",
575
- "environment",
576
- "eventBus",
577
- "persistAuth",
578
- "proxyUrl",
579
- "securityRequirements",
580
- "securitySchemes",
581
- "selectedSecurity",
582
- "server"
583
- ])) : l("", !0)], 512));
584
- }
585
- }), Bt = { class: "toggleButton" }, Vt = { class: "authContent" }, Ht = { class: "authContentInner" }, Ut = /* @__PURE__ */ Q(/* @__PURE__ */ h({
586
- __name: "AskForAuthentication",
587
- props: { messagePart: {} },
588
- setup(e) {
589
- let { workspaceStore: t, eventBus: n, config: r, chat: a } = Z(), o = s(() => {
590
- if (!e.messagePart.value.input?.uniqueIdentifier || e.messagePart.value.state !== "input-available") return;
591
- let [t, n] = e.messagePart.value.input.uniqueIdentifier.split("---");
592
- if (!(!t || !n)) return K(t, n);
593
- }), f = s(() => {
594
- if (o.value) return t.workspace.documents[o.value];
595
- }), h = s(() => {
596
- if (f.value) return Fe(t, f.value);
597
- }), g = s(() => {
598
- if (f.value) return B(V(f.value.servers, { documentUrl: f.value["x-scalar-original-source-url"] }), f.value["x-scalar-selected-server"]);
599
- }), _ = s(() => o.value && h.value && g.value);
600
- async function v() {
601
- await a.addToolOutput({
602
- toolCallId: e.messagePart.value.toolCallId,
603
- output: "Authentication provided.",
604
- tool: i,
605
- state: "output-available"
606
- });
607
- }
608
- return (i, a) => (S(), u("div", { class: y(["askForAuthentication", { open: _.value }]) }, [d("div", Bt, [
609
- e.messagePart.value.state === "output-available" ? (S(), c(Pt, { key: 0 })) : l("", !0),
610
- e.messagePart.value.state === "input-available" ? (S(), c(Rt, { key: 1 })) : l("", !0),
611
- e.messagePart.value.state === "input-available" ? (S(), c(j(oe), {
612
- key: 2,
613
- class: "authorizeButton",
614
- size: "xs",
615
- onClick: v
616
- }, {
617
- default: F(() => [a[0] ||= p(" Authorize ", -1), m(j(Ue), { weight: "bold" })]),
618
- _: 1
619
- })) : l("", !0)
620
- ]), d("div", Vt, [d("div", Ht, [o.value && f.value && h.value && g.value ? (S(), c(zt, {
621
- key: 0,
622
- authStore: j(t).auth,
623
- document: f.value,
624
- environment: h.value,
625
- eventBus: j(n),
626
- name: o.value,
627
- options: j(r),
628
- selectedServer: g.value
629
- }, null, 8, [
630
- "authStore",
631
- "document",
632
- "environment",
633
- "eventBus",
634
- "name",
635
- "options",
636
- "selectedServer"
637
- ])) : l("", !0)])])], 2));
638
- }
639
- }), [["__scopeId", "data-v-8af07610"]]), Wt = {}, Gt = { class: "autosendPaused" };
640
- function Kt(e, t) {
641
- return S(), u("div", Gt, [...t[0] ||= [f("<svg fill=\"none\" height=\"16\" viewBox=\"0 0 16 16\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\" data-v-d08225db><rect height=\"14.25\" rx=\"7.125\" width=\"14.25\" x=\"0.875\" y=\"0.875\" data-v-d08225db></rect><rect height=\"14.25\" rx=\"7.125\" stroke=\"currentColor\" stroke-width=\"1.5\" width=\"14.25\" x=\"0.875\" y=\"0.875\" data-v-d08225db></rect><g clip-path=\"url(#clip0_74_585)\" data-v-d08225db><path d=\"M10.75 5.5V10.5C10.75 10.6326 10.6973 10.7598 10.6036 10.8536C10.5098 10.9473 10.3826 11 10.25 11H9C8.86739 11 8.74021 10.9473 8.64645 10.8536C8.55268 10.7598 8.5 10.6326 8.5 10.5V5.5C8.5 5.36739 8.55268 5.24021 8.64645 5.14645C8.74021 5.05268 8.86739 5 9 5H10.25C10.3826 5 10.5098 5.05268 10.6036 5.14645C10.6973 5.24021 10.75 5.36739 10.75 5.5ZM7 5H5.75C5.61739 5 5.49021 5.05268 5.39645 5.14645C5.30268 5.24021 5.25 5.36739 5.25 5.5V10.5C5.25 10.6326 5.30268 10.7598 5.39645 10.8536C5.49021 10.9473 5.61739 11 5.75 11H7C7.13261 11 7.25979 10.9473 7.35355 10.8536C7.44732 10.7598 7.5 10.6326 7.5 10.5V5.5C7.5 5.36739 7.44732 5.24021 7.35355 5.14645C7.25979 5.05268 7.13261 5 7 5Z\" fill=\"currentColor\" data-v-d08225db></path></g><defs data-v-d08225db><clipPath id=\"clip0_74_585\" data-v-d08225db><rect height=\"8\" rx=\"4\" width=\"8\" x=\"4\" y=\"4\" data-v-d08225db></rect></clipPath></defs></svg> Accept Request to Continue ", 2)]]);
642
- }
643
- var qt = /* @__PURE__ */ Q(Wt, [["render", Kt], ["__scopeId", "data-v-d08225db"]]), Jt = {}, Yt = { class: "buildingRequest" };
644
- function Xt(e, t) {
645
- return S(), u("div", Yt, [...t[0] ||= [d("div", { class: "playIcon" }, [d("svg", {
646
- fill: "currentColor",
647
- height: "32",
648
- viewBox: "0 0 256 256",
649
- width: "32",
650
- xmlns: "http://www.w3.org/2000/svg"
651
- }, [d("path", { d: "M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z" })])], -1), p(" Building Request... ", -1)]]);
652
- }
653
- var Zt = /* @__PURE__ */ Q(Jt, [["render", Xt], ["__scopeId", "data-v-5749c429"]]), Qt = {}, $t = { class: "requestApproved" };
654
- function en(e, t) {
655
- return S(), u("div", $t, [...t[0] ||= [f("<svg fill=\"none\" height=\"16\" viewBox=\"0 0 16 16\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\" data-v-bb311586><rect height=\"14.25\" rx=\"7.125\" width=\"14.25\" x=\"0.875\" y=\"0.875\" data-v-bb311586></rect><rect height=\"14.25\" rx=\"7.125\" stroke=\"var(--scalar-color-green)\" stroke-width=\"1.75\" width=\"14.25\" x=\"0.875\" y=\"0.875\" data-v-bb311586></rect><g clip-path=\"url(#clip0_74_840)\" data-v-bb311586><path d=\"M11.6037 6.841L7.59117 10.8535C7.49742 10.9472 7.37029 10.9998 7.23774 10.9998C7.10519 10.9998 6.97806 10.9472 6.8843 10.8535L4.64617 8.6035C4.55257 8.50975 4.5 8.38269 4.5 8.25022C4.5 8.11774 4.55257 7.99068 4.64617 7.89694L5.27117 7.27194C5.36488 7.17862 5.49174 7.12623 5.62399 7.12623C5.75623 7.12623 5.88309 7.17862 5.9768 7.27194L7.25024 8.50694L10.274 5.52037C10.3677 5.42696 10.4946 5.37451 10.627 5.37451C10.7593 5.37451 10.8862 5.42696 10.9799 5.52037L11.6034 6.131C11.6502 6.17746 11.6875 6.23274 11.7129 6.29366C11.7383 6.35458 11.7514 6.41993 11.7514 6.48593C11.7514 6.55194 11.7384 6.6173 11.713 6.67824C11.6877 6.73918 11.6505 6.7945 11.6037 6.841Z\" fill=\"var(--scalar-color-green)\" data-v-bb311586></path></g><defs data-v-bb311586><clipPath id=\"clip0_74_840\" data-v-bb311586><rect height=\"8\" rx=\"4\" width=\"8\" x=\"4\" y=\"4\" data-v-bb311586></rect></clipPath></defs></svg> Request Approved ", 2)]]);
656
- }
657
- var tn = /* @__PURE__ */ Q(Qt, [["render", en], ["__scopeId", "data-v-bb311586"]]), nn = {}, rn = { class: "requestFailed" };
658
- function an(e, t) {
659
- return S(), u("div", rn, [...t[0] ||= [d("i", { class: "requestFailedIcon" }, [d("svg", {
660
- fill: "currentColor",
661
- height: "100%",
662
- viewBox: "0 0 256 256",
663
- width: "100%",
664
- xmlns: "http://www.w3.org/2000/svg"
665
- }, [d("path", { d: "M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z" })])], -1), p(" Request Failed ", -1)]]);
666
- }
667
- var on = /* @__PURE__ */ Q(nn, [["render", an], ["__scopeId", "data-v-bc27e533"]]), sn = {}, cn = { class: "requestRejected" };
668
- function ln(e, t) {
669
- return S(), u("div", cn, [...t[0] ||= [d("svg", {
670
- fill: "currentColor",
671
- height: "16",
672
- viewBox: "0 0 256 256",
673
- width: "16",
674
- xmlns: "http://www.w3.org/2000/svg"
675
- }, [d("path", { d: "M56.88,31.93A12,12,0,1,0,39.12,48.07l7.81,8.59A108,108,0,0,0,31.85,177.23L21,209.66A20,20,0,0,0,46.34,235l32.43-10.81a108.08,108.08,0,0,0,112.55-8.66l7.8,8.58a12,12,0,0,0,17.76-16.14ZM128,212a83.91,83.91,0,0,1-42-11.27,12,12,0,0,0-9.82-1l-29.79,9.93,9.93-29.79a12,12,0,0,0-1-9.82,84,84,0,0,1,7.94-95.49l111.84,123A83.83,83.83,0,0,1,128,212Zm108-84a107.22,107.22,0,0,1-8.65,42.4A12,12,0,0,1,205.28,161a84.07,84.07,0,0,0-102.77-113,12,12,0,0,1-7.27-22.87A108.08,108.08,0,0,1,236,128Z" })], -1), p(" Request Rejected ", -1)]]);
676
- }
677
- var un = /* @__PURE__ */ Q(sn, [["render", ln], ["__scopeId", "data-v-9803a54c"]]), dn = {}, fn = { class: "requestSuccess" };
678
- function pn(e, t) {
679
- return S(), u("div", fn, [...t[0] ||= [f("<svg fill=\"none\" height=\"16\" viewBox=\"0 0 16 16\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\" data-v-acc2c0d8><rect height=\"14.25\" rx=\"7.125\" width=\"14.25\" x=\"0.875\" y=\"0.875\" data-v-acc2c0d8></rect><rect height=\"14.25\" rx=\"7.125\" stroke=\"currentColor\" stroke-width=\"1.75\" width=\"14.25\" x=\"0.875\" y=\"0.875\" data-v-acc2c0d8></rect><g clip-path=\"url(#clip0_74_840)\" data-v-acc2c0d8><path d=\"M11.6037 6.841L7.59117 10.8535C7.49742 10.9472 7.37029 10.9998 7.23774 10.9998C7.10519 10.9998 6.97806 10.9472 6.8843 10.8535L4.64617 8.6035C4.55257 8.50975 4.5 8.38269 4.5 8.25022C4.5 8.11774 4.55257 7.99068 4.64617 7.89694L5.27117 7.27194C5.36488 7.17862 5.49174 7.12623 5.62399 7.12623C5.75623 7.12623 5.88309 7.17862 5.9768 7.27194L7.25024 8.50694L10.274 5.52037C10.3677 5.42696 10.4946 5.37451 10.627 5.37451C10.7593 5.37451 10.8862 5.42696 10.9799 5.52037L11.6034 6.131C11.6502 6.17746 11.6875 6.23274 11.7129 6.29366C11.7383 6.35458 11.7514 6.41993 11.7514 6.48593C11.7514 6.55194 11.7384 6.6173 11.713 6.67824C11.6877 6.73918 11.6505 6.7945 11.6037 6.841Z\" fill=\"currentColor\" data-v-acc2c0d8></path></g><defs data-v-acc2c0d8><clipPath id=\"clip0_74_840\" data-v-acc2c0d8><rect height=\"8\" rx=\"4\" width=\"8\" x=\"4\" y=\"4\" data-v-acc2c0d8></rect></clipPath></defs></svg> Request Succeeded ", 2)]]);
680
- }
681
- var mn = /* @__PURE__ */ Q(dn, [["render", pn], ["__scopeId", "data-v-acc2c0d8"]]), hn = {
682
- "application/epub+zip": { extension: ".epub" },
683
- "application/gzip": { extension: ".gz" },
684
- "application/java-archive": { extension: ".jar" },
685
- "application/javascript": {
686
- extension: ".js",
687
- raw: !0
688
- },
689
- "application/json": {
690
- extension: ".json",
691
- raw: !0,
692
- language: "json"
693
- },
694
- "application/ld+json": {
695
- extension: ".jsonld",
696
- raw: !0,
697
- language: "json"
698
- },
699
- "application/problem+json": {
700
- extension: ".json",
701
- raw: !0,
702
- language: "json"
703
- },
704
- "application/vnd.api+json": {
705
- extension: ".json",
706
- raw: !0,
707
- language: "json"
708
- },
709
- "application/dns-json": {
710
- extension: ".json",
711
- raw: !0,
712
- language: "json"
713
- },
714
- "application/msword": { extension: ".doc" },
715
- "application/octet-stream": { extension: ".bin" },
716
- "application/ogg": { extension: ".ogx" },
717
- "application/pdf": {
718
- extension: ".pdf",
719
- preview: "object"
720
- },
721
- "application/rtf": {
722
- extension: ".rtf",
723
- raw: !0
724
- },
725
- "application/vnd.amazon.ebook": { extension: ".azw" },
726
- "application/vnd.apple.installer+xml": {
727
- extension: ".mpkg",
728
- raw: !0,
729
- language: "xml"
730
- },
731
- "application/vnd.mozilla.xul+xml": {
732
- extension: ".xul",
733
- raw: !0,
734
- language: "xml"
735
- },
736
- "application/vnd.ms-excel": { extension: ".xls" },
737
- "application/vnd.ms-fontobject": { extension: ".eot" },
738
- "application/vnd.ms-powerpoint": { extension: ".ppt" },
739
- "application/vnd.oasis.opendocument.presentation": { extension: ".odp" },
740
- "application/vnd.oasis.opendocument.spreadsheet": { extension: ".ods" },
741
- "application/vnd.oasis.opendocument.text": { extension: ".odt" },
742
- "application/vnd.openxmlformats-officedocument.presentationml.presentation": { extension: ".pptx" },
743
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": { extension: ".xlsx" },
744
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { extension: ".docx" },
745
- "application/vnd.rar": { extension: ".rar" },
746
- "application/vnd.visio": { extension: ".vsd" },
747
- "application/x-7z-compressed": { extension: ".7z" },
748
- "application/x-abiword": { extension: ".abw" },
749
- "application/x-bzip": { extension: ".bz" },
750
- "application/x-bzip2": { extension: ".bz2" },
751
- "application/x-cdf": { extension: ".cda" },
752
- "application/x-csh": { extension: ".csh" },
753
- "application/x-freearc": { extension: ".arc" },
754
- "application/x-httpd-php": {
755
- extension: ".php",
756
- raw: !0
757
- },
758
- "application/x-sh": {
759
- extension: ".sh",
760
- raw: !0
761
- },
762
- "application/x-tar": { extension: ".tar" },
763
- "application/xhtml+xml": {
764
- extension: ".xhtml",
765
- raw: !0,
766
- language: "html"
767
- },
768
- "application/xml": {
769
- extension: ".xml",
770
- raw: !0,
771
- language: "xml"
772
- },
773
- "application/yaml": {
774
- extension: ".yaml",
775
- raw: !0,
776
- language: "yaml"
777
- },
778
- "application/zip": { extension: ".zip" },
779
- "audio/aac": { extension: ".aac" },
780
- "audio/midi": { extension: ".midi" },
781
- "audio/mpeg": {
782
- extension: ".mp3",
783
- preview: "audio"
784
- },
785
- "audio/ogg": { extension: ".oga" },
786
- "audio/wav": { extension: ".wav" },
787
- "audio/webm": { extension: ".weba" },
788
- "font/otf": { extension: ".otf" },
789
- "font/ttf": { extension: ".ttf" },
790
- "font/woff": { extension: ".woff" },
791
- "font/woff2": { extension: ".woff2" },
792
- "image/apng": {
793
- extension: ".apng",
794
- preview: "image",
795
- alpha: !0
796
- },
797
- "image/avif": {
798
- extension: ".avif",
799
- preview: "image"
800
- },
801
- "image/bmp": {
802
- extension: ".bmp",
803
- preview: "image"
804
- },
805
- "image/gif": {
806
- extension: ".gif",
807
- preview: "image",
808
- alpha: !0
809
- },
810
- "image/jpeg": {
811
- extension: ".jpg",
812
- preview: "image"
813
- },
814
- "image/png": {
815
- extension: ".png",
816
- preview: "image",
817
- alpha: !0
818
- },
819
- "image/svg+xml": {
820
- extension: ".svg",
821
- raw: !0,
822
- language: "xml",
823
- preview: "image",
824
- alpha: !0
825
- },
826
- "image/tiff": { extension: ".tiff" },
827
- "image/vnd.microsoft.icon": {
828
- extension: ".ico",
829
- preview: "image"
830
- },
831
- "image/webp": {
832
- extension: ".webp",
833
- preview: "image",
834
- alpha: !0
835
- },
836
- "text/calendar": {
837
- extension: ".ics",
838
- raw: !0
839
- },
840
- "text/css": {
841
- extension: ".css",
842
- raw: !0,
843
- language: "css"
844
- },
845
- "text/csv": {
846
- extension: ".csv",
847
- raw: !0
848
- },
849
- "text/html": {
850
- extension: ".html",
851
- raw: !0,
852
- language: "html",
853
- preview: "object"
854
- },
855
- "text/javascript": {
856
- extension: ".js",
857
- raw: !0
858
- },
859
- "text/plain": {
860
- extension: ".txt",
861
- raw: !0
862
- },
863
- "text/xml": {
864
- extension: ".xml",
865
- raw: !0,
866
- language: "xml"
867
- },
868
- "text/yaml": {
869
- extension: ".yaml",
870
- raw: !0,
871
- language: "yaml"
872
- },
873
- "video/3gpp": { extension: ".3gp" },
874
- "audio/3gpp": { extension: ".3gp" },
875
- "video/3gpp2": { extension: ".3g2" },
876
- "audio/3gpp2": { extension: ".3g2" },
877
- "video/mp2t": { extension: ".ts" },
878
- "video/mp4": {
879
- extension: ".mp4",
880
- preview: "video"
881
- },
882
- "video/mpeg": { extension: ".mpeg" },
883
- "video/ogg": { extension: ".ogv" },
884
- "video/webm": {
885
- extension: ".webm",
886
- preview: "video"
887
- },
888
- "video/x-msvideo": { extension: ".avi" }
889
- };
890
- function gn(e) {
891
- let t = hn[e];
892
- if (t) return t;
893
- if (e.endsWith("+json")) return {
894
- extension: ".json",
895
- raw: !0,
896
- language: "json"
897
- };
898
- }
899
- //#endregion
900
- //#region src/components/ResponseBody/helpers/process-response-body.ts
901
- var _n = (e) => {
902
- try {
903
- return decodeURIComponent(e);
904
- } catch {
905
- return e;
906
- }
907
- };
908
- function vn(e) {
909
- let t = "";
910
- if (e) {
911
- let n = e.match(/filename\*=UTF-8''([^;]+)/)?.[1] ?? e.match(/filename\s*=\s*"?([^";]+)"?/)?.[1];
912
- n && (t = _n(n.trim()));
913
- }
914
- return t;
915
- }
916
- var yn = (e) => e instanceof Blob, bn = (e) => e ? Object.keys(e).map((t) => ({
917
- name: t,
918
- value: e[t] ?? ""
919
- })) : [];
920
- function xn({ data: e, headers: t }) {
921
- let n = bn(t), r = n.find((e) => e.name.toLowerCase() === "content-type"), i = r?.value ? new et(r.value) : void 0;
922
- return {
923
- mimeType: i,
924
- attachmentFilename: vn(n.find((e) => e.name.toLowerCase() === "content-disposition")?.value ?? ""),
925
- dataUrl: yn(e) ? URL.createObjectURL(e) : typeof e == "string" ? URL.createObjectURL(new Blob([e], { type: i ? i.toString() : void 0 })) : e instanceof Object && Object.keys(e).length ? URL.createObjectURL(new Blob([JSON.stringify(e)], { type: i ? i.toString() : void 0 })) : ""
926
- };
927
- }
928
- //#endregion
929
- //#region src/components/ResponseBody/ResponseBodyInfo.vue
930
- var Sn = {}, Cn = { class: "flex justify-center px-2 py-3" }, wn = { class: "text-c-3 p-2 text-sm" };
931
- function Tn(e, t) {
932
- return S(), u("div", Cn, [d("div", wn, [D(e.$slots, "default")])]);
933
- }
934
- var En = /* @__PURE__ */ Q(Sn, [["render", Tn]]), Dn = ["src"], On = ["src", "type"], kn = ["src", "type"], An = ["data", "type"], jn = /* @__PURE__ */ Q(/* @__PURE__ */ h({
935
- __name: "ResponseBodyPreview",
936
- props: {
937
- src: {},
938
- type: {},
939
- mode: {},
940
- alpha: {
941
- type: Boolean,
942
- default: !1
943
- }
944
- },
945
- setup(e) {
946
- let t = T(!1);
947
- return P(() => e.src, () => {
948
- t.value = !1;
949
- }), (n, r) => !t.value && e.src ? (S(), u("div", {
950
- key: 0,
951
- class: y(["flex justify-center overflow-auto rounded-b", { "bg-preview p-2": e.alpha }])
952
- }, [e.mode === "image" ? (S(), u("img", {
953
- key: 0,
954
- class: y(["h-full max-w-full", { rounded: e.alpha }]),
955
- src: e.src,
956
- onError: r[0] ||= (e) => t.value = !0
957
- }, null, 42, Dn)) : e.mode === "video" ? (S(), u("video", {
958
- key: 1,
959
- autoplay: "",
960
- controls: "",
961
- width: "100%",
962
- onError: r[1] ||= (e) => t.value = !0
963
- }, [d("source", {
964
- src: e.src,
965
- type: e.type
966
- }, null, 8, On)], 32)) : e.mode === "audio" ? (S(), u("audio", {
967
- key: 2,
968
- class: "my-12",
969
- controls: "",
970
- onError: r[2] ||= (e) => t.value = !0
971
- }, [d("source", {
972
- src: e.src,
973
- type: e.type
974
- }, null, 8, kn)], 32)) : (S(), u("object", {
975
- key: 3,
976
- class: "aspect-[4/3] w-full",
977
- data: e.src,
978
- type: e.type,
979
- onError: r[3] ||= (e) => t.value = !0
980
- }, null, 40, An))], 2)) : (S(), c(En, { key: 1 }, {
981
- default: F(() => [...r[4] ||= [p("Preview unavailable", -1)]]),
982
- _: 1
983
- }));
984
- }
985
- }), [["__scopeId", "data-v-92f84612"]]), Mn = /* @__PURE__ */ h({
986
- __name: "ResponseBodyRaw",
987
- props: {
988
- content: {},
989
- language: {}
990
- },
991
- setup(e) {
992
- let t = e;
993
- return (n, r) => (S(), c(j(se), {
994
- class: "codeBlock",
995
- content: t.content,
996
- lang: e.language
997
- }, null, 8, ["content", "lang"]));
998
- }
999
- }), Nn = /* @__PURE__ */ h({
1000
- __name: "ResponseBody",
1001
- props: {
1002
- data: {},
1003
- responseBody: {},
1004
- mediaConfig: {},
1005
- display: {}
1006
- },
1007
- setup(e) {
1008
- return P(() => e.display, (e) => console.log(e)), (t, n) => (S(), u(o, null, [
1009
- e.mediaConfig?.raw && e.display === "raw" && e.mediaConfig.language ? (S(), c(Mn, {
1010
- key: e.responseBody.dataUrl,
1011
- content: e.data,
1012
- language: e.mediaConfig.language
1013
- }, null, 8, ["content", "language"])) : l("", !0),
1014
- e.mediaConfig?.preview && e.display === "preview" ? (S(), c(jn, {
1015
- key: e.responseBody.dataUrl,
1016
- alpha: e.mediaConfig.alpha,
1017
- mode: e.mediaConfig.preview,
1018
- src: e.responseBody.dataUrl,
1019
- type: e.responseBody.mimeType?.essence ?? ""
1020
- }, null, 8, [
1021
- "alpha",
1022
- "mode",
1023
- "src",
1024
- "type"
1025
- ])) : l("", !0),
1026
- !e.mediaConfig?.raw && !e.mediaConfig?.preview ? (S(), c(En, { key: 2 }, {
1027
- default: F(() => [...n[0] ||= [p(" Binary file ", -1)]]),
1028
- _: 1
1029
- })) : l("", !0)
1030
- ], 64));
1031
- }
1032
- }), Pn = { class: "text-c-3 text-xxs -my-1 flex justify-center gap-0.5 rounded p-0.5" }, Fn = /* @__PURE__ */ h({
1033
- __name: "ResponseBodyToggle",
1034
- props: { modelValue: {} },
1035
- emits: ["toggle"],
1036
- setup(e, { emit: t }) {
1037
- let n = t;
1038
- return (t, r) => (S(), u("div", Pn, [d("button", {
1039
- class: y(["hover:bg-b-3 rounded px-1", { "bg-b-3 text-c-1 cursor-default": e.modelValue === "preview" }]),
1040
- type: "button",
1041
- onClick: r[0] ||= I((e) => n("toggle", "preview"), ["stop"])
1042
- }, " Preview ", 2), d("button", {
1043
- class: y(["hover:bg-b-3 rounded px-1", { "bg-b-3 text-c-1 cursor-default": e.modelValue === "raw" }]),
1044
- type: "button",
1045
- onClick: r[1] ||= I((e) => n("toggle", "raw"), ["stop"])
1046
- }, " Raw ", 2)]));
1047
- }
1048
- }), In = {}, Ln = { class: "sendingRequest" };
1049
- function Rn(e, t) {
1050
- return S(), u("div", Ln, [...t[0] ||= [d("div", { class: "playIcon" }, [d("svg", {
1051
- fill: "currentColor",
1052
- height: "32",
1053
- viewBox: "0 0 256 256",
1054
- width: "32",
1055
- xmlns: "http://www.w3.org/2000/svg"
1056
- }, [d("path", { d: "M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z" })])], -1), p(" Sending Request to Endpoint ", -1)]]);
1057
- }
1058
- var zn = /* @__PURE__ */ Q(In, [["render", Rn], ["__scopeId", "data-v-65dc6dfb"]]), Bn = {
1059
- key: 1,
1060
- class: "autosendContainer"
1061
- }, Vn = {
1062
- key: 2,
1063
- class: "autosendContainer"
1064
- }, Hn = { class: "requestContent" }, Un = { class: "requestContentInner" }, Wn = {
1065
- key: 0,
1066
- class: "code"
1067
- }, Gn = {
1068
- key: 1,
1069
- class: "code"
1070
- }, Kn = { class: "requestHeaderContainer" }, qn = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1071
- __name: "RequestPreview",
1072
- props: {
1073
- request: {},
1074
- response: {},
1075
- state: {}
1076
- },
1077
- setup(e) {
1078
- let t = s(() => {
1079
- if (e.response?.success) return {
1080
- data: e.response.data.responseBody,
1081
- headers: e.response.data.headers
1082
- };
1083
- if (e.response?.error?.code === "REQUEST_NOT_OK") return {
1084
- data: e.response.error.detail.responseBody,
1085
- headers: e.response.error.detail.headers
1086
- };
1087
- }), n = T(!1), r = s(() => e.state === "requestFailed" || e.state === "requiresApproval" ? !0 : n.value), i = s(() => xn({
1088
- data: t.value?.data,
1089
- headers: t.value?.headers
1090
- })), a = s(() => gn(i.value.mimeType?.essence ?? "")), o = T();
1091
- function f(e) {
1092
- o.value = e;
1093
- }
1094
- let p = s(() => o.value ? o.value : a.value?.raw && !a.value.preview ? "raw" : a.value?.preview ? "preview" : "raw");
1095
- return (o, s) => (S(), u("div", { class: y(["requestPreview", {
1096
- open: r.value,
1097
- succeeded: e.state === "requestSucceeded"
1098
- }]) }, [e.state === "approved" ? (S(), c(tn, { key: 0 })) : e.state === "buildingRequest" ? (S(), u("div", Bn, [m(Zt)])) : e.state === "requiresApproval" ? (S(), u("div", Vn, [m(qt)])) : e.state === "sendingRequest" ? (S(), u("button", {
1099
- key: 3,
1100
- class: "toggleButton",
1101
- type: "button",
1102
- onClick: s[0] ||= (e) => n.value = !n.value
1103
- }, [m(zn), r.value ? (S(), c(j(U), { key: 0 })) : (S(), c(j(W), { key: 1 }))])) : e.state === "requestSucceeded" ? (S(), u("button", {
1104
- key: 4,
1105
- class: "toggleButton",
1106
- type: "button",
1107
- onClick: s[1] ||= (e) => n.value = !n.value
1108
- }, [m(mn), r.value ? (S(), c(j(U), { key: 0 })) : (S(), c(j(W), { key: 1 }))])) : e.state === "rejected" ? (S(), u("button", {
1109
- key: 5,
1110
- class: "toggleButton",
1111
- type: "button",
1112
- onClick: s[2] ||= (e) => n.value = !n.value
1113
- }, [m(un), r.value ? (S(), c(j(U), { key: 0 })) : (S(), c(j(W), { key: 1 }))])) : e.state === "requestFailed" ? (S(), c(on, { key: 6 })) : l("", !0), d("div", Hn, [d("div", Un, [e.request ? (S(), u("div", Wn, [s[4] ||= d("div", { class: "requestHeaderContainer" }, [d("h1", null, "Request")], -1), m(j(se), {
1114
- class: "codeBlock",
1115
- content: JSON.stringify(e.request, null, 2),
1116
- lang: "json"
1117
- }, null, 8, ["content"])])) : l("", !0), t.value ? (S(), u("div", Gn, [d("div", Kn, [s[5] ||= d("h1", null, "Response", -1), a.value?.raw && a.value.preview ? (S(), c(Fn, {
1118
- key: 0,
1119
- modelValue: p.value,
1120
- "onUpdate:modelValue": s[3] ||= (e) => p.value = e,
1121
- onToggle: f
1122
- }, null, 8, ["modelValue"])) : l("", !0)]), m(Nn, {
1123
- data: t.value.data,
1124
- display: p.value,
1125
- mediaConfig: a.value,
1126
- responseBody: i.value
1127
- }, null, 8, [
1128
- "data",
1129
- "display",
1130
- "mediaConfig",
1131
- "responseBody"
1132
- ])])) : l("", !0)])])], 2));
1133
- }
1134
- }), [["__scopeId", "data-v-0eb5f95d"]]);
1135
- //#endregion
1136
- //#region src/hooks/use-chat-approvals.ts
1137
- function $(e) {
1138
- return e.type === "tool-execute-request" && e.state === "input-available" && e.input?.method?.toLowerCase() !== "get";
1139
- }
1140
- function Jn() {
1141
- let e = Z(), t = s(() => e.chat.messages.filter((e) => e.parts.some($)).flatMap((e) => e.parts).filter($));
1142
- async function r(r) {
1143
- let i = t.value.map(async (t) => {
1144
- if (!r) return await e.chat.addToolOutput({
1145
- tool: n,
1146
- toolCallId: t.toolCallId,
1147
- state: "output-error",
1148
- errorText: "The user denied the request."
1149
- });
1150
- await lt({
1151
- documentSettings: J(e.workspaceStore),
1152
- proxyUrl: e.proxyUrl.value,
1153
- input: t.input,
1154
- toolCallId: t.toolCallId,
1155
- chat: e.chat
1156
- });
1157
- });
1158
- await Promise.all(i);
1159
- }
1160
- return {
1161
- approvalRequiredParts: t,
1162
- respondToRequestApprovals: r
1163
- };
1164
- }
1165
- //#endregion
1166
- //#region src/views/Chat/Messages/ExecuteRequestTool.vue?vue&type=script&setup=true&lang.ts
1167
- var Yn = { class: "executeRequestTool" }, Xn = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1168
- __name: "ExecuteRequestTool",
1169
- props: { messagePart: {} },
1170
- setup(e) {
1171
- let t = Z(), n = s(() => e.messagePart.value.state === "input-streaming" ? "buildingRequest" : e.messagePart.value.state === "approval-responded" && t.chat.status === "submitted" ? "sendingRequest" : $(e.messagePart.value) ? "requiresApproval" : e.messagePart.value.state === "output-available" ? e.messagePart.value.output.success ? "requestSucceeded" : "requestFailed" : e.messagePart.value.state === "output-error" ? "rejected" : null);
1172
- return (t, r) => (S(), u("div", Yn, [n.value ? (S(), c(qn, {
1173
- key: 0,
1174
- request: e.messagePart.value.input,
1175
- response: e.messagePart.value.output,
1176
- state: n.value
1177
- }, null, 8, [
1178
- "request",
1179
- "response",
1180
- "state"
1181
- ])) : l("", !0)]));
1182
- }
1183
- }), [["__scopeId", "data-v-3e825a81"]]), Zn = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1184
- __name: "ContextItem",
1185
- props: { loading: { type: Boolean } },
1186
- setup(e) {
1187
- return (t, n) => (S(), u("div", { class: y(["contextItem", { shimmer: e.loading }]) }, [D(t.$slots, "default", {}, void 0, !0)], 2));
1188
- }
1189
- }), [["__scopeId", "data-v-b6e5aa96"]]), Qn = {}, $n = { class: "sendingRequest" };
1190
- function er(e, t) {
1191
- return S(), u("div", $n, [...t[0] ||= [d("div", { class: "playIcon" }, null, -1), p(" Retrieving relevant information... ", -1)]]);
1192
- }
1193
- var tr = /* @__PURE__ */ Q(Qn, [["render", er], ["__scopeId", "data-v-653c66b3"]]), nr = { key: 0 }, rr = {
1194
- key: 1,
1195
- class: "operations"
1196
- }, ir = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1197
- __name: "GetMiniOpenAPIDocTool",
1198
- props: {
1199
- messagePart: {},
1200
- message: {}
1201
- },
1202
- setup(e) {
1203
- let t = T(!1);
1204
- P(() => e.message, () => {
1205
- let n = e.message.parts;
1206
- t.value = !!n[n.findIndex((t) => "toolCallId" in t && t.toolCallId === e.messagePart.value.toolCallId) + 1];
1207
- });
1208
- let n = s(() => {
1209
- if (!e.messagePart.value.output?.structuredContent) return;
1210
- let t = e.messagePart.value.output?.structuredContent?.info?.title;
1211
- return ut(e.messagePart.value.output?.structuredContent).map((e) => `${t ? `${t} - ` : ""}${e.summary ?? ""}`).filter(Boolean);
1212
- }), r = Z();
1213
- return (i, a) => (S(), u(o, null, [e.messagePart.value.state === "input-available" && j(r).chat.status === "streaming" ? (S(), u("div", nr, [m(tr)])) : l("", !0), n.value ? (S(), u("div", rr, [(S(!0), u(o, null, E(n.value, (e) => (S(), c(Zn, {
1214
- key: e,
1215
- loading: !t.value
1216
- }, {
1217
- default: F(() => [p(k(e), 1)]),
1218
- _: 2
1219
- }, 1032, ["loading"]))), 128))])) : l("", !0)], 64));
1220
- }
1221
- }), [["__scopeId", "data-v-ecee6203"]]), ar = {}, or = { class: "loadingApiSpecs" };
1222
- function sr(e, t) {
1223
- return S(), u("div", or, [...t[0] ||= [d("div", { class: "playIcon" }, null, -1), p(" Loading APIs... ", -1)]]);
1224
- }
1225
- var cr = /* @__PURE__ */ Q(ar, [["render", sr], ["__scopeId", "data-v-9d9724d2"]]), lr = { key: 0 }, ur = /* @__PURE__ */ h({
1226
- __name: "GetOpenAPISpecsSummary",
1227
- props: {
1228
- messagePart: {},
1229
- message: {}
1230
- },
1231
- setup(e) {
1232
- let t = T(!1);
1233
- return P(() => e.message, () => {
1234
- let n = e.message.parts;
1235
- t.value = !!n[n.findIndex((t) => "toolCallId" in t && t.toolCallId === e.messagePart.value.toolCallId) + 1];
1236
- }), (e, n) => t.value ? l("", !0) : (S(), u("div", lr, [m(cr)]));
1237
- }
1238
- }), dr = /* @__PURE__ */ h({
1239
- __name: "Text",
1240
- props: { messagePart: {} },
1241
- setup(e) {
1242
- return (t, n) => (S(), c(j(he), { value: e.messagePart.value.text }, null, 8, ["value"]));
1243
- }
1244
- });
1245
- //#endregion
1246
- //#region src/hooks/use-search.ts
1247
- function fr() {
1248
- let { api: e } = Z(), t = T(""), n = Qe(async (t) => {
1249
- let n = await e.search(t);
1250
- n.success && (i.value = n.data.results);
1251
- }, 200), r = s({
1252
- get: () => t.value,
1253
- set: (e) => {
1254
- n(e), t.value = e;
1255
- }
1256
- }), i = T([]);
1257
- return n(""), {
1258
- query: r,
1259
- results: i
1260
- };
1261
- }
1262
- //#endregion
1263
- //#region src/views/Catalog/Catalog.vue?vue&type=script&setup=true&lang.ts
1264
- var pr = {
1265
- key: 0,
1266
- class: "catalog custom-scroll"
1267
- }, mr = ["onClick"], hr = { class: "left" }, gr = ["src"], _r = { class: "right" }, vr = { class: "item-top" }, yr = { class: "version" }, br = { class: "description" }, xr = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1268
- __name: "Catalog",
1269
- props: { modal: {} },
1270
- setup(e) {
1271
- let t = fr(), n = Z(), r = s(() => t.results.value.filter((e) => !n.registryDocuments.value.some((t) => t.namespace === e.namespace && t.slug === e.slug)).map((e) => ({
1272
- ...e,
1273
- label: e.title,
1274
- id: e.id
1275
- })));
1276
- return (i, a) => (S(), c(j(ge), {
1277
- class: "catalogModal",
1278
- state: e.modal
1279
- }, {
1280
- default: F(() => [m(j(ve), {
1281
- autofocus: "",
1282
- class: "searchInput",
1283
- modelValue: j(t).query.value,
1284
- "onUpdate:modelValue": a[0] ||= (e) => j(t).query.value = e ?? ""
1285
- }, null, 8, ["modelValue"]), r.value.length ? (S(), u("div", pr, [(S(!0), u(o, null, E(r.value, (t) => (S(), u("button", {
1286
- key: t.id,
1287
- class: "item",
1288
- type: "button",
1289
- onClick: () => {
1290
- j(n).addDocument(t), e.modal.hide();
1291
- }
1292
- }, [d("div", hr, [t.logoUrl ? (S(), u("img", {
1293
- key: 0,
1294
- class: "logo",
1295
- src: t.logoUrl
1296
- }, null, 8, gr)) : (S(), c(j(de), {
1297
- key: 1,
1298
- class: "logo",
1299
- logo: "Openapi"
1300
- }))]), d("div", _r, [d("div", vr, [d("span", null, k(t.title), 1), d("span", yr, "v" + k(t.currentVersion), 1)]), d("span", br, " @" + k(t.namespace) + "/" + k(t.slug), 1)])], 8, mr))), 128))])) : l("", !0)]),
1301
- _: 1
1302
- }, 8, ["state"]));
1303
- }
1304
- }), [["__scopeId", "data-v-bc24f891"]]), Sr = { class: "dropdown-item" }, Cr = { class: "dropdown-item" }, wr = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1305
- __name: "ActionsDropdown",
1306
- emits: ["uploadApi"],
1307
- setup(e) {
1308
- let t = Se();
1309
- return (e, n) => (S(), u(o, null, [m(j(le), { offset: {
1310
- crossAxis: -5,
1311
- mainAxis: 5
1312
- } }, {
1313
- items: F(() => [m(j(ue), { onClick: n[0] ||= (t) => e.$emit("uploadApi") }, {
1314
- default: F(() => [d("div", Sr, [m(j(Ye)), n[2] ||= p(" Upload API ", -1)])]),
1315
- _: 1
1316
- }), m(j(ue), { onClick: n[1] ||= (e) => j(t).show() }, {
1317
- default: F(() => [d("div", Cr, [m(j(qe)), n[3] ||= p(" Search Catalog ", -1)])]),
1318
- _: 1
1319
- })]),
1320
- default: F(() => [D(e.$slots, "default", {}, void 0, !0)]),
1321
- _: 3
1322
- }), j(t).open ? (S(), c(xr, {
1323
- key: 0,
1324
- modal: j(t)
1325
- }, null, 8, ["modal"])) : l("", !0)], 64));
1326
- }
1327
- }), [["__scopeId", "data-v-2d142bb5"]]), Tr = { class: "approvalSection" }, Er = { class: "approvalText flex items-center gap-1.5" }, Dr = { class: "approveContainer" }, Or = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1328
- __name: "ApprovalSection",
1329
- emits: ["approve", "reject"],
1330
- setup(e, { emit: t }) {
1331
- let n = t;
1332
- return (e, t) => (S(), u("div", Tr, [d("strong", Er, [m(j(G), {
1333
- class: "text-blue size-4",
1334
- weight: "bold"
1335
- }), t[2] ||= p(" One or more requests require approval. ", -1)]), d("div", Dr, [d("button", {
1336
- type: "button",
1337
- class: "actionButton rejectButton",
1338
- onClick: t[0] ||= (e) => n("reject")
1339
- }, " Reject "), d("button", {
1340
- type: "button",
1341
- class: "actionButton approveButton",
1342
- onClick: t[1] ||= (e) => n("approve")
1343
- }, " Approve ")])]));
1344
- }
1345
- }), [["__scopeId", "data-v-a7e6c699"]]), kr = H.object({
1346
- message: H.string(),
1347
- code: H.string(),
1348
- status: H.optional(H.number())
1349
- });
1350
- function Ar() {
1351
- let { chat: e } = Z();
1352
- return s(() => {
1353
- if (!e.error) return;
1354
- let t = ht(e.error.message), n = kr.safeParse(t);
1355
- return !t || !n.success ? {
1356
- message: e.error.message,
1357
- code: "UNKNOWN_ERROR"
1358
- } : n.data;
1359
- });
1360
- }
1361
- //#endregion
1362
- //#region src/components/ErrorMessage.vue?vue&type=script&setup=true&lang.ts
1363
- var jr = {
1364
- key: 0,
1365
- class: "error gap-1.5"
1366
- }, Mr = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1367
- __name: "ErrorMessage",
1368
- props: { error: {} },
1369
- setup(e) {
1370
- let t = [a.LIMIT_REACHED];
1371
- return (n, r) => t.includes(e.error.code) ? l("", !0) : (S(), u("div", jr, [m(j(G), {
1372
- class: "text-red size-4",
1373
- weight: "bold"
1374
- }), p(" " + k(e.error.message), 1)]));
1375
- }
1376
- }), [["__scopeId", "data-v-63a481da"]]);
1377
- //#endregion
1378
- //#region src/hooks/use-signup-link.ts
1379
- function Nr() {
1380
- let { dashboardUrl: e, mode: t, uploadedTmpDocumentUrl: n } = Z(), r = s(() => t === "full" ? e : n.value ? `${e}/register?flow=oss-agent&docUrl=${n.value}` : e);
1381
- function i() {
1382
- window.location.assign(r.value);
1383
- }
1384
- return {
1385
- signupLink: r,
1386
- navigateToSignup: i
1387
- };
1388
- }
1389
- //#endregion
1390
- //#region src/components/FreeMessagesInfoSection.vue?vue&type=script&setup=true&lang.ts
1391
- var Pr = { class: "freeMessagesInfoSection" }, Fr = { class: "infoText flex items-center gap-1.5" }, Ir = ["href"], Lr = { class: "actionsContainer" }, Rr = ["href"], zr = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1392
- __name: "FreeMessagesInfoSection",
1393
- setup(e) {
1394
- let t = T(!1), { signupLink: n } = Nr();
1395
- function r() {
1396
- t.value = !0;
1397
- }
1398
- return (e, i) => ne((S(), u("div", Pr, [d("strong", Fr, [
1399
- m(j(G), {
1400
- class: "text-blue size-4",
1401
- weight: "bold"
1402
- }),
1403
- d("a", {
1404
- class: "underline",
1405
- href: j(n),
1406
- target: "_blank"
1407
- }, "Sign up for Agent Scalar", 8, Ir),
1408
- i[0] ||= p(" to continue without hitting limits. ", -1)
1409
- ]), d("div", Lr, [d("a", {
1410
- class: "actionButton upgradeButton",
1411
- href: j(q).AGENT_SCALAR_DOCUMENTATION,
1412
- target: "_blank",
1413
- type: "button"
1414
- }, " Read more ", 8, Rr), d("button", {
1415
- "aria-label": "Close",
1416
- class: "closeButton",
1417
- type: "button",
1418
- onClick: r
1419
- }, [m(j(Xe), {
1420
- class: "size-4",
1421
- weight: "bold"
1422
- })])])], 512)), [[N, !t.value]]);
1423
- }
1424
- }), [["__scopeId", "data-v-913a3815"]]), Br = { class: "paymentSection" }, Vr = { class: "approvalText flex items-center gap-1.5" }, Hr = { class: "paymentContainer" }, Ur = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1425
- __name: "PaymentSection",
1426
- setup(e) {
1427
- let { navigateToSignup: t } = Nr();
1428
- return (e, n) => (S(), u("div", Br, [d("strong", Vr, [m(j(G), {
1429
- class: "text-blue size-4",
1430
- weight: "bold"
1431
- }), n[1] ||= p(" You've reached your free message limit. Unlock unlimited access by upgrading now. ", -1)]), d("div", Hr, [d("button", {
1432
- class: "actionButton approveButton",
1433
- type: "button",
1434
- onClick: n[0] ||= (...e) => j(t) && j(t)(...e)
1435
- }, " Upgrade "), n[2] ||= f("<div class=\"paymentInfo\" data-v-91e028d5><h3 data-v-91e028d5>$72 <span data-v-91e028d5>/ month</span></h3><div class=\"paymentInfoSection\" data-v-91e028d5><div class=\"paymentInfoItem\" data-v-91e028d5><span data-v-91e028d5>Seat minimum</span><span data-v-91e028d5>3</span></div><div class=\"paymentInfoItem\" data-v-91e028d5><span data-v-91e028d5>Base monthly total</span><span data-v-91e028d5>$72.00</span></div></div><div class=\"paymentInfoSection\" data-v-91e028d5><div class=\"paymentInfoItem\" data-v-91e028d5><span data-v-91e028d5>Messages</span><span data-v-91e028d5>250</span></div><div class=\"paymentInfoItem\" data-v-91e028d5><span data-v-91e028d5>Additional Messages</span><span data-v-91e028d5>+ $0.02 Message</span></div></div></div>", 1)])]));
1436
- }
1437
- }), [["__scopeId", "data-v-91e028d5"]]), Wr = ["onClick"], Gr = ["src"], Kr = {
1438
- key: 1,
1439
- class: "searchResultsEmpty"
1440
- }, qr = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1441
- __name: "SearchPopover",
1442
- setup(e) {
1443
- let t = Z(), n = fr(), r = s(() => n.results.value.filter((e) => !t.registryDocuments.value.some((t) => t.namespace === e.namespace && t.slug === e.slug)).map((e) => ({
1444
- ...e,
1445
- label: e.title,
1446
- id: e.id
1447
- })));
1448
- return (e, i) => (S(), c(j(_e), {
1449
- offset: 0,
1450
- placement: "top-start",
1451
- resize: "",
1452
- style: { width: "220px" }
1453
- }, {
1454
- popover: F(({ close: e }) => [m(j(ye), {
1455
- autofocus: "",
1456
- class: "searchInput",
1457
- modelValue: j(n).query.value,
1458
- placeholder: "Add an API",
1459
- "onUpdate:modelValue": i[0] ||= (e) => j(n).query.value = e ?? ""
1460
- }, {
1461
- prefix: F(() => [m(j(qe), { class: "searchIcon" })]),
1462
- _: 1
1463
- }, 8, ["modelValue"]), r.value.length ? (S(!0), u(o, { key: 0 }, E(r.value, (n) => (S(), u("button", {
1464
- key: n.id,
1465
- class: "searchItem",
1466
- type: "button",
1467
- onClick: () => {
1468
- j(t).addDocument(n), e();
1469
- }
1470
- }, [n.logoUrl ? (S(), u("img", {
1471
- key: 0,
1472
- class: "searchItemLogo",
1473
- src: n.logoUrl
1474
- }, null, 8, Gr)) : l("", !0), d("span", null, k(n.title), 1)], 8, Wr))), 128)) : (S(), u("span", Kr, " No APIs found "))]),
1475
- default: F(() => [D(e.$slots, "default", {}, void 0, !0)]),
1476
- _: 3
1477
- }));
1478
- }
1479
- }), [["__scopeId", "data-v-7945f74c"]]), Jr = {
1480
- key: 0,
1481
- class: "flex items-center gap-1.5"
1482
- }, Yr = {
1483
- key: 0,
1484
- class: "uploadText"
1485
- }, Xr = {
1486
- key: 1,
1487
- class: "uploadText"
1488
- }, Zr = {
1489
- key: 2,
1490
- class: "uploadText"
1491
- }, Qr = {
1492
- key: 1,
1493
- class: "uploadText flex items-center gap-1.5"
1494
- }, $r = {
1495
- key: 2,
1496
- class: "uploadText flex items-center gap-1.5"
1497
- }, ei = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1498
- __name: "UploadSection",
1499
- props: { uploadState: {} },
1500
- setup(e) {
1501
- let t = xe(), n = s(() => [
1502
- "uploading",
1503
- "processing",
1504
- "loading"
1505
- ].includes(e.uploadState.type));
1506
- return (r, i) => (S(), u("div", { class: y(["uploadSection", {
1507
- error: e.uploadState.type === "error",
1508
- done: e.uploadState.type === "done"
1509
- }]) }, [
1510
- n.value ? (S(), u("div", Jr, [m(j(me), {
1511
- class: "text-blue",
1512
- loader: {
1513
- ...j(t),
1514
- isLoading: !0
1515
- },
1516
- size: "lg"
1517
- }, null, 8, ["loader"]), e.uploadState.type === "loading" ? (S(), u("strong", Yr, " Loading OpenAPI document… ")) : e.uploadState.type === "processing" ? (S(), u("strong", Xr, " Processing OpenAPI document… ")) : (S(), u("strong", Zr, " Uploading OpenAPI document… "))])) : l("", !0),
1518
- e.uploadState.type === "done" ? (S(), u("strong", Qr, [m(j(Ge), { class: "icon text-green" }), i[0] ||= p(" Your OpenAPI document has been processed successfully. ", -1)])) : l("", !0),
1519
- e.uploadState.type === "error" ? (S(), u("strong", $r, [m(j(Ze), { class: "icon text-red" }), p(" " + k(e.uploadState.error), 1)])) : l("", !0)
1520
- ], 2));
1521
- }
1522
- }), [["__scopeId", "data-v-9551cf83"]]);
1523
- //#endregion
1524
- //#region src/hooks/use-chat-pending-client-tool-parts.ts
1525
- function ti(e) {
1526
- return e.type.startsWith("tool") && e.state === "input-available";
1527
- }
1528
- function ni() {
1529
- let e = Z();
1530
- return { pendingClientToolParts: s(() => e.chat.messages.filter((e) => e.parts.some(ti)).flatMap((e) => e.parts).filter(ti)) };
1531
- }
1532
- //#endregion
1533
- //#region src/views/PromptForm.vue?vue&type=script&setup=true&lang.ts
1534
- var ri = { class: "actionContainer" }, ii = ["disabled"], ai = { class: "inputActionsContainer" }, oi = { class: "inputActionsLeft" }, si = {
1535
- class: "addAPIButton",
1536
- type: "button"
1537
- }, ci = {
1538
- class: "addAPIButton",
1539
- type: "button"
1540
- }, li = ["src"], ui = ["onClick"], di = { class: "inputActionsRight" }, fi = { class: "sendCheckboxContinue" }, pi = {
1541
- key: 0,
1542
- class: "relative flex items-center gap-1.5"
1543
- }, mi = {
1544
- class: "termsAgree",
1545
- for: "agentTermsAgree"
1546
- }, hi = {
1547
- key: 5,
1548
- class: "addMoreContext"
1549
- }, gi = { class: "ml-auto flex items-center gap-1" }, _i = ["onClick"], vi = ["alt", "src"], yi = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1550
- __name: "PromptForm",
1551
- emits: ["submit", "uploadApi"],
1552
- setup(e, { expose: t, emit: n }) {
1553
- let i = n;
1554
- t({ focusPrompt: b });
1555
- let f = ee("agentPrompt"), h = Z(), g = s(() => h.prompt.value.trim().length > 0), _ = s(() => h.prompt.value.trim().length > r), v = s(() => h.chat.messages.length > 1 && !h.getAgentKey?.() && N?.value?.code !== a.LIMIT_REACHED);
1556
- P(h.prompt, () => {
1557
- if (f?.value) {
1558
- if (!h.prompt.value.length) {
1559
- f.value.style.height = "0px";
1560
- return;
1561
- }
1562
- f.value.style.height = "auto", f.value.style.height = f.value.scrollHeight + "px";
1563
- }
1564
- });
1565
- function y(e) {
1566
- h.loading.value || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), M(), window.scrollTo(0, document.body.scrollHeight));
1567
- }
1568
- function b() {
1569
- f.value?.focus();
1570
- }
1571
- P(() => h.chat.status, (e) => {
1572
- (e === "ready" || e === "error") && f.value?.focus();
1573
- });
1574
- let { approvalRequiredParts: x, respondToRequestApprovals: C } = Jn(), { pendingClientToolParts: w } = ni(), T = St();
1575
- function D() {
1576
- h.terms.accept(), h.mode === "preview" && h.getActiveDocumentJson && T.uploadTempDocument(h.getActiveDocumentJson(), !0);
1577
- }
1578
- let O = s(() => Object.values(h.pendingDocuments).some(Boolean)), A = s(() => {
1579
- let e = _.value, t = !g.value, n = x.value.length > 0, r = w.value.length > 0, i = h.mode === "preview", a = i && !h.terms.accepted.value, o = i && !!T.uploadState.value, s = O.value;
1580
- return e || t || n || r || a || o || s;
1581
- });
1582
- function M() {
1583
- A.value || i("submit");
1584
- }
1585
- let N = Ar();
1586
- return (e, t) => (S(), u("div", ri, [
1587
- j(T).uploadState.value || O.value ? (S(), c(ei, {
1588
- key: 0,
1589
- uploadState: j(T).uploadState.value ?? { type: "loading" }
1590
- }, null, 8, ["uploadState"])) : l("", !0),
1591
- j(N) ? (S(), c(Mr, {
1592
- key: 1,
1593
- error: j(N)
1594
- }, null, 8, ["error"])) : l("", !0),
1595
- j(x).length ? (S(), c(Or, {
1596
- key: 2,
1597
- onApprove: t[0] ||= (e) => j(C)(!0),
1598
- onReject: t[1] ||= (e) => j(C)(!1)
1599
- })) : l("", !0),
1600
- j(N)?.code === j(a).LIMIT_REACHED ? (S(), c(Ur, { key: 3 })) : l("", !0),
1601
- v.value ? (S(), c(zr, { key: 4 })) : l("", !0),
1602
- d("form", {
1603
- class: "promptForm",
1604
- onSubmit: I(M, ["prevent"])
1605
- }, [
1606
- t[6] ||= d("label", {
1607
- class: "agentLabel",
1608
- for: "agentTextarea"
1609
- }, " Type a Request To get Started ", -1),
1610
- ne(d("textarea", {
1611
- id: "agentTextarea",
1612
- ref: "agentPrompt",
1613
- "onUpdate:modelValue": t[2] ||= (e) => j(h).prompt.value = e,
1614
- class: "prompt custom-scroll",
1615
- disabled: j(h).loading.value,
1616
- name: "prompt",
1617
- placeholder: "Ask me anything…",
1618
- onKeydown: y
1619
- }, null, 40, ii), [[te, j(h).prompt.value]]),
1620
- d("div", ai, [d("div", oi, [j(h).hideAddApi ? l("", !0) : (S(), u(o, { key: 0 }, [j(h).isLoggedIn?.value ? (S(), c(wr, {
1621
- key: 1,
1622
- onUploadApi: t[3] ||= (t) => e.$emit("uploadApi")
1623
- }, {
1624
- default: F(() => [d("button", ci, [m(j(Je), {
1625
- class: "size-4",
1626
- weight: "bold"
1627
- })])]),
1628
- _: 1
1629
- })) : (S(), c(qr, { key: 0 }, {
1630
- default: F(() => [d("button", si, [m(j(Je), {
1631
- class: "size-4",
1632
- weight: "bold"
1633
- })])]),
1634
- _: 1
1635
- }))], 64)), (S(!0), u(o, null, E(j(h).registryDocuments.value, (e) => (S(), u("div", {
1636
- key: e.id,
1637
- class: "apiPill"
1638
- }, [
1639
- e.logoUrl ? (S(), u("img", {
1640
- key: 0,
1641
- class: "apiPillLogo",
1642
- src: e.logoUrl
1643
- }, null, 8, li)) : l("", !0),
1644
- p(" " + k(e.title) + " ", 1),
1645
- e.removable ? (S(), u("button", {
1646
- key: 1,
1647
- class: "apiPillRemove",
1648
- type: "button",
1649
- onClick: (t) => j(h).removeDocument(e)
1650
- }, [m(j(Xe), {
1651
- class: "size-4",
1652
- weight: "bold"
1653
- })], 8, ui)) : l("", !0)
1654
- ]))), 128))]), d("div", di, [j(h).loading.value ? l("", !0) : (S(), c(j(be), {
1655
- key: 0,
1656
- content: "Settings"
1657
- }, {
1658
- default: F(() => [m(j(fe), {
1659
- class: "settingsButton h-7 w-7 p-1.5",
1660
- icon: j(Ke),
1661
- label: "Scalar",
1662
- size: "md",
1663
- weight: "bold",
1664
- onClick: t[4] ||= (e) => j(h).settingsModal.show()
1665
- }, null, 8, ["icon"])]),
1666
- _: 1
1667
- })), d("div", fi, [!j(h).terms.accepted.value && j(h).mode === "preview" ? (S(), u("div", pi, [d("input", {
1668
- id: "agentTermsAgree",
1669
- class: "sr-only",
1670
- type: "checkbox",
1671
- onChange: D
1672
- }, null, 32), d("label", mi, [m(j(Ge), {
1673
- class: "termsAgreeIcon",
1674
- weight: "bold"
1675
- }), t[5] ||= p(" Agree to Terms & Conditions ", -1)])])) : l("", !0), j(h).loading.value ? (S(), c(j(me), {
1676
- key: 2,
1677
- class: "loader h-7 w-7",
1678
- loader: {
1679
- isLoading: j(h).loading.value,
1680
- isValid: !1,
1681
- clear: async () => {},
1682
- invalidate: async () => {},
1683
- isInvalid: !1,
1684
- isActive: !1,
1685
- validate: async () => {},
1686
- start: () => {}
1687
- },
1688
- size: "2xl"
1689
- }, null, 8, ["loader"])) : (S(), c(j(fe), {
1690
- key: 1,
1691
- class: "sendButton h-7 w-7 p-1.5",
1692
- disabled: A.value,
1693
- icon: j(We),
1694
- label: "Scalar",
1695
- size: "md",
1696
- type: "submit",
1697
- weight: "bold"
1698
- }, null, 8, ["disabled", "icon"]))])])])
1699
- ], 32),
1700
- j(h).chat.messages.length <= 1 && !j(h).hideAddApi ? (S(), u("div", hi, [t[7] ||= d("span", null, "Load additional APIs", -1), d("div", gi, [(S(!0), u(o, null, E(j(h).curatedDocuments.value, (e) => (S(), u("button", {
1701
- key: e.id,
1702
- class: "addAPIContext",
1703
- type: "button",
1704
- onClick: (t) => j(h).addDocument(e)
1705
- }, [e.logoUrl ? (S(), u("img", {
1706
- key: 0,
1707
- alt: e.title,
1708
- class: "size-4",
1709
- src: e.logoUrl
1710
- }, null, 8, vi)) : l("", !0)], 8, _i))), 128))])])) : l("", !0)
1711
- ]));
1712
- }
1713
- }), [["__scopeId", "data-v-e7c7c266"]]), bi = { class: "chat" }, xi = { key: 0 }, Si = { class: "formContainer" }, Ci = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1714
- __name: "Chat",
1715
- emits: ["submit", "uploadApi"],
1716
- setup(e, { emit: t }) {
1717
- let n = t, r = Z();
1718
- return (e, t) => (S(), u(o, null, [d("div", bi, [(S(!0), u(o, null, E(j(r).chat.messages, (e) => (S(), u(o, { key: e.id }, [e.role === "user" ? (S(!0), u(o, { key: 0 }, E(e.parts, (t, n) => (S(), u("div", {
1719
- key: `${e.id}-${n}`,
1720
- class: "userMessage"
1721
- }, [t.type === "text" ? (S(), u("p", xi, k(t.text), 1)) : l("", !0)]))), 128)) : l("", !0), e.role === "assistant" ? (S(!0), u(o, { key: 1 }, E(e.parts, (t, n) => (S(), u("div", { key: `${e.id}-${n}` }, [
1722
- t.type === "text" ? (S(), c(dr, {
1723
- key: 0,
1724
- messagePart: A(t)
1725
- }, null, 8, ["messagePart"])) : l("", !0),
1726
- t.type.endsWith(j("execute-request")) ? (S(), c(Xn, {
1727
- key: 1,
1728
- messagePart: A(t)
1729
- }, null, 8, ["messagePart"])) : l("", !0),
1730
- t.type.endsWith(j("get-mini-openapi-spec")) ? (S(), c(ir, {
1731
- key: 2,
1732
- message: w(e),
1733
- messagePart: A(t)
1734
- }, null, 8, ["message", "messagePart"])) : l("", !0),
1735
- t.type.endsWith(j("get-openapi-specs-summary")) ? (S(), c(ur, {
1736
- key: 3,
1737
- message: w(e),
1738
- messagePart: A(t)
1739
- }, null, 8, ["message", "messagePart"])) : l("", !0),
1740
- t.type.endsWith(j("ask-for-authentication")) ? (S(), c(Ut, {
1741
- key: 4,
1742
- message: w(e),
1743
- messagePart: A(t)
1744
- }, null, 8, ["message", "messagePart"])) : l("", !0)
1745
- ]))), 128)) : l("", !0)], 64))), 128)), t[2] ||= d("div", { class: "spacer" }, null, -1)]), d("div", Si, [m(yi, {
1746
- onSubmit: t[0] ||= (e) => n("submit"),
1747
- onUploadApi: t[1] ||= (e) => n("uploadApi")
1748
- })])], 64));
1749
- }
1750
- }), [["__scopeId", "data-v-db4ff6c9"]]), wi = {}, Ti = {
1751
- fill: "none",
1752
- height: "54",
1753
- viewBox: "0 0 64 54",
1754
- width: "64",
1755
- xmlns: "http://www.w3.org/2000/svg"
1756
- };
1757
- function Ei(e, t) {
1758
- return S(), u("svg", Ti, [...t[0] ||= [d("path", {
1759
- "clip-rule": "evenodd",
1760
- d: "M31.0667 0C40.2667 0 48.3333 6.13333 52.6 14.9333H57.2667C59.6 14.9333 61.5333 16.8 61.5333 19.1333V32.2C61.5333 33.4667 60.8667 34.6 60 35.3333L63.3333 45.4V45.4667C63.5639 46.207 63.6166 46.9912 63.4874 47.7557C63.3582 48.5202 63.0505 49.2435 62.5895 49.8669C62.1284 50.4903 61.5269 50.9962 60.8338 51.3437C60.1406 51.6911 59.3754 51.8703 58.6 51.8667H54.3333C53.9895 52.4222 53.5082 52.8797 52.936 53.195C52.3638 53.5103 51.72 53.6728 51.0667 53.6667H47.0667C46.5764 53.6755 46.0892 53.5877 45.6328 53.4082C45.1765 53.2287 44.76 52.961 44.4071 52.6205C44.0542 52.28 43.7719 51.8733 43.5762 51.4237C43.3805 50.9741 43.2753 50.4903 43.2667 50C43.2667 47.9333 44.9333 46.2667 47 46.2667H51.0667C52.4667 46.2667 53.7333 46.9333 54.3333 48.0667H58.6C59.3333 48.0667 59.9333 47.4 59.6667 46.6L56.3333 36.3333H51.3333C49.9333 36.3333 48.6 35.6667 47.8 34.5333V34.4667L46.8 32.9333C46.7585 32.8643 46.6999 32.8072 46.6298 32.7675C46.5597 32.7279 46.4805 32.707 46.4 32.707C46.3195 32.707 46.2403 32.7279 46.1702 32.7675C46.1001 32.8072 46.0415 32.8643 46 32.9333L45.4667 34C45.1162 34.7065 44.5739 35.3 43.9019 35.7126C43.2299 36.1253 42.4552 36.3404 41.6667 36.3333H24.9333C23.4 36.3333 21.9333 35.7333 20.8667 34.6667H20.8L19.8667 33.6667C19.6667 33.4667 19.4667 33.3333 19.2 33.3333L17.4667 33.1333C17.3333 38.8667 13.4667 43.4667 8.73333 43.4667C3.93333 43.4667 0 38.6667 0 32.9333C0 32.2667 0 31.6667 0.133333 31.1333V31C0.8 26.8 3.46667 23.4667 6.93333 22.6C9.46667 9.93333 19.3333 0 31.0667 0ZM3.93333 31.5333C4.46667 28 6.93333 26.2 8.73333 26.2C10.7333 26.2 13.6 28.4 13.6 32.8667C13.6 34.4667 13.2667 35.7333 12.7333 36.7333C11.7333 38.7333 10.0667 39.6667 8.73333 39.6667C7.67025 39.6269 6.66506 39.1722 5.93333 38.4C5.8414 38.3142 5.75246 38.2253 5.66667 38.1333C5.19113 37.6008 4.80806 36.9924 4.53333 36.3333C4.0607 35.2169 3.83335 34.0119 3.86667 32.8V31.6667L3.93333 31.6V31.5333ZM24.3333 20.6667C24.3333 19.6667 25.2 18.8 26.2667 18.8H55.8667C56.9333 18.8 57.8 19.6667 57.7333 20.7333V30.7333C57.6667 31.8 56.8 32.6667 55.7333 32.6667H53.4C53.0667 32.6667 52.7333 32.6667 52.4 32.5333C51.5333 32.3333 50.7333 31.8667 50.4 31.3333L47.9333 27.6C47.7363 27.2901 47.4602 27.0383 47.1336 26.8706C46.8069 26.7028 46.4414 26.6251 46.0747 26.6455C45.7081 26.6658 45.3535 26.7835 45.0474 26.9865C44.7413 27.1894 44.4948 27.4702 44.3333 27.8L42.6667 31C42.4199 31.4974 42.04 31.9165 41.5692 32.2107C41.0984 32.505 40.5552 32.6628 40 32.6667L26.2 32.8C25.1333 32.8 24.2667 31.9333 24.2667 30.8667V20.6667H24.3333ZM11 22.2C13.5333 11.5333 22 3.86667 31 3.86667C37.9333 3.86667 44.4 8.2 48.3333 15H24.3333C21.4667 15 18.6 16 16.3333 17.8L16.2667 17.8667L10.9333 22.2H11Z",
1761
- fill: "currentColor",
1762
- "fill-rule": "evenodd"
1763
- }, null, -1)]]);
1764
- }
1765
- var Di = /* @__PURE__ */ Q(wi, [["render", Ei]]), Oi = { class: "startContainer" }, ki = { class: "disclaimerText" }, Ai = ["href"], ji = ["href"], Mi = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1766
- __name: "Start",
1767
- emits: ["submit", "uploadApi"],
1768
- setup(e, { emit: t }) {
1769
- let n = t, { mode: r } = Z();
1770
- return (e, t) => (S(), u("div", Oi, [
1771
- m(Di, { class: "agentLogo" }),
1772
- t[4] ||= d("h1", { class: "heading" }, "How can I help you today?", -1),
1773
- m(yi, {
1774
- ref: "promptFormField",
1775
- onSubmit: t[0] ||= (e) => n("submit"),
1776
- onUploadApi: t[1] ||= (e) => n("uploadApi")
1777
- }, null, 512),
1778
- d("p", ki, [
1779
- j(r) === "preview" ? (S(), u(o, { key: 0 }, [p(" By messaging Agent Scalar your OpenAPI document will be temporarily uploaded to Scalar's servers. You must agree to our ")], 64)) : (S(), u(o, { key: 1 }, [p("By messaging Agent Scalar you agree to our ")], 64)),
1780
- d("a", {
1781
- class: "disclaimerLink",
1782
- href: j(q).TERMS_AND_CONDITIONS,
1783
- target: "_blank"
1784
- }, "Terms", 8, Ai),
1785
- t[2] ||= p(" and ", -1),
1786
- d("a", {
1787
- class: "disclaimerLink",
1788
- href: j(q).PRIVACY_POLICY,
1789
- target: "_blank"
1790
- }, "Privacy Policy", 8, ji),
1791
- t[3] ||= p(". ", -1)
1792
- ])
1793
- ]));
1794
- }
1795
- }), [["__scopeId", "data-v-56f7e8dd"]]), Ni = { class: "wrapper" }, Pi = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1796
- __name: "Layout",
1797
- emits: ["submit", "uploadApi"],
1798
- setup(e, { emit: t }) {
1799
- let n = t, { chat: r } = Z();
1800
- return (e, t) => (S(), u("div", Ni, [j(r).messages.length && (j(r).messages.length > 1 || j(r).status !== "submitted") ? (S(), c(Ci, {
1801
- key: 0,
1802
- onSubmit: t[0] ||= (e) => n("submit"),
1803
- onUploadApi: t[1] ||= (e) => n("uploadApi")
1804
- })) : (S(), c(Mi, {
1805
- key: 1,
1806
- onSubmit: t[2] ||= (e) => n("submit"),
1807
- onUploadApi: t[3] ||= (e) => n("uploadApi")
1808
- }))]));
1809
- }
1810
- }), [["__scopeId", "data-v-f1eee0af"]]), Fi = { class: "overflow-x-auto" }, Ii = {
1811
- key: 1,
1812
- class: "text-c-1 flex h-auto w-full items-center gap-0.75 rounded-b-lg px-3 py-1.5 text-base leading-[20px] whitespace-nowrap"
1813
- }, Li = { class: "overflow-x-auto" }, Ri = /* @__PURE__ */ h({
1814
- __name: "Selector",
1815
- props: {
1816
- selectedServer: {},
1817
- servers: {},
1818
- target: {}
1819
- },
1820
- emits: ["update:modelValue"],
1821
- setup(e, { expose: t, emit: n }) {
1822
- let r = n, i = s(() => e.servers.map((e) => ({
1823
- id: e.url,
1824
- label: e.url
1825
- }))), a = s(() => e.selectedServer?.url?.replace(/\/$/, "") || ""), o = s(() => i.value.find((t) => t.id === e.selectedServer?.url));
1826
- return t({
1827
- servers: e.servers,
1828
- serverUrlWithoutTrailingSlash: a,
1829
- serverOptions: i,
1830
- selectedServer: e.selectedServer
1831
- }), (t, n) => i.value.length > 1 ? (S(), c(j(pe), {
1832
- key: 0,
1833
- ref: "elem",
1834
- class: "group",
1835
- modelValue: o.value,
1836
- options: i.value,
1837
- placement: "bottom-start",
1838
- resize: "",
1839
- target: e.target,
1840
- "onUpdate:modelValue": n[0] ||= (e) => r("update:modelValue", e.id)
1841
- }, {
1842
- default: F(() => [m(j(oe), {
1843
- class: "bg-b-1 text-c-1 h-auto w-full justify-start gap-1.5 overflow-x-auto rounded-t-none rounded-b-xl px-3 py-1.5 text-base font-normal whitespace-nowrap -outline-offset-1",
1844
- variant: "ghost"
1845
- }, {
1846
- default: F(() => [
1847
- n[1] ||= d("span", { class: "sr-only" }, "Server:", -1),
1848
- d("span", Fi, k(a.value || "Select a server"), 1),
1849
- m(j(U), {
1850
- class: "text-c-2 ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100",
1851
- weight: "bold"
1852
- })
1853
- ]),
1854
- _: 1
1855
- })]),
1856
- _: 1
1857
- }, 8, [
1858
- "modelValue",
1859
- "options",
1860
- "target"
1861
- ])) : (S(), u("div", Ii, [n[2] ||= d("span", { class: "sr-only" }, "Server:", -1), d("span", Li, k(a.value), 1)]));
1862
- }
1863
- }), zi = ["id"], Bi = /* @__PURE__ */ h({
1864
- __name: "ServerSelector",
1865
- props: {
1866
- eventBus: {},
1867
- selectedServer: {},
1868
- servers: {}
1869
- },
1870
- setup(e) {
1871
- let t = M(), n = (t) => {
1872
- e.eventBus.emit("server:update:selected", {
1873
- url: e.selectedServer?.url === t ? "" : t,
1874
- meta: { type: "document" }
1875
- });
1876
- }, r = (t, n) => {
1877
- let r = e.servers.findIndex((t) => t.url === e.selectedServer?.url);
1878
- r !== -1 && e.eventBus.emit("server:update:variables", {
1879
- index: r,
1880
- key: t,
1881
- value: n,
1882
- meta: { type: "document" }
1883
- });
1884
- };
1885
- return (i, a) => (S(), u(o, null, [
1886
- a[0] ||= d("label", { class: "bg-b-2 flex h-8 items-center rounded-t-xl border border-b-0 px-3 py-2.5 font-medium" }, " Server ", -1),
1887
- d("div", {
1888
- id: j(t),
1889
- class: y(["border", { "rounded-b-xl": !e.selectedServer?.description && !e.selectedServer?.variables }])
1890
- }, [e.servers.length ? (S(), c(Ri, {
1891
- key: 0,
1892
- selectedServer: e.selectedServer,
1893
- servers: e.servers,
1894
- target: j(t),
1895
- "onUpdate:modelValue": n
1896
- }, null, 8, [
1897
- "selectedServer",
1898
- "servers",
1899
- "target"
1900
- ])) : l("", !0)], 10, zi),
1901
- m(j(tt), {
1902
- layout: "reference",
1903
- variables: e.selectedServer?.variables,
1904
- "onUpdate:variable": r
1905
- }, null, 8, ["variables"]),
1906
- e.selectedServer?.description ? (S(), c(j(he), {
1907
- key: 0,
1908
- class: "text-c-3 rounded-b-xl border border-t-0 px-3 py-1.5",
1909
- value: e.selectedServer.description
1910
- }, null, 8, ["value"])) : l("", !0)
1911
- ], 64));
1912
- }
1913
- }), Vi = { class: "docSettings" }, Hi = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1914
- __name: "DocSettings",
1915
- props: {
1916
- document: {},
1917
- name: {}
1918
- },
1919
- setup(e) {
1920
- let { workspaceStore: t, config: n, eventBus: r } = Z(), i = s(() => Fe(t, e.document)), a = s(() => B(V(e.document.servers, { documentUrl: e.document["x-scalar-original-source-url"] }), e.document["x-scalar-selected-server"])), o = s(() => e.document.components?.securitySchemes ?? {});
1921
- return (s, c) => (S(), u("div", Vi, [d("div", null, [m(zt, {
1922
- authStore: j(t).auth,
1923
- document: e.document,
1924
- environment: i.value,
1925
- eventBus: j(r),
1926
- name: e.name,
1927
- options: j(n),
1928
- securitySchemes: o.value,
1929
- selectedServer: a.value
1930
- }, null, 8, [
1931
- "authStore",
1932
- "document",
1933
- "environment",
1934
- "eventBus",
1935
- "name",
1936
- "options",
1937
- "securitySchemes",
1938
- "selectedServer"
1939
- ])]), d("div", null, [m(Bi, {
1940
- eventBus: j(r),
1941
- selectedServer: a.value,
1942
- servers: e.document.servers ?? []
1943
- }, null, 8, [
1944
- "eventBus",
1945
- "selectedServer",
1946
- "servers"
1947
- ])])]));
1948
- }
1949
- }), [["__scopeId", "data-v-31f052ad"]]), Ui = { class: "settingsHeading" }, Wi = { class: "documentList" }, Gi = ["onClick"], Ki = { key: 0 }, qi = {
1950
- key: 1,
1951
- class: "noDocuments"
1952
- }, Ji = { class: "proxyUrlContainer" }, Yi = ["href"], Xi = /* @__PURE__ */ Q(/* @__PURE__ */ h({
1953
- __name: "Settings",
1954
- props: { modalState: {} },
1955
- setup(e) {
1956
- let { workspaceStore: t, proxyUrlRaw: n } = Z();
1957
- function r(e) {
1958
- t.update("x-scalar-active-document", e);
1959
- }
1960
- return (i, a) => (S(), c(j(ge), {
1961
- class: "settingsModal",
1962
- state: e.modalState
1963
- }, {
1964
- default: F(() => [
1965
- d("div", Ui, [a[1] ||= d("h1", null, "Settings", -1), m(j(ce), { class: "colorToggle ml-auto" })]),
1966
- d("div", Wi, [Object.entries(j(t).workspace.documents).length ? (S(!0), u(o, { key: 0 }, E(Object.entries(j(t).workspace.documents), ([e, n]) => (S(), u("div", {
1967
- key: e,
1968
- class: "document"
1969
- }, [d("button", {
1970
- class: y(["documentName", { documentNameActive: j(t).workspace.activeDocument === n }]),
1971
- type: "button",
1972
- onClick: (t) => r(e)
1973
- }, [p(" @" + k(e) + " ", 1), j(t).workspace.activeDocument === n ? (S(), c(j(U), { key: 0 })) : (S(), c(j(W), { key: 1 }))], 10, Gi), j(t).workspace.activeDocument === n ? (S(), u("div", Ki, [m(Hi, {
1974
- document: n,
1975
- name: e
1976
- }, null, 8, ["document", "name"])])) : l("", !0)]))), 128)) : (S(), u("div", qi, " There's no API definition loaded. Use the + button to load APIs. "))]),
1977
- d("div", Ji, [
1978
- a[3] ||= d("label", { for: "proxyUrl" }, "CORS Proxy", -1),
1979
- d("p", null, [a[2] ||= p(" All requests will be sent through the specified proxy URL to help avoid CORS (Cross-Origin Resource Sharing) issues. ", -1), d("a", {
1980
- class: "underline",
1981
- href: j(q).PROXY_SOURCE_CODE,
1982
- target: "_blank"
1983
- }, " Read more ", 8, Yi)]),
1984
- m(j(ye), {
1985
- id: "proxyUrl",
1986
- modelValue: j(n),
1987
- "onUpdate:modelValue": a[0] ||= (e) => _(n) ? n.value = e : null,
1988
- label: "Proxy URL",
1989
- placeholder: j(q).DEFAULT_PROXY_URL
1990
- }, null, 8, ["modelValue", "placeholder"])
1991
- ])
1992
- ]),
1993
- _: 1
1994
- }, 8, ["state"]));
1995
- }
1996
- }), [["__scopeId", "data-v-5e4bca68"]]), Zi = { ref: "clientModal" }, Qi = /* @__PURE__ */ h({
1997
- __name: "Chat",
1998
- emits: ["uploadApi"],
1999
- setup(e) {
2000
- let { chat: t, prompt: n, settingsModal: r, eventBus: i, workspaceStore: a, config: s, mode: c, addDocument: l } = Z(), f = ee("clientModal"), p = T(null);
2001
- x(async () => {
2002
- let e = bt();
2003
- c === "preview" && e && await l({
2004
- namespace: e.namespace,
2005
- slug: e.slug,
2006
- removable: !1,
2007
- tmp: !0
2008
- }), f.value && (p.value = re({
2009
- el: f.value,
2010
- options: s,
2011
- eventBus: i,
2012
- workspaceStore: a
2013
- }));
2014
- }), b(() => {
2015
- p.value?.app.unmount();
2016
- }), kt(), Ot(), At();
2017
- async function h() {
2018
- await t.sendMessage({ text: n.value });
2019
- }
2020
- return (e, t) => (S(), u(o, null, [
2021
- d("div", Zi, null, 512),
2022
- m(Pi, {
2023
- onSubmit: h,
2024
- onUploadApi: t[0] ||= (t) => e.$emit("uploadApi")
2025
- }),
2026
- m(Xi, { modalState: j(r) }, null, 8, ["modalState"])
2027
- ], 64));
2028
- }
2029
- }), $i = /* @__PURE__ */ h({
2030
- __name: "App",
2031
- props: {
2032
- registryDocuments: {},
2033
- registryUrl: {},
2034
- dashboardUrl: {},
2035
- baseUrl: {},
2036
- mode: { default: "full" },
2037
- getAccessToken: { type: Function },
2038
- getAgentKey: { type: Function },
2039
- getActiveDocumentJson: { type: Function },
2040
- isLoggedIn: {},
2041
- prefilledMessage: {},
2042
- hideAddApi: { type: Boolean }
2043
- },
2044
- emits: ["uploadApi"],
2045
- setup(e, { expose: t }) {
2046
- let n = Dt({
2047
- getActiveDocumentJson: e.getActiveDocumentJson,
2048
- initialRegistryDocuments: e.registryDocuments,
2049
- prefilledMessageRef: e.prefilledMessage,
2050
- registryUrl: e.registryUrl,
2051
- baseUrl: e.baseUrl,
2052
- mode: e.mode,
2053
- getAccessToken: e.getAccessToken,
2054
- getAgentKey: e.getAgentKey,
2055
- isLoggedIn: e.isLoggedIn,
2056
- dashboardUrl: e.dashboardUrl,
2057
- hideAddApi: e.hideAddApi
2058
- });
2059
- return C(Tt, n), t({ addDocumentAsync: n.addDocumentAsync }), (e, t) => (S(), c(Qi, { onUploadApi: t[0] ||= (t) => e.$emit("uploadApi") }));
2060
- }
2061
- });
2062
- //#endregion
2063
- export { $i as Chat };
2064
-
2065
- //# sourceMappingURL=index.js.map
1
+ import e from "./App.vue.js";
2
+ export { e as Chat };