@scalar/api-client 3.3.1 → 3.4.0

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 (185) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/monacoeditorwork/yaml.worker.bundle.js +92 -79
  3. package/dist/style.css +87 -57
  4. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +2 -0
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  6. package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
  7. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +5 -0
  8. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
  9. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +4 -0
  10. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  11. package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
  12. package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
  13. package/dist/v2/blocks/operation-block/components/Header.vue.script.js +6 -0
  14. package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
  15. package/dist/v2/blocks/operation-block/helpers/response-cache.d.ts +2 -1
  16. package/dist/v2/blocks/operation-block/helpers/response-cache.d.ts.map +1 -1
  17. package/dist/v2/blocks/operation-block/helpers/response-cache.js +9 -2
  18. package/dist/v2/blocks/operation-block/helpers/response-cache.js.map +1 -1
  19. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  20. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -2
  21. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +2 -2
  22. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +4 -0
  23. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  24. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  25. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
  26. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +84 -71
  27. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
  28. package/dist/v2/blocks/scalar-address-bar-block/helpers/is-placeholder-path.d.ts +13 -0
  29. package/dist/v2/blocks/scalar-address-bar-block/helpers/is-placeholder-path.d.ts.map +1 -0
  30. package/dist/v2/blocks/scalar-address-bar-block/helpers/is-placeholder-path.js +28 -0
  31. package/dist/v2/blocks/scalar-address-bar-block/helpers/is-placeholder-path.js.map +1 -0
  32. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.d.ts +16 -0
  33. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.d.ts.map +1 -0
  34. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.js +28 -0
  35. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.js.map +1 -0
  36. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-path-masking.d.ts +31 -0
  37. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-path-masking.d.ts.map +1 -0
  38. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-path-masking.js +18 -0
  39. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-path-masking.js.map +1 -0
  40. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  41. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  42. package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
  43. package/dist/v2/components/code-input/CodeInput.vue.script.js +1 -1
  44. package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
  45. package/dist/v2/constants.js +1 -1
  46. package/dist/v2/features/app/App.vue.d.ts +25 -1
  47. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  48. package/dist/v2/features/app/App.vue.js.map +1 -1
  49. package/dist/v2/features/app/App.vue.script.js +54 -39
  50. package/dist/v2/features/app/App.vue.script.js.map +1 -1
  51. package/dist/v2/features/app/app-events.js +4 -4
  52. package/dist/v2/features/app/app-events.js.map +1 -1
  53. package/dist/v2/features/app/app-state.d.ts +20 -14
  54. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  55. package/dist/v2/features/app/app-state.js +89 -55
  56. package/dist/v2/features/app/app-state.js.map +1 -1
  57. package/dist/v2/features/app/components/AppHeader.vue.d.ts +26 -3
  58. package/dist/v2/features/app/components/AppHeader.vue.d.ts.map +1 -1
  59. package/dist/v2/features/app/components/AppHeader.vue.js.map +1 -1
  60. package/dist/v2/features/app/components/AppHeader.vue.script.js +15 -6
  61. package/dist/v2/features/app/components/AppHeader.vue.script.js.map +1 -1
  62. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +2 -2
  63. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  64. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  65. package/dist/v2/features/app/components/AppSidebar.vue.js.map +1 -1
  66. package/dist/v2/features/app/components/AppSidebar.vue.script.js +86 -108
  67. package/dist/v2/features/app/components/AppSidebar.vue.script.js.map +1 -1
  68. package/dist/v2/features/app/components/CreateVersionModal.vue.d.ts +28 -0
  69. package/dist/v2/features/app/components/CreateVersionModal.vue.d.ts.map +1 -0
  70. package/dist/v2/features/app/components/CreateVersionModal.vue.js +7 -0
  71. package/dist/v2/features/app/components/CreateVersionModal.vue.js.map +1 -0
  72. package/dist/v2/features/app/components/CreateVersionModal.vue.script.js +84 -0
  73. package/dist/v2/features/app/components/CreateVersionModal.vue.script.js.map +1 -0
  74. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.d.ts +26 -0
  75. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.d.ts.map +1 -0
  76. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.js +9 -0
  77. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.js.map +1 -0
  78. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.script.js +376 -0
  79. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.script.js.map +1 -0
  80. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.d.ts +16 -0
  81. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.d.ts.map +1 -0
  82. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.js +7 -0
  83. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.js.map +1 -0
  84. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.script.js +51 -0
  85. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.script.js.map +1 -0
  86. package/dist/v2/features/app/components/SidebarDocument.vue.d.ts +45 -0
  87. package/dist/v2/features/app/components/SidebarDocument.vue.d.ts.map +1 -0
  88. package/dist/v2/features/app/components/SidebarDocument.vue.js +7 -0
  89. package/dist/v2/features/app/components/SidebarDocument.vue.js.map +1 -0
  90. package/dist/v2/features/app/components/SidebarDocument.vue.script.js +137 -0
  91. package/dist/v2/features/app/components/SidebarDocument.vue.script.js.map +1 -0
  92. package/dist/v2/features/app/helpers/check-version-conflict.d.ts +51 -0
  93. package/dist/v2/features/app/helpers/check-version-conflict.d.ts.map +1 -0
  94. package/dist/v2/features/app/helpers/check-version-conflict.js +79 -0
  95. package/dist/v2/features/app/helpers/check-version-conflict.js.map +1 -0
  96. package/dist/v2/features/app/helpers/compute-version-status.d.ts +45 -0
  97. package/dist/v2/features/app/helpers/compute-version-status.d.ts.map +1 -0
  98. package/dist/v2/features/app/helpers/compute-version-status.js +18 -0
  99. package/dist/v2/features/app/helpers/compute-version-status.js.map +1 -0
  100. package/dist/v2/features/app/helpers/create-draft-registry-document.d.ts +39 -0
  101. package/dist/v2/features/app/helpers/create-draft-registry-document.d.ts.map +1 -0
  102. package/dist/v2/features/app/helpers/create-draft-registry-document.js +64 -0
  103. package/dist/v2/features/app/helpers/create-draft-registry-document.js.map +1 -0
  104. package/dist/v2/features/app/helpers/create-temp-operation.d.ts.map +1 -1
  105. package/dist/v2/features/app/helpers/create-temp-operation.js +5 -8
  106. package/dist/v2/features/app/helpers/create-temp-operation.js.map +1 -1
  107. package/dist/v2/features/app/helpers/detect-document-conflicts.d.ts +26 -0
  108. package/dist/v2/features/app/helpers/detect-document-conflicts.d.ts.map +1 -0
  109. package/dist/v2/features/app/helpers/detect-document-conflicts.js +27 -0
  110. package/dist/v2/features/app/helpers/detect-document-conflicts.js.map +1 -0
  111. package/dist/v2/features/app/helpers/filter-workspaces.d.ts +14 -14
  112. package/dist/v2/features/app/helpers/filter-workspaces.d.ts.map +1 -1
  113. package/dist/v2/features/app/helpers/filter-workspaces.js +15 -15
  114. package/dist/v2/features/app/helpers/filter-workspaces.js.map +1 -1
  115. package/dist/v2/features/app/helpers/group-workspaces.d.ts +23 -3
  116. package/dist/v2/features/app/helpers/group-workspaces.d.ts.map +1 -1
  117. package/dist/v2/features/app/helpers/group-workspaces.js +22 -7
  118. package/dist/v2/features/app/helpers/group-workspaces.js.map +1 -1
  119. package/dist/v2/features/app/helpers/load-registry-document.d.ts +16 -1
  120. package/dist/v2/features/app/helpers/load-registry-document.d.ts.map +1 -1
  121. package/dist/v2/features/app/helpers/load-registry-document.js +7 -6
  122. package/dist/v2/features/app/helpers/load-registry-document.js.map +1 -1
  123. package/dist/v2/features/app/helpers/routes.d.ts +5 -1
  124. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  125. package/dist/v2/features/app/helpers/routes.js +1 -1
  126. package/dist/v2/features/app/helpers/routes.js.map +1 -1
  127. package/dist/v2/features/app/helpers/version-status-presentation.d.ts +24 -0
  128. package/dist/v2/features/app/helpers/version-status-presentation.d.ts.map +1 -0
  129. package/dist/v2/features/app/helpers/version-status-presentation.js +43 -0
  130. package/dist/v2/features/app/helpers/version-status-presentation.js.map +1 -0
  131. package/dist/v2/features/app/hooks/use-active-document-version.d.ts +41 -0
  132. package/dist/v2/features/app/hooks/use-active-document-version.d.ts.map +1 -0
  133. package/dist/v2/features/app/hooks/use-active-document-version.js +60 -0
  134. package/dist/v2/features/app/hooks/use-active-document-version.js.map +1 -0
  135. package/dist/v2/features/app/hooks/use-sidebar-documents.d.ts +71 -23
  136. package/dist/v2/features/app/hooks/use-sidebar-documents.d.ts.map +1 -1
  137. package/dist/v2/features/app/hooks/use-sidebar-documents.js +167 -45
  138. package/dist/v2/features/app/hooks/use-sidebar-documents.js.map +1 -1
  139. package/dist/v2/features/app/hooks/use-version-conflict-check.d.ts +35 -0
  140. package/dist/v2/features/app/hooks/use-version-conflict-check.d.ts.map +1 -0
  141. package/dist/v2/features/app/hooks/use-version-conflict-check.js +62 -0
  142. package/dist/v2/features/app/hooks/use-version-conflict-check.js.map +1 -0
  143. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  144. package/dist/v2/features/collection/DocumentCollection.vue.js.map +1 -1
  145. package/dist/v2/features/collection/DocumentCollection.vue.script.js +6 -1
  146. package/dist/v2/features/collection/DocumentCollection.vue.script.js.map +1 -1
  147. package/dist/v2/features/collection/OperationCollection.vue.script.js +1 -0
  148. package/dist/v2/features/collection/OperationCollection.vue.script.js.map +1 -1
  149. package/dist/v2/features/collection/WorkspaceCollection.vue.script.js +1 -0
  150. package/dist/v2/features/collection/WorkspaceCollection.vue.script.js.map +1 -1
  151. package/dist/v2/features/collection/components/Authentication.vue.script.js +1 -0
  152. package/dist/v2/features/collection/components/Authentication.vue.script.js.map +1 -1
  153. package/dist/v2/features/collection/components/Cookies.vue.script.js +1 -0
  154. package/dist/v2/features/collection/components/Cookies.vue.script.js.map +1 -1
  155. package/dist/v2/features/collection/components/Editor/Editor.vue.script.js +1 -0
  156. package/dist/v2/features/collection/components/Editor/Editor.vue.script.js.map +1 -1
  157. package/dist/v2/features/collection/components/Environment.vue.script.js +1 -0
  158. package/dist/v2/features/collection/components/Environment.vue.script.js.map +1 -1
  159. package/dist/v2/features/collection/components/GetStarted.vue.d.ts +12 -4
  160. package/dist/v2/features/collection/components/GetStarted.vue.d.ts.map +1 -1
  161. package/dist/v2/features/collection/components/GetStarted.vue.js.map +1 -1
  162. package/dist/v2/features/collection/components/GetStarted.vue.script.js +56 -13
  163. package/dist/v2/features/collection/components/GetStarted.vue.script.js.map +1 -1
  164. package/dist/v2/features/collection/components/Overview.vue.script.js +1 -0
  165. package/dist/v2/features/collection/components/Overview.vue.script.js.map +1 -1
  166. package/dist/v2/features/collection/components/Runner/components/Runner.vue.script.js +1 -0
  167. package/dist/v2/features/collection/components/Runner/components/Runner.vue.script.js.map +1 -1
  168. package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.js +2 -2
  169. package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.js.map +1 -1
  170. package/dist/v2/features/collection/components/Scripts.vue.script.js +1 -0
  171. package/dist/v2/features/collection/components/Scripts.vue.script.js.map +1 -1
  172. package/dist/v2/features/collection/components/Servers.vue.script.js +1 -0
  173. package/dist/v2/features/collection/components/Servers.vue.script.js.map +1 -1
  174. package/dist/v2/features/collection/components/Settings.vue.script.js +1 -0
  175. package/dist/v2/features/collection/components/Settings.vue.script.js.map +1 -1
  176. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js +1 -1
  177. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  178. package/dist/v2/features/operation/Operation.vue.js.map +1 -1
  179. package/dist/v2/features/operation/Operation.vue.script.js +3 -0
  180. package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
  181. package/dist/v2/helpers/safe-run.d.ts +25 -1
  182. package/dist/v2/helpers/safe-run.d.ts.map +1 -1
  183. package/dist/v2/helpers/safe-run.js +26 -2
  184. package/dist/v2/helpers/safe-run.js.map +1 -1
  185. package/package.json +12 -11
@@ -2,40 +2,40 @@
2
2
  * Filters workspaces to show only those accessible to the current team.
3
3
  *
4
4
  * A workspace is accessible if:
5
- * - Its teamUid matches the current team, OR
6
- * - Its teamUid is 'local' (local workspaces are always accessible)
5
+ * - Its teamSlug matches the current team, OR
6
+ * - Its teamSlug is 'local' (local workspaces are always accessible)
7
7
  *
8
8
  * @param workspaces - Array of workspaces to filter
9
- * @param currentTeamUid - The currently active team identifier
9
+ * @param currentTeamSlug - The currently active team identifier
10
10
  * @returns Filtered array of workspaces accessible to the current team
11
11
  *
12
12
  * @example
13
13
  * ```ts
14
14
  * const workspaces = [
15
- * { id: '1', teamUid: 'local', name: 'Local' },
16
- * { id: '2', teamUid: 'team-a', name: 'Team A' },
17
- * { id: '3', teamUid: 'team-b', name: 'Team B' },
15
+ * { id: '1', teamSlug: 'local', name: 'Local' },
16
+ * { id: '2', teamSlug: 'team-a', name: 'Team A' },
17
+ * { id: '3', teamSlug: 'team-b', name: 'Team B' },
18
18
  * ]
19
19
  *
20
20
  * filterWorkspacesByTeam(workspaces, 'team-a')
21
- * // => [{ id: '1', teamUid: 'local' }, { id: '2', teamUid: 'team-a' }]
21
+ * // => [{ id: '1', teamSlug: 'local' }, { id: '2', teamSlug: 'team-a' }]
22
22
  * ```
23
23
  */
24
24
  export declare const filterWorkspacesByTeam: <T extends {
25
- teamUid: string;
26
- }>(workspaces: T[], currentTeamUid: string) => T[];
25
+ teamSlug: string;
26
+ }>(workspaces: T[], currentTeamSlug: string) => T[];
27
27
  /**
28
28
  * Checks if a workspace can be loaded by the current team.
29
29
  *
30
30
  * A workspace can be loaded if:
31
- * - Its teamUid matches the current team, OR
32
- * - Its teamUid is 'local' (local workspaces are always accessible)
31
+ * - Its teamSlug matches the current team, OR
32
+ * - Its teamSlug is 'local' (local workspaces are always accessible)
33
33
  *
34
34
  * This is used during route changes to prevent users from accessing
35
35
  * workspaces that do not belong to their active team.
36
36
  *
37
- * @param workspaceTeamUid - The team identifier of the workspace to check
38
- * @param currentTeamUid - The currently active team identifier
37
+ * @param workspaceTeamSlug - The team identifier of the workspace to check
38
+ * @param currentTeamSlug - The currently active team identifier
39
39
  * @returns true if the workspace can be loaded, false otherwise
40
40
  *
41
41
  * @example
@@ -45,5 +45,5 @@ export declare const filterWorkspacesByTeam: <T extends {
45
45
  * canLoadWorkspace('team-b', 'team-a') // => false
46
46
  * ```
47
47
  */
48
- export declare const canLoadWorkspace: (workspaceTeamUid: string, currentTeamUid: string) => boolean;
48
+ export declare const canLoadWorkspace: (workspaceTeamSlug: string, currentTeamSlug: string) => boolean;
49
49
  //# sourceMappingURL=filter-workspaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-workspaces.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/filter-workspaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,YAAY,CAAC,EAAE,EAAE,gBAAgB,MAAM,KAAG,CAAC,EAEhH,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB,GAAI,kBAAkB,MAAM,EAAE,gBAAgB,MAAM,KAAG,OAEnF,CAAA"}
1
+ {"version":3,"file":"filter-workspaces.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/filter-workspaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EACnE,YAAY,CAAC,EAAE,EACf,iBAAiB,MAAM,KACtB,CAAC,EAEH,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB,GAAI,mBAAmB,MAAM,EAAE,iBAAiB,MAAM,KAAG,OAErF,CAAA"}
@@ -3,40 +3,40 @@
3
3
  * Filters workspaces to show only those accessible to the current team.
4
4
  *
5
5
  * A workspace is accessible if:
6
- * - Its teamUid matches the current team, OR
7
- * - Its teamUid is 'local' (local workspaces are always accessible)
6
+ * - Its teamSlug matches the current team, OR
7
+ * - Its teamSlug is 'local' (local workspaces are always accessible)
8
8
  *
9
9
  * @param workspaces - Array of workspaces to filter
10
- * @param currentTeamUid - The currently active team identifier
10
+ * @param currentTeamSlug - The currently active team identifier
11
11
  * @returns Filtered array of workspaces accessible to the current team
12
12
  *
13
13
  * @example
14
14
  * ```ts
15
15
  * const workspaces = [
16
- * { id: '1', teamUid: 'local', name: 'Local' },
17
- * { id: '2', teamUid: 'team-a', name: 'Team A' },
18
- * { id: '3', teamUid: 'team-b', name: 'Team B' },
16
+ * { id: '1', teamSlug: 'local', name: 'Local' },
17
+ * { id: '2', teamSlug: 'team-a', name: 'Team A' },
18
+ * { id: '3', teamSlug: 'team-b', name: 'Team B' },
19
19
  * ]
20
20
  *
21
21
  * filterWorkspacesByTeam(workspaces, 'team-a')
22
- * // => [{ id: '1', teamUid: 'local' }, { id: '2', teamUid: 'team-a' }]
22
+ * // => [{ id: '1', teamSlug: 'local' }, { id: '2', teamSlug: 'team-a' }]
23
23
  * ```
24
24
  */
25
- var filterWorkspacesByTeam = (workspaces, currentTeamUid) => {
26
- return workspaces.filter((workspace) => canLoadWorkspace(workspace.teamUid, currentTeamUid));
25
+ var filterWorkspacesByTeam = (workspaces, currentTeamSlug) => {
26
+ return workspaces.filter((workspace) => canLoadWorkspace(workspace.teamSlug, currentTeamSlug));
27
27
  };
28
28
  /**
29
29
  * Checks if a workspace can be loaded by the current team.
30
30
  *
31
31
  * A workspace can be loaded if:
32
- * - Its teamUid matches the current team, OR
33
- * - Its teamUid is 'local' (local workspaces are always accessible)
32
+ * - Its teamSlug matches the current team, OR
33
+ * - Its teamSlug is 'local' (local workspaces are always accessible)
34
34
  *
35
35
  * This is used during route changes to prevent users from accessing
36
36
  * workspaces that do not belong to their active team.
37
37
  *
38
- * @param workspaceTeamUid - The team identifier of the workspace to check
39
- * @param currentTeamUid - The currently active team identifier
38
+ * @param workspaceTeamSlug - The team identifier of the workspace to check
39
+ * @param currentTeamSlug - The currently active team identifier
40
40
  * @returns true if the workspace can be loaded, false otherwise
41
41
  *
42
42
  * @example
@@ -46,8 +46,8 @@ var filterWorkspacesByTeam = (workspaces, currentTeamUid) => {
46
46
  * canLoadWorkspace('team-b', 'team-a') // => false
47
47
  * ```
48
48
  */
49
- var canLoadWorkspace = (workspaceTeamUid, currentTeamUid) => {
50
- return workspaceTeamUid === currentTeamUid || workspaceTeamUid === "local";
49
+ var canLoadWorkspace = (workspaceTeamSlug, currentTeamSlug) => {
50
+ return workspaceTeamSlug === currentTeamSlug || workspaceTeamSlug === "local";
51
51
  };
52
52
  //#endregion
53
53
  export { canLoadWorkspace, filterWorkspacesByTeam };
@@ -1 +1 @@
1
- {"version":3,"file":"filter-workspaces.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/filter-workspaces.ts"],"sourcesContent":["/**\n * Filters workspaces to show only those accessible to the current team.\n *\n * A workspace is accessible if:\n * - Its teamUid matches the current team, OR\n * - Its teamUid is 'local' (local workspaces are always accessible)\n *\n * @param workspaces - Array of workspaces to filter\n * @param currentTeamUid - The currently active team identifier\n * @returns Filtered array of workspaces accessible to the current team\n *\n * @example\n * ```ts\n * const workspaces = [\n * { id: '1', teamUid: 'local', name: 'Local' },\n * { id: '2', teamUid: 'team-a', name: 'Team A' },\n * { id: '3', teamUid: 'team-b', name: 'Team B' },\n * ]\n *\n * filterWorkspacesByTeam(workspaces, 'team-a')\n * // => [{ id: '1', teamUid: 'local' }, { id: '2', teamUid: 'team-a' }]\n * ```\n */\nexport const filterWorkspacesByTeam = <T extends { teamUid: string }>(workspaces: T[], currentTeamUid: string): T[] => {\n return workspaces.filter((workspace) => canLoadWorkspace(workspace.teamUid, currentTeamUid))\n}\n\n/**\n * Checks if a workspace can be loaded by the current team.\n *\n * A workspace can be loaded if:\n * - Its teamUid matches the current team, OR\n * - Its teamUid is 'local' (local workspaces are always accessible)\n *\n * This is used during route changes to prevent users from accessing\n * workspaces that do not belong to their active team.\n *\n * @param workspaceTeamUid - The team identifier of the workspace to check\n * @param currentTeamUid - The currently active team identifier\n * @returns true if the workspace can be loaded, false otherwise\n *\n * @example\n * ```ts\n * canLoadWorkspace('team-a', 'team-a') // => true\n * canLoadWorkspace('local', 'team-a') // => true\n * canLoadWorkspace('team-b', 'team-a') // => false\n * ```\n */\nexport const canLoadWorkspace = (workspaceTeamUid: string, currentTeamUid: string): boolean => {\n return workspaceTeamUid === currentTeamUid || workspaceTeamUid === 'local'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,0BAAyD,YAAiB,mBAAgC;AACrH,QAAO,WAAW,QAAQ,cAAc,iBAAiB,UAAU,SAAS,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;AAwB9F,IAAa,oBAAoB,kBAA0B,mBAAoC;AAC7F,QAAO,qBAAqB,kBAAkB,qBAAqB"}
1
+ {"version":3,"file":"filter-workspaces.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/filter-workspaces.ts"],"sourcesContent":["/**\n * Filters workspaces to show only those accessible to the current team.\n *\n * A workspace is accessible if:\n * - Its teamSlug matches the current team, OR\n * - Its teamSlug is 'local' (local workspaces are always accessible)\n *\n * @param workspaces - Array of workspaces to filter\n * @param currentTeamSlug - The currently active team identifier\n * @returns Filtered array of workspaces accessible to the current team\n *\n * @example\n * ```ts\n * const workspaces = [\n * { id: '1', teamSlug: 'local', name: 'Local' },\n * { id: '2', teamSlug: 'team-a', name: 'Team A' },\n * { id: '3', teamSlug: 'team-b', name: 'Team B' },\n * ]\n *\n * filterWorkspacesByTeam(workspaces, 'team-a')\n * // => [{ id: '1', teamSlug: 'local' }, { id: '2', teamSlug: 'team-a' }]\n * ```\n */\nexport const filterWorkspacesByTeam = <T extends { teamSlug: string }>(\n workspaces: T[],\n currentTeamSlug: string,\n): T[] => {\n return workspaces.filter((workspace) => canLoadWorkspace(workspace.teamSlug, currentTeamSlug))\n}\n\n/**\n * Checks if a workspace can be loaded by the current team.\n *\n * A workspace can be loaded if:\n * - Its teamSlug matches the current team, OR\n * - Its teamSlug is 'local' (local workspaces are always accessible)\n *\n * This is used during route changes to prevent users from accessing\n * workspaces that do not belong to their active team.\n *\n * @param workspaceTeamSlug - The team identifier of the workspace to check\n * @param currentTeamSlug - The currently active team identifier\n * @returns true if the workspace can be loaded, false otherwise\n *\n * @example\n * ```ts\n * canLoadWorkspace('team-a', 'team-a') // => true\n * canLoadWorkspace('local', 'team-a') // => true\n * canLoadWorkspace('team-b', 'team-a') // => false\n * ```\n */\nexport const canLoadWorkspace = (workspaceTeamSlug: string, currentTeamSlug: string): boolean => {\n return workspaceTeamSlug === currentTeamSlug || workspaceTeamSlug === 'local'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,0BACX,YACA,oBACQ;AACR,QAAO,WAAW,QAAQ,cAAc,iBAAiB,UAAU,UAAU,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;AAwBhG,IAAa,oBAAoB,mBAA2B,oBAAqC;AAC/F,QAAO,sBAAsB,mBAAmB,sBAAsB"}
@@ -9,16 +9,36 @@ export type WorkspaceItem = {
9
9
  /** Display name of the workspace. */
10
10
  label: string;
11
11
  /** Team identifier. Use 'local' for local workspaces. */
12
- teamUid: string;
12
+ teamSlug: string;
13
13
  };
14
14
  /**
15
15
  * Groups workspaces into team and local categories.
16
16
  * Team workspaces are listed first (if not viewing local workspaces),
17
17
  * followed by local workspaces.
18
18
  *
19
+ * When `placeholder` is provided and the current non-local team has no real
20
+ * workspaces yet, a single "fake" option is added to the team group. The
21
+ * option uses the same id format as a real workspace (`teamSlug/slug`) so
22
+ * clicking it routes through the normal navigation flow. The route handler is
23
+ * responsible for creating the workspace on demand when it does not yet exist.
24
+ *
19
25
  * @param workspaces - Array of workspaces to group
20
- * @param currentTeamUid - Current team identifier ('local' for local team)
26
+ * @param currentTeamSlug - Current team identifier ('local' for local team)
27
+ * @param options - Optional grouping behavior
21
28
  * @returns Array of workspace groups with labels and options
22
29
  */
23
- export declare function groupWorkspacesByTeam(workspaces: WorkspaceItem[], currentTeamUid: string): WorkspaceGroup[];
30
+ export declare function groupWorkspacesByTeam(workspaces: WorkspaceItem[], currentTeamSlug: string, options?: {
31
+ /**
32
+ * Surfaces a fake default option for the current non-local team when it
33
+ * has no real workspaces yet. The option's id is
34
+ * `getWorkspaceId(currentTeamSlug, slug)` so the picker can navigate to it
35
+ * like any other workspace.
36
+ */
37
+ placeholder?: {
38
+ /** Slug used for the on-demand team workspace (e.g. `'default'`). */
39
+ slug: string;
40
+ /** Display label for the placeholder option (e.g. `'Workspace'`). */
41
+ label: string;
42
+ };
43
+ }): WorkspaceGroup[];
24
44
  //# sourceMappingURL=group-workspaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"group-workspaces.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/group-workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE7E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAA;IACV,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,aAAa,EAAE,EAAE,cAAc,EAAE,MAAM,GAAG,cAAc,EAAE,CAsC3G"}
1
+ {"version":3,"file":"group-workspaces.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/group-workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAG7E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAA;IACV,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,aAAa,EAAE,EAC3B,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE;IACR;;;;;OAKG;IACH,WAAW,CAAC,EAAE;QACZ,qEAAqE;QACrE,IAAI,EAAE,MAAM,CAAA;QACZ,qEAAqE;QACrE,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,GACA,cAAc,EAAE,CAmDlB"}
@@ -1,30 +1,45 @@
1
+ import { getWorkspaceId } from "@scalar/workspace-store/persistence";
1
2
  //#region src/v2/features/app/helpers/group-workspaces.ts
2
3
  /**
3
4
  * Groups workspaces into team and local categories.
4
5
  * Team workspaces are listed first (if not viewing local workspaces),
5
6
  * followed by local workspaces.
6
7
  *
8
+ * When `placeholder` is provided and the current non-local team has no real
9
+ * workspaces yet, a single "fake" option is added to the team group. The
10
+ * option uses the same id format as a real workspace (`teamSlug/slug`) so
11
+ * clicking it routes through the normal navigation flow. The route handler is
12
+ * responsible for creating the workspace on demand when it does not yet exist.
13
+ *
7
14
  * @param workspaces - Array of workspaces to group
8
- * @param currentTeamUid - Current team identifier ('local' for local team)
15
+ * @param currentTeamSlug - Current team identifier ('local' for local team)
16
+ * @param options - Optional grouping behavior
9
17
  * @returns Array of workspace groups with labels and options
10
18
  */
11
- function groupWorkspacesByTeam(workspaces, currentTeamUid) {
19
+ function groupWorkspacesByTeam(workspaces, currentTeamSlug, options) {
12
20
  const workspacesByTeam = workspaces.reduce((acc, workspace) => {
13
- const teamUid = workspace.teamUid;
14
- if (!acc[teamUid]) acc[teamUid] = [];
15
- acc[teamUid].push({
21
+ const teamSlug = workspace.teamSlug;
22
+ if (!acc[teamSlug]) acc[teamSlug] = [];
23
+ acc[teamSlug].push({
16
24
  id: workspace.id,
17
25
  label: workspace.label
18
26
  });
19
27
  return acc;
20
28
  }, {});
21
29
  const result = [];
22
- if (currentTeamUid !== "local") {
23
- const teamWorkspaces = workspacesByTeam[currentTeamUid] ?? [];
30
+ if (currentTeamSlug !== "local") {
31
+ const teamWorkspaces = workspacesByTeam[currentTeamSlug] ?? [];
24
32
  if (teamWorkspaces.length > 0) result.push({
25
33
  label: "Team Workspaces",
26
34
  options: teamWorkspaces
27
35
  });
36
+ else if (options?.placeholder) result.push({
37
+ label: "Team Workspaces",
38
+ options: [{
39
+ id: getWorkspaceId(currentTeamSlug, options.placeholder.slug),
40
+ label: options.placeholder.label
41
+ }]
42
+ });
28
43
  }
29
44
  result.push({
30
45
  label: "Local Workspaces",
@@ -1 +1 @@
1
- {"version":3,"file":"group-workspaces.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/group-workspaces.ts"],"sourcesContent":["import type { ScalarListboxOption, WorkspaceGroup } from '@scalar/components'\n\n/**\n * Represents a workspace with team information.\n * Used to group workspaces by team or local status.\n */\nexport type WorkspaceItem = {\n /** Unique identifier for the workspace. */\n id: string\n /** Display name of the workspace. */\n label: string\n /** Team identifier. Use 'local' for local workspaces. */\n teamUid: string\n}\n\n/**\n * Groups workspaces into team and local categories.\n * Team workspaces are listed first (if not viewing local workspaces),\n * followed by local workspaces.\n *\n * @param workspaces - Array of workspaces to group\n * @param currentTeamUid - Current team identifier ('local' for local team)\n * @returns Array of workspace groups with labels and options\n */\nexport function groupWorkspacesByTeam(workspaces: WorkspaceItem[], currentTeamUid: string): WorkspaceGroup[] {\n // Group workspaces by teamUid\n const workspacesByTeam = workspaces.reduce<Record<string, ScalarListboxOption[]>>((acc, workspace) => {\n const teamUid = workspace.teamUid\n\n if (!acc[teamUid]) {\n acc[teamUid] = []\n }\n\n acc[teamUid].push({\n id: workspace.id,\n label: workspace.label,\n })\n\n return acc\n }, {})\n\n const result: WorkspaceGroup[] = []\n\n // Add current team workspaces (if not local)\n if (currentTeamUid !== 'local') {\n const teamWorkspaces = workspacesByTeam[currentTeamUid] ?? []\n\n if (teamWorkspaces.length > 0) {\n result.push({\n label: 'Team Workspaces',\n options: teamWorkspaces,\n })\n }\n }\n\n // Always add local workspaces section\n result.push({\n label: 'Local Workspaces',\n options: workspacesByTeam['local'] ?? [],\n })\n\n return result\n}\n"],"mappings":";;;;;;;;;;AAwBA,SAAgB,sBAAsB,YAA6B,gBAA0C;CAE3G,MAAM,mBAAmB,WAAW,QAA+C,KAAK,cAAc;EACpG,MAAM,UAAU,UAAU;AAE1B,MAAI,CAAC,IAAI,SACP,KAAI,WAAW,EAAE;AAGnB,MAAI,SAAS,KAAK;GAChB,IAAI,UAAU;GACd,OAAO,UAAU;GAClB,CAAC;AAEF,SAAO;IACN,EAAE,CAAC;CAEN,MAAM,SAA2B,EAAE;AAGnC,KAAI,mBAAmB,SAAS;EAC9B,MAAM,iBAAiB,iBAAiB,mBAAmB,EAAE;AAE7D,MAAI,eAAe,SAAS,EAC1B,QAAO,KAAK;GACV,OAAO;GACP,SAAS;GACV,CAAC;;AAKN,QAAO,KAAK;EACV,OAAO;EACP,SAAS,iBAAiB,YAAY,EAAE;EACzC,CAAC;AAEF,QAAO"}
1
+ {"version":3,"file":"group-workspaces.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/group-workspaces.ts"],"sourcesContent":["import type { ScalarListboxOption, WorkspaceGroup } from '@scalar/components'\nimport { getWorkspaceId } from '@scalar/workspace-store/persistence'\n\n/**\n * Represents a workspace with team information.\n * Used to group workspaces by team or local status.\n */\nexport type WorkspaceItem = {\n /** Unique identifier for the workspace. */\n id: string\n /** Display name of the workspace. */\n label: string\n /** Team identifier. Use 'local' for local workspaces. */\n teamSlug: string\n}\n\n/**\n * Groups workspaces into team and local categories.\n * Team workspaces are listed first (if not viewing local workspaces),\n * followed by local workspaces.\n *\n * When `placeholder` is provided and the current non-local team has no real\n * workspaces yet, a single \"fake\" option is added to the team group. The\n * option uses the same id format as a real workspace (`teamSlug/slug`) so\n * clicking it routes through the normal navigation flow. The route handler is\n * responsible for creating the workspace on demand when it does not yet exist.\n *\n * @param workspaces - Array of workspaces to group\n * @param currentTeamSlug - Current team identifier ('local' for local team)\n * @param options - Optional grouping behavior\n * @returns Array of workspace groups with labels and options\n */\nexport function groupWorkspacesByTeam(\n workspaces: WorkspaceItem[],\n currentTeamSlug: string,\n options?: {\n /**\n * Surfaces a fake default option for the current non-local team when it\n * has no real workspaces yet. The option's id is\n * `getWorkspaceId(currentTeamSlug, slug)` so the picker can navigate to it\n * like any other workspace.\n */\n placeholder?: {\n /** Slug used for the on-demand team workspace (e.g. `'default'`). */\n slug: string\n /** Display label for the placeholder option (e.g. `'Workspace'`). */\n label: string\n }\n },\n): WorkspaceGroup[] {\n // Bucket workspaces by their team slug.\n const workspacesByTeam = workspaces.reduce<Record<string, ScalarListboxOption[]>>((acc, workspace) => {\n const teamSlug = workspace.teamSlug\n\n if (!acc[teamSlug]) {\n acc[teamSlug] = []\n }\n\n acc[teamSlug].push({\n id: workspace.id,\n label: workspace.label,\n })\n\n return acc\n }, {})\n\n const result: WorkspaceGroup[] = []\n\n // Add current team workspaces (if not local)\n if (currentTeamSlug !== 'local') {\n const teamWorkspaces = workspacesByTeam[currentTeamSlug] ?? []\n\n if (teamWorkspaces.length > 0) {\n result.push({\n label: 'Team Workspaces',\n options: teamWorkspaces,\n })\n } else if (options?.placeholder) {\n // No real team workspace yet: surface a fake option using a real\n // workspace id so the picker can navigate to it normally. The route\n // handler creates the workspace on demand when it is not yet persisted.\n result.push({\n label: 'Team Workspaces',\n options: [\n {\n id: getWorkspaceId(currentTeamSlug, options.placeholder.slug),\n label: options.placeholder.label,\n },\n ],\n })\n }\n }\n\n // Always add local workspaces section\n result.push({\n label: 'Local Workspaces',\n options: workspacesByTeam['local'] ?? [],\n })\n\n return result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,SAAgB,sBACd,YACA,iBACA,SAckB;CAElB,MAAM,mBAAmB,WAAW,QAA+C,KAAK,cAAc;EACpG,MAAM,WAAW,UAAU;AAE3B,MAAI,CAAC,IAAI,UACP,KAAI,YAAY,EAAE;AAGpB,MAAI,UAAU,KAAK;GACjB,IAAI,UAAU;GACd,OAAO,UAAU;GAClB,CAAC;AAEF,SAAO;IACN,EAAE,CAAC;CAEN,MAAM,SAA2B,EAAE;AAGnC,KAAI,oBAAoB,SAAS;EAC/B,MAAM,iBAAiB,iBAAiB,oBAAoB,EAAE;AAE9D,MAAI,eAAe,SAAS,EAC1B,QAAO,KAAK;GACV,OAAO;GACP,SAAS;GACV,CAAC;WACO,SAAS,YAIlB,QAAO,KAAK;GACV,OAAO;GACP,SAAS,CACP;IACE,IAAI,eAAe,iBAAiB,QAAQ,YAAY,KAAK;IAC7D,OAAO,QAAQ,YAAY;IAC5B,CACF;GACF,CAAC;;AAKN,QAAO,KAAK;EACV,OAAO;EACP,SAAS,iBAAiB,YAAY,EAAE;EACzC,CAAC;AAEF,QAAO"}
@@ -8,11 +8,26 @@ type LoadRegistryDocumentResult = {
8
8
  ok: false;
9
9
  error: string;
10
10
  };
11
- export declare const loadRegistryDocument: ({ workspaceStore, fetcher, namespace, slug, }: {
11
+ export declare const loadRegistryDocument: ({ workspaceStore, fetcher, namespace, slug, version, commitHash, }: {
12
12
  workspaceStore: WorkspaceStore;
13
13
  fetcher: ImportDocumentFromRegistry;
14
14
  namespace: string;
15
15
  slug: string;
16
+ /**
17
+ * Specific version to fetch from the registry. When omitted we ask the
18
+ * registry for `latest`, which is what callers default to when they do
19
+ * not have a concrete version pinned for the document yet.
20
+ */
21
+ version?: string;
22
+ /**
23
+ * Commit hash the registry currently advertises for `version`. Callers
24
+ * already know this from the version listing (sidebar row, breadcrumb
25
+ * picker, etc.) so we accept it directly rather than parsing it back
26
+ * out of the fetched document. When provided it is persisted on
27
+ * `x-scalar-registry-meta.commitHash` so subsequent refreshes can
28
+ * detect drift and surface upstream changes.
29
+ */
30
+ commitHash?: string;
16
31
  }) => Promise<LoadRegistryDocumentResult>;
17
32
  export {};
18
33
  //# sourceMappingURL=load-registry-document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-registry-document.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/load-registry-document.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAGpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAE1E,iFAAiF;AACjF,KAAK,0BAA0B,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnG,eAAO,MAAM,oBAAoB,GAAU,+CAKxC;IACD,cAAc,EAAE,cAAc,CAAA;IAC9B,OAAO,EAAE,0BAA0B,CAAA;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb,KAAG,OAAO,CAAC,0BAA0B,CA2CrC,CAAA"}
1
+ {"version":3,"file":"load-registry-document.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/load-registry-document.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAGpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAE1E,iFAAiF;AACjF,KAAK,0BAA0B,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnG,eAAO,MAAM,oBAAoB,GAAU,oEAOxC;IACD,cAAc,EAAE,cAAc,CAAA;IAC9B,OAAO,EAAE,0BAA0B,CAAA;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,KAAG,OAAO,CAAC,0BAA0B,CAwDrC,CAAA"}
@@ -1,11 +1,11 @@
1
1
  import { generateUniqueSlug } from "../../command-palette/helpers/generate-unique-slug.js";
2
2
  import { coerce, object, string } from "@scalar/validation";
3
3
  //#region src/v2/features/app/helpers/load-registry-document.ts
4
- var loadRegistryDocument = async ({ workspaceStore, fetcher, namespace, slug }) => {
4
+ var loadRegistryDocument = async ({ workspaceStore, fetcher, namespace, slug, version = "latest", commitHash }) => {
5
5
  const documents = workspaceStore.workspace.documents;
6
6
  const existing = Object.entries(documents).find(([, doc]) => {
7
7
  const meta = doc?.["x-scalar-registry-meta"];
8
- return meta?.namespace === namespace && meta?.slug === slug;
8
+ return meta?.namespace === namespace && meta?.slug === slug && meta?.version === version;
9
9
  });
10
10
  if (existing) return {
11
11
  ok: true,
@@ -14,14 +14,13 @@ var loadRegistryDocument = async ({ workspaceStore, fetcher, namespace, slug })
14
14
  const result = await fetcher({
15
15
  namespace,
16
16
  slug,
17
- version: "latest"
17
+ version
18
18
  });
19
19
  if (!result.ok) return {
20
20
  ok: false,
21
21
  error: `Failed to fetch document: ${result.error || "Unknown error"}`
22
22
  };
23
- const baseName = coerce(object({ info: object({ title: string() }) }), result.data).info.title;
24
- const documentName = await generateUniqueSlug(baseName.trim() || slug, new Set(Object.keys(documents)));
23
+ const documentName = await generateUniqueSlug(`${coerce(object({ info: object({ title: string() }) }), result.data).info.title.trim() || slug}-${version}`, new Set(Object.keys(documents)));
25
24
  if (!documentName) return {
26
25
  ok: false,
27
26
  error: "Failed to generate a unique name for the document"
@@ -31,7 +30,9 @@ var loadRegistryDocument = async ({ workspaceStore, fetcher, namespace, slug })
31
30
  document: result.data,
32
31
  meta: { "x-scalar-registry-meta": {
33
32
  namespace,
34
- slug
33
+ slug,
34
+ version,
35
+ ...commitHash ? { commitHash } : {}
35
36
  } }
36
37
  });
37
38
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"load-registry-document.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/load-registry-document.ts"],"sourcesContent":["import { coerce, object, string } from '@scalar/validation'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\n\nimport { generateUniqueSlug } from '@/v2/features/command-palette/helpers/generate-unique-slug'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\n\n/** Result of attempting to load a registry document into the workspace store. */\ntype LoadRegistryDocumentResult = { ok: true; documentName: string } | { ok: false; error: string }\n\nexport const loadRegistryDocument = async ({\n workspaceStore,\n fetcher,\n namespace,\n slug,\n}: {\n workspaceStore: WorkspaceStore\n fetcher: ImportDocumentFromRegistry\n namespace: string\n slug: string\n}): Promise<LoadRegistryDocumentResult> => {\n const documents = workspaceStore.workspace.documents\n\n const existing = Object.entries(documents).find(([, doc]) => {\n const meta = doc?.['x-scalar-registry-meta']\n return meta?.namespace === namespace && meta?.slug === slug\n })\n\n if (existing) {\n return { ok: true, documentName: existing[0] }\n }\n\n const result = await fetcher({ namespace, slug, version: 'latest' })\n if (!result.ok) {\n return {\n ok: false,\n error: `Failed to fetch document: ${result.error || 'Unknown error'}`,\n }\n }\n\n // Parse the document data into a schema\n const schema = object({ info: object({ title: string() }) })\n const baseName = coerce(schema, result.data).info.title\n\n const documentName = await generateUniqueSlug(baseName.trim() || slug, new Set(Object.keys(documents)))\n\n if (!documentName) {\n return {\n ok: false,\n error: 'Failed to generate a unique name for the document',\n }\n }\n\n // Add the document to the workspace store\n await workspaceStore.addDocument({\n name: documentName,\n document: result.data,\n meta: {\n 'x-scalar-registry-meta': { namespace, slug },\n },\n })\n\n return { ok: true, documentName }\n}\n"],"mappings":";;;AASA,IAAa,uBAAuB,OAAO,EACzC,gBACA,SACA,WACA,WAMyC;CACzC,MAAM,YAAY,eAAe,UAAU;CAE3C,MAAM,WAAW,OAAO,QAAQ,UAAU,CAAC,MAAM,GAAG,SAAS;EAC3D,MAAM,OAAO,MAAM;AACnB,SAAO,MAAM,cAAc,aAAa,MAAM,SAAS;GACvD;AAEF,KAAI,SACF,QAAO;EAAE,IAAI;EAAM,cAAc,SAAS;EAAI;CAGhD,MAAM,SAAS,MAAM,QAAQ;EAAE;EAAW;EAAM,SAAS;EAAU,CAAC;AACpE,KAAI,CAAC,OAAO,GACV,QAAO;EACL,IAAI;EACJ,OAAO,6BAA6B,OAAO,SAAS;EACrD;CAKH,MAAM,WAAW,OADF,OAAO,EAAE,MAAM,OAAO,EAAE,OAAO,QAAQ,EAAE,CAAC,EAAE,CAAC,EAC5B,OAAO,KAAK,CAAC,KAAK;CAElD,MAAM,eAAe,MAAM,mBAAmB,SAAS,MAAM,IAAI,MAAM,IAAI,IAAI,OAAO,KAAK,UAAU,CAAC,CAAC;AAEvG,KAAI,CAAC,aACH,QAAO;EACL,IAAI;EACJ,OAAO;EACR;AAIH,OAAM,eAAe,YAAY;EAC/B,MAAM;EACN,UAAU,OAAO;EACjB,MAAM,EACJ,0BAA0B;GAAE;GAAW;GAAM,EAC9C;EACF,CAAC;AAEF,QAAO;EAAE,IAAI;EAAM;EAAc"}
1
+ {"version":3,"file":"load-registry-document.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/load-registry-document.ts"],"sourcesContent":["import { coerce, object, string } from '@scalar/validation'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\n\nimport { generateUniqueSlug } from '@/v2/features/command-palette/helpers/generate-unique-slug'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\n\n/** Result of attempting to load a registry document into the workspace store. */\ntype LoadRegistryDocumentResult = { ok: true; documentName: string } | { ok: false; error: string }\n\nexport const loadRegistryDocument = async ({\n workspaceStore,\n fetcher,\n namespace,\n slug,\n version = 'latest',\n commitHash,\n}: {\n workspaceStore: WorkspaceStore\n fetcher: ImportDocumentFromRegistry\n namespace: string\n slug: string\n /**\n * Specific version to fetch from the registry. When omitted we ask the\n * registry for `latest`, which is what callers default to when they do\n * not have a concrete version pinned for the document yet.\n */\n version?: string\n /**\n * Commit hash the registry currently advertises for `version`. Callers\n * already know this from the version listing (sidebar row, breadcrumb\n * picker, etc.) so we accept it directly rather than parsing it back\n * out of the fetched document. When provided it is persisted on\n * `x-scalar-registry-meta.commitHash` so subsequent refreshes can\n * detect drift and surface upstream changes.\n */\n commitHash?: string\n}): Promise<LoadRegistryDocumentResult> => {\n const documents = workspaceStore.workspace.documents\n\n const existing = Object.entries(documents).find(([, doc]) => {\n const meta = doc?.['x-scalar-registry-meta']\n return meta?.namespace === namespace && meta?.slug === slug && meta?.version === version\n })\n\n if (existing) {\n return { ok: true, documentName: existing[0] }\n }\n\n const result = await fetcher({ namespace, slug, version })\n if (!result.ok) {\n return {\n ok: false,\n error: `Failed to fetch document: ${result.error || 'Unknown error'}`,\n }\n }\n\n // Parse the document data into a schema\n const schema = object({ info: object({ title: string() }) })\n const baseName = coerce(schema, result.data).info.title\n\n // Compose the workspace key as `slug(title)-slug(version)`\n // so the url will be like /workspace/acme/pets-api-1.0.0\n const title = baseName.trim() || slug\n const documentName = await generateUniqueSlug(`${title}-${version}`, new Set(Object.keys(documents)))\n\n if (!documentName) {\n return {\n ok: false,\n error: 'Failed to generate a unique name for the document',\n }\n }\n\n // Add the document to the workspace store. The registry meta records the\n // exact `version` we requested so subsequent lookups can match the local\n // document back to the version row in the sidebar. We also persist the\n // registry's commit hash (when the caller passed one) so later\n // refreshes can detect when the registry has moved on and surface\n // upstream changes to the user.\n await workspaceStore.addDocument({\n name: documentName,\n document: result.data,\n meta: {\n 'x-scalar-registry-meta': {\n namespace,\n slug,\n version,\n ...(commitHash ? { commitHash } : {}),\n },\n },\n })\n\n return { ok: true, documentName }\n}\n"],"mappings":";;;AASA,IAAa,uBAAuB,OAAO,EACzC,gBACA,SACA,WACA,MACA,UAAU,UACV,iBAqByC;CACzC,MAAM,YAAY,eAAe,UAAU;CAE3C,MAAM,WAAW,OAAO,QAAQ,UAAU,CAAC,MAAM,GAAG,SAAS;EAC3D,MAAM,OAAO,MAAM;AACnB,SAAO,MAAM,cAAc,aAAa,MAAM,SAAS,QAAQ,MAAM,YAAY;GACjF;AAEF,KAAI,SACF,QAAO;EAAE,IAAI;EAAM,cAAc,SAAS;EAAI;CAGhD,MAAM,SAAS,MAAM,QAAQ;EAAE;EAAW;EAAM;EAAS,CAAC;AAC1D,KAAI,CAAC,OAAO,GACV,QAAO;EACL,IAAI;EACJ,OAAO,6BAA6B,OAAO,SAAS;EACrD;CAUH,MAAM,eAAe,MAAM,mBAAmB,GAL7B,OADF,OAAO,EAAE,MAAM,OAAO,EAAE,OAAO,QAAQ,EAAE,CAAC,EAAE,CAAC,EAC5B,OAAO,KAAK,CAAC,KAAK,MAI3B,MAAM,IAAI,KACsB,GAAG,WAAW,IAAI,IAAI,OAAO,KAAK,UAAU,CAAC,CAAC;AAErG,KAAI,CAAC,aACH,QAAO;EACL,IAAI;EACJ,OAAO;EACR;AASH,OAAM,eAAe,YAAY;EAC/B,MAAM;EACN,UAAU,OAAO;EACjB,MAAM,EACJ,0BAA0B;GACxB;GACA;GACA;GACA,GAAI,aAAa,EAAE,YAAY,GAAG,EAAE;GACrC,EACF;EACF,CAAC;AAEF,QAAO;EAAE,IAAI;EAAM;EAAc"}
@@ -34,6 +34,10 @@ export type RouteProps = {
34
34
  id: string;
35
35
  label: string;
36
36
  };
37
+ /**
38
+ * Whether the active workspace is backed by a team (i.e. not the built-in `local` team).
39
+ */
40
+ isTeamWorkspace?: boolean;
37
41
  /** Client plugins */
38
42
  plugins: ClientPlugin[];
39
43
  /** Custom themes available to the team */
@@ -62,7 +66,7 @@ export type CollectionProps = RouteProps & ({
62
66
  collectionType: 'workspace';
63
67
  document: null;
64
68
  });
65
- export type ScalarClientAppRouteParams = 'namespace' | 'workspaceSlug' | 'documentSlug' | 'pathEncoded' | 'method' | 'exampleName';
69
+ export type ScalarClientAppRouteParams = 'teamSlug' | 'workspaceSlug' | 'documentSlug' | 'pathEncoded' | 'method' | 'exampleName';
66
70
  /** Routes for the API client app and web, the same as modal + workspace routes */
67
71
  export declare const ROUTES: ({
68
72
  path: string;
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAiB3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,kDAAkD;AAClD,MAAM,MAAM,UAAU,GAAG;IACvB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,8BAA8B;IAC9B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,+BAA+B;IAC/B,MAAM,EAAE,YAAY,CAAA;IACpB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2EAA2E;IAC3E,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uCAAuC;IACvC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,0BAA0B;IAC1B,cAAc,EAAE,cAAc,CAAA;IAC9B,qCAAqC;IACrC,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C,qBAAqB;IACrB,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,KAAK,EAAE,CAAA;IACtB,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,0BAA0B,CAAA;IAClD,mCAAmC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,8DAA8D;IAC9D,OAAO,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;CAC7C,CAAA;AAED,oCAAoC;AACpC,MAAM,MAAM,eAAe,GAAG,UAAU,GACtC,CACI;IACE,cAAc,EAAE,UAAU,GAAG,WAAW,CAAA;IACxC,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,GACD;IACE,cAAc,EAAE,WAAW,CAAA;IAC3B,QAAQ,EAAE,IAAI,CAAA;CACf,CACJ,CAAA;AAEH,MAAM,MAAM,0BAA0B,GAClC,WAAW,GACX,eAAe,GACf,cAAc,GACd,aAAa,GACb,QAAQ,GACR,aAAa,CAAA;AAEjB,kFAAkF;AAClF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAlBK,UAAU,GAAG,WAAW;kCAC9B,iBAAiB;;wCAGX,WAAW;kCACjB,IAAI;;wCALE,UAAU,GAAG,WAAW;kCAC9B,iBAAiB;;wCAGX,WAAW;kCACjB,IAAI;;;;;;;;;;;;;;;;;;;;;oCALE,UAAU,GAAG,WAAW;8BAC9B,iBAAiB;;oCAGX,WAAW;8BACjB,IAAI;;oCALE,UAAU,GAAG,WAAW;8BAC9B,iBAAiB;;oCAGX,WAAW;8BACjB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;gCALE,UAAU,GAAG,WAAW;0BAC9B,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;gCALE,UAAU,GAAG,WAAW;0BAC9B,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;;;;;;;;IAqLM,CAAA"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"names":[],"mappings":"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"}
@@ -16,7 +16,7 @@ import { mergeSearchParams } from "@scalar/helpers/url/merge-urls";
16
16
  //#region src/v2/features/app/helpers/routes.ts
17
17
  /** Routes for the API client app and web, the same as modal + workspace routes */
18
18
  var ROUTES = [{
19
- path: "/@:namespace/:workspaceSlug",
19
+ path: "/@:teamSlug/:workspaceSlug",
20
20
  children: [
21
21
  {
22
22
  path: "document/:documentSlug",
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"sourcesContent":["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { mergeSearchParams } from '@scalar/helpers/url/merge-urls'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { Theme } from '@scalar/themes'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace'\nimport type { MaybeRefOrGetter } from 'vue'\nimport type { RouteRecordRaw } from 'vue-router'\n\nimport Authentication from '@/v2/features/collection/components/Authentication.vue'\nimport Cookies from '@/v2/features/collection/components/Cookies.vue'\nimport { Editor } from '@/v2/features/collection/components/Editor'\nimport Environment from '@/v2/features/collection/components/Environment.vue'\nimport GetStarted from '@/v2/features/collection/components/GetStarted.vue'\nimport Overview from '@/v2/features/collection/components/Overview.vue'\nimport { Runner } from '@/v2/features/collection/components/Runner'\nimport Servers from '@/v2/features/collection/components/Servers.vue'\nimport Settings from '@/v2/features/collection/components/Settings.vue'\nimport DocumentCollection from '@/v2/features/collection/DocumentCollection.vue'\nimport OperationCollection from '@/v2/features/collection/OperationCollection.vue'\nimport WorkspaceCollection from '@/v2/features/collection/WorkspaceCollection.vue'\nimport { Operation } from '@/v2/features/operation'\nimport { workspaceStorage } from '@/v2/helpers/storage'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\nimport type { ApiClientOptions } from '@/v2/types/options'\n\n/** These props are provided at the route level */\nexport type RouteProps = {\n /** The slug of the currently selected document in the workspace */\n documentSlug: string\n /** The currently active document */\n document: WorkspaceDocument | null\n /** The workspace event bus */\n eventBus: WorkspaceEventBus\n /** The layout of the client */\n layout: ClientLayout\n /** The API path currently selected (e.g. \"/users/{id}\") */\n path?: string\n /** The HTTP method for the currently selected API path (e.g. GET, POST) */\n method?: HttpMethod\n /** The name of the currently selected example (for examples within an endpoint) */\n exampleName?: string\n /** The currently active environment */\n environment: XScalarEnvironment\n /** The workspace store */\n workspaceStore: WorkspaceStore\n /** The currently active workspace */\n activeWorkspace: { id: string; label: string }\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Custom themes available to the team */\n customThemes?: Theme[]\n /** The currently selected theme styles string */\n currentTheme?: string\n /** Whether the current color mode is dark */\n isDarkMode?: boolean\n /**\n * Fetches the full document from registry by meta. When provided, registry meta takes priority\n * over x-scalar-original-source-url when syncing. Returns the document as a plain object.\n */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n /** Whether telemetry is enabled */\n telemetry?: boolean\n /** Updates the telemetry enabled state */\n onUpdateTelemetry?: (value: boolean) => void\n /** App or modal options forwarded to operation/auth blocks */\n options?: MaybeRefOrGetter<ApiClientOptions>\n}\n\n/** When in the collections pages */\nexport type CollectionProps = RouteProps &\n (\n | {\n collectionType: 'document' | 'operation'\n document: WorkspaceDocument\n }\n | {\n collectionType: 'workspace'\n document: null\n }\n )\n\nexport type ScalarClientAppRouteParams =\n | 'namespace'\n | 'workspaceSlug'\n | 'documentSlug'\n | 'pathEncoded'\n | 'method'\n | 'exampleName'\n\n/** Routes for the API client app and web, the same as modal + workspace routes */\nexport const ROUTES = [\n {\n path: '/@:namespace/:workspaceSlug',\n children: [\n {\n path: 'document/:documentSlug',\n children: [\n // Example page\n {\n path: 'path/:pathEncoded/method/:method',\n children: [\n {\n name: 'example',\n path: 'example/:exampleName',\n component: Operation,\n },\n {\n name: 'operation',\n path: '',\n component: OperationCollection,\n redirect: {\n name: 'operation.overview',\n },\n children: [\n {\n name: 'operation.overview',\n path: 'overview',\n component: Overview,\n },\n {\n name: 'operation.servers',\n path: 'servers',\n component: Servers,\n },\n {\n name: 'operation.authentication',\n path: 'authentication',\n component: Authentication,\n },\n {\n name: 'operation.editor',\n path: 'editor',\n component: Editor,\n },\n ],\n },\n ],\n },\n // Document Page\n {\n name: 'document',\n path: '',\n component: DocumentCollection,\n children: [\n // Redirect to overview\n {\n name: 'document.redirect',\n path: '',\n redirect: {\n name: 'document.overview',\n },\n },\n // Document overview\n {\n name: 'document.overview',\n path: 'overview',\n component: Overview,\n },\n // Document servers\n {\n name: 'document.servers',\n path: 'servers',\n component: Servers,\n },\n // Document environment\n {\n name: 'document.environment',\n path: 'environment',\n component: Environment,\n },\n // Document authentication\n {\n name: 'document.authentication',\n path: 'authentication',\n component: Authentication,\n },\n // Document cookies\n {\n name: 'document.cookies',\n path: 'cookies',\n component: Cookies,\n },\n // Document scripts (pre-request / post-response)\n {\n name: 'document.scripts',\n path: 'scripts',\n component: () => import('@/v2/features/collection/components/Scripts.vue'),\n },\n // Document runner\n {\n name: 'document.runner',\n path: 'runner',\n component: Runner,\n },\n // Document settings\n {\n name: 'document.settings',\n path: 'settings',\n component: Settings,\n },\n ],\n },\n ],\n },\n // Workspace get started page (standalone, no workspace header or tabs)\n {\n name: 'workspace.get-started',\n path: 'get-started',\n component: GetStarted,\n },\n // Workspace page\n {\n name: 'workspace',\n path: '',\n component: WorkspaceCollection,\n children: [\n // Workspace environment\n {\n name: 'workspace.environment',\n path: 'environment',\n component: Environment,\n },\n // Workspace cookies\n {\n name: 'workspace.cookies',\n path: 'cookies',\n component: Cookies,\n },\n // Workspace settings\n {\n name: 'workspace.settings',\n path: 'settings',\n component: Settings,\n },\n ],\n },\n ],\n },\n {\n path: '/:pathMatch(.*)*',\n redirect: () => {\n const DEFAULT_PATH = '/@local/default/document/drafts/overview'\n const lastPath = workspaceStorage.getLastPath() ?? DEFAULT_PATH\n\n // Set the default path to the last path so we don't go to an inifite loop if the last path is invalid\n workspaceStorage.setCurrentPath(DEFAULT_PATH)\n\n const url = new URL(lastPath, 'http://example.com')\n\n const queryParameters = new URLSearchParams(window.location.search)\n\n //Merge the query parameters with the last path\n const mergedSearchParams = mergeSearchParams(url.searchParams, queryParameters)\n\n // Preserve all query paramters\n return `${url.pathname}?${mergedSearchParams.toString()}`\n },\n },\n] satisfies RouteRecordRaw[]\n"],"mappings":";;;;;;;;;;;;;;;;;AA8FA,IAAa,SAAS,CACpB;CACE,MAAM;CACN,UAAU;EACR;GACE,MAAM;GACN,UAAU,CAER;IACE,MAAM;IACN,UAAU,CACR;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ,EACD;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACX,UAAU,EACR,MAAM,sBACP;KACD,UAAU;MACR;OACE,MAAM;OACN,MAAM;OACN,WAAW;OACZ;MACD;OACE,MAAM;OACN,MAAM;OACN,WAAW;OACZ;MACD;OACE,MAAM;OACN,MAAM;OACN,WAAW;OACZ;MACD;OACE,MAAM;OACN,MAAM;OACN,WAAW;OACZ;MACF;KACF,CACF;IACF,EAED;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACX,UAAU;KAER;MACE,MAAM;MACN,MAAM;MACN,UAAU,EACR,MAAM,qBACP;MACF;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,iBAAiB,OAAO;MACzB;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KACF;IACF,CACF;GACF;EAED;GACE,MAAM;GACN,MAAM;GACN,WAAW;GACZ;EAED;GACE,MAAM;GACN,MAAM;GACN,WAAW;GACX,UAAU;IAER;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IACF;GACF;EACF;CACF,EACD;CACE,MAAM;CACN,gBAAgB;EACd,MAAM,eAAe;EACrB,MAAM,WAAW,iBAAiB,aAAa,IAAI;AAGnD,mBAAiB,eAAe,aAAa;EAE7C,MAAM,MAAM,IAAI,IAAI,UAAU,qBAAqB;EAEnD,MAAM,kBAAkB,IAAI,gBAAgB,OAAO,SAAS,OAAO;EAGnE,MAAM,qBAAqB,kBAAkB,IAAI,cAAc,gBAAgB;AAG/E,SAAO,GAAG,IAAI,SAAS,GAAG,mBAAmB,UAAU;;CAE1D,CACF"}
1
+ {"version":3,"file":"routes.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"sourcesContent":["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { mergeSearchParams } from '@scalar/helpers/url/merge-urls'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { Theme } from '@scalar/themes'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace'\nimport type { MaybeRefOrGetter } from 'vue'\nimport type { RouteRecordRaw } from 'vue-router'\n\nimport Authentication from '@/v2/features/collection/components/Authentication.vue'\nimport Cookies from '@/v2/features/collection/components/Cookies.vue'\nimport { Editor } from '@/v2/features/collection/components/Editor'\nimport Environment from '@/v2/features/collection/components/Environment.vue'\nimport GetStarted from '@/v2/features/collection/components/GetStarted.vue'\nimport Overview from '@/v2/features/collection/components/Overview.vue'\nimport { Runner } from '@/v2/features/collection/components/Runner'\nimport Servers from '@/v2/features/collection/components/Servers.vue'\nimport Settings from '@/v2/features/collection/components/Settings.vue'\nimport DocumentCollection from '@/v2/features/collection/DocumentCollection.vue'\nimport OperationCollection from '@/v2/features/collection/OperationCollection.vue'\nimport WorkspaceCollection from '@/v2/features/collection/WorkspaceCollection.vue'\nimport { Operation } from '@/v2/features/operation'\nimport { workspaceStorage } from '@/v2/helpers/storage'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\nimport type { ApiClientOptions } from '@/v2/types/options'\n\n/** These props are provided at the route level */\nexport type RouteProps = {\n /** The slug of the currently selected document in the workspace */\n documentSlug: string\n /** The currently active document */\n document: WorkspaceDocument | null\n /** The workspace event bus */\n eventBus: WorkspaceEventBus\n /** The layout of the client */\n layout: ClientLayout\n /** The API path currently selected (e.g. \"/users/{id}\") */\n path?: string\n /** The HTTP method for the currently selected API path (e.g. GET, POST) */\n method?: HttpMethod\n /** The name of the currently selected example (for examples within an endpoint) */\n exampleName?: string\n /** The currently active environment */\n environment: XScalarEnvironment\n /** The workspace store */\n workspaceStore: WorkspaceStore\n /** The currently active workspace */\n activeWorkspace: { id: string; label: string }\n /**\n * Whether the active workspace is backed by a team (i.e. not the built-in `local` team).\n */\n isTeamWorkspace?: boolean\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Custom themes available to the team */\n customThemes?: Theme[]\n /** The currently selected theme styles string */\n currentTheme?: string\n /** Whether the current color mode is dark */\n isDarkMode?: boolean\n /**\n * Fetches the full document from registry by meta. When provided, registry meta takes priority\n * over x-scalar-original-source-url when syncing. Returns the document as a plain object.\n */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n /** Whether telemetry is enabled */\n telemetry?: boolean\n /** Updates the telemetry enabled state */\n onUpdateTelemetry?: (value: boolean) => void\n /** App or modal options forwarded to operation/auth blocks */\n options?: MaybeRefOrGetter<ApiClientOptions>\n}\n\n/** When in the collections pages */\nexport type CollectionProps = RouteProps &\n (\n | {\n collectionType: 'document' | 'operation'\n document: WorkspaceDocument\n }\n | {\n collectionType: 'workspace'\n document: null\n }\n )\n\nexport type ScalarClientAppRouteParams =\n | 'teamSlug'\n | 'workspaceSlug'\n | 'documentSlug'\n | 'pathEncoded'\n | 'method'\n | 'exampleName'\n\n/** Routes for the API client app and web, the same as modal + workspace routes */\nexport const ROUTES = [\n {\n path: '/@:teamSlug/:workspaceSlug',\n children: [\n {\n path: 'document/:documentSlug',\n children: [\n // Example page\n {\n path: 'path/:pathEncoded/method/:method',\n children: [\n {\n name: 'example',\n path: 'example/:exampleName',\n component: Operation,\n },\n {\n name: 'operation',\n path: '',\n component: OperationCollection,\n redirect: {\n name: 'operation.overview',\n },\n children: [\n {\n name: 'operation.overview',\n path: 'overview',\n component: Overview,\n },\n {\n name: 'operation.servers',\n path: 'servers',\n component: Servers,\n },\n {\n name: 'operation.authentication',\n path: 'authentication',\n component: Authentication,\n },\n {\n name: 'operation.editor',\n path: 'editor',\n component: Editor,\n },\n ],\n },\n ],\n },\n // Document Page\n {\n name: 'document',\n path: '',\n component: DocumentCollection,\n children: [\n // Redirect to overview\n {\n name: 'document.redirect',\n path: '',\n redirect: {\n name: 'document.overview',\n },\n },\n // Document overview\n {\n name: 'document.overview',\n path: 'overview',\n component: Overview,\n },\n // Document servers\n {\n name: 'document.servers',\n path: 'servers',\n component: Servers,\n },\n // Document environment\n {\n name: 'document.environment',\n path: 'environment',\n component: Environment,\n },\n // Document authentication\n {\n name: 'document.authentication',\n path: 'authentication',\n component: Authentication,\n },\n // Document cookies\n {\n name: 'document.cookies',\n path: 'cookies',\n component: Cookies,\n },\n // Document scripts (pre-request / post-response)\n {\n name: 'document.scripts',\n path: 'scripts',\n component: () => import('@/v2/features/collection/components/Scripts.vue'),\n },\n // Document runner\n {\n name: 'document.runner',\n path: 'runner',\n component: Runner,\n },\n // Document settings\n {\n name: 'document.settings',\n path: 'settings',\n component: Settings,\n },\n ],\n },\n ],\n },\n // Workspace get started page (standalone, no workspace header or tabs)\n {\n name: 'workspace.get-started',\n path: 'get-started',\n component: GetStarted,\n },\n // Workspace page\n {\n name: 'workspace',\n path: '',\n component: WorkspaceCollection,\n children: [\n // Workspace environment\n {\n name: 'workspace.environment',\n path: 'environment',\n component: Environment,\n },\n // Workspace cookies\n {\n name: 'workspace.cookies',\n path: 'cookies',\n component: Cookies,\n },\n // Workspace settings\n {\n name: 'workspace.settings',\n path: 'settings',\n component: Settings,\n },\n ],\n },\n ],\n },\n {\n path: '/:pathMatch(.*)*',\n redirect: () => {\n const DEFAULT_PATH = '/@local/default/document/drafts/overview'\n const lastPath = workspaceStorage.getLastPath() ?? DEFAULT_PATH\n\n // Set the default path to the last path so we don't go to an inifite loop if the last path is invalid\n workspaceStorage.setCurrentPath(DEFAULT_PATH)\n\n const url = new URL(lastPath, 'http://example.com')\n\n const queryParameters = new URLSearchParams(window.location.search)\n\n //Merge the query parameters with the last path\n const mergedSearchParams = mergeSearchParams(url.searchParams, queryParameters)\n\n // Preserve all query paramters\n return `${url.pathname}?${mergedSearchParams.toString()}`\n },\n },\n] satisfies RouteRecordRaw[]\n"],"mappings":";;;;;;;;;;;;;;;;;AAkGA,IAAa,SAAS,CACpB;CACE,MAAM;CACN,UAAU;EACR;GACE,MAAM;GACN,UAAU,CAER;IACE,MAAM;IACN,UAAU,CACR;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ,EACD;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACX,UAAU,EACR,MAAM,sBACP;KACD,UAAU;MACR;OACE,MAAM;OACN,MAAM;OACN,WAAW;OACZ;MACD;OACE,MAAM;OACN,MAAM;OACN,WAAW;OACZ;MACD;OACE,MAAM;OACN,MAAM;OACN,WAAW;OACZ;MACD;OACE,MAAM;OACN,MAAM;OACN,WAAW;OACZ;MACF;KACF,CACF;IACF,EAED;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACX,UAAU;KAER;MACE,MAAM;MACN,MAAM;MACN,UAAU,EACR,MAAM,qBACP;MACF;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,iBAAiB,OAAO;MACzB;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KAED;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KACF;IACF,CACF;GACF;EAED;GACE,MAAM;GACN,MAAM;GACN,WAAW;GACZ;EAED;GACE,MAAM;GACN,MAAM;GACN,WAAW;GACX,UAAU;IAER;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IACF;GACF;EACF;CACF,EACD;CACE,MAAM;CACN,gBAAgB;EACd,MAAM,eAAe;EACrB,MAAM,WAAW,iBAAiB,aAAa,IAAI;AAGnD,mBAAiB,eAAe,aAAa;EAE7C,MAAM,MAAM,IAAI,IAAI,UAAU,qBAAqB;EAEnD,MAAM,kBAAkB,IAAI,gBAAgB,OAAO,SAAS,OAAO;EAGnE,MAAM,qBAAqB,kBAAkB,IAAI,cAAc,gBAAgB;AAG/E,SAAO,GAAG,IAAI,SAAS,GAAG,mBAAmB,UAAU;;CAE1D,CACF"}
@@ -0,0 +1,24 @@
1
+ import { ScalarIconCloudCheck } from '@scalar/icons';
2
+ import type { VersionStatus } from '../../../../v2/features/app/helpers/compute-version-status.js';
3
+ /** Visual presentation for a single sync state. */
4
+ type VersionStatusPresentation = {
5
+ /** Cloud-style icon component matching the swatch the design system uses for this state. */
6
+ icon: typeof ScalarIconCloudCheck;
7
+ /** Tailwind text colour class applied to the icon. */
8
+ class: string;
9
+ /** Human-readable description used as both the tooltip and the accessible label. */
10
+ label: string;
11
+ };
12
+ /**
13
+ * Visual mapping for every sync status surfaced by the registry workflow.
14
+ *
15
+ * The mapping is intentionally shared across surfaces (version picker rows,
16
+ * the right-side header indicator, future sync buttons / badges) so the icon
17
+ * and colour for a given state stay consistent everywhere it is rendered.
18
+ *
19
+ * Keep the presentation purely declarative — no behaviour, no event
20
+ * handlers — so it remains safe to import from any layer.
21
+ */
22
+ export declare const VERSION_STATUS_PRESENTATION: Record<VersionStatus, VersionStatusPresentation>;
23
+ export {};
24
+ //# sourceMappingURL=version-status-presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-status-presentation.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/version-status-presentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EAErB,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAA;AAErF,mDAAmD;AACnD,KAAK,yBAAyB,GAAG;IAC/B,4FAA4F;IAC5F,IAAI,EAAE,OAAO,oBAAoB,CAAA;IACjC,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,aAAa,EAAE,yBAAyB,CA0BxF,CAAA"}
@@ -0,0 +1,43 @@
1
+ import { ScalarIconCloudArrowDown, ScalarIconCloudArrowUp, ScalarIconCloudCheck, ScalarIconCloudWarning } from "@scalar/icons";
2
+ //#region src/v2/features/app/helpers/version-status-presentation.ts
3
+ /**
4
+ * Visual mapping for every sync status surfaced by the registry workflow.
5
+ *
6
+ * The mapping is intentionally shared across surfaces (version picker rows,
7
+ * the right-side header indicator, future sync buttons / badges) so the icon
8
+ * and colour for a given state stay consistent everywhere it is rendered.
9
+ *
10
+ * Keep the presentation purely declarative — no behaviour, no event
11
+ * handlers — so it remains safe to import from any layer.
12
+ */
13
+ var VERSION_STATUS_PRESENTATION = {
14
+ synced: {
15
+ icon: ScalarIconCloudCheck,
16
+ class: "text-green",
17
+ label: "Synced with the registry"
18
+ },
19
+ push: {
20
+ icon: ScalarIconCloudArrowUp,
21
+ class: "text-blue",
22
+ label: "Local changes ready to push"
23
+ },
24
+ pull: {
25
+ icon: ScalarIconCloudArrowDown,
26
+ class: "text-blue",
27
+ label: "Upstream changes available to pull"
28
+ },
29
+ conflict: {
30
+ icon: ScalarIconCloudWarning,
31
+ class: "text-orange",
32
+ label: "Conflicts detected — resolve before pulling"
33
+ },
34
+ unknown: {
35
+ icon: ScalarIconCloudCheck,
36
+ class: "text-c-3",
37
+ label: "Version not loaded"
38
+ }
39
+ };
40
+ //#endregion
41
+ export { VERSION_STATUS_PRESENTATION };
42
+
43
+ //# sourceMappingURL=version-status-presentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-status-presentation.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/version-status-presentation.ts"],"sourcesContent":["import {\n ScalarIconCloudArrowDown,\n ScalarIconCloudArrowUp,\n ScalarIconCloudCheck,\n ScalarIconCloudWarning,\n} from '@scalar/icons'\n\nimport type { VersionStatus } from '@/v2/features/app/helpers/compute-version-status'\n\n/** Visual presentation for a single sync state. */\ntype VersionStatusPresentation = {\n /** Cloud-style icon component matching the swatch the design system uses for this state. */\n icon: typeof ScalarIconCloudCheck\n /** Tailwind text colour class applied to the icon. */\n class: string\n /** Human-readable description used as both the tooltip and the accessible label. */\n label: string\n}\n\n/**\n * Visual mapping for every sync status surfaced by the registry workflow.\n *\n * The mapping is intentionally shared across surfaces (version picker rows,\n * the right-side header indicator, future sync buttons / badges) so the icon\n * and colour for a given state stay consistent everywhere it is rendered.\n *\n * Keep the presentation purely declarative — no behaviour, no event\n * handlers — so it remains safe to import from any layer.\n */\nexport const VERSION_STATUS_PRESENTATION: Record<VersionStatus, VersionStatusPresentation> = {\n synced: {\n icon: ScalarIconCloudCheck,\n class: 'text-green',\n label: 'Synced with the registry',\n },\n push: {\n icon: ScalarIconCloudArrowUp,\n class: 'text-blue',\n label: 'Local changes ready to push',\n },\n pull: {\n icon: ScalarIconCloudArrowDown,\n class: 'text-blue',\n label: 'Upstream changes available to pull',\n },\n conflict: {\n icon: ScalarIconCloudWarning,\n class: 'text-orange',\n label: 'Conflicts detected — resolve before pulling',\n },\n unknown: {\n icon: ScalarIconCloudCheck,\n class: 'text-c-3',\n label: 'Version not loaded',\n },\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,IAAa,8BAAgF;CAC3F,QAAQ;EACN,MAAM;EACN,OAAO;EACP,OAAO;EACR;CACD,MAAM;EACJ,MAAM;EACN,OAAO;EACP,OAAO;EACR;CACD,MAAM;EACJ,MAAM;EACN,OAAO;EACP,OAAO;EACR;CACD,UAAU;EACR,MAAM;EACN,OAAO;EACP,OAAO;EACR;CACD,SAAS;EACP,MAAM;EACN,OAAO;EACP,OAAO;EACR;CACF"}
@@ -0,0 +1,41 @@
1
+ import { type ComputedRef } from 'vue';
2
+ import type { AppState } from '../../../../v2/features/app/app-state.js';
3
+ import { type RegistryDocumentsState, type SidebarDocumentItem, type SidebarDocumentVersion } from '../../../../v2/features/app/hooks/use-sidebar-documents.js';
4
+ /**
5
+ * Resolves everything UI surfaces need to know about the document the user
6
+ * is currently viewing in a registry-backed workspace.
7
+ *
8
+ * The breadcrumb's version picker and the right-side sync indicator both
9
+ * need the same data:
10
+ *
11
+ * - the sidebar item for the active group (so titles match the registry),
12
+ * - the full version list for that group (used to render dropdown rows /
13
+ * feed `useVersionConflictCheck`),
14
+ * - and the currently active version (used for the picker selection and
15
+ * the standalone status icon).
16
+ *
17
+ * Pulling this into a composable keeps both surfaces aligned and avoids
18
+ * duplicating the active-version selection rules — in particular the
19
+ * fallback to the version declared on `x-scalar-registry-meta` when the
20
+ * sidebar's notion of the active version has not caught up yet (e.g. during
21
+ * a pending fetch).
22
+ */
23
+ export declare const useActiveDocumentVersion: ({ app, registryDocuments, }: {
24
+ app: AppState;
25
+ /** Reactive accessor — components pass a getter so the composable stays prop-driven. */
26
+ registryDocuments: () => RegistryDocumentsState;
27
+ }) => {
28
+ documents: ComputedRef<SidebarDocumentItem[]>;
29
+ activeRegistryMeta: ComputedRef<{
30
+ namespace: string;
31
+ slug: string;
32
+ version?: string;
33
+ commitHash?: string;
34
+ conflictCheckedAgainstHash?: string;
35
+ hasConflict?: boolean;
36
+ } | undefined>;
37
+ activeItem: ComputedRef<SidebarDocumentItem | undefined>;
38
+ versions: ComputedRef<SidebarDocumentVersion[]>;
39
+ activeVersion: ComputedRef<SidebarDocumentVersion | undefined>;
40
+ };
41
+ //# sourceMappingURL=use-active-document-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-active-document-version.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/hooks/use-active-document-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,KAAK,CAAA;AAEhD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAE5B,MAAM,+CAA+C,CAAA;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,wBAAwB,GAAI,6BAGtC;IACD,GAAG,EAAE,QAAQ,CAAA;IACb,wFAAwF;IACxF,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;CAChD,KAAG;IACF,SAAS,EAAE,WAAW,CAAC,mBAAmB,EAAE,CAAC,CAAA;IAC7C,kBAAkB,EAAE,WAAW,CAC3B;QACE,SAAS,EAAE,MAAM,CAAA;QACjB,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,0BAA0B,CAAC,EAAE,MAAM,CAAA;QACnC,WAAW,CAAC,EAAE,OAAO,CAAA;KACtB,GACD,SAAS,CACZ,CAAA;IACD,UAAU,EAAE,WAAW,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAA;IACxD,QAAQ,EAAE,WAAW,CAAC,sBAAsB,EAAE,CAAC,CAAA;IAC/C,aAAa,EAAE,WAAW,CAAC,sBAAsB,GAAG,SAAS,CAAC,CAAA;CAqD/D,CAAA"}