@scalar/api-client 2.27.1 → 2.29.2

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 (87) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/dist/components/ViewLayout/ViewLayoutSection.vue.d.ts.map +1 -1
  3. package/dist/components/ViewLayout/ViewLayoutSection.vue.js +1 -1
  4. package/dist/libs/local-storage.js +3 -3
  5. package/dist/style.css +1 -1
  6. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  7. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +21 -21
  8. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  9. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  10. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +67 -75
  11. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -0
  12. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  13. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +2 -0
  14. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  15. package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts +1 -1
  16. package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -1
  17. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +20 -19
  18. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +2 -0
  19. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  20. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +42 -40
  21. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  22. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +5 -5
  23. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +3 -1
  24. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  25. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +35 -35
  26. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  27. package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
  28. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  29. package/dist/v2/components/sidebar/Sidebar.vue.js +1 -1
  30. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  31. package/dist/v2/features/app/App.vue.js +70 -70
  32. package/dist/v2/features/app/app-events.d.ts +2 -1
  33. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  34. package/dist/v2/features/app/app-events.js +89 -64
  35. package/dist/v2/features/app/app-state.d.ts +4 -2
  36. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  37. package/dist/v2/features/app/app-state.js +185 -156
  38. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  39. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  40. package/dist/v2/features/app/components/AppSidebar.vue2.js +48 -47
  41. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
  42. package/dist/v2/features/app/components/DesktopTabs.vue.js +4 -4
  43. package/dist/v2/features/app/components/DownloadAppButton.vue.d.ts.map +1 -1
  44. package/dist/v2/features/app/components/DownloadAppButton.vue.js +1 -1
  45. package/dist/v2/features/app/components/DownloadAppButton.vue2.js +9 -9
  46. package/dist/v2/features/app/components/SidebarItemMenu.vue.d.ts.map +1 -1
  47. package/dist/v2/features/app/components/SidebarItemMenu.vue.js +71 -43
  48. package/dist/v2/features/app/helpers/routes.js +11 -11
  49. package/dist/v2/features/collection/WorkspaceCollection.vue.d.ts +1 -6
  50. package/dist/v2/features/collection/WorkspaceCollection.vue.d.ts.map +1 -1
  51. package/dist/v2/features/collection/WorkspaceCollection.vue.js +38 -20
  52. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  53. package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
  54. package/dist/v2/features/collection/components/Authentication.vue2.js +20 -16
  55. package/dist/v2/features/collection/components/LabelInput.vue.d.ts +3 -0
  56. package/dist/v2/features/collection/components/LabelInput.vue.d.ts.map +1 -1
  57. package/dist/v2/features/collection/components/LabelInput.vue.js +2 -2
  58. package/dist/v2/features/collection/components/LabelInput.vue2.js +20 -16
  59. package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
  60. package/dist/v2/features/collection/components/Settings.vue.js +18 -14
  61. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts +7 -2
  62. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -1
  63. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +70 -71
  64. package/dist/v2/features/command-palette/components/{CommandPaletteDocument.vue.d.ts → CommandPaletteOpenApiDocument.vue.d.ts} +3 -3
  65. package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue.d.ts.map +1 -0
  66. package/dist/v2/features/command-palette/components/{CommandPaletteDocument.vue.js → CommandPaletteOpenApiDocument.vue.js} +15 -15
  67. package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue2.js +4 -0
  68. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +2 -2
  69. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -1
  70. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +10 -10
  71. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +27 -5
  72. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -1
  73. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +80 -53
  74. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +34 -9
  75. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
  76. package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +50 -44
  77. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  78. package/dist/v2/features/operation/Operation.vue.js +19 -15
  79. package/dist/v2/helpers/get-active-proxy-url.d.ts +18 -0
  80. package/dist/v2/helpers/get-active-proxy-url.d.ts.map +1 -0
  81. package/dist/v2/helpers/get-active-proxy-url.js +5 -0
  82. package/dist/v2/workspace-events.d.ts.map +1 -1
  83. package/dist/v2/workspace-events.js +123 -113
  84. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  85. package/package.json +18 -18
  86. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts.map +0 -1
  87. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue2.js +0 -4
@@ -1,69 +1,78 @@
1
- import { isDefined as Y } from "@scalar/helpers/array/is-defined";
2
- import { sortByOrder as pe } from "@scalar/helpers/array/sort-by-order";
3
- import { createSidebarState as ue, generateReverseIndex as me } from "@scalar/sidebar";
4
- import { createWorkspaceStore as j } from "@scalar/workspace-store/client";
5
- import { createWorkspaceEventBus as de } from "@scalar/workspace-store/events";
6
- import { generateUniqueValue as ve } from "@scalar/workspace-store/helpers/generate-unique-value";
7
- import { getParentEntry as v } from "@scalar/workspace-store/navigation";
8
- import { createWorkspaceStorePersistence as fe } from "@scalar/workspace-store/persistence";
9
- import { persistencePlugin as he } from "@scalar/workspace-store/plugins/client";
10
- import { extensions as we } from "@scalar/workspace-store/schemas/extensions";
11
- import { ref as u, computed as p, shallowRef as H } from "vue";
1
+ import { isDefined as M } from "@scalar/helpers/array/is-defined";
2
+ import { sortByOrder as de } from "@scalar/helpers/array/sort-by-order";
3
+ import { migrateLocalStorageToIndexDb as ve } from "@scalar/oas-utils/migrations";
4
+ import { createSidebarState as fe, generateReverseIndex as he } from "@scalar/sidebar";
5
+ import { createWorkspaceStore as Y } from "@scalar/workspace-store/client";
6
+ import { createWorkspaceEventBus as we } from "@scalar/workspace-store/events";
7
+ import { generateUniqueValue as ge } from "@scalar/workspace-store/helpers/generate-unique-value";
8
+ import { getParentEntry as h } from "@scalar/workspace-store/navigation";
9
+ import { createWorkspaceStorePersistence as ke, getWorkspaceId as w } from "@scalar/workspace-store/persistence";
10
+ import { persistencePlugin as xe } from "@scalar/workspace-store/plugins/client";
11
+ import { extensions as be } from "@scalar/workspace-store/schemas/extensions";
12
+ import { ref as p, computed as u, shallowRef as j, readonly as ye } from "vue";
12
13
  import { getRouteParam as l } from "./helpers/get-route-param.js";
13
- import { groupWorkspacesByTeam as ke } from "./helpers/group-workspaces.js";
14
- import { getActiveEnvironment as ge } from "../../helpers/get-active-environment.js";
15
- import { getTabDetails as xe } from "../../helpers/get-tab-details.js";
16
- import { slugify as be } from "../../helpers/slugify.js";
17
- import { workspaceStorage as ye } from "../../helpers/storage.js";
18
- import { initializeAppEventHandlers as Se } from "./app-events.js";
19
- import { filterWorkspacesByTeam as Ee, canLoadWorkspace as We } from "./helpers/filter-workspaces.js";
20
- const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
14
+ import { groupWorkspacesByTeam as Se } from "./helpers/group-workspaces.js";
15
+ import { getActiveEnvironment as Ee } from "../../helpers/get-active-environment.js";
16
+ import { getTabDetails as We } from "../../helpers/get-tab-details.js";
17
+ import { slugify as Ue } from "../../helpers/slugify.js";
18
+ import { workspaceStorage as Te } from "../../helpers/storage.js";
19
+ import { initializeAppEventHandlers as Ie } from "./app-events.js";
20
+ import { filterWorkspacesByTeam as De, canLoadWorkspace as H } from "./helpers/filter-workspaces.js";
21
+ const Re = 1e3, Ae = 288, Xe = async ({
21
22
  router: i,
22
- fileLoader: T
23
+ fileLoader: z
23
24
  }) => {
24
- const w = de({
25
+ const S = we({
25
26
  debug: !1
26
- }), { workspace: k } = await fe(), g = u("local"), x = u(void 0), I = u(void 0), b = u(void 0), L = u(void 0), O = u(void 0), N = u(void 0), y = u(!1);
27
- i.afterEach((e) => ce(e));
28
- const d = p(() => i.currentRoute.value ?? null), D = H(null), f = u([]), S = p(() => Ee(f.value, g.value)), z = p(() => ke(S.value, g.value)), s = H(null), A = p(() => s.value?.workspace.documents[b.value ?? ""] || null), G = p(() => ge(s.value, A.value));
29
- f.value = await k.getAll().then(
27
+ }), { workspace: g } = await ke();
28
+ await ve();
29
+ const k = p("local"), f = p(void 0), x = p(void 0), E = p(void 0), B = p(void 0), L = p(void 0), N = p(void 0), W = p(!1);
30
+ i.afterEach((e) => ue(e));
31
+ const d = u(() => i.currentRoute.value ?? null), U = j(null), v = p([]), b = u(() => De(v.value, k.value)), G = u(() => Se(b.value, k.value)), s = j(null), D = u(() => s.value?.workspace.documents[E.value ?? ""] || null), J = u(() => Ee(s.value, D.value));
32
+ v.value = await g.getAll().then(
30
33
  (e) => e.map(({ teamUid: a, namespace: t, slug: n, name: c }) => ({
31
- id: h(t, n),
34
+ id: w(t, n),
32
35
  teamUid: a,
33
36
  namespace: t,
34
37
  slug: n,
35
38
  label: c
36
39
  }))
37
40
  );
38
- const J = async ({
41
+ const Q = async (e) => {
42
+ const a = f.value, t = x.value;
43
+ if (!a || !t)
44
+ return;
45
+ const n = w(a, t);
46
+ await g.updateName({ namespace: a, slug: t }, e) !== void 0 && (v.value = v.value.map((o) => o.id === n ? { ...o, label: e } : o), U.value = { id: n, label: e });
47
+ }, X = async ({
39
48
  namespace: e,
40
49
  slug: a
41
- }) => j({
50
+ }) => Y({
42
51
  plugins: [
43
- await he({
44
- workspaceId: h(e, a),
45
- debounceDelay: Ue
52
+ await xe({
53
+ workspaceId: w(e, a),
54
+ debounceDelay: Re
46
55
  })
47
56
  ],
48
- fileLoader: T
49
- }), Q = async (e, a) => {
50
- const t = await k.getItem({ namespace: e, slug: a });
57
+ fileLoader: z
58
+ }), Z = async (e, a) => {
59
+ const t = await g.getItem({ namespace: e, slug: a });
51
60
  if (!t)
52
61
  return {
53
62
  success: !1
54
63
  };
55
- const n = await J({ namespace: e, slug: a });
56
- return n.loadWorkspace(t.workspace), D.value = { id: h(t.namespace, t.slug), label: t.name }, s.value = n, {
64
+ const n = await X({ namespace: e, slug: a });
65
+ return n.loadWorkspace(t.workspace), U.value = { id: w(t.namespace, t.slug), label: t.name }, s.value = n, {
57
66
  success: !0,
58
67
  workspace: n.workspace
59
68
  };
60
- }, X = async ({
69
+ }, ee = async ({
61
70
  name: e,
62
71
  teamUid: a,
63
72
  namespace: t,
64
73
  slug: n
65
74
  }) => {
66
- const c = j();
75
+ const c = Y();
67
76
  await c.addDocument({
68
77
  name: "drafts",
69
78
  document: {
@@ -81,7 +90,7 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
81
90
  "x-scalar-icon": "interface-edit-tool-pencil"
82
91
  }
83
92
  });
84
- const r = await k.setItem(
93
+ const o = await g.setItem(
85
94
  { namespace: t, slug: n },
86
95
  {
87
96
  name: e,
@@ -89,85 +98,103 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
89
98
  workspace: c.exportWorkspace()
90
99
  }
91
100
  );
92
- return f.value.push({
93
- id: h(r.namespace, r.slug),
94
- teamUid: r.teamUid,
95
- namespace: r.namespace,
96
- slug: r.slug,
97
- label: r.name
98
- }), r;
99
- }, E = async (e, a) => {
101
+ return v.value.push({
102
+ id: w(o.namespace, o.slug),
103
+ teamUid: o.teamUid,
104
+ namespace: o.namespace,
105
+ slug: o.slug,
106
+ label: o.name
107
+ }), o;
108
+ }, y = async (e, a) => {
109
+ if (!e || !a) {
110
+ await i.push("/");
111
+ return;
112
+ }
100
113
  await i.push({
101
- name: "workspace.environment",
102
- params: { namespace: e, workspaceSlug: a }
114
+ name: "example",
115
+ params: {
116
+ namespace: e,
117
+ workspaceSlug: a,
118
+ documentSlug: "drafts",
119
+ pathEncoded: encodeURIComponent("/"),
120
+ method: "get",
121
+ exampleName: "default"
122
+ }
103
123
  });
104
- }, _ = async ({
124
+ }, O = async ({
105
125
  teamUid: e,
106
126
  namespace: a,
107
127
  slug: t,
108
128
  name: n
109
129
  }) => {
110
130
  s.value = null;
111
- const c = await ve({
131
+ const c = await ge({
112
132
  defaultValue: t ?? n,
113
133
  // Use the provided id if it exists, otherwise use the name
114
- validation: async (U) => !await k.has({ namespace: a ?? "local", slug: U }),
134
+ validation: async (I) => !await g.has({ namespace: a ?? "local", slug: I }),
115
135
  maxRetries: 100,
116
- transformation: be
136
+ transformation: Ue
117
137
  });
118
138
  if (!c)
119
139
  return;
120
- const m = await X({
140
+ const m = await ee({
121
141
  teamUid: e,
122
142
  namespace: a,
123
143
  slug: c,
124
144
  name: n
125
145
  });
126
- return await E(m.namespace, m.slug), m;
127
- }, Z = async (e, a) => {
128
- s.value = null, y.value = !0;
129
- const t = await Q(e, a);
146
+ return await y(m.namespace, m.slug), m;
147
+ }, ae = async (e, a) => {
148
+ s.value = null, W.value = !0;
149
+ const t = await Z(e, a);
130
150
  if (t.success) {
131
- const r = t.workspace["x-scalar-active-tab"] ?? 0, m = t.workspace["x-scalar-tabs"], U = m?.[r];
132
- U && await i.replace({
133
- path: U.path,
151
+ const o = t.workspace["x-scalar-active-tab"] ?? 0, m = t.workspace["x-scalar-tabs"], I = m?.[o];
152
+ I && await i.replace({
153
+ path: I.path,
134
154
  query: d.value?.query ?? {}
135
- }), m && r >= m.length && w.emit("tabs:update:tabs", {
155
+ }), m && o >= m.length && S.emit("tabs:update:tabs", {
136
156
  "x-scalar-active-tab": 0
137
- }), m || w.emit("tabs:update:tabs", {
138
- "x-scalar-tabs": [B(d.value)],
157
+ }), m || S.emit("tabs:update:tabs", {
158
+ "x-scalar-tabs": [C(d.value)],
139
159
  "x-scalar-active-tab": 0
140
- }), y.value = !1;
160
+ }), W.value = !1;
141
161
  return;
142
162
  }
143
- const n = S.value.find((r) => r.teamUid === "local" && r.slug === "default") ?? S.value[0];
163
+ const n = b.value.find((o) => o.teamUid === "local" && o.slug === "default") ?? b.value[0];
144
164
  if (n)
145
- return E(n.namespace, n.slug);
146
- const c = await _({
165
+ return y(n.namespace, n.slug);
166
+ const c = await O({
147
167
  name: "Default Workspace",
148
168
  slug: "default"
149
169
  });
150
- if (y.value = !1, !c)
170
+ if (W.value = !1, !c)
151
171
  return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
152
- o.reset();
153
- }, P = p(() => {
172
+ r.reset();
173
+ }, te = (e) => {
174
+ k.value = e;
175
+ const a = b.value.find(
176
+ (t) => t.namespace === f.value && t.slug === x.value
177
+ );
178
+ if (!(a && H(a.teamUid, e)))
179
+ return y("local", "default");
180
+ }, _ = u(() => {
154
181
  const e = s.value;
155
182
  if (!e)
156
183
  return [];
157
184
  const a = e.workspace["x-scalar-order"] ?? Object.keys(e.workspace.documents);
158
- return pe(Object.keys(e.workspace.documents), a, (t) => t).map((t) => e.workspace.documents[t]?.["x-scalar-navigation"]).filter(Y);
159
- }), o = ue(P), R = ({
185
+ return de(Object.keys(e.workspace.documents), a, (t) => t).map((t) => e.workspace.documents[t]?.["x-scalar-navigation"]).filter(M);
186
+ }), r = fe(_), R = ({
160
187
  document: e,
161
188
  path: a,
162
189
  method: t,
163
190
  example: n
164
- }) => JSON.stringify([e, a, t, n].filter(Y)), $ = p(
165
- () => me({
166
- items: P.value,
191
+ }) => JSON.stringify([e, a, t, n].filter(M)), P = u(
192
+ () => he({
193
+ items: _.value,
167
194
  nestedKey: "children",
168
195
  filter: (e) => e.type === "document" || e.type === "operation" || e.type === "example",
169
196
  getId: (e) => {
170
- const a = v("document", e), t = v("operation", e);
197
+ const a = h("document", e), t = h("operation", e);
171
198
  return R({
172
199
  document: a?.name ?? "",
173
200
  path: t?.path,
@@ -176,41 +203,41 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
176
203
  });
177
204
  }
178
205
  })
179
- ), W = (e) => {
180
- const a = $.value.get(R(e));
181
- return a || $.value.get(
206
+ ), T = (e) => {
207
+ const a = P.value.get(R(e));
208
+ return a || P.value.get(
182
209
  R({
183
210
  document: e.document,
184
211
  path: e.path,
185
212
  method: e.method
186
213
  })
187
214
  );
188
- }, F = (e) => {
189
- const a = o.getEntryById(e);
215
+ }, V = (e) => {
216
+ const a = r.getEntryById(e);
190
217
  if (!a) {
191
218
  console.warn(`Could not find sidebar entry with id ${e} to select`);
192
219
  return;
193
220
  }
194
221
  if (a.type === "document") {
195
- if (o.selectedItem.value === e) {
196
- o.setExpanded(e, !o.isExpanded(e));
222
+ if (r.selectedItem.value === e) {
223
+ r.setExpanded(e, !r.isExpanded(e));
197
224
  return;
198
225
  }
199
- return o.setSelected(e), o.setExpanded(e, !0), i.push({
226
+ return r.setSelected(e), r.setExpanded(e, !0), i.push({
200
227
  name: "document.overview",
201
228
  params: { documentSlug: a.name }
202
229
  });
203
230
  }
204
231
  if (a.type === "operation") {
205
- if (o.isSelected(e)) {
206
- o.setExpanded(e, !o.isExpanded(e));
232
+ if (r.isSelected(e)) {
233
+ r.setExpanded(e, !r.isExpanded(e));
207
234
  return;
208
235
  }
209
236
  const t = a.children?.find((n) => n.type === "example");
210
- return t ? (o.setSelected(t.id), o.setExpanded(t.id, !0)) : o.setSelected(e), i.push({
237
+ return t ? (r.setSelected(t.id), r.setExpanded(t.id, !0)) : r.setSelected(e), i.push({
211
238
  name: "example",
212
239
  params: {
213
- documentSlug: v("document", a)?.name,
240
+ documentSlug: h("document", a)?.name,
214
241
  pathEncoded: encodeURIComponent(a.path),
215
242
  method: a.method,
216
243
  exampleName: t?.name ?? "default"
@@ -218,12 +245,12 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
218
245
  });
219
246
  }
220
247
  if (a.type === "example") {
221
- o.setSelected(e);
222
- const t = v("operation", a);
248
+ r.setSelected(e);
249
+ const t = h("operation", a);
223
250
  return i.push({
224
251
  name: "example",
225
252
  params: {
226
- documentSlug: v("document", a)?.name,
253
+ documentSlug: h("document", a)?.name,
227
254
  pathEncoded: encodeURIComponent(t?.path ?? ""),
228
255
  method: t?.method,
229
256
  exampleName: a.name
@@ -234,42 +261,42 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
234
261
  return i.push({
235
262
  name: "document.overview",
236
263
  params: {
237
- documentSlug: v("document", a)?.name
264
+ documentSlug: h("document", a)?.name
238
265
  }
239
266
  });
240
- o.setExpanded(e, !o.isExpanded(e));
241
- }, ee = async () => {
267
+ r.setExpanded(e, !r.isExpanded(e));
268
+ }, ne = async () => {
242
269
  if (!s.value)
243
270
  return;
244
271
  const e = s.value.workspace["x-scalar-active-tab"] ?? 0, a = s.value.workspace["x-scalar-tabs"]?.[e];
245
272
  a && await i.replace(a.path);
246
- }, K = (e) => {
273
+ }, F = (e) => {
247
274
  e && s.value?.buildSidebar(e);
248
- }, ae = (e) => {
249
- const a = A.value?.["x-scalar-navigation"]?.name;
275
+ }, se = (e) => {
276
+ const a = D.value?.["x-scalar-navigation"]?.name;
250
277
  if (!a)
251
278
  return;
252
- const t = W({
279
+ const t = T({
253
280
  document: a,
254
281
  path: e.path,
255
282
  method: e.method,
256
283
  example: e.exampleKey
257
284
  });
258
- (!t || t.type !== "example") && (K(a), d.value && M(d.value));
259
- }, te = p(() => s.value?.workspace?.["x-scalar-sidebar-width"] ?? Te), ne = (e) => s.value?.update("x-scalar-sidebar-width", e), C = u(!0), se = "x-scalar-tabs", oe = "x-scalar-active-tab", B = (e) => {
285
+ (!t || t.type !== "example") && (F(a), d.value && q(d.value));
286
+ }, oe = u(() => s.value?.workspace?.["x-scalar-sidebar-width"] ?? Ae), re = (e) => s.value?.update("x-scalar-sidebar-width", e), A = p(!0), ce = "x-scalar-tabs", le = "x-scalar-active-tab", C = (e) => {
260
287
  const a = l("method", e), t = l("pathEncoded", e), n = l("documentSlug", e), c = l("workspaceSlug", e);
261
288
  return {
262
- ...xe({
289
+ ...We({
263
290
  workspace: c,
264
291
  document: n,
265
292
  path: t,
266
293
  method: a,
267
- getEntryByLocation: W
294
+ getEntryByLocation: T
268
295
  }),
269
296
  path: d.value?.path ?? ""
270
297
  };
271
- }, V = p(() => s.value?.workspace[se] ?? [B(d.value)]), re = p(() => s.value?.workspace[oe] ?? 0), q = async (e) => {
272
- const a = V.value[e];
298
+ }, K = u(() => s.value?.workspace[ce] ?? [C(d.value)]), ie = u(() => s.value?.workspace[le] ?? 0), $ = async (e) => {
299
+ const a = K.value[e];
273
300
  if (!a) {
274
301
  console.warn(`Cannot copy URL: tab at index ${e} does not exist`);
275
302
  return;
@@ -280,47 +307,48 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
280
307
  } catch (n) {
281
308
  console.error("Failed to copy URL to clipboard:", n);
282
309
  }
283
- }, ce = (e) => {
310
+ }, ue = (e) => {
284
311
  const a = l("workspaceSlug", e), t = l("documentSlug", e), n = l("namespace", e);
285
312
  if (!n || !a)
286
313
  return;
287
- const c = f.value.find(
288
- (r) => r.slug === a && r.namespace === n
314
+ const c = v.value.find(
315
+ (o) => o.slug === a && o.namespace === n
289
316
  );
290
- if (c && !We(c.teamUid, g.value))
291
- return E("local", "default");
292
- if (x.value = n, I.value = a, b.value = t, L.value = l("method", e), O.value = l("pathEncoded", e), N.value = l("exampleName", e), e.path !== "" && ye.setCurrentPath(e.path), h(x.value, a) !== D.value?.id)
293
- return Z(x.value, a);
294
- t && t !== s.value?.workspace[we.workspace.activeDocument] && s?.value?.update("x-scalar-active-document", t), le(e), M(e);
295
- }, le = (e) => {
317
+ if (c && !H(c.teamUid, k.value))
318
+ return y("local", "default");
319
+ if (f.value = n, x.value = a, E.value = t, B.value = l("method", e), L.value = l("pathEncoded", e), N.value = l("exampleName", e), e.path !== "" && Te.setCurrentPath(e.path), w(f.value, a) !== U.value?.id)
320
+ return ae(f.value, a);
321
+ t && t !== s.value?.workspace[be.workspace.activeDocument] && s?.value?.update("x-scalar-active-document", t), pe(e), q(e);
322
+ }, pe = (e) => {
296
323
  const a = s.value?.workspace["x-scalar-tabs"] ?? [], t = s.value?.workspace["x-scalar-active-tab"] ?? 0, n = a[t];
297
- !n || n.path === e.path || (a[t] = B(e));
298
- }, M = (e) => {
324
+ !n || n.path === e.path || (a[t] = C(e));
325
+ }, q = (e) => {
299
326
  const a = l("documentSlug", e);
300
327
  if (!a) {
301
- o.setSelected(null);
328
+ r.setSelected(null);
302
329
  return;
303
330
  }
304
- const t = W({
331
+ const t = T({
305
332
  document: a,
306
333
  path: l("pathEncoded", e),
307
334
  method: l("method", e),
308
335
  example: l("exampleName", e)
309
336
  });
310
- t && (o.setSelected(t.id), o.setExpanded(t.id, !0));
337
+ t && (r.setSelected(t.id), r.setExpanded(t.id, !0));
311
338
  };
312
- Se({
313
- eventBus: w,
339
+ Ie({
340
+ eventBus: S,
314
341
  router: i,
315
342
  store: s,
316
- navigateToCurrentTab: ee,
317
- rebuildSidebar: K,
318
- onAfterExampleCreation: ae,
319
- onSelectSidebarItem: F,
320
- onCopyTabUrl: (e) => q(e),
321
- onToggleSidebar: () => C.value = !C.value
343
+ navigateToCurrentTab: ne,
344
+ rebuildSidebar: F,
345
+ onAfterExampleCreation: se,
346
+ onSelectSidebarItem: V,
347
+ onCopyTabUrl: (e) => $(e),
348
+ onToggleSidebar: () => A.value = !A.value,
349
+ renameWorkspace: Q
322
350
  });
323
- const ie = p(() => {
351
+ const me = u(() => {
324
352
  const e = s.value?.workspace["x-scalar-color-mode"] ?? "system";
325
353
  return e === "system" ? window.matchMedia?.("(prefers-color-scheme: dark)")?.matches ?? !1 : e === "dark";
326
354
  });
@@ -328,45 +356,46 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
328
356
  /** Active workspace store */
329
357
  store: s,
330
358
  sidebar: {
331
- state: o,
332
- width: te,
333
- isOpen: C,
334
- handleSelectItem: F,
335
- handleSidebarWidthUpdate: ne,
336
- getEntryByLocation: W
359
+ state: r,
360
+ width: oe,
361
+ isOpen: A,
362
+ handleSelectItem: V,
363
+ handleSidebarWidthUpdate: re,
364
+ getEntryByLocation: T
337
365
  },
338
366
  tabs: {
339
- state: V,
340
- activeTabIndex: re,
341
- copyTabUrl: q
367
+ state: K,
368
+ activeTabIndex: ie,
369
+ copyTabUrl: $
342
370
  },
343
371
  workspace: {
344
- create: _,
345
- workspaceList: f,
346
- filteredWorkspaceList: S,
347
- workspaceGroups: z,
348
- activeWorkspace: D,
349
- navigateToWorkspace: E,
350
- isOpen: p(() => !!(I.value && !b.value))
372
+ create: O,
373
+ workspaceList: v,
374
+ filteredWorkspaceList: b,
375
+ workspaceGroups: G,
376
+ activeWorkspace: U,
377
+ navigateToWorkspace: y,
378
+ isOpen: u(() => !!(x.value && !E.value))
351
379
  },
352
- eventBus: w,
380
+ eventBus: S,
353
381
  router: i,
354
382
  currentRoute: d,
355
- loading: y,
383
+ loading: W,
356
384
  activeEntities: {
357
- namespace: x,
358
- workspaceSlug: I,
359
- documentSlug: b,
360
- path: O,
361
- method: L,
385
+ namespace: f,
386
+ workspaceSlug: x,
387
+ documentSlug: E,
388
+ path: L,
389
+ method: B,
362
390
  exampleName: N,
363
- teamUid: g
391
+ teamUid: ye(k),
392
+ setTeamUid: te
364
393
  },
365
- environment: G,
366
- document: A,
367
- isDarkMode: ie
394
+ environment: J,
395
+ document: D,
396
+ isDarkMode: me
368
397
  };
369
398
  };
370
399
  export {
371
- He as createAppState
400
+ Xe as createAppState
372
401
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AppSidebar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/AppSidebar.vue"],"names":[],"mappings":"AA+eA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAA;AAQ3B,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAUhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,KAAK,WAAW,GAAG;IACf;;OAEG;IACH,MAAM,EAAE,YA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  import p from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const e = /* @__PURE__ */ p(o, [["__scopeId", "data-v-658f060e"]]);
4
+ const e = /* @__PURE__ */ p(o, [["__scopeId", "data-v-2baee4d5"]]);
5
5
  export {
6
6
  e as default
7
7
  };