@scalar/api-client 1.2.37 → 1.2.38

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 (29) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/components/ApiClient/Request/RequestAuthentication/CardFormRows.vue.d.ts +10 -0
  3. package/dist/components/ApiClient/Request/RequestAuthentication/CardFormRows.vue.d.ts.map +1 -0
  4. package/dist/components/ApiClient/Request/RequestAuthentication/RequestAuthentication.vue.d.ts +14 -1
  5. package/dist/components/ApiClient/Request/RequestAuthentication/RequestAuthentication.vue.d.ts.map +1 -1
  6. package/dist/components/ApiClient/Request/RequestAuthentication/SecurityScheme.vue.d.ts +2 -0
  7. package/dist/components/ApiClient/Request/RequestAuthentication/SecurityScheme.vue.d.ts.map +1 -1
  8. package/dist/components/ApiClient/Request/RequestAuthentication/SecuritySchemeSelector.vue.d.ts.map +1 -1
  9. package/dist/helpers/concatenateUrlAndPath.d.ts.map +1 -1
  10. package/dist/helpers/getUrlFromServerState.d.ts +6 -0
  11. package/dist/helpers/getUrlFromServerState.d.ts.map +1 -0
  12. package/dist/helpers/index.d.ts +2 -0
  13. package/dist/helpers/index.d.ts.map +1 -1
  14. package/dist/helpers/redirectToProxy.d.ts +3 -0
  15. package/dist/helpers/redirectToProxy.d.ts.map +1 -0
  16. package/dist/helpers/replaceVariables.d.ts +2 -2
  17. package/dist/helpers/replaceVariables.d.ts.map +1 -1
  18. package/dist/helpers/sendRequest.d.ts.map +1 -1
  19. package/dist/index.css +66 -19
  20. package/dist/index.js +363 -134
  21. package/dist/stores/index.d.ts +1 -0
  22. package/dist/stores/index.d.ts.map +1 -1
  23. package/dist/stores/useAuthenticationStore.d.ts +5 -1
  24. package/dist/stores/useAuthenticationStore.d.ts.map +1 -1
  25. package/dist/stores/useServerStore.d.ts +16 -0
  26. package/dist/stores/useServerStore.d.ts.map +1 -0
  27. package/dist/types.d.ts +19 -0
  28. package/dist/types.d.ts.map +1 -1
  29. package/package.json +8 -7
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ const purpleTheme = "/* basic theme */\n.light-mode {\n --scalar-background-1:
24
24
  const saturnTheme = "/* basic theme */\n.light-mode {\n --scalar-background-1: #f3f3ee;\n --scalar-background-2: #e8e8e3;\n --scalar-background-3: #e4e4df;\n --scalar-border-color: rgba(215, 215, 206, 0.5);\n\n --scalar-color-1: #2a2f45;\n --scalar-color-2: #757575;\n --scalar-color-3: #8e8e8e;\n\n --scalar-color-accent: #1763a6;\n --scalar-background-accent: #1f648e1f;\n}\n.dark-mode {\n --scalar-background-1: #09090b;\n --scalar-background-2: #18181b;\n --scalar-background-3: #2c2c30;\n --scalar-border-color: rgba(255, 255, 255, 0.12);\n\n --scalar-color-1: #fafafa;\n --scalar-color-2: rgb(161, 161, 170);\n --scalar-color-3: rgba(255, 255, 255, 0.533);\n\n --scalar-color-accent: #4eb3ec;\n --scalar-background-accent: #8ab4f81f;\n}\n/* Document Sidebar */\n.light-mode .t-doc__sidebar,\n.dark-mode .t-doc__sidebar {\n --scalar-sidebar-background-1: var(--scalar-background-1);\n --scalar-sidebar-color-1: var(--scalar-color-1);\n --scalar-sidebar-color-2: var(--scalar-color-2);\n --scalar-sidebar-border-color: var(--scalar-border-color);\n\n --scalar-sidebar-item-hover-background: var(--scalar-background-2);\n --scalar-sidebar-item-hover-color: currentColor;\n\n --scalar-sidebar-item-active-background: var(--scalar-background-3);\n --scalar-sidebar-color-active: var(--scalar-color-1);\n\n --scalar-sidebar-search-background: var(--scalar-background-1);\n --scalar-sidebar-search-border-color: var(--scalar-border-color);\n --scalar-sidebar-search-color: var(--scalar-color-3);\n}\n\n/* advanced */\n.light-mode {\n --scalar-color-green: #17803d;\n --scalar-color-red: #e10909;\n --scalar-color-yellow: #edbe20;\n --scalar-color-blue: #1763a6;\n --scalar-color-orange: #e25b09;\n --scalar-color-purple: #5c3993;\n\n --scalar-button-1: rgba(0, 0, 0, 1);\n --scalar-button-1-hover: rgba(0, 0, 0, 0.8);\n --scalar-button-1-color: rgba(255, 255, 255, 0.9);\n}\n.dark-mode {\n --scalar-color-green: #30a159;\n --scalar-color-red: #dc1b19;\n --scalar-color-yellow: #eec644;\n --scalar-color-blue: #2b7abf;\n --scalar-color-orange: #f07528;\n --scalar-color-purple: #7a59b1;\n\n --scalar-button-1: rgba(255, 255, 255, 1);\n --scalar-button-1-hover: rgba(255, 255, 255, 0.9);\n --scalar-button-1-color: black;\n}\n.dark-mode h2.t-editor__heading,\n.dark-mode .t-editor__page-title h1,\n.dark-mode h1.section-header,\n.dark-mode .markdown h1,\n.dark-mode .markdown h2,\n.dark-mode .markdown h3,\n.dark-mode .markdown h4,\n.dark-mode .markdown h5,\n.dark-mode .markdown h6 {\n -webkit-text-fill-color: transparent;\n background-image: linear-gradient(\n to right bottom,\n rgb(255, 255, 255) 30%,\n rgba(255, 255, 255, 0.38)\n );\n -webkit-background-clip: text;\n background-clip: text;\n}\n";
25
25
  const solarizedTheme = ".light-mode {\n color-scheme: light;\n --scalar-color-1: #584c27;\n --scalar-color-2: #616161;\n --scalar-color-3: #a89f84;\n --scalar-color-accent: #b58900;\n --scalar-background-1: #fdf6e3;\n --scalar-background-2: #eee8d5;\n --scalar-background-3: #ddd6c1;\n --scalar-background-accent: #b589001f;\n\n --scalar-border-color: #ded8c8;\n --scalar-scrollbar-color: rgba(0, 0, 0, 0.18);\n --scalar-scrollbar-color-active: rgba(0, 0, 0, 0.36);\n --scalar-lifted-brightness: 1;\n --scalar-backdrop-brightness: 1;\n\n --scalar-shadow-1: 0 1px 3px 0 rgba(0, 0, 0, 0.11);\n --scalar-shadow-2: rgba(0, 0, 0, 0.08) 0px 13px 20px 0px,\n rgba(0, 0, 0, 0.08) 0px 3px 8px 0px, #eeeeed 0px 0 0 1px;\n\n --scalar-button-1: rgb(49 53 56);\n --scalar-button-1-color: #fff;\n --scalar-button-1-hover: rgb(28 31 33);\n\n --scalar-color-red: #b91c1c;\n --scalar-color-orange: #a16207;\n --scalar-color-green: #047857;\n --scalar-color-blue: #1d4ed8;\n --scalar-color-orange: #c2410c;\n --scalar-color-purple: #6d28d9;\n}\n\n.dark-mode {\n color-scheme: dark;\n --scalar-color-1: #fff;\n --scalar-color-2: #cccccc;\n --scalar-color-3: #6d8890;\n --scalar-color-accent: #007acc;\n --scalar-background-1: #00212b;\n --scalar-background-2: #012b36;\n --scalar-background-3: #004052;\n --scalar-background-accent: #015a6f;\n\n --scalar-border-color: rgba(255, 255, 255, 0.1);\n --scalar-scrollbar-color: rgba(255, 255, 255, 0.24);\n --scalar-scrollbar-color-active: rgba(255, 255, 255, 0.48);\n --scalar-lifted-brightness: 1.45;\n --scalar-backdrop-brightness: 0.5;\n\n --scalar-shadow-1: 0 1px 3px 0 rgb(0, 0, 0, 0.1);\n --scalar-shadow-2: rgba(15, 15, 15, 0.2) 0px 3px 6px,\n rgba(15, 15, 15, 0.4) 0px 9px 24px, 0 0 0 1px rgba(255, 255, 255, 0.1);\n\n --scalar-button-1: #f6f6f6;\n --scalar-button-1-color: #000;\n --scalar-button-1-hover: #e7e7e7;\n\n --scalar-color-green: #00b648;\n --scalar-color-red: #dc1b19;\n --scalar-color-yellow: #ffc90d;\n --scalar-color-blue: #4eb3ec;\n --scalar-color-orange: #ff8d4d;\n --scalar-color-purple: #b191f9;\n}\n\n/* Sidebar */\n.light-mode .t-doc__sidebar {\n --scalar-sidebar-background-1: var(--scalar-background-1);\n --scalar-sidebar-item-hover-color: currentColor;\n --scalar-sidebar-item-hover-background: var(--scalar-background-2);\n --scalar-sidebar-item-active-background: var(--scalar-background-accent);\n --scalar-sidebar-border-color: var(--scalar-border-color);\n --scalar-sidebar-color-1: var(--scalar-color-1);\n --scalar-sidebar-color-2: var(--scalar-color-2);\n --scalar-sidebar-color-active: var(--scalar-color-accent);\n --scalar-sidebar-search-background: var(--scalar-background-2);\n --scalar-sidebar-search-border-color: var(--scalar-sidebar-search-background);\n --scalar-sidebar-search--color: var(--scalar-color-3);\n}\n\n.dark-mode .sidebar {\n --scalar-sidebar-background-1: var(--scalar-background-1);\n --scalar-sidebar-item-hover-color: currentColor;\n --scalar-sidebar-item-hover-background: var(--scalar-background-2);\n --scalar-sidebar-item-active-background: var(--scalar-background-accent);\n --scalar-sidebar-border-color: var(--scalar-border-color);\n --scalar-sidebar-color-1: var(--scalar-color-1);\n --scalar-sidebar-color-2: var(--scalar-color-2);\n --scalar-sidebar-color-active: var(--scalar-sidebar-color-1);\n --scalar-sidebar-search-background: var(--scalar-background-2);\n --scalar-sidebar-search-border-color: var(--scalar-sidebar-search-background);\n --scalar-sidebar-search--color: var(--scalar-color-3);\n}\n";
26
26
  const fonts = "\n@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900');\n@import url('https://fonts.googleapis.com/css?family=JetBrains%20Mono');\n/* Inter (--scalar-font) */\n/* JetBrains Mono (--scalar-font-code) */\n";
27
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
27
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
28
28
  __name: "DefaultFonts",
29
29
  setup(__props) {
30
30
  return (_ctx, _cache) => {
@@ -32,7 +32,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
32
32
  };
33
33
  }
34
34
  });
35
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
35
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
36
36
  __name: "ThemeStyles",
37
37
  props: {
38
38
  id: {},
@@ -41,7 +41,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
41
41
  setup(__props) {
42
42
  return (_ctx, _cache) => {
43
43
  return openBlock(), createElementBlock(Fragment, null, [
44
- _ctx.withDefaultFonts ? (openBlock(), createBlock(_sfc_main$F, { key: 0 })) : createCommentVNode("", true),
44
+ _ctx.withDefaultFonts ? (openBlock(), createBlock(_sfc_main$G, { key: 0 })) : createCommentVNode("", true),
45
45
  _ctx.id !== "none" ? (openBlock(), createBlock(resolveDynamicComponent("style"), { key: 1 }, {
46
46
  default: withCtx(() => [
47
47
  createTextVNode(toDisplayString(unref(getThemeById)(_ctx.id, { layer: "scalar-theme" })), 1)
@@ -60,7 +60,7 @@ function useApplyClasses(selector, classes) {
60
60
  el == null ? void 0 : el.classList.add(classes);
61
61
  });
62
62
  }
63
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
63
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
64
64
  __name: "ResetStyles",
65
65
  setup(__props) {
66
66
  const { reset: reset2 } = useCssModule();
@@ -84,7 +84,7 @@ const _export_sfc = (sfc, props) => {
84
84
  const cssModules = {
85
85
  "$style": style0
86
86
  };
87
- const ResetStyles = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__cssModules", cssModules]]);
87
+ const ResetStyles = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__cssModules", cssModules]]);
88
88
  const presets = {
89
89
  alternate: alternateTheme,
90
90
  default: defaultTheme,
@@ -114,28 +114,28 @@ function defaultState() {
114
114
  snippetType: "javascript"
115
115
  };
116
116
  }
117
- const state = reactive(defaultState());
117
+ const state$1 = reactive(defaultState());
118
118
  function toggleApiClient(item, forceShow = false) {
119
119
  if (forceShow) {
120
- state.showApiClient = true;
120
+ state$1.showApiClient = true;
121
121
  } else {
122
- state.showApiClient = !state.showApiClient;
122
+ state$1.showApiClient = !state$1.showApiClient;
123
123
  }
124
124
  if (item) {
125
- state.activeItem = item;
125
+ state$1.activeItem = item;
126
126
  }
127
127
  }
128
128
  function hideApiClient() {
129
- state.showApiClient = false;
129
+ state$1.showApiClient = false;
130
130
  }
131
131
  function setActiveApiClientEndpointId(id2) {
132
- state.activeApiClientEndpointId = id2;
132
+ state$1.activeApiClientEndpointId = id2;
133
133
  }
134
134
  function setSnippetType(type) {
135
- state.snippetType = type;
135
+ state$1.snippetType = type;
136
136
  }
137
137
  const useApiClientStore = () => ({
138
- state: readonly(state),
138
+ state: readonly(state$1),
139
139
  toggleApiClient,
140
140
  setActiveApiClientEndpointId,
141
141
  setSnippetType,
@@ -2238,6 +2238,8 @@ const createEmptyAuthenticationState = () => ({
2238
2238
  token: ""
2239
2239
  },
2240
2240
  oAuth2: {
2241
+ username: "",
2242
+ password: "",
2241
2243
  clientId: "",
2242
2244
  scopes: [],
2243
2245
  accessToken: "",
@@ -2324,6 +2326,22 @@ const useRequestStore = () => ({
2324
2326
  addRequestToHistory,
2325
2327
  setActiveRequest
2326
2328
  });
2329
+ const createEmptyServerState = () => ({
2330
+ selectedServer: null,
2331
+ servers: [],
2332
+ variables: []
2333
+ });
2334
+ const server = reactive(createEmptyServerState());
2335
+ const setServer = (newState) => {
2336
+ Object.assign(server, {
2337
+ ...server,
2338
+ ...newState
2339
+ });
2340
+ };
2341
+ const useServerStore = () => ({
2342
+ server,
2343
+ setServer
2344
+ });
2327
2345
  const httpHeaders = [
2328
2346
  {
2329
2347
  name: "Accept",
@@ -2886,7 +2904,7 @@ const requestMethodAbbreviations = {
2886
2904
  CONNECT: "CONN",
2887
2905
  TRACE: "TRACE"
2888
2906
  };
2889
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
2907
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
2890
2908
  __name: "HttpMethod",
2891
2909
  props: {
2892
2910
  as: {},
@@ -25803,7 +25821,7 @@ function getCodeMirrorExtensions({
25803
25821
  }
25804
25822
  return extensions;
25805
25823
  }
25806
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
25824
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
25807
25825
  __name: "CodeMirror",
25808
25826
  props: {
25809
25827
  content: {},
@@ -25840,9 +25858,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
25840
25858
  };
25841
25859
  }
25842
25860
  });
25843
- const CodeMirror = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-5dbce8c1"]]);
25844
- const _hoisted_1$w = { class: "scalar-modal-layout modal-layout" };
25845
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
25861
+ const CodeMirror = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-5dbce8c1"]]);
25862
+ const _hoisted_1$x = { class: "scalar-modal-layout modal-layout" };
25863
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
25846
25864
  __name: "FlowModal",
25847
25865
  props: {
25848
25866
  state: {},
@@ -25858,7 +25876,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
25858
25876
  onClose: _cache[0] || (_cache[0] = ($event) => _ctx.state.hide())
25859
25877
  }, {
25860
25878
  default: withCtx(() => [
25861
- createElementVNode("div", _hoisted_1$w, [
25879
+ createElementVNode("div", _hoisted_1$x, [
25862
25880
  createVNode(unref(DialogPanel), {
25863
25881
  class: normalizeClass(["modal", {
25864
25882
  "modal-content-large": _ctx.variant === "large",
@@ -25897,7 +25915,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
25897
25915
  };
25898
25916
  }
25899
25917
  });
25900
- const FlowModal = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-4aafbf68"]]);
25918
+ const FlowModal = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-4aafbf68"]]);
25901
25919
  const useModal = () => reactive({
25902
25920
  open: false,
25903
25921
  show() {
@@ -25914,8 +25932,10 @@ const concatenateUrlAndPath = (url, path) => {
25914
25932
  if (typeof path !== "string" || !path.length) {
25915
25933
  return url;
25916
25934
  }
25917
- const urlWithSlash = url.endsWith("/") ? url : `${url}/`;
25918
- const pathWithoutSlash = path.startsWith("/") ? path.slice(1) : path;
25935
+ const trimmedUrl = url.trim();
25936
+ const trimmedPath = path.trim();
25937
+ const urlWithSlash = trimmedUrl.endsWith("/") ? trimmedUrl : `${trimmedUrl}/`;
25938
+ const pathWithoutSlash = trimmedPath.startsWith("/") ? trimmedPath.slice(1) : trimmedPath;
25919
25939
  return [urlWithSlash, pathWithoutSlash].join("");
25920
25940
  };
25921
25941
  function encodeStringAsBase64(value) {
@@ -26022,6 +26042,32 @@ function getSecretCredentialsFromAuthentication(authentication2) {
26022
26042
  authentication2.http.basic.password
26023
26043
  ].filter(Boolean);
26024
26044
  }
26045
+ function replaceVariables(value, variablesOrCallback) {
26046
+ const doubleCurlyBrackets = /{{\s*([\w.-]+)\s*}}/g;
26047
+ const singleCurlyBrackets = /{\s*([\w.-]+)\s*}/g;
26048
+ const callback = (_, match) => {
26049
+ var _a2;
26050
+ if (typeof variablesOrCallback === "function") {
26051
+ return variablesOrCallback(match);
26052
+ } else {
26053
+ return (_a2 = variablesOrCallback[match]) == null ? void 0 : _a2.toString();
26054
+ }
26055
+ };
26056
+ return value.replace(doubleCurlyBrackets, callback).replace(singleCurlyBrackets, callback);
26057
+ }
26058
+ function getUrlFromServerState(state2) {
26059
+ var _a2;
26060
+ const server2 = (_a2 = state2 == null ? void 0 : state2.servers) == null ? void 0 : _a2[state2.selectedServer ?? 0];
26061
+ const variables2 = state2.variables.reduce(
26062
+ (acc, variable2) => {
26063
+ acc[variable2.name] = variable2.value;
26064
+ return acc;
26065
+ },
26066
+ {}
26067
+ );
26068
+ const url = typeof (server2 == null ? void 0 : server2.url) === "string" ? replaceVariables(server2 == null ? void 0 : server2.url, variables2) : server2 == null ? void 0 : server2.url;
26069
+ return url;
26070
+ }
26025
26071
  function humanDiff(unixTimestamp) {
26026
26072
  const seconds = Math.floor(((/* @__PURE__ */ new Date()).getTime() - unixTimestamp) / 1e3);
26027
26073
  if (seconds < 45) {
@@ -26148,13 +26194,11 @@ const prepareClientRequestConfig = (configuration) => {
26148
26194
  ...request
26149
26195
  };
26150
26196
  };
26151
- const replaceVariables = (url, variables2) => {
26152
- return Object.entries(variables2).reduce((acc, [key, value]) => {
26153
- return acc.replace(`{${key}}`, value.toString());
26154
- }, url);
26155
- };
26156
26197
  function redirectToProxy(proxy, url) {
26157
- return `${proxy}?scalar_url=${encodeURI(url)}`;
26198
+ const newUrl = new URL(url);
26199
+ newUrl.href = proxy;
26200
+ newUrl.searchParams.append("scalar_url", url);
26201
+ return newUrl.toString();
26158
26202
  }
26159
26203
  function isRequestToLocalhost(url) {
26160
26204
  const { hostname } = new URL(url);
@@ -26275,10 +26319,10 @@ async function sendRequest(request, proxyUrl) {
26275
26319
  responseId: nanoid()
26276
26320
  };
26277
26321
  }
26278
- const _hoisted_1$v = { class: "navtable-item-40 navtable-item-request" };
26322
+ const _hoisted_1$w = { class: "navtable-item-40 navtable-item-request" };
26279
26323
  const _hoisted_2$o = { class: "navtable-item-40 navtable-item-response" };
26280
26324
  const _hoisted_3$g = { class: "navtable-item-20 navtable-item-time" };
26281
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
26325
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
26282
26326
  __name: "RequestHistoryItem",
26283
26327
  props: {
26284
26328
  history: {}
@@ -26299,7 +26343,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
26299
26343
  class: normalizeClass(["navtable-item", { "navtable-item__active": unref(activeRequestId2) === _ctx.history }]),
26300
26344
  onClick: _cache[0] || (_cache[0] = ($event) => unref(setActiveResponse2)(_ctx.history))
26301
26345
  }, [
26302
- createElementVNode("div", _hoisted_1$v, [
26346
+ createElementVNode("div", _hoisted_1$w, [
26303
26347
  createElementVNode("button", {
26304
26348
  class: normalizeClass(["radio", unref(requestHistory2)[_ctx.history].request.type.toLowerCase()]),
26305
26349
  type: "button"
@@ -26325,20 +26369,20 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
26325
26369
  };
26326
26370
  }
26327
26371
  });
26328
- const RequestHistoryItem = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-353c6d86"]]);
26329
- const _hoisted_1$u = { class: "navigation-content-item" };
26372
+ const RequestHistoryItem = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-353c6d86"]]);
26373
+ const _hoisted_1$v = { class: "navigation-content-item" };
26330
26374
  const _hoisted_2$n = { class: "navtable" };
26331
26375
  const _hoisted_3$f = { class: "navtable-table" };
26332
26376
  const _hoisted_4$b = /* @__PURE__ */ createStaticVNode('<div class="navtable-item navtable-item__top"><div class="navtable-item-40"><label for="">Request</label></div><div class="navtable-item-40"><label for="">Response</label></div><div class="navtable-item-20"><label for="">TIME</label></div></div>', 1);
26333
26377
  const _hoisted_5$8 = { class: "navtable-radios" };
26334
26378
  const _hoisted_6$5 = /* @__PURE__ */ createStaticVNode('<div class="navtable-mock"><div class="navtable-item"><div class="navtable-item-40"></div><div class="navtable-item-40"></div><div class="navtable-item-20"></div></div></div>', 1);
26335
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
26379
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
26336
26380
  __name: "RequestHistory",
26337
26381
  emits: ["toggle"],
26338
26382
  setup(__props) {
26339
26383
  const { requestHistoryOrder: requestHistoryOrder2 } = useRequestStore();
26340
26384
  return (_ctx, _cache) => {
26341
- return openBlock(), createElementBlock("div", _hoisted_1$u, [
26385
+ return openBlock(), createElementBlock("div", _hoisted_1$v, [
26342
26386
  createElementVNode("div", _hoisted_2$n, [
26343
26387
  createElementVNode("div", _hoisted_3$f, [
26344
26388
  _hoisted_4$b,
@@ -26357,10 +26401,10 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
26357
26401
  };
26358
26402
  }
26359
26403
  });
26360
- const _hoisted_1$t = { class: "request-method-select" };
26404
+ const _hoisted_1$u = { class: "request-method-select" };
26361
26405
  const _hoisted_2$m = ["disabled", "value"];
26362
26406
  const _hoisted_3$e = ["value"];
26363
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
26407
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
26364
26408
  __name: "RequestMethodSelect",
26365
26409
  props: {
26366
26410
  requestMethod: {},
@@ -26380,7 +26424,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
26380
26424
  // 'TRACE',
26381
26425
  ];
26382
26426
  return (_ctx, _cache) => {
26383
- return openBlock(), createElementBlock("div", _hoisted_1$t, [
26427
+ return openBlock(), createElementBlock("div", _hoisted_1$u, [
26384
26428
  createElementVNode("span", {
26385
26429
  class: normalizeClass(["request-method", { "request-method--disabled": _ctx.readOnly }])
26386
26430
  }, [
@@ -26402,9 +26446,9 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
26402
26446
  };
26403
26447
  }
26404
26448
  });
26405
- const RequestMethodSelect = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-0f1e5bdc"]]);
26449
+ const RequestMethodSelect = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-0f1e5bdc"]]);
26406
26450
  const _withScopeId$5 = (n) => (pushScopeId("data-v-b1791ec2"), n = n(), popScopeId(), n);
26407
- const _hoisted_1$s = {
26451
+ const _hoisted_1$t = {
26408
26452
  key: 0,
26409
26453
  class: "loader"
26410
26454
  };
@@ -26468,7 +26512,7 @@ const _hoisted_13 = [
26468
26512
  _hoisted_12
26469
26513
  ];
26470
26514
  const _hoisted_14 = { class: "address-bar-content" };
26471
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
26515
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
26472
26516
  __name: "AddressBar",
26473
26517
  props: {
26474
26518
  proxyUrl: {}
@@ -26526,7 +26570,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
26526
26570
  };
26527
26571
  return (_ctx, _cache) => {
26528
26572
  return openBlock(), createElementBlock(Fragment, null, [
26529
- loading.value ? (openBlock(), createElementBlock("div", _hoisted_1$s)) : createCommentVNode("", true),
26573
+ loading.value ? (openBlock(), createElementBlock("div", _hoisted_1$t)) : createCommentVNode("", true),
26530
26574
  createElementVNode("div", {
26531
26575
  class: normalizeClass(["address-bar", { "address-bar--with-history": showHistory.value }])
26532
26576
  }, [
@@ -26575,7 +26619,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
26575
26619
  variant: "history"
26576
26620
  }, {
26577
26621
  default: withCtx(() => [
26578
- createVNode(_sfc_main$y, {
26622
+ createVNode(_sfc_main$z, {
26579
26623
  showHistory: showHistory.value,
26580
26624
  onToggle: _cache[2] || (_cache[2] = ($event) => showHistory.value = !showHistory.value)
26581
26625
  }, null, 8, ["showHistory"])
@@ -26588,9 +26632,9 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
26588
26632
  };
26589
26633
  }
26590
26634
  });
26591
- const AddressBar = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-b1791ec2"]]);
26635
+ const AddressBar = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-b1791ec2"]]);
26592
26636
  const clickGeneratedParameter = useEventBus(Symbol());
26593
- const _hoisted_1$r = { class: "scalar-api-client-item-topbar" };
26637
+ const _hoisted_1$s = { class: "scalar-api-client-item-topbar" };
26594
26638
  const _hoisted_2$k = { class: "scalar-api-client__toggle-container" };
26595
26639
  const _hoisted_3$c = /* @__PURE__ */ createElementVNode("svg", {
26596
26640
  class: "scalar-api-client__toggle__icon",
@@ -26611,7 +26655,7 @@ const _hoisted_5$6 = {
26611
26655
  class: "scalar-api-client__item__options"
26612
26656
  };
26613
26657
  const _hoisted_6$3 = { class: "scalar-api-client__item__content" };
26614
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
26658
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
26615
26659
  __name: "CollapsibleSection",
26616
26660
  props: {
26617
26661
  title: {},
@@ -26641,7 +26685,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
26641
26685
  createElementVNode("div", {
26642
26686
  class: normalizeClass(["scalar-api-client__item", { "scalar-api-client__item--open": open }])
26643
26687
  }, [
26644
- createElementVNode("div", _hoisted_1$r, [
26688
+ createElementVNode("div", _hoisted_1$s, [
26645
26689
  createVNode(unref(DisclosureButton), {
26646
26690
  ref_key: "collapseButton",
26647
26691
  ref: collapseButton,
@@ -26675,15 +26719,29 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
26675
26719
  };
26676
26720
  }
26677
26721
  });
26678
- const _sfc_main$u = {};
26679
- const _hoisted_1$q = { class: "card-form" };
26680
- function _sfc_render$3(_ctx, _cache) {
26681
- return openBlock(), createElementBlock("form", _hoisted_1$q, [
26722
+ const state = {
26723
+ toast: () => null
26724
+ };
26725
+ function initializeToasts(toastFunction) {
26726
+ state.toast = toastFunction;
26727
+ }
26728
+ function useToasts() {
26729
+ return {
26730
+ initializeToasts,
26731
+ toast: (message, level = "info", options = { timeout: 3e3 }) => {
26732
+ state.toast(message, level, options);
26733
+ }
26734
+ };
26735
+ }
26736
+ const _sfc_main$v = {};
26737
+ const _hoisted_1$r = { class: "card-form" };
26738
+ function _sfc_render$4(_ctx, _cache) {
26739
+ return openBlock(), createElementBlock("form", _hoisted_1$r, [
26682
26740
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
26683
26741
  ]);
26684
26742
  }
26685
- const CardForm = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$3], ["__scopeId", "data-v-bc8cea71"]]);
26686
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
26743
+ const CardForm = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$4], ["__scopeId", "data-v-bc8cea71"]]);
26744
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
26687
26745
  __name: "CardFormButton",
26688
26746
  setup(__props, { expose: __expose }) {
26689
26747
  const el = ref();
@@ -26700,15 +26758,23 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
26700
26758
  };
26701
26759
  }
26702
26760
  });
26703
- const CardFormButton = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-6ae053e9"]]);
26761
+ const CardFormButton = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-6ae053e9"]]);
26762
+ const _sfc_main$t = {};
26763
+ const _hoisted_1$q = { class: "card-form-group" };
26764
+ function _sfc_render$3(_ctx, _cache) {
26765
+ return openBlock(), createElementBlock("div", _hoisted_1$q, [
26766
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
26767
+ ]);
26768
+ }
26769
+ const CardFormGroup = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", _sfc_render$3], ["__scopeId", "data-v-d894ccf7"]]);
26704
26770
  const _sfc_main$s = {};
26705
- const _hoisted_1$p = { class: "card-form-group" };
26771
+ const _hoisted_1$p = { class: "card-form-rows" };
26706
26772
  function _sfc_render$2(_ctx, _cache) {
26707
26773
  return openBlock(), createElementBlock("div", _hoisted_1$p, [
26708
26774
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
26709
26775
  ]);
26710
26776
  }
26711
- const CardFormGroup = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$2], ["__scopeId", "data-v-d894ccf7"]]);
26777
+ const CardFormRows = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$2], ["__scopeId", "data-v-25140d72"]]);
26712
26778
  function r(e) {
26713
26779
  var t2, f, n = "";
26714
26780
  if ("string" == typeof e || "number" == typeof e)
@@ -31577,9 +31643,12 @@ const SecuritySchemeScopes = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scope
31577
31643
  const _sfc_main$p = /* @__PURE__ */ defineComponent({
31578
31644
  __name: "SecurityScheme",
31579
31645
  props: {
31580
- value: {}
31646
+ value: {},
31647
+ proxy: {}
31581
31648
  },
31582
31649
  setup(__props) {
31650
+ const { toast } = useToasts();
31651
+ const { server: server2 } = useServerStore();
31583
31652
  const { authentication: authentication2, setAuthentication: setAuthentication2 } = useAuthenticationStore();
31584
31653
  const handleApiKeyTokenInput = (event) => {
31585
31654
  setAuthentication2({
@@ -31630,7 +31699,23 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
31630
31699
  }
31631
31700
  });
31632
31701
  };
31633
- const getOpenAuth2AuthorizationUrl = (flow) => {
31702
+ const handleOAuth2UsernameInput = (event) => {
31703
+ setAuthentication2({
31704
+ oAuth2: {
31705
+ ...authentication2.oAuth2,
31706
+ username: event.target.value
31707
+ }
31708
+ });
31709
+ };
31710
+ const handleOAuth2PasswordInput = (event) => {
31711
+ setAuthentication2({
31712
+ oAuth2: {
31713
+ ...authentication2.oAuth2,
31714
+ password: event.target.value
31715
+ }
31716
+ });
31717
+ };
31718
+ function getOpenAuth2AuthorizationUrl(flow) {
31634
31719
  const scopes = authentication2.oAuth2.scopes.join(" ");
31635
31720
  const state2 = (Math.random() + 1).toString(36).substring(7);
31636
31721
  const url = new URL(flow.authorizationUrl);
@@ -31643,7 +31728,45 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
31643
31728
  url.searchParams.set("scope", scopes);
31644
31729
  url.searchParams.set("state", state2);
31645
31730
  return url.toString();
31646
- };
31731
+ }
31732
+ function authorizeWithPassword(tokenUrl, options) {
31733
+ if (typeof tokenUrl !== "string") {
31734
+ console.log("tokenUrl is not a string");
31735
+ return;
31736
+ }
31737
+ const urlAndPath = (options == null ? void 0 : options.baseUrl) && !tokenUrl.startsWith("http") ? concatenateUrlAndPath(options == null ? void 0 : options.baseUrl, tokenUrl) : tokenUrl;
31738
+ const url = new URL(urlAndPath);
31739
+ url.searchParams.set("grant_type", "password");
31740
+ url.searchParams.set("username", authentication2.oAuth2.username);
31741
+ url.searchParams.set("password", authentication2.oAuth2.password);
31742
+ url.searchParams.set("client_id", authentication2.oAuth2.clientId);
31743
+ url.searchParams.set("scope", authentication2.oAuth2.scopes.join(" "));
31744
+ fetch(
31745
+ (options == null ? void 0 : options.proxy) ? redirectToProxy(options == null ? void 0 : options.proxy, url.toString()) : url.toString(),
31746
+ {
31747
+ method: "POST",
31748
+ headers: {
31749
+ "Content-Type": "application/x-www-form-urlencoded"
31750
+ }
31751
+ }
31752
+ ).then((response) => {
31753
+ if (!response.ok) {
31754
+ throw new Error(
31755
+ "Failed to get an access token. Please check your credentials."
31756
+ );
31757
+ }
31758
+ return response.json();
31759
+ }).then((data) => {
31760
+ setAuthentication2({
31761
+ oAuth2: { ...authentication2.oAuth2, accessToken: data.access_token }
31762
+ });
31763
+ }).catch((response) => {
31764
+ toast(`Couldn’t retrieve the password grant token`, "warn", {
31765
+ description: "Open your browser console to get more information."
31766
+ });
31767
+ console.error("[authorizeWithPassword]", response);
31768
+ });
31769
+ }
31647
31770
  const oauth2SelectedScopes = computed({
31648
31771
  get: () => authentication2.oAuth2.scopes,
31649
31772
  set: (scopes) => setAuthentication2({ oAuth2: { ...authentication2.oAuth2, scopes } })
@@ -31729,66 +31852,157 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
31729
31852
  ]),
31730
31853
  _: 1
31731
31854
  }, 8, ["value"])) : createCommentVNode("", true)
31732
- ], 64)) : _ctx.value.type.toLowerCase() === "oauth2" && _ctx.value.flows && _ctx.value.flows.implicit ? (openBlock(), createBlock(CardFormGroup, { key: 2 }, {
31855
+ ], 64)) : _ctx.value.type.toLowerCase() === "oauth2" && _ctx.value.flows ? (openBlock(), createBlock(CardFormGroup, { key: 2 }, {
31733
31856
  default: withCtx(() => [
31734
- unref(authentication2).oAuth2.accessToken ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
31735
- createVNode(CardFormTextInput, {
31736
- id: "oAuth2.accessToken",
31737
- placeholder: "xxxxx",
31738
- type: "password",
31739
- value: unref(authentication2).oAuth2.accessToken
31740
- }, {
31741
- default: withCtx(() => [
31742
- createTextVNode(" Access Token ")
31743
- ]),
31744
- _: 1
31745
- }, 8, ["value"]),
31746
- createVNode(CardFormButton, {
31747
- onClick: _cache[0] || (_cache[0] = () => unref(setAuthentication2)({
31748
- oAuth2: {
31749
- ...unref(authentication2).oAuth2,
31750
- accessToken: "",
31751
- state: ""
31752
- }
31753
- }))
31754
- }, {
31755
- default: withCtx(() => [
31756
- createTextVNode(" Reset ")
31757
- ]),
31758
- _: 1
31759
- })
31760
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
31761
- createVNode(CardFormTextInput, {
31762
- id: "oAuth2.clientId",
31763
- placeholder: "12345",
31764
- type: "text",
31765
- value: unref(authentication2).oAuth2.clientId,
31766
- onInput: handleOpenAuth2ClientIdInput
31767
- }, {
31768
- default: withCtx(() => [
31769
- createTextVNode(" Client ID ")
31770
- ]),
31771
- _: 1
31772
- }, 8, ["value"]),
31773
- _ctx.value !== void 0 ? (openBlock(), createBlock(SecuritySchemeScopes, {
31774
- key: 0,
31775
- selected: oauth2SelectedScopes.value,
31776
- "onUpdate:selected": _cache[1] || (_cache[1] = ($event) => oauth2SelectedScopes.value = $event),
31777
- scopes: _ctx.value.flows.implicit.scopes
31778
- }, null, 8, ["selected", "scopes"])) : createCommentVNode("", true),
31779
- createElementVNode("button", {
31780
- class: "cardform-auth-button",
31781
- onClick: _cache[2] || (_cache[2] = () => {
31782
- var _a3;
31783
- return startAuthentication(
31784
- getOpenAuth2AuthorizationUrl(
31785
- //@ts-ignore
31786
- (_a3 = _ctx.value) == null ? void 0 : _a3.flows.implicit
31787
- )
31788
- );
31857
+ _ctx.value.flows.implicit ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
31858
+ unref(authentication2).oAuth2.accessToken ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
31859
+ createVNode(CardFormTextInput, {
31860
+ id: "oAuth2.accessToken",
31861
+ placeholder: "xxxxx",
31862
+ type: "password",
31863
+ value: unref(authentication2).oAuth2.accessToken
31864
+ }, {
31865
+ default: withCtx(() => [
31866
+ createTextVNode(" Access Token ")
31867
+ ]),
31868
+ _: 1
31869
+ }, 8, ["value"]),
31870
+ createVNode(CardFormButton, {
31871
+ onClick: _cache[0] || (_cache[0] = () => unref(setAuthentication2)({
31872
+ oAuth2: {
31873
+ ...unref(authentication2).oAuth2,
31874
+ accessToken: "",
31875
+ state: ""
31876
+ }
31877
+ }))
31878
+ }, {
31879
+ default: withCtx(() => [
31880
+ createTextVNode(" Reset ")
31881
+ ]),
31882
+ _: 1
31789
31883
  })
31790
- }, " Authorize ")
31791
- ], 64))
31884
+ ], 64)) : createCommentVNode("", true)
31885
+ ], 64)) : createCommentVNode("", true),
31886
+ _ctx.value.flows.password ? (openBlock(), createBlock(CardFormRows, { key: 1 }, {
31887
+ default: withCtx(() => [
31888
+ createVNode(CardFormGroup, null, {
31889
+ default: withCtx(() => [
31890
+ createVNode(CardFormTextInput, {
31891
+ id: "oAuth2.username",
31892
+ placeholder: "Username",
31893
+ value: unref(authentication2).oAuth2.username,
31894
+ onInput: handleOAuth2UsernameInput
31895
+ }, {
31896
+ default: withCtx(() => [
31897
+ createTextVNode(" Username ")
31898
+ ]),
31899
+ _: 1
31900
+ }, 8, ["value"]),
31901
+ createVNode(CardFormTextInput, {
31902
+ id: "oAuth2.password",
31903
+ placeholder: "Password",
31904
+ type: "password",
31905
+ value: unref(authentication2).oAuth2.password,
31906
+ onInput: handleOAuth2PasswordInput
31907
+ }, {
31908
+ default: withCtx(() => [
31909
+ createTextVNode(" Password ")
31910
+ ]),
31911
+ _: 1
31912
+ }, 8, ["value"])
31913
+ ]),
31914
+ _: 1
31915
+ }),
31916
+ createVNode(CardFormGroup, null, {
31917
+ default: withCtx(() => {
31918
+ var _a3, _b;
31919
+ return [
31920
+ createVNode(CardFormTextInput, {
31921
+ id: "oAuth2.clientId",
31922
+ placeholder: "12345",
31923
+ type: "text",
31924
+ value: unref(authentication2).oAuth2.clientId,
31925
+ onInput: handleOpenAuth2ClientIdInput
31926
+ }, {
31927
+ default: withCtx(() => [
31928
+ createTextVNode(" Client ID ")
31929
+ ]),
31930
+ _: 1
31931
+ }, 8, ["value"]),
31932
+ _ctx.value !== void 0 && Object.entries(
31933
+ ((_a3 = _ctx.value.flows.implicit) == null ? void 0 : _a3.scopes) ?? _ctx.value.flows.password.scopes
31934
+ ).length > 0 ? (openBlock(), createBlock(SecuritySchemeScopes, {
31935
+ key: 0,
31936
+ selected: oauth2SelectedScopes.value,
31937
+ "onUpdate:selected": _cache[1] || (_cache[1] = ($event) => oauth2SelectedScopes.value = $event),
31938
+ scopes: ((_b = _ctx.value.flows.implicit) == null ? void 0 : _b.scopes) ?? _ctx.value.flows.password.scopes
31939
+ }, null, 8, ["selected", "scopes"])) : createCommentVNode("", true),
31940
+ createElementVNode("button", {
31941
+ class: "cardform-auth-button",
31942
+ type: "button",
31943
+ onClick: _cache[2] || (_cache[2] = () => {
31944
+ var _a4, _b2;
31945
+ return authorizeWithPassword(
31946
+ (_b2 = (_a4 = _ctx.value.flows) == null ? void 0 : _a4.password) == null ? void 0 : _b2.tokenUrl,
31947
+ {
31948
+ baseUrl: unref(getUrlFromServerState)(unref(server2)),
31949
+ proxy: _ctx.proxy
31950
+ }
31951
+ );
31952
+ })
31953
+ }, " Authorize ")
31954
+ ];
31955
+ }),
31956
+ _: 1
31957
+ })
31958
+ ]),
31959
+ _: 1
31960
+ })) : (openBlock(), createBlock(CardFormRows, { key: 2 }, {
31961
+ default: withCtx(() => [
31962
+ createVNode(CardFormGroup, null, {
31963
+ default: withCtx(() => {
31964
+ var _a3, _b;
31965
+ return [
31966
+ createVNode(CardFormTextInput, {
31967
+ id: "oAuth2.clientId",
31968
+ placeholder: "12345",
31969
+ type: "text",
31970
+ value: unref(authentication2).oAuth2.clientId,
31971
+ onInput: handleOpenAuth2ClientIdInput
31972
+ }, {
31973
+ default: withCtx(() => [
31974
+ createTextVNode(" Client ID ")
31975
+ ]),
31976
+ _: 1
31977
+ }, 8, ["value"]),
31978
+ _ctx.value !== void 0 && Object.entries(
31979
+ ((_a3 = _ctx.value.flows.implicit) == null ? void 0 : _a3.scopes) ?? _ctx.value.flows.password.scopes
31980
+ ).length > 0 ? (openBlock(), createBlock(SecuritySchemeScopes, {
31981
+ key: 0,
31982
+ selected: oauth2SelectedScopes.value,
31983
+ "onUpdate:selected": _cache[3] || (_cache[3] = ($event) => oauth2SelectedScopes.value = $event),
31984
+ scopes: ((_b = _ctx.value.flows.implicit) == null ? void 0 : _b.scopes) ?? _ctx.value.flows.password.scopes
31985
+ }, null, 8, ["selected", "scopes"])) : createCommentVNode("", true),
31986
+ createElementVNode("button", {
31987
+ class: "cardform-auth-button",
31988
+ type: "button",
31989
+ onClick: _cache[4] || (_cache[4] = () => {
31990
+ var _a4, _b2;
31991
+ return startAuthentication(
31992
+ getOpenAuth2AuthorizationUrl(
31993
+ //@ts-ignore
31994
+ ((_a4 = _ctx.value) == null ? void 0 : _a4.flows.implicit) ?? ((_b2 = _ctx.value) == null ? void 0 : _b2.flows.password)
31995
+ )
31996
+ );
31997
+ })
31998
+ }, " Authorize ")
31999
+ ];
32000
+ }),
32001
+ _: 1
32002
+ })
32003
+ ]),
32004
+ _: 1
32005
+ }))
31792
32006
  ]),
31793
32007
  _: 1
31794
32008
  })) : createCommentVNode("", true)
@@ -31798,8 +32012,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
31798
32012
  };
31799
32013
  }
31800
32014
  });
31801
- const SecurityScheme = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-3eb93ac9"]]);
31802
- const _withScopeId$3 = (n) => (pushScopeId("data-v-b83bdfab"), n = n(), popScopeId(), n);
32015
+ const SecurityScheme = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-93b19e52"]]);
32016
+ const _withScopeId$3 = (n) => (pushScopeId("data-v-daca0c64"), n = n(), popScopeId(), n);
31803
32017
  const _hoisted_1$m = {
31804
32018
  key: 0,
31805
32019
  class: "security-scheme-label"
@@ -31849,6 +32063,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
31849
32063
  return `${getAuthorizationTypeLabel(item)} (${key})`;
31850
32064
  };
31851
32065
  const getAuthorizationTypeLabel = (item) => {
32066
+ var _a2, _b;
31852
32067
  if (isNone(item)) {
31853
32068
  return "No Authentication";
31854
32069
  } else if (isApiKey(item)) {
@@ -31858,6 +32073,12 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
31858
32073
  } else if (isHttpBearer(item)) {
31859
32074
  return "Bearer Authentication";
31860
32075
  } else if (isOAuth2(item)) {
32076
+ if ((_a2 = item.flows) == null ? void 0 : _a2.implicit) {
32077
+ return "OAuth 2.0 Implicit";
32078
+ }
32079
+ if ((_b = item.flows) == null ? void 0 : _b.password) {
32080
+ return "OAuth 2.0 Password";
32081
+ }
31861
32082
  return "OAuth 2.0";
31862
32083
  }
31863
32084
  return `${item.type} (not yet supported)`;
@@ -31890,7 +32111,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
31890
32111
  };
31891
32112
  }
31892
32113
  });
31893
- const SecuritySchemeSelector = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-b83bdfab"]]);
32114
+ const SecuritySchemeSelector = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-daca0c64"]]);
31894
32115
  const _hoisted_1$l = {
31895
32116
  key: 0,
31896
32117
  class: "preferred-security-scheme"
@@ -31901,6 +32122,9 @@ const _hoisted_2$g = {
31901
32122
  };
31902
32123
  const _sfc_main$n = /* @__PURE__ */ defineComponent({
31903
32124
  __name: "RequestAuthentication",
32125
+ props: {
32126
+ proxy: {}
32127
+ },
31904
32128
  setup(__props) {
31905
32129
  const requestAuthenticationRef = ref(null);
31906
32130
  clickGeneratedParameter.on(() => {
@@ -31931,7 +32155,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
31931
32155
  ref_key: "requestAuthenticationRef",
31932
32156
  ref: requestAuthenticationRef
31933
32157
  }, [
31934
- createVNode(unref(_sfc_main$v), { title: "Authentication" }, {
32158
+ createVNode(unref(_sfc_main$w), { title: "Authentication" }, {
31935
32159
  options: withCtx(() => [
31936
32160
  createVNode(SecuritySchemeSelector, {
31937
32161
  value: unref(authentication2).securitySchemes
@@ -31942,8 +32166,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
31942
32166
  return [
31943
32167
  unref(authentication2).preferredSecurityScheme ? (openBlock(), createElementBlock("div", _hoisted_1$l, [
31944
32168
  createVNode(SecurityScheme, {
32169
+ proxy: _ctx.proxy,
31945
32170
  value: (_a2 = unref(authentication2).securitySchemes) == null ? void 0 : _a2[unref(authentication2).preferredSecurityScheme]
31946
- }, null, 8, ["value"])
32171
+ }, null, 8, ["proxy", "value"])
31947
32172
  ])) : createCommentVNode("", true),
31948
32173
  !unref(authentication2).securitySchemes ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
31949
32174
  createElementVNode("div", {
@@ -31970,7 +32195,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
31970
32195
  };
31971
32196
  }
31972
32197
  });
31973
- const RequestAuthentication = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-3fb420c2"]]);
32198
+ const RequestAuthentication = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-9f62f731"]]);
31974
32199
  const _hoisted_1$k = { class: "table-row" };
31975
32200
  const _hoisted_2$f = { class: "table-row-meta" };
31976
32201
  const _hoisted_3$8 = { class: "table-row-item" };
@@ -32340,7 +32565,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
32340
32565
  }
32341
32566
  };
32342
32567
  return (_ctx, _cache) => {
32343
- return openBlock(), createBlock(unref(_sfc_main$v), { title: "Body" }, {
32568
+ return openBlock(), createBlock(unref(_sfc_main$w), { title: "Body" }, {
32344
32569
  default: withCtx(() => [
32345
32570
  _ctx.body && _ctx.body.length === 0 && _ctx.formData && _ctx.formData.length === 0 ? (openBlock(), createElementBlock("span", _hoisted_1$e, "No Body")) : _ctx.formData && _ctx.formData.length > 0 ? (openBlock(), createBlock(unref(Grid), {
32346
32571
  key: 1,
@@ -32404,7 +32629,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
32404
32629
  return !!(((_a2 = props.cookies) == null ? void 0 : _a2.length) || ((_b = props.generatedCookies) == null ? void 0 : _b.length));
32405
32630
  });
32406
32631
  return (_ctx, _cache) => {
32407
- return openBlock(), createBlock(unref(_sfc_main$v), {
32632
+ return openBlock(), createBlock(unref(_sfc_main$w), {
32408
32633
  defaultOpen: hasCookies.value,
32409
32634
  title: "Cookies"
32410
32635
  }, {
@@ -32478,7 +32703,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
32478
32703
  return !!(((_a2 = props.headers) == null ? void 0 : _a2.length) || ((_b = props.generatedHeaders) == null ? void 0 : _b.length));
32479
32704
  });
32480
32705
  return (_ctx, _cache) => {
32481
- return openBlock(), createBlock(unref(_sfc_main$v), {
32706
+ return openBlock(), createBlock(unref(_sfc_main$w), {
32482
32707
  defaultOpen: hasHeaders.value,
32483
32708
  title: "Headers"
32484
32709
  }, {
@@ -32552,7 +32777,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
32552
32777
  return !!(((_a2 = props.queries) == null ? void 0 : _a2.length) || ((_b = props.generatedQueries) == null ? void 0 : _b.length));
32553
32778
  });
32554
32779
  return (_ctx, _cache) => {
32555
- return openBlock(), createBlock(unref(_sfc_main$v), {
32780
+ return openBlock(), createBlock(unref(_sfc_main$w), {
32556
32781
  defaultOpen: hasQueries.value,
32557
32782
  title: "Query Parameters"
32558
32783
  }, {
@@ -32621,7 +32846,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
32621
32846
  (_a2 = activeRequest2.variables) == null ? void 0 : _a2.push({ name: "", value: "", enabled: true });
32622
32847
  }
32623
32848
  return (_ctx, _cache) => {
32624
- return openBlock(), createBlock(unref(_sfc_main$v), {
32849
+ return openBlock(), createBlock(unref(_sfc_main$w), {
32625
32850
  defaultOpen: unref(activeRequest2).variables && unref(activeRequest2).variables.length > 0,
32626
32851
  title: "Variables"
32627
32852
  }, {
@@ -32802,7 +33027,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
32802
33027
  return value;
32803
33028
  });
32804
33029
  return (_ctx, _cache) => {
32805
- return openBlock(), createBlock(unref(_sfc_main$v), { title: "Body" }, {
33030
+ return openBlock(), createBlock(unref(_sfc_main$w), { title: "Body" }, {
32806
33031
  default: withCtx(() => [
32807
33032
  _ctx.response ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
32808
33033
  codeMirrorLanguage.value || typeof _ctx.response.data === "string" ? (openBlock(), createBlock(unref(zt), {
@@ -32927,7 +33152,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
32927
33152
  }).join("-");
32928
33153
  };
32929
33154
  return (_ctx, _cache) => {
32930
- return openBlock(), createBlock(unref(_sfc_main$v), { title: "Headers" }, {
33155
+ return openBlock(), createBlock(unref(_sfc_main$w), { title: "Headers" }, {
32931
33156
  default: withCtx(() => [
32932
33157
  _ctx.headers.length > 0 ? (openBlock(), createBlock(unref(SimpleTable), { key: 0 }, {
32933
33158
  default: withCtx(() => [
@@ -33084,7 +33309,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
33084
33309
  unref(activeRequestId2) && unref(activeResponse2) ? (openBlock(), createElementBlock("div", _hoisted_6, [
33085
33310
  createVNode(_sfc_main$9, { response: unref(activeResponse2) }, null, 8, ["response"]),
33086
33311
  createVNode(_sfc_main$3, { headers: responseHeaders.value }, null, 8, ["headers"]),
33087
- createVNode(unref(_sfc_main$v), { title: "Cookies" }, {
33312
+ createVNode(unref(_sfc_main$w), { title: "Cookies" }, {
33088
33313
  default: withCtx(() => [
33089
33314
  withDirectives(createVNode(unref(SimpleGrid), { items: responseCookies.value }, null, 8, ["items"]), [
33090
33315
  [vShow, responseCookies.value.length > 0]
@@ -33138,11 +33363,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
33138
33363
  );
33139
33364
  return (_ctx, _cache) => {
33140
33365
  return openBlock(), createElementBlock(Fragment, null, [
33141
- createVNode(unref(_sfc_main$E), {
33366
+ createVNode(unref(_sfc_main$F), {
33142
33367
  id: _ctx.theme,
33143
33368
  withDefaultFonts: _ctx.withDefaultFonts
33144
33369
  }, null, 8, ["id", "withDefaultFonts"]),
33145
- createVNode(_sfc_main$C, {
33370
+ createVNode(_sfc_main$D, {
33146
33371
  class: "scalar-api-client",
33147
33372
  method: unref(activeRequest2).type ?? "get",
33148
33373
  property: "--scalar-api-client-color",
@@ -33222,19 +33447,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
33222
33447
  });
33223
33448
  export {
33224
33449
  _sfc_main as ApiClient,
33225
- _sfc_main$C as HttpMethod,
33450
+ _sfc_main$D as HttpMethod,
33226
33451
  RequestAuthentication,
33227
33452
  SecurityScheme,
33228
33453
  SecuritySchemeSelector,
33229
33454
  concatenateUrlAndPath,
33230
33455
  createEmptyAuthenticationState,
33231
33456
  createEmptyOpenApiState,
33457
+ createEmptyServerState,
33232
33458
  createPlaceholderRequest,
33233
33459
  encodeStringAsBase64,
33234
33460
  findVariables,
33235
33461
  getBase64Token,
33236
33462
  getRequestFromAuthentication,
33237
33463
  getSecretCredentialsFromAuthentication,
33464
+ getUrlFromServerState,
33238
33465
  httpHeaders,
33239
33466
  humanDiff,
33240
33467
  isRequestMethod,
@@ -33244,6 +33471,7 @@ export {
33244
33471
  normalizeRequestMethod,
33245
33472
  normalizeUrl,
33246
33473
  prepareClientRequestConfig,
33474
+ redirectToProxy,
33247
33475
  replaceVariables,
33248
33476
  requestMethodAbbreviations,
33249
33477
  requestMethodColors,
@@ -33252,5 +33480,6 @@ export {
33252
33480
  useAuthenticationStore,
33253
33481
  useOpenApiStore,
33254
33482
  useRequestStore,
33483
+ useServerStore,
33255
33484
  validRequestMethods
33256
33485
  };