@scalar/api-client 2.38.3 → 2.38.4

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 (226) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{AddressBar-CX8xiYoe.js → AddressBar-BOZGKSoz.js} +4 -4
  3. package/dist/{AddressBar-CX8xiYoe.js.map → AddressBar-BOZGKSoz.js.map} +1 -1
  4. package/dist/{App-BpNPKHmM.js → App-DHBmpWJI.js} +4 -4
  5. package/dist/{App-BpNPKHmM.js.map → App-DHBmpWJI.js.map} +1 -1
  6. package/dist/{CodeInput-BN7uw3Bh.js → CodeInput-BTN8cC5h.js} +2 -2
  7. package/dist/{CodeInput-BN7uw3Bh.js.map → CodeInput-BTN8cC5h.js.map} +1 -1
  8. package/dist/{Collection-ChAxs3rz.js → Collection-BsAG7ms5.js} +2 -2
  9. package/dist/{Collection-ChAxs3rz.js.map → Collection-BsAG7ms5.js.map} +1 -1
  10. package/dist/{CollectionAuthentication-BDpvv8cA.js → CollectionAuthentication-BMGhRnpo.js} +5 -5
  11. package/dist/{CollectionAuthentication-BDpvv8cA.js.map → CollectionAuthentication-BMGhRnpo.js.map} +1 -1
  12. package/dist/{CollectionEnvironment-dwisJ-h5.js → CollectionEnvironment-BY9Gcnln.js} +4 -4
  13. package/dist/{CollectionEnvironment-dwisJ-h5.js.map → CollectionEnvironment-BY9Gcnln.js.map} +1 -1
  14. package/dist/{CollectionOverview-CJ9-Vmei.js → CollectionOverview-C3GvN8GY.js} +3 -3
  15. package/dist/{CollectionOverview-CJ9-Vmei.js.map → CollectionOverview-C3GvN8GY.js.map} +1 -1
  16. package/dist/{CollectionServers-BWkIGwz4.js → CollectionServers-DuOLysNB.js} +5 -5
  17. package/dist/{CollectionServers-BWkIGwz4.js.map → CollectionServers-DuOLysNB.js.map} +1 -1
  18. package/dist/{CollectionSettings-CqUUYOym.js → CollectionSettings-FtXNetOh.js} +2 -2
  19. package/dist/{CollectionSettings-CqUUYOym.js.map → CollectionSettings-FtXNetOh.js.map} +1 -1
  20. package/dist/{CommandPalette-BiA0IgO8.js → CommandPalette-BxoEK8TY.js} +2 -2
  21. package/dist/{CommandPalette-BiA0IgO8.js.map → CommandPalette-BxoEK8TY.js.map} +1 -1
  22. package/dist/{Cookies-CNRSxP8J.js → Cookies-BYTv1YIA.js} +8 -8
  23. package/dist/{Cookies-CNRSxP8J.js.map → Cookies-BYTv1YIA.js.map} +1 -1
  24. package/dist/{DataTableInput-SkIUPlrB.js → DataTableInput-RydMDjn2.js} +2 -2
  25. package/dist/{DataTableInput-SkIUPlrB.js.map → DataTableInput-RydMDjn2.js.map} +1 -1
  26. package/dist/{Environment-D_CbZk0A.js → Environment-BIxG7DaO.js} +5 -5
  27. package/dist/{Environment-D_CbZk0A.js.map → Environment-BIxG7DaO.js.map} +1 -1
  28. package/dist/{EnvironmentModal-CcyqnPc2.js → EnvironmentModal-C0lYytkh.js} +2 -2
  29. package/dist/{EnvironmentModal-CcyqnPc2.js.map → EnvironmentModal-C0lYytkh.js.map} +1 -1
  30. package/dist/{Form-bA4bV_oA.js → Form-KFcdRQp1.js} +3 -3
  31. package/dist/{Form-bA4bV_oA.js.map → Form-KFcdRQp1.js.map} +1 -1
  32. package/dist/{ImportCollection-BIYMxB9Q.js → ImportCollection-CGjySEzP.js} +2 -2
  33. package/dist/{ImportCollection-BIYMxB9Q.js.map → ImportCollection-CGjySEzP.js.map} +1 -1
  34. package/dist/{MainLayout-oMIJ5QXF.js → MainLayout-BnLwst16.js} +3 -3
  35. package/dist/{MainLayout-oMIJ5QXF.js.map → MainLayout-BnLwst16.js.map} +1 -1
  36. package/dist/{Modal-DkOa_KK0.js → Modal-CTZ8UNds.js} +2 -2
  37. package/dist/{Modal-DkOa_KK0.js.map → Modal-CTZ8UNds.js.map} +1 -1
  38. package/dist/{Request-BWfYWyBa.js → Request-d0RY0ZhC.js} +10 -10
  39. package/dist/{Request-BWfYWyBa.js.map → Request-d0RY0ZhC.js.map} +1 -1
  40. package/dist/{RequestAuth-BU6ubH-c.js → RequestAuth-1cRH3DDn.js} +3 -3
  41. package/dist/{RequestAuth-BU6ubH-c.js.map → RequestAuth-1cRH3DDn.js.map} +1 -1
  42. package/dist/{RequestRoot-7xhK5_qr.js → RequestRoot-pW0yXesG.js} +7 -7
  43. package/dist/{RequestRoot-7xhK5_qr.js.map → RequestRoot-pW0yXesG.js.map} +1 -1
  44. package/dist/{RequestSection-Bx8UHW-k.js → RequestSection-D2BLvDTr.js} +4 -4
  45. package/dist/{RequestSection-Bx8UHW-k.js.map → RequestSection-D2BLvDTr.js.map} +1 -1
  46. package/dist/{ResponseSection-CLrgLMN_.js → ResponseSection-B_YF7l_E.js} +3 -3
  47. package/dist/{ResponseSection-CLrgLMN_.js.map → ResponseSection-B_YF7l_E.js.map} +1 -1
  48. package/dist/{Server-BS4zjUdO.js → Server-CEKGIEfE.js} +2 -2
  49. package/dist/{Server-BS4zjUdO.js.map → Server-CEKGIEfE.js.map} +1 -1
  50. package/dist/{Settings-BuLKHzRY.js → Settings-BaPvhJ8Y.js} +2 -2
  51. package/dist/{Settings-BuLKHzRY.js.map → Settings-BaPvhJ8Y.js.map} +1 -1
  52. package/dist/{Sidebar-Xl9_nFXX.js → Sidebar-CRxdl38Y.js} +2 -2
  53. package/dist/{Sidebar-Xl9_nFXX.js.map → Sidebar-CRxdl38Y.js.map} +1 -1
  54. package/dist/components/AddressBar/AddressBar.vue.d.ts +1 -1
  55. package/dist/components/AddressBar/index.js +3 -3
  56. package/dist/components/CodeInput/CodeInput.vue.d.ts +1 -1
  57. package/dist/components/CodeInput/codeVariableWidget.d.ts +1 -1
  58. package/dist/components/CodeInput/index.js +1 -1
  59. package/dist/components/CommandPalette/index.js +1 -1
  60. package/dist/components/DataTable/DataTableInput.vue.d.ts +2 -2
  61. package/dist/components/DataTable/index.js +2 -2
  62. package/dist/components/Form/LabelInput.vue.d.ts +1 -1
  63. package/dist/components/ImportCollection/index.js +1 -1
  64. package/dist/components/ImportCollection/utils/import-collection.d.ts +1 -1
  65. package/dist/components/ImportCollection/utils/workspace-store-is-empty.d.ts +1 -1
  66. package/dist/components/Server/ServerVariablesForm.vue.d.ts +1 -1
  67. package/dist/components/Server/index.js +1 -1
  68. package/dist/components/Sidebar/index.js +1 -1
  69. package/dist/components/index.d.ts +2 -2
  70. package/dist/components/index.js +4 -4
  71. package/dist/{components-DfJHvSLM.js → components-B0BwUDFw.js} +2 -2
  72. package/dist/{components-DfJHvSLM.js.map → components-B0BwUDFw.js.map} +1 -1
  73. package/dist/hooks/useSidebar.d.ts +1 -1
  74. package/dist/index.d.ts +2 -2
  75. package/dist/index.js +5 -5
  76. package/dist/layouts/App/create-api-client-app.d.ts +9 -9
  77. package/dist/layouts/App/index.js +3 -3
  78. package/dist/layouts/Modal/create-api-client-modal.d.ts +1 -1
  79. package/dist/layouts/Modal/index.d.ts +1 -1
  80. package/dist/layouts/Modal/index.js +1 -1
  81. package/dist/layouts/Web/create-api-client-web.d.ts +9 -9
  82. package/dist/layouts/Web/index.js +4 -4
  83. package/dist/libs/create-client.d.ts +3 -3
  84. package/dist/libs/environment-parser.d.ts +1 -1
  85. package/dist/libs/get-request-uid-by-path-method.d.ts +1 -1
  86. package/dist/libs/hot-keys.d.ts +1 -1
  87. package/dist/libs/index.d.ts +1 -1
  88. package/dist/libs/index.js +1 -1
  89. package/dist/libs/local-storage.d.ts +1 -1
  90. package/dist/libs/send-request/create-request-operation.d.ts +3 -3
  91. package/dist/{operation-block-DE-hoO03.js → operation-block-B1B3lJPx.js} +3 -3
  92. package/dist/{operation-block-DE-hoO03.js.map → operation-block-B1B3lJPx.js.map} +1 -1
  93. package/dist/{operation-code-sample-xgx4qi2H.js → operation-code-sample-DOzAPxLQ.js} +2 -2
  94. package/dist/{operation-code-sample-xgx4qi2H.js.map → operation-code-sample-DOzAPxLQ.js.map} +1 -1
  95. package/dist/plugins/hooks/usePluginManager.d.ts +1 -1
  96. package/dist/{request-block-N7dPFyrG.js → request-block-C1kLLMEd.js} +2 -2
  97. package/dist/{request-block-N7dPFyrG.js.map → request-block-C1kLLMEd.js.map} +1 -1
  98. package/dist/store/collections.d.ts +1 -1
  99. package/dist/store/environment.d.ts +1 -1
  100. package/dist/store/events.d.ts +8 -8
  101. package/dist/store/import-spec.d.ts +2 -2
  102. package/dist/store/index.js +1 -1
  103. package/dist/store/request-example.d.ts +1 -1
  104. package/dist/store/requests.d.ts +1 -1
  105. package/dist/store/security-schemes.d.ts +1 -1
  106. package/dist/store/servers.d.ts +1 -1
  107. package/dist/store/store.d.ts +7 -7
  108. package/dist/store/tags.d.ts +1 -1
  109. package/dist/store/workspace.d.ts +1 -1
  110. package/dist/{store-DaPoVtIS.js → store-DnlAQK5d.js} +15 -15
  111. package/dist/{store-DaPoVtIS.js.map → store-DnlAQK5d.js.map} +1 -1
  112. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +3 -3
  113. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +2 -2
  114. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +2 -2
  115. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +2 -2
  116. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts +1 -1
  117. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -1
  118. package/dist/v2/blocks/operation-block/index.js +8 -8
  119. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +2 -2
  120. package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +1 -1
  121. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +1 -1
  122. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +1 -1
  123. package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts +2 -2
  124. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +1 -1
  125. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +1 -1
  126. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +1 -1
  127. package/dist/v2/blocks/operation-code-sample/index.js +1 -1
  128. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +4 -4
  129. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts +1 -1
  130. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +1 -1
  131. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts +1 -1
  132. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts +1 -1
  133. package/dist/v2/blocks/request-block/index.js +4 -4
  134. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +1 -1
  135. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.d.ts +1 -1
  136. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +1 -1
  137. package/dist/v2/blocks/response-block/index.js +2 -2
  138. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +1 -1
  139. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +3 -3
  140. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +1 -1
  141. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +2 -2
  142. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts +1 -1
  143. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +1 -1
  144. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +1 -1
  145. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -2
  146. package/dist/v2/blocks/scalar-auth-selector-block/index.js +2 -2
  147. package/dist/v2/components/code-input/CodeInput.vue.d.ts +1 -1
  148. package/dist/v2/components/data-table/DataTableInput.vue.d.ts +1 -1
  149. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +1 -1
  150. package/dist/v2/components/server/ServerDropdown.vue.d.ts +1 -1
  151. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +1 -1
  152. package/dist/v2/features/app/App.vue.d.ts +3 -3
  153. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +1 -1
  154. package/dist/v2/features/app/components/index.js +2 -2
  155. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +3 -3
  156. package/dist/v2/features/app/helpers/get-route-param.d.ts +1 -1
  157. package/dist/v2/features/app/helpers/routes.d.ts +3 -3
  158. package/dist/v2/features/app/index.d.ts +5 -5
  159. package/dist/v2/features/app/index.js +8 -8
  160. package/dist/v2/features/collection/DocumentCollection.vue.d.ts +1 -1
  161. package/dist/v2/features/collection/OperationCollection.vue.d.ts +1 -1
  162. package/dist/v2/features/collection/WorkspaceCollection.vue.d.ts +1 -1
  163. package/dist/v2/features/collection/components/Authentication.vue.d.ts +4 -4
  164. package/dist/v2/features/collection/components/Cookies.vue.d.ts +4 -4
  165. package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts +4 -4
  166. package/dist/v2/features/collection/components/Environment.vue.d.ts +4 -4
  167. package/dist/v2/features/collection/components/Overview.vue.d.ts +4 -4
  168. package/dist/v2/features/collection/components/Servers.vue.d.ts +4 -4
  169. package/dist/v2/features/collection/components/Settings.vue.d.ts +4 -4
  170. package/dist/v2/features/collection/components/Tabs.vue.d.ts +1 -1
  171. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +45 -10
  172. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
  173. package/dist/v2/features/editor/helpers/json/create-json-model.d.ts +1 -1
  174. package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts +1 -1
  175. package/dist/v2/features/editor/helpers/yaml/get-yaml-node-range-from-path.d.ts +1 -1
  176. package/dist/v2/features/editor/hooks/use-editor.d.ts +1 -1
  177. package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts +1 -1
  178. package/dist/v2/features/modal/Modal.vue.d.ts +1 -1
  179. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +2 -2
  180. package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts +1 -1
  181. package/dist/v2/features/modal/index.js +8 -8
  182. package/dist/v2/features/modal/modal-events.d.ts +1 -1
  183. package/dist/v2/features/operation/Operation.vue.d.ts +2 -2
  184. package/dist/v2/features/operation/index.js +8 -8
  185. package/dist/v2/features/search/helpers/create-fuse-instance.d.ts +1 -1
  186. package/dist/v2/features/search/helpers/create-search-index.d.ts +1 -1
  187. package/dist/v2/helpers/get-active-proxy-url.d.ts +1 -1
  188. package/dist/v2/helpers/get-tab-details.d.ts +1 -1
  189. package/dist/v2/helpers/handle-hotkeys.d.ts +1 -1
  190. package/dist/v2/hooks/use-global-hot-keys.d.ts +1 -1
  191. package/dist/views/Collection/components/EnvironmentForm.vue.d.ts +1 -1
  192. package/dist/views/Collection/components/MarkdownInput.vue.d.ts +1 -1
  193. package/dist/views/Components/CodeSnippet/CodeSnippet.vue.d.ts +1 -1
  194. package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts +1 -1
  195. package/dist/views/Components/CodeSnippet/helpers/get-snippet.d.ts +1 -1
  196. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts +1 -1
  197. package/dist/views/Environment/handle-drag.d.ts +1 -1
  198. package/dist/views/Request/Request.vue.d.ts +1 -1
  199. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts +1 -1
  200. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts +1 -1
  201. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts +1 -1
  202. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +1 -1
  203. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue.d.ts +2 -2
  204. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.d.ts +1 -1
  205. package/dist/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.d.ts +1 -1
  206. package/dist/views/Request/RequestSection/RequestAuth/index.js +3 -3
  207. package/dist/views/Request/RequestSection/RequestBody.vue.d.ts +1 -1
  208. package/dist/views/Request/RequestSection/RequestCodeExample.vue.d.ts +1 -1
  209. package/dist/views/Request/RequestSection/RequestParams.vue.d.ts +1 -1
  210. package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts +1 -1
  211. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts +1 -1
  212. package/dist/views/Request/RequestSection/RequestTable.vue.d.ts +1 -1
  213. package/dist/views/Request/RequestSection/helpers/update-scheme.d.ts +1 -1
  214. package/dist/views/Request/RequestSection/index.js +4 -4
  215. package/dist/views/Request/RequestSidebarItem.vue.d.ts +1 -1
  216. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +3 -3
  217. package/dist/views/Request/RequestSubpageHeader.vue.d.ts +1 -1
  218. package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.d.ts +1 -1
  219. package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts +1 -1
  220. package/dist/views/Request/ResponseSection/index.js +3 -3
  221. package/dist/views/Request/components/index.js +1 -1
  222. package/dist/views/Request/handle-drag.d.ts +2 -2
  223. package/dist/views/Request/libs/auth.d.ts +1 -1
  224. package/dist/views/Request/libs/oauth2.d.ts +1 -1
  225. package/dist/views/Request/libs/watch-mode.d.ts +2 -2
  226. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"store-DaPoVtIS.js","names":[],"sources":["../src/routes.ts","../src/store/router-params.ts","../src/store/active-entities.ts","../src/store/collections.ts","../src/store/cookies.ts","../src/store/environment.ts","../src/libs/event-bus.ts","../src/store/events.ts","../src/hooks/useClientConfig.ts","../src/libs/find-request.ts","../src/libs/get-request-uid-by-path-method.ts","../src/libs/local-storage.ts","../src/libs/create-client.ts","../src/libs/env-helpers.ts","../src/libs/environment-parser.ts","../src/libs/isUrl.ts","../src/libs/getOpenApiDocumentDetails.ts","../src/libs/hot-keys.ts","../src/libs/postman.ts","../src/store/import-spec.ts","../src/store/request-example.ts","../src/store/requests.ts","../src/store/security-schemes.ts","../src/store/servers.ts","../src/store/tags.ts","../src/store/workspace.ts","../src/store/store.ts"],"sourcesContent":["import type { RouteLocationNormalized, RouteRecordRaw } from 'vue-router'\n\nexport enum PathId {\n Request = 'request',\n Examples = 'examples',\n Cookies = 'cookies',\n Collection = 'collection',\n Schema = 'schema',\n Environment = 'environment',\n Servers = 'servers',\n Workspace = 'workspace',\n Settings = 'settings',\n}\n\n/** Tracks the active workspace in localStorage for when the client reloads */\nconst ACTIVE_WORKSPACE_KEY = 'activeWorkspace' as const\n\n/** Save the active workspace in localStorage for when the client reloads */\nexport function saveActiveWorkspace(to: RouteLocationNormalized) {\n const workspace = to.params[PathId.Workspace]\n\n if (workspace) {\n localStorage.setItem(ACTIVE_WORKSPACE_KEY, `${workspace}`)\n }\n}\n\n/** Redirect to the saved workspace or the default workspace */\nfunction redirectToActiveWorkspace() {\n // Access localStorage\n const activeWorkspace = localStorage.getItem(ACTIVE_WORKSPACE_KEY)\n\n // Fallback\n if (!activeWorkspace) {\n return {\n name: 'workspace.default',\n }\n }\n\n // Redirect to active workspace\n return {\n name: 'request.root',\n params: {\n [PathId.Workspace]: activeWorkspace,\n },\n }\n}\n\n/** Shared request routes between modal and app */\nconst requestRoutes = [\n {\n name: 'request.root',\n path: '',\n component: () => import('@/views/Request/RequestRoot.vue'),\n redirect: (to: RouteLocationNormalized, _from: RouteLocationNormalized) => ({\n name: 'request',\n params: { ...to.params, request: 'default' },\n }),\n children: [\n {\n name: 'request',\n path: `request/:${PathId.Request}`,\n component: () => import('@/views/Request/Request.vue'),\n },\n {\n name: 'request.examples',\n path: `request/:${PathId.Request}/examples/:${PathId.Examples}`,\n component: () => import('@/views/Request/Request.vue'),\n },\n {\n name: 'collection',\n path: `collection/:${PathId.Collection}`,\n component: () => import('@/views/Collection/Collection.vue'),\n redirect: (_to: RouteLocationNormalized, _from: RouteLocationNormalized) => {\n return {\n name: 'collection.overview',\n }\n },\n children: [\n {\n name: 'collection.overview',\n path: 'overview',\n component: () => import('@/views/Collection/CollectionOverview.vue'),\n },\n {\n name: 'collection.servers',\n path: 'servers',\n component: () => import('@/views/Collection/CollectionServers.vue'),\n children: [\n {\n name: 'collection.servers.edit',\n path: `:${PathId.Servers}`,\n component: () => import('@/views/Collection/CollectionServers.vue'),\n },\n ],\n },\n {\n name: 'collection.environment',\n path: 'environment',\n component: () => import('@/views/Collection/CollectionEnvironment.vue'),\n },\n {\n name: 'collection.authentication',\n path: 'authentication',\n component: () => import('@/views/Collection/CollectionAuthentication.vue'),\n },\n {\n name: 'collection.cookies',\n path: 'cookies',\n component: () => import('@/views/Collection/CollectionCookies.vue'),\n },\n {\n name: 'collection.scripts',\n path: 'scripts',\n component: () => import('@/views/Collection/CollectionScripts.vue'),\n },\n {\n name: 'collection.sync',\n path: 'sync',\n component: () => import('@/views/Collection/CollectionSync.vue'),\n },\n {\n name: 'collection.settings',\n path: 'settings',\n component: () => import('@/views/Collection/CollectionSettings.vue'),\n },\n ],\n },\n ],\n },\n] as RouteRecordRaw[]\n\n/** Routes required by the API client modal */\nexport const modalRoutes = [\n {\n name: 'root',\n path: '/',\n redirect: redirectToActiveWorkspace,\n },\n {\n name: 'workspace.default',\n path: '/workspace',\n redirect: {\n name: 'workspace',\n params: {\n [PathId.Workspace]: 'default',\n },\n },\n },\n {\n name: 'workspace',\n path: `/workspace/:${PathId.Workspace}`,\n redirect: {\n name: 'request.root',\n },\n children: requestRoutes,\n },\n] as RouteRecordRaw[]\n\n/** Routes for the API client app */\nexport const routes = [\n {\n name: 'root',\n path: '/',\n redirect: redirectToActiveWorkspace,\n },\n {\n name: 'workspace.default',\n path: '/workspace',\n redirect: {\n name: 'request.root',\n params: {\n [PathId.Workspace]: 'default',\n },\n },\n },\n {\n name: 'workspace',\n path: `/workspace/:${PathId.Workspace}`,\n redirect: {\n name: 'request.root',\n },\n children: [\n ...requestRoutes,\n {\n name: 'environment.default',\n path: 'environment',\n redirect: (to: RouteLocationNormalized, _from: RouteLocationNormalized) => ({\n name: 'environment',\n params: { ...to.params, [PathId.Environment]: 'default' },\n }),\n },\n {\n name: 'environment',\n path: `environment/:${PathId.Environment}`,\n component: () => import('@/views/Environment/Environment.vue'),\n },\n {\n name: 'environment.collection',\n path: `environment/:${PathId.Collection}/:${PathId.Environment}`,\n component: () => import('@/views/Environment/Environment.vue'),\n props: true,\n },\n {\n name: 'cookies.default',\n path: 'cookies',\n redirect: (to: RouteLocationNormalized, _from: RouteLocationNormalized) => ({\n name: 'cookies',\n params: { ...to.params, [PathId.Cookies]: 'default' },\n }),\n },\n {\n name: 'cookies',\n path: `cookies/:${PathId.Cookies}`,\n component: () => import('@/views/Cookies/Cookies.vue'),\n },\n {\n name: 'servers.default',\n path: 'servers',\n redirect: (to: RouteLocationNormalized, _from: RouteLocationNormalized) => ({\n name: 'servers',\n params: {\n ...to.params,\n [PathId.Collection]: 'default',\n [PathId.Servers]: 'default',\n },\n }),\n },\n {\n name: 'settings.default',\n path: 'settings',\n redirect: (to: RouteLocationNormalized, _from: RouteLocationNormalized) => ({\n name: 'settings',\n params: { ...to.params, [PathId.Settings]: 'general' },\n }),\n },\n {\n name: 'settings',\n path: `settings/:${PathId.Settings}`,\n component: () => import('@/views/Settings/Settings.vue'),\n },\n ],\n },\n] as RouteRecordRaw[]\n","import type { Cookie } from '@scalar/oas-utils/entities/cookie'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { Collection, Request, RequestExample, Server } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport type { Router } from 'vue-router'\n\nimport { PathId } from '@/routes'\n\n/** Getter function for router parameters */\nexport function getRouterParams(router?: Router) {\n return () => {\n const pathParams = {\n [PathId.Collection]: 'default' as Collection['uid'],\n [PathId.Environment]: 'default' as Environment['uid'],\n [PathId.Request]: 'default' as Request['uid'],\n [PathId.Examples]: 'default' as RequestExample['uid'],\n [PathId.Schema]: 'default' as string,\n [PathId.Cookies]: 'default' as Cookie['uid'],\n [PathId.Servers]: 'default' as Server['uid'],\n [PathId.Workspace]: 'default' as Workspace['uid'],\n [PathId.Settings]: 'default' as string,\n } as const\n\n const currentRoute = router?.currentRoute.value\n\n if (currentRoute) {\n ;(Object.keys(pathParams) as (keyof typeof pathParams)[]).forEach((k) => {\n if (currentRoute.params[k]) {\n // @ts-expect-error this gives us good types without redoing PathId :)\n pathParams[k] = currentRoute.params[k]\n }\n })\n }\n\n return pathParams\n }\n}\n","import type { Cookie } from '@scalar/oas-utils/entities/cookie'\nimport { type Environment, environmentSchema } from '@scalar/oas-utils/entities/environment'\nimport type { Collection, Request, RequestExample, Server } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { isDefined } from '@scalar/oas-utils/helpers'\nimport { type InjectionKey, computed, inject } from 'vue'\nimport type { Router } from 'vue-router'\n\nimport { flattenEnvVars } from '@/libs/string-template'\nimport { PathId } from '@/routes'\n\nimport { getRouterParams } from './router-params'\n\ntype CreateActiveEntitiesStoreParams = {\n collections: Record<string, Collection>\n environments: Record<string, Environment>\n requestExamples: Record<string, RequestExample>\n requests: Record<string, Request>\n servers: Record<string, Server>\n workspaces: Record<string, Workspace>\n router?: Router\n}\n\nexport type EnvVariable = {\n key: string\n value: any\n source: 'global' | 'collection'\n}\n\n/**\n * Create the active entities store\n *\n * We need the factory function to pass the router instance\n */\nexport const createActiveEntitiesStore = ({\n collections,\n requestExamples,\n requests,\n router,\n servers,\n workspaces,\n}: CreateActiveEntitiesStoreParams) => {\n /** Gives the required UID usually per route */\n const activeRouterParams = computed(getRouterParams(router))\n\n /** The currently selected workspace OR the first one */\n const activeWorkspace = computed(\n () => workspaces[activeRouterParams.value[PathId.Workspace]] ?? Object.values(workspaces)[0],\n )\n\n /** Ordered list of the active workspace's collections with drafts last */\n const activeWorkspaceCollections = computed(\n () =>\n activeWorkspace.value?.collections\n .map((uid) => collections[uid])\n .filter(isDefined)\n .sort((a, b) => {\n if (a.info?.title === 'Drafts') {\n return 1\n }\n if (b.info?.title === 'Drafts') {\n return -1\n }\n return 0\n }) ?? [],\n )\n\n /** Simplified list of servers in the workspace for displaying */\n const activeWorkspaceServers = computed(() =>\n activeWorkspaceCollections.value?.flatMap((collection) => collection.servers.map((uid) => servers[uid])),\n )\n\n /** Simplified list of requests in the workspace for displaying */\n const activeWorkspaceRequests = computed(\n () => activeWorkspaceCollections.value?.flatMap((collection) => collection.requests) ?? [],\n )\n\n /** The currently selected environment */\n const activeEnvironment = computed(() => {\n if (!activeWorkspace.value?.activeEnvironmentId) {\n return environmentSchema.parse({\n uid: 'default',\n color: '#FFFFFF',\n name: 'No Environment',\n value: JSON.stringify(activeWorkspace.value?.environments, null, 2),\n })\n }\n\n const activeEnvironmentCollection = activeWorkspaceCollections.value.find(\n (c) => c['x-scalar-environments']?.[activeWorkspace.value?.activeEnvironmentId ?? ''],\n )\n\n if (activeEnvironmentCollection && activeWorkspace.value?.activeEnvironmentId) {\n return environmentSchema.parse({\n uid: activeWorkspace.value.activeEnvironmentId,\n name: activeWorkspace.value.activeEnvironmentId,\n value: JSON.stringify(\n activeEnvironmentCollection['x-scalar-environments']?.[activeWorkspace.value?.activeEnvironmentId]?.variables,\n null,\n 2,\n ),\n color:\n activeEnvironmentCollection['x-scalar-environments']?.[activeWorkspace.value?.activeEnvironmentId]?.color ||\n '#FFFFFF',\n isDefault: false,\n })\n }\n\n return environmentSchema.parse({\n uid: 'default',\n color: '#FFFFFF',\n name: 'No Environment',\n value: JSON.stringify(activeWorkspace.value.environments, null, 2),\n })\n })\n\n /**\n * Request associated with the current route\n *\n * undefined must be handled as we may have no requests\n */\n const activeRequest = computed(() => {\n const key = activeRouterParams.value[PathId.Request]\n\n // Can use this fallback to get an active request\n const collection =\n collections[activeRouterParams.value.collection] || collections[activeWorkspace.value?.collections[0] ?? '']\n\n return requests[key] || requests[collection?.requests[0] ?? ''] || Object.values(requests)[0]\n })\n\n /** Grabs the currently active example using the path param */\n const activeExample = computed(() => {\n const key =\n activeRouterParams.value[PathId.Examples] === 'default'\n ? activeRequest.value?.examples[0] || ''\n : activeRouterParams.value[PathId.Examples]\n\n return requestExamples[key]\n })\n\n /**\n * First collection that the active request is in\n */\n const activeCollection = computed(() => {\n // Grab the collection from route parameters.\n const collection = collections[activeRouterParams.value[PathId.Collection]]\n\n if (collection) {\n return collection\n }\n\n // If no collection is found, try to grab the collection from the request.\n const requestUid = activeRequest.value?.uid\n if (requestUid) {\n return Object.values(collections).find((c) => c.requests?.includes(requestUid))\n }\n\n // If no collection is found, try to grab the collection from the workspace.\n const fallbackUid = activeWorkspace.value?.collections[0] ?? collections[0]?.uid ?? ''\n\n return collections[fallbackUid]\n })\n\n /** The currently selected server in the addressBar */\n const activeServer = computed(() => {\n // Request has a selected server\n if (activeRequest.value?.selectedServerUid) {\n // Return server if selected\n const server = servers[activeRequest.value.selectedServerUid]\n if (server) {\n return server\n }\n }\n\n // Collection has a selected server\n if (activeCollection.value?.selectedServerUid) {\n // Return server if selected\n const server = servers[activeCollection.value.selectedServerUid]\n if (server) {\n return server\n }\n }\n\n return undefined\n })\n\n /** Cookie associated with the current route */\n const activeCookieId = computed(() =>\n activeRouterParams.value[PathId.Cookies] === 'default'\n ? (activeWorkspace.value?.cookies[0] ?? ('default' as Cookie['uid']))\n : activeRouterParams.value[PathId.Cookies],\n )\n\n /**\n * Active list all available substitution variables. Server variables\n * will be populated into the environment on spec loading\n */\n const activeEnvVariables = computed<EnvVariable[]>(() => {\n const globalEnvironment = activeWorkspace.value?.environments ?? {}\n const collectionEnvironment = activeEnvironment.value.uid ? JSON.parse(activeEnvironment.value.value) : {}\n\n const globalEnvVars: EnvVariable[] = flattenEnvVars(globalEnvironment).map(([key, value]) => ({\n key,\n value,\n source: 'global',\n }))\n\n const collectionEnvVars: EnvVariable[] = flattenEnvVars(collectionEnvironment).map(([key, value]) => ({\n key,\n value,\n source: 'collection',\n }))\n\n const mergedEnvVars = new Map<string, EnvVariable>()\n\n collectionEnvVars.forEach((envVar) => {\n mergedEnvVars.set(envVar.key, envVar)\n })\n\n globalEnvVars.forEach((envVar) => {\n if (!mergedEnvVars.has(envVar.key)) {\n mergedEnvVars.set(envVar.key, envVar)\n }\n })\n\n return Array.from(mergedEnvVars.values())\n })\n\n return {\n activeCollection,\n activeCookieId,\n activeExample,\n activeRequest,\n activeRouterParams,\n activeEnvironment,\n activeServer,\n activeWorkspace,\n activeWorkspaceCollections,\n activeWorkspaceServers,\n activeEnvVariables,\n activeWorkspaceRequests,\n }\n}\n\nexport type ActiveEntitiesStore = ReturnType<typeof createActiveEntitiesStore>\nexport const ACTIVE_ENTITIES_SYMBOL = Symbol() as InjectionKey<ActiveEntitiesStore>\n\n/**\n * The active entities store\n *\n * This store returns anything related to the currently active entities\n * The only reason this is a store and not a simple hook is due to storing the current router here\n *\n * @deprecated due to components being used outside of the client now, we should prop drill instead of this hook/store\n */\nexport const useActiveEntities = (): ActiveEntitiesStore => {\n const store = inject(ACTIVE_ENTITIES_SYMBOL)\n if (!store) {\n throw new Error('Active entities store not provided')\n }\n return store\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport {\n type Collection,\n type CollectionPayload,\n type XScalarEnvironment,\n collectionSchema,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Initiate the workspace collections */\nexport function createStoreCollections(useLocalStorage: boolean) {\n const collections = reactive<Record<string, Collection>>({})\n const collectionMutators = mutationFactory(collections, reactive({}), useLocalStorage && LS_KEYS.COLLECTION)\n\n return {\n collections,\n collectionMutators,\n }\n}\n\n/** Extended mutators and data for collections that required workspace access */\nexport function extendedCollectionDataFactory({\n requests,\n requestMutators,\n requestExamples,\n requestExampleMutators,\n workspaces,\n workspaceMutators,\n collections,\n collectionMutators,\n tagMutators,\n serverMutators,\n}: StoreContext) {\n const addCollection = (payload: CollectionPayload, workspaceUid: Workspace['uid']) => {\n const collection = collectionSchema.parse(payload)\n const workspace = workspaces[workspaceUid]\n if (workspace) {\n workspaceMutators.edit(workspaceUid, 'collections', [...workspace.collections, collection.uid])\n }\n\n collectionMutators.add(collection)\n\n return collection\n }\n\n const deleteCollection = (collection: Collection, workspace: Workspace) => {\n if (!workspace.uid) {\n return\n }\n\n if (collections[collection.uid]?.info?.title === 'Drafts') {\n console.warn('The drafts collection cannot be deleted')\n return\n }\n\n if (Object.values(collections).length === 1) {\n console.warn('You must have at least one collection')\n return\n }\n\n // Handle data cleanup\n // NOTE: This is only for local memory management; unassociated objects will not be synced\n\n // Remove all tags\n collection.tags.forEach((uid) => tagMutators.delete(uid))\n\n // Remove requests\n collection.requests.forEach((uid) => {\n const request = requests[uid]\n if (!request) {\n return\n }\n\n requestMutators.delete(uid)\n request.examples.forEach((e) => requestExamples[e] && requestExampleMutators.delete(e))\n })\n\n // Remove servers\n collection.servers.forEach((uid) => {\n if (uid) {\n serverMutators.delete(uid)\n }\n })\n\n // Remove collection from workspace\n workspaceMutators.edit(\n workspace.uid,\n 'collections',\n workspace.collections.filter((uid) => uid !== collection.uid),\n )\n\n collectionMutators.delete(collection.uid)\n }\n\n const addCollectionEnvironment = (\n environmentName: string,\n environment: XScalarEnvironment,\n collectionUid: Collection['uid'],\n ) => {\n const collection = collections[collectionUid]\n if (collection) {\n const currentEnvironments = collection['x-scalar-environments'] || {}\n collectionMutators.edit(collectionUid, 'x-scalar-environments', {\n ...currentEnvironments,\n [environmentName]: environment,\n })\n }\n }\n\n const removeCollectionEnvironment = (environmentName: string, collectionUid: Collection['uid']) => {\n const collection = collections[collectionUid]\n if (collection) {\n const currentEnvironments = collection['x-scalar-environments'] || {}\n if (environmentName in currentEnvironments) {\n delete currentEnvironments[environmentName]\n collectionMutators.edit(collectionUid, 'x-scalar-environments', currentEnvironments)\n }\n }\n }\n\n return {\n addCollection,\n deleteCollection,\n addCollectionEnvironment,\n removeCollectionEnvironment,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport type { Cookie } from '@scalar/oas-utils/entities/cookie'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\n/** Create cookie mutators for the workspace */\nexport function createStoreCookies(useLocalStorage: boolean) {\n const cookies = reactive<Record<string, Cookie>>({})\n\n const cookieMutators = mutationFactory(cookies, reactive({}), useLocalStorage && LS_KEYS.COOKIE)\n\n return {\n cookies,\n cookieMutators,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport { type Environment, environmentSchema } from '@scalar/oas-utils/entities/environment'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Generate reactive environments for the workspace */\nexport function createStoreEnvironments(useLocalStorage: boolean) {\n /** Initialize default environment */\n const environments = reactive<Record<string, Environment>>({})\n const environmentMutators = mutationFactory(environments, reactive({}), useLocalStorage && LS_KEYS.ENVIRONMENT)\n\n // Add default environment\n environmentMutators.add(\n environmentSchema.parse({\n uid: 'default',\n name: 'Default Environment',\n color: '#FFFFFF',\n value: JSON.stringify({ exampleKey: 'exampleValue' }, null, 2),\n isDefault: true,\n }),\n )\n\n return {\n environments,\n environmentMutators,\n }\n}\n\n/** Extended environment data factory where workspace access is needed */\nexport function extendedEnvironmentDataFactory({ environmentMutators }: StoreContext) {\n /** prevent deletion of the default environment */\n const deleteEnvironment = (uid: Environment['uid']) => {\n if (uid === 'default') {\n console.warn('Default environment cannot be deleted.')\n return\n }\n environmentMutators.delete(uid)\n }\n\n return { deleteEnvironment }\n}\n","export type EventBusListener<P = any> = (payload?: P) => void\n\nexport type EventBus<P> = {\n /**\n * Subscribe to an event. When calling emit, the listeners will execute.\n * @param listener watch listener.\n * @returns a stop function to remove the current callback.\n */\n on: (listener: EventBusListener<P>) => () => void\n /**\n * Similar to `on`, but only fires once\n * @param listener watch listener.\n * @returns a stop function to remove the current callback.\n */\n once: (listener: EventBusListener<P>) => () => void\n /**\n * Emit an event, the corresponding event listeners will execute.\n * @param event data sent.\n */\n emit: (payload?: P) => void\n /**\n * Remove the corresponding listener.\n * @param listener watch listener.\n */\n off: (listener: EventBusListener<P>) => void\n /**\n * Clear all events\n */\n reset: () => void\n /**\n * Fetches an array of all active listeners\n */\n listeners: () => EventBusListener<P>[]\n}\n\n/**\n * Creates a ClientEvent with a payload of type P\n *\n * Modified from `@vueuse/core/useEventBus`\n * @see https://github.com/vueuse/vueuse/tree/v10.10.0/packages/core/useEventBus\n */\nexport function createEventBus<P = any>(): EventBus<P> {\n const listeners = new Set<EventBusListener<P>>()\n\n function on(listener: EventBusListener<P>) {\n listeners.add(listener)\n\n const _off = () => off(listener)\n return _off\n }\n\n function once(listener: EventBusListener<P>) {\n function _listener(...args: any[]) {\n off(_listener)\n listener(...args)\n }\n return on(_listener)\n }\n\n function off(listener: EventBusListener<P>): void {\n listeners.delete(listener)\n }\n\n function reset() {\n listeners.clear()\n }\n\n function emit(payload?: P) {\n listeners?.forEach((v) => v(payload))\n }\n\n return {\n on,\n once,\n off,\n emit,\n reset,\n listeners: () => Array.from(listeners),\n }\n}\n","import type { CommandPaletteEvent } from '@/components/CommandPalette/TheCommandPalette.vue'\nimport { createEventBus } from '@/libs/event-bus'\nimport type { HotKeyEvent } from '@/libs/hot-keys'\nimport type { RequestStatus } from '@/libs/send-request'\n\n/** Create the store for the api client events */\nexport function createStoreEvents() {\n return {\n /**\n * Event bus to execute requests, usually triggered by the send button in the address bar\n * OR the keyboard shortcut\n */\n executeRequest: createEventBus<{ requestUid?: string }>(),\n /**\n * Event bus to focus the address bar or send button\n */\n focusAddressBar: createEventBus(),\n /**\n * Event bus to cancel requests, usually triggered by response loading overlay\n */\n cancelRequest: createEventBus(),\n /**\n * Event bus to keep track of when a request is started, stopped, or aborted\n */\n requestStatus: createEventBus<RequestStatus>(),\n /**\n * Event bus for controlling the Command Palette\n *\n * @param commandName - the command name you wish to execute, leave empty for the full palette\n */\n commandPalette: createEventBus<CommandPaletteEvent>(),\n /**\n * Event bus for handling hot keys\n */\n hotKeys: createEventBus<HotKeyEvent>(),\n }\n}\n","import { type ApiClientConfiguration, apiClientConfigurationSchema } from '@scalar/types/api-reference'\nimport { type InjectionKey, type Ref, inject, ref } from 'vue'\n\nexport const CLIENT_CONFIGURATION_SYMBOL = Symbol() as InjectionKey<Ref<ApiClientConfiguration>>\n\n/** Hook for easy access to the reference configuration */\nexport const useClientConfig = () => inject(CLIENT_CONFIGURATION_SYMBOL, ref(apiClientConfigurationSchema.parse({})))\n","import type { Request } from '@scalar/oas-utils/entities/spec'\n\n/** Convert path string like '/planets/{planetId}' to regex pattern /\\/planets/([^/]+)/ */\nexport const pathToRegex = (path: string) => {\n const regxStr =\n '^' + // start anchor\n path\n .replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&') // escape special regex chars\n .replace(/\\\\\\{([^}]+)\\\\\\}/g, '([^/]+)') + // replace {param} with capture group\n '(\\\\?.*)?$' // optional query parameters at the end\n\n return new RegExp(regxStr)\n}\n\n/**\n * Takes a path and method and returns the request that matches the path and method while taking\n * path params into account by converting to a regex. Will also return the path params if they exist.\n *\n * @example path can be /planets/{planetId} OR /planets/1\n */\nexport const findRequestByPathMethod = (path: string, method: string, requests: Request[]) => {\n let pathParams: { key: string; value: string }[] = []\n\n const request = requests.find((r) => {\n if (r.method.toLowerCase() !== method.toLowerCase()) {\n return false\n }\n if (r.path === path) {\n return true\n }\n\n const regex = pathToRegex(r.path)\n const match = path.match(regex)\n\n // Extract path params from the match\n if (match) {\n pathParams = match.slice(1).flatMap((value, index) => {\n const key = r.path.split('{')[index + 1]?.split('}')[0]\n if (!key) {\n return []\n }\n return [{ key, value }]\n })\n return true\n }\n\n return false\n })\n\n return { request, pathParams }\n}\n","import type { Operation } from '@scalar/oas-utils/entities/spec'\n\nimport type { OpenClientPayload } from '@/libs/create-client'\nimport { findRequestByPathMethod } from '@/libs/find-request'\n\n/**\n * Get the request uid by path and method\n */\nexport const getRequestUidByPathMethod = (\n requests: Record<string, Operation>,\n payload?: Omit<OpenClientPayload, '_source'>,\n) => {\n const { requestUid, method, path } = payload ?? {}\n\n // If requestUid is provided, return it directly\n if (requestUid) {\n return requestUid\n }\n\n // In case theres no path or method provided, return the first\n if (!path || !method) {\n return Object.keys(requests)[0]\n }\n\n // Convert requests record to array for findRequestByPathMethod\n const requestsArray = Object.values(requests)\n\n // First try to find exact match (prioritize exact paths over pattern matches)\n const exactMatch = requestsArray.find(\n (item) => item.path.toLowerCase() === path.toLowerCase() && item.method.toLowerCase() === method.toLowerCase(),\n )\n\n if (exactMatch) {\n return exactMatch.uid\n }\n\n // If no exact match, use pattern matching logic for path parameters\n const { request } = findRequestByPathMethod(path, method, requestsArray)\n\n return request?.uid || Object.keys(requests)[0]\n}\n","import { cookieSchema } from '@scalar/oas-utils/entities/cookie'\nimport { environmentSchema } from '@scalar/oas-utils/entities/environment'\nimport {\n collectionSchema,\n requestExampleSchema,\n requestSchema,\n securitySchemeSchema,\n serverSchema,\n tagSchema,\n} from '@scalar/oas-utils/entities/spec'\nimport { workspaceSchema } from '@scalar/oas-utils/entities/workspace'\nimport { schemaModel } from '@scalar/oas-utils/helpers'\nimport { DATA_VERSION, DATA_VERSION_LS_LEY, migrator } from '@scalar/oas-utils/migrations'\nimport type { ZodSchema } from 'zod'\n\nimport type { WorkspaceStore } from '@/store'\n\n/** Loads the migrated resource into the mutator safely */\nconst loadResources = <T extends (object & { uid: string })[]>(\n resources: T,\n schema: ZodSchema<T[number], any>,\n add: (payload: T[number]) => void | T[number],\n) =>\n resources.forEach((payload) => {\n // Use schema model for safe parsing\n const resource = schemaModel(payload, schema, false)\n\n // Success, a failure should log a warning in the console already through the schema model\n if (resource) {\n add(resource)\n }\n })\n\n/**\n * Loads all resources from localStorage and applies any migrations, then loads into mutators\n * We use the raw mutator.add here instead of the custom ones because we do NOT want any side effects\n *\n * Currently not working for workspace\n */\nexport const loadAllResources = (mutators: WorkspaceStore) => {\n const {\n collectionMutators,\n cookieMutators,\n environmentMutators,\n tagMutators,\n requestExampleMutators,\n requestMutators,\n serverMutators,\n securitySchemeMutators,\n workspaceMutators,\n } = mutators\n\n try {\n // Hit our local storage data migrator\n const {\n collections,\n cookies,\n environments,\n requestExamples,\n requests,\n servers,\n securitySchemes,\n tags,\n workspaces,\n } = migrator().arrays\n\n // Load the migrated data up into the mutators with safe parsing\n // TODO: we should probably make rawAdd -> add, and add a new name for adding with side effects\n loadResources(collections, collectionSchema, collectionMutators.rawAdd)\n loadResources(cookies, cookieSchema, cookieMutators.add)\n loadResources(environments, environmentSchema, environmentMutators.add)\n loadResources(requestExamples, requestExampleSchema, requestExampleMutators.rawAdd)\n loadResources(requests, requestSchema, requestMutators.rawAdd)\n loadResources(servers, serverSchema, serverMutators.rawAdd)\n loadResources(securitySchemes, securitySchemeSchema, securitySchemeMutators.rawAdd)\n loadResources(tags, tagSchema, tagMutators.rawAdd)\n loadResources(workspaces, workspaceSchema, workspaceMutators.rawAdd)\n\n // Set localStorage version for future migrations\n localStorage.setItem(DATA_VERSION_LS_LEY, DATA_VERSION)\n } catch (e) {\n console.error(e)\n }\n}\n","import { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport type { SecurityScheme } from '@scalar/oas-utils/entities/spec'\nimport { type Workspace, workspaceSchema } from '@scalar/oas-utils/entities/workspace'\nimport { DATA_VERSION, DATA_VERSION_LS_LEY } from '@scalar/oas-utils/migrations'\nimport type { Path, PathValue } from '@scalar/object-utils/nested'\nimport type { OpenAPI } from '@scalar/openapi-types'\nimport { type ApiClientConfiguration, apiClientConfigurationSchema } from '@scalar/types/api-reference'\nimport { type Component, createApp, ref, watch } from 'vue'\nimport type { Router } from 'vue-router'\n\nimport { CLIENT_CONFIGURATION_SYMBOL } from '@/hooks/useClientConfig'\nimport { type ClientLayout, LAYOUT_SYMBOL } from '@/hooks/useLayout'\nimport { SIDEBAR_SYMBOL, createSidebarState } from '@/hooks/useSidebar'\nimport { getRequestUidByPathMethod } from '@/libs/get-request-uid-by-path-method'\nimport { loadAllResources } from '@/libs/local-storage'\nimport { PLUGIN_MANAGER_SYMBOL, createPluginManager } from '@/plugins'\nimport { ACTIVE_ENTITIES_SYMBOL, createActiveEntitiesStore } from '@/store/active-entities'\nimport { WORKSPACE_SYMBOL, type WorkspaceStore, createWorkspaceStore } from '@/store/store'\n\nexport type OpenClientPayload = (\n | {\n path: string\n method: OpenAPI.HttpMethod | Uppercase<OpenAPI.HttpMethod>\n requestUid?: never\n }\n | {\n path?: never\n method?: never\n requestUid: string\n }\n) & {\n _source?: 'api-reference' | 'gitbook'\n}\n\nexport type CreateApiClientParams = {\n /** Element to mount the references to */\n el: HTMLElement | null\n /** Main vue app component to create the vue app */\n appComponent: Component\n /** Configuration object for API client */\n configuration?: Partial<ApiClientConfiguration>\n /** Read only version of the client app */\n isReadOnly?: boolean\n /** Persist the workspace to localStoragfe */\n persistData?: boolean\n /**\n * Will attempt to mount the references immediately\n * For SSR this may need to be blocked and done client side\n */\n mountOnInitialize?: boolean\n /** Instance of a vue router */\n router: Router\n /** In case the store has been instantiated beforehand */\n store?: WorkspaceStore | undefined\n /**\n * The layout of the client\n * @see {@link ClientLayout}\n */\n layout?: ClientLayout\n}\n\n/**\n * ApiClient type\n *\n * We need to do this due to some typescript type propagation errors\n * This is pretty much add properties as they are needed\n */\nexport type ApiClient = Omit<ReturnType<typeof createApiClient>, 'app' | 'store'> & {\n /** Add properties as they are needed, see above */\n app: { unmount: () => void }\n /**\n * The main workspace store from the client\n * These refs don't wanna play nice with typescript, if we need them we can de-reference them\n */\n store: Omit<WorkspaceStore, 'router' | 'events' | 'sidebarWidth' | 'proxyUrl' | 'requestHistory'>\n}\n\n/**\n * Sync method to create the api client vue app and store\n *\n * This method will NOT import the spec, just create the modal so you must use update/updateConfig before opening\n */\nexport const createApiClient = ({\n el,\n appComponent,\n configuration: _configuration = {},\n isReadOnly = false,\n store: _store,\n persistData = true,\n mountOnInitialize = true,\n layout = 'desktop',\n router,\n}: CreateApiClientParams) => {\n // Parse the config\n const configuration = ref(apiClientConfigurationSchema.parse(_configuration))\n\n // Create the store if it wasn't passed in\n const store =\n _store ||\n createWorkspaceStore({\n proxyUrl: configuration.value.proxyUrl,\n theme: configuration.value.theme,\n showSidebar: configuration.value.showSidebar ?? true,\n hideClientButton: configuration.value.hideClientButton ?? false,\n _integration: configuration.value._integration,\n useLocalStorage: persistData,\n })\n\n // Create the router based active entities store\n const activeEntities = createActiveEntitiesStore({ ...store, router })\n\n // Create the sidebar state\n const sidebarState = createSidebarState({ layout })\n\n // Create the plugin manager\n const pluginManager = createPluginManager({\n plugins: configuration.value.plugins ?? [],\n })\n\n // Safely check for localStorage availability\n const hasLocalStorage = () => {\n try {\n return typeof window !== 'undefined' && window.localStorage !== undefined\n } catch {\n return false\n }\n }\n\n // Load from localStorage if available and enabled\n if (hasLocalStorage() && localStorage.getItem(LS_KEYS.WORKSPACE) && !isReadOnly) {\n try {\n const size: Record<string, string> = {}\n let _lsTotal = 0\n let _xLen = 0\n let _key = ''\n\n for (_key in localStorage) {\n if (!Object.hasOwn(localStorage, _key)) {\n continue\n }\n _xLen = (localStorage[_key].length + _key.length) * 2\n _lsTotal += _xLen\n size[_key] = (_xLen / 1024).toFixed(2) + ' KB'\n }\n size['Total'] = (_lsTotal / 1024).toFixed(2) + ' KB'\n console.table(size)\n\n loadAllResources(store)\n } catch (error) {\n console.warn('Failed to load from localStorage:', error)\n }\n }\n // Create the default store\n else if (!isReadOnly && !configuration.value.url && !configuration.value.content) {\n // Create default workspace\n store.workspaceMutators.add({\n uid: 'default' as Workspace['uid'],\n name: 'Workspace',\n proxyUrl: configuration.value.proxyUrl,\n })\n\n if (hasLocalStorage()) {\n try {\n localStorage.setItem(DATA_VERSION_LS_LEY, DATA_VERSION)\n } catch (error) {\n console.warn('Failed to set localStorage version:', error)\n }\n }\n }\n // Add a barebones workspace if we want to load a spec in the modal\n else {\n const workspace = workspaceSchema.parse({\n uid: 'default',\n name: 'Workspace',\n proxyUrl: configuration.value.proxyUrl,\n })\n store.workspaceMutators.rawAdd(workspace)\n }\n\n const app = createApp(appComponent)\n app.use(router)\n // Provide the workspace store for the useWorkspace hook\n app.provide(WORKSPACE_SYMBOL, store)\n // Provide the layout for the useLayout hook\n app.provide(LAYOUT_SYMBOL, layout)\n // Provide the active entities store\n app.provide(ACTIVE_ENTITIES_SYMBOL, activeEntities)\n // Provide the sidebar state\n app.provide(SIDEBAR_SYMBOL, sidebarState)\n // Provide the client config\n app.provide(CLIENT_CONFIGURATION_SYMBOL, configuration)\n // Provide the plugin manager\n app.provide(PLUGIN_MANAGER_SYMBOL, pluginManager)\n // Set an id prefix for useId so we don't have collisions with other Vue apps\n app.config.idPrefix = 'scalar-client'\n\n const {\n collectionMutators,\n importSpecFile,\n importSpecFromUrl,\n modalState,\n requests,\n securitySchemes,\n securitySchemeMutators,\n servers,\n workspaceMutators,\n requestExampleMutators,\n } = store\n const { activeCollection, activeWorkspace } = activeEntities\n\n // Mount the vue app\n const mount = (mountingEl = el) => {\n if (!mountingEl) {\n console.error(\n '[@scalar/api-client-modal] Could not create the API client.',\n 'Invalid HTML element provided.',\n 'Read more: https://github.com/scalar/scalar/tree/main/packages/api-client',\n )\n\n return\n }\n app.mount(mountingEl)\n }\n if (mountOnInitialize) {\n mount()\n }\n\n /** Route to the specified method and path */\n const route = (payload?: OpenClientPayload) => {\n // Find the request from path + method\n const resolvedRequestUid = getRequestUidByPathMethod(requests, payload)\n\n // Redirect to the request\n if (resolvedRequestUid) {\n router.push({\n name: 'request',\n query: payload?._source ? { source: payload._source } : {},\n params: {\n workspace: 'default',\n request: resolvedRequestUid,\n },\n })\n } else {\n console.warn('[@scalar/api-client] Could not find request for path and method', payload)\n }\n }\n\n /** Reset the client store */\n const resetStore = () => {\n store.collectionMutators.reset()\n store.requestMutators.reset()\n store.requestExampleMutators.reset()\n store.securitySchemeMutators.reset()\n store.serverMutators.reset()\n store.tagMutators.reset()\n workspaceMutators.edit(activeWorkspace.value?.uid, 'collections', [])\n }\n\n return {\n /** The vue app instance for the modal, be careful with this */\n app,\n resetStore,\n /**\n * Update the API client config\n *\n * Deletes the current store before importing again for now, in the future will Diff and only update what is needed\n */\n updateConfig: async (_newConfig: Partial<ApiClientConfiguration>) => {\n const newConfig = apiClientConfigurationSchema.parse(_newConfig)\n\n // When to rigger rebuilding the store (until we diff) this is just a temp hack BUT do not put anything that\n // has a default here as it will always trigger as the config has already been parsed\n if (\n newConfig.url ||\n newConfig.content ||\n newConfig.servers ||\n newConfig.authentication ||\n newConfig.slug ||\n newConfig.title ||\n newConfig.baseServerURL ||\n newConfig.proxyUrl ||\n newConfig.showSidebar\n ) {\n // Update the spec, reset the store first\n resetStore()\n\n /** Add any extra properties to the config */\n const config = {\n ...newConfig,\n useCollectionSecurity: isReadOnly,\n }\n\n // Update the config ref\n configuration.value = config\n\n if (newConfig.url) {\n await importSpecFromUrl(newConfig.url, activeWorkspace.value?.uid ?? 'default', config)\n } else if (newConfig.content) {\n await importSpecFile(newConfig.content, activeWorkspace.value?.uid ?? 'default', config)\n } else {\n console.error(\n '[@scalar/api-client-modal] Could not create the API client.',\n 'Please provide an OpenAPI document: { url: \"…\" }',\n 'Read more: https://github.com/scalar/scalar/tree/main/packages/api-client',\n )\n }\n }\n },\n /** Update the currently selected server via URL */\n updateServer: (serverUrl: string) => {\n const server = Object.values(servers).find((s) => s.url === serverUrl)\n\n if (server && activeCollection.value) {\n collectionMutators.edit(activeCollection.value?.uid, 'selectedServerUid', server.uid)\n }\n },\n /** Update the currently selected server via URL */\n onUpdateServer: (callback: (url: string) => void) => {\n watch(\n () => activeCollection.value?.selectedServerUid,\n (uid) => {\n const server = Object.values(servers).find((s) => s.uid === uid)\n if (server?.url) {\n callback(server.url)\n }\n },\n )\n },\n /**\n * Update the auth values, we currently don't change the auth selection\n */\n updateAuth: <P extends Path<SecurityScheme>>({\n nameKey,\n propertyKey,\n value,\n }: {\n nameKey: string\n propertyKey: P\n value: NonNullable<PathValue<SecurityScheme, P>>\n }) => {\n const schemes = Object.values(securitySchemes)\n const scheme = schemes.find((s) => s.nameKey === nameKey)\n\n if (scheme) {\n securitySchemeMutators.edit(scheme.uid, propertyKey, value)\n }\n },\n /** Route to a method + path */\n route,\n\n /** Open the API client modal and optionally route to a request */\n open: (payload?: OpenClientPayload) => {\n const { method, path, requestUid } = payload ?? {}\n if ((method && path) || requestUid) {\n route(payload)\n }\n\n // Open the modal\n modalState.open = true\n },\n /** Mount the references to a given element */\n mount,\n /** State for controlling the modal */\n modalState,\n /* The workspace store */\n store,\n /** Update the currently selected example */\n updateExample: (exampleKey: string, operationId: string) => {\n if (!exampleKey || !operationId) {\n return\n }\n\n const request = Object.values(requests).find(\n ({ operationId: reqOperationId, path }) => reqOperationId === operationId || path === operationId,\n )\n if (!request) {\n return\n }\n\n const contentType = Object.keys(request.requestBody?.content || {})[0] || ''\n const example = request.requestBody?.content?.[contentType]?.examples?.[exampleKey]\n if (!example) {\n return\n }\n\n requestExampleMutators.edit(request.examples[0], 'body.raw.value', prettyPrintJson(example.value))\n },\n }\n}\n","import type { Environment } from '@scalar/oas-utils/entities/environment'\n\nexport type EnvVariables = { key: string; value: string; source: 'global' | 'collection' }[]\n\nexport type EnvConfig = {\n variables: Record<string, string | { default: string; description?: string | undefined }>\n color?: string | undefined\n description?: string | undefined\n}\n\n/** Gets the color of an environment with default fallback */\nexport function getEnvColor(environment: Environment): string {\n return environment?.color || '#FFFFFF'\n}\n","import type { EnvVariables } from '@/libs/env-helpers'\n\n/** Parses the active environment variables and extracts key-value pairs. */\nexport function parseEnvVariables(activeEnvVariables: EnvVariables) {\n return activeEnvVariables.flatMap((variable) => {\n if (variable.key === 'value') {\n try {\n const parsedValue = JSON.parse(variable.value)\n return Object.keys(parsedValue).map((key) => ({\n key,\n value: parsedValue[key],\n source: variable.source,\n }))\n } catch (_e) {\n // Skip invalid environment editor JSON entries\n }\n }\n return [variable]\n })\n}\n","import { isValidUrl } from '@scalar/oas-utils/helpers'\n\n/** Checks whether the given string is an URL */\nexport function isUrl(input: string | null) {\n if (!input) {\n return false\n }\n if (!(input.startsWith('http://') || input.startsWith('https://'))) {\n return false\n }\n\n return isValidUrl(input)\n}\n","import { json, yaml } from '@scalar/oas-utils/helpers'\n\nimport { isUrl } from './isUrl'\n\nexport type OpenApiDocumentDetails = {\n version: string\n type: 'json' | 'yaml'\n title: string | undefined\n}\n\n/** Try to extract details from the info */\nfunction tryGetInfo(info: any) {\n return {\n title: typeof info?.title === 'string' ? `${info?.title}` : undefined,\n }\n}\n\n/**\n * Get the base Swagger/OpenAPI details from the given string\n */\nexport function getOpenApiDocumentDetails(input: string | null): OpenApiDocumentDetails | undefined {\n if (!input || isUrl(input)) {\n return undefined\n }\n\n try {\n const result = json.parse(input ?? '')\n\n if (typeof result?.openapi === 'string') {\n return {\n version: `OpenAPI ${result.openapi}`,\n type: 'json',\n ...tryGetInfo(result.info),\n }\n }\n\n if (typeof result?.swagger === 'string') {\n return {\n version: `Swagger ${result.swagger}`,\n type: 'json',\n ...tryGetInfo(result.info),\n }\n }\n\n return undefined\n } catch {\n //\n }\n\n try {\n const result = yaml.parse(input ?? '')\n\n if (typeof result?.openapi === 'string') {\n return {\n version: `OpenAPI ${result.openapi}`,\n type: 'yaml',\n ...tryGetInfo(result.info),\n }\n }\n\n if (typeof result?.swagger === 'string') {\n return {\n version: `Swagger ${result.swagger}`,\n type: 'yaml',\n ...tryGetInfo(result.info),\n }\n }\n\n return undefined\n } catch {\n //\n }\n\n return undefined\n}\n","import { isMacOS } from '@scalar/helpers/general/is-mac-os'\nimport type { HotkeyEventName, KeydownKey } from '@scalar/oas-utils/entities/hotkeys'\nimport type { HotKeyConfig, HotKeyModifiers } from '@scalar/oas-utils/entities/workspace'\n\nimport type { EventBus } from '@/libs'\n\nexport type HotKeyEvent = Partial<Record<HotkeyEventName, KeyboardEvent>>\n\n/**\n * These are unrelated to an input so they will still fire if we are in one,\n * this is not for a textarea in which you should be able to use arrow keys, enter etc\n */\nconst inputHotkeys = [\n 'Escape',\n 'ArrowDown',\n 'ArrowUp',\n 'Enter',\n 'F1',\n 'F2',\n 'F3',\n 'F4',\n 'F5',\n 'F6',\n 'F7',\n 'F8',\n 'F9',\n 'F10',\n 'F11',\n 'F12',\n]\n\n/**\n * Default set of keybindings\n *\n * Passing an empty object for hotkeys will disable them\n *\n * TODO we can add a merge or overwrite option\n *\n * The modifier can be set by the user but defaults to ctrl for windows/linux and meta for macos\n *\n * For the modifier key:\n * - if you leave it blank it can be true or false\n * - if you explicitly set it, the event must match ex: modifier false will not trigger if the modifier was pressed\n */\nexport const DEFAULT_HOTKEYS: HotKeyConfig = {\n Escape: { event: 'closeModal' },\n Enter: { event: 'executeRequest', modifiers: ['default'] },\n b: { event: 'toggleSidebar', modifiers: ['default'] },\n k: { event: 'openCommandPalette', modifiers: ['default'] },\n l: { event: 'focusAddressBar', modifiers: ['default'] },\n}\n\n/** Checks if we are in an \"input\" */\nexport const isInput = (ev: KeyboardEvent) => {\n if (!(ev.target instanceof HTMLElement)) {\n return false\n }\n const target = ev.target\n\n // For actual inputs we would like to allow certain hotkeys to go through even without modifiers\n if (target.tagName === 'INPUT') {\n return !inputHotkeys.includes(ev.key)\n }\n if (target.tagName === 'TEXTAREA') {\n return true\n }\n if (target.getAttribute('contenteditable')) {\n return true\n }\n if (target.contentEditable === 'true') {\n return true\n }\n\n return false\n}\n\nconst MODIFIER_DICT = {\n Alt: 'altKey',\n Control: 'ctrlKey',\n Shift: 'shiftKey',\n Meta: 'metaKey',\n} as const\n\n/** Converts our modifier config to the eventKey */\nexport const getModifiers = (modifiers: HotKeyModifiers) =>\n modifiers.map((modifier) => (modifier === 'default' ? (isMacOS() ? 'metaKey' : 'ctrlKey') : MODIFIER_DICT[modifier]))\n\n/**\n * Global keydown handler for hotkeys\n *\n * This is the brain of the operation, we turn keybindings -> events\n */\nexport const handleHotKeyDown = (\n ev: KeyboardEvent,\n eventBus: EventBus<HotKeyEvent>,\n { hotKeys = DEFAULT_HOTKEYS, modifiers = ['default'] as HotKeyModifiers } = {},\n) => {\n const key = ev.key === ' ' ? 'Space' : (ev.key as KeydownKey)\n const hotKeyEvent = hotKeys[key]\n\n // Match the event with possible hotkeys\n if (hotKeyEvent) {\n // For escape we always send it\n if (key === 'Escape') {\n eventBus.emit({ [hotKeyEvent.event]: ev })\n } else {\n const _modifiers = getModifiers(hotKeyEvent.modifiers || modifiers)\n const areModifiersPressed = _modifiers.every((mod) => ev[mod] === true)\n\n // We send even in inputs if there is a modifier\n if (areModifiersPressed) {\n eventBus.emit({ [hotKeyEvent.event]: ev })\n }\n // Check if we are in an input as modifier === 'undefined'\n else if (!isInput(ev) && hotKeyEvent.modifiers === undefined) {\n eventBus.emit({ [hotKeyEvent.event]: ev })\n }\n }\n }\n}\n","import { convert } from '@scalar/postman-to-openapi'\n\n/** Checks if the given content is a Postman collection */\nexport function isPostmanCollection(content: string): boolean {\n try {\n const parsed = JSON.parse(content)\n const isPostman =\n parsed.info?._postman_id !== undefined && new URL(parsed.info?.schema).host === 'schema.getpostman.com'\n return isPostman\n } catch (_error) {\n return false\n }\n}\n\n/** Converts a Postman collection JSON string to an OpenAPI JSON string */\nexport function convertPostmanToOpenApi(postmanJson: string): string {\n try {\n const postmanCollection = JSON.parse(postmanJson)\n const openApiDoc = convert(postmanCollection)\n return JSON.stringify(openApiDoc, null, 2)\n } catch (_error) {\n throw new Error('Failed to convert Postman collection to OpenAPI')\n }\n}\n\n/** Extracts details from a Postman collection JSON string */\nexport function getPostmanDocumentDetails(content: string): {\n type: string\n title: string\n version: string\n} | null {\n try {\n if (isPostmanCollection(content)) {\n const parsed = JSON.parse(content)\n return {\n type: 'json',\n title: parsed.info?.name || 'Postman Collection',\n version: parsed.info?.version || '1.0',\n }\n }\n return null\n } catch {\n return null\n }\n}\n","import type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { createHash, fetchDocument } from '@scalar/oas-utils/helpers'\nimport { type ImportSpecToWorkspaceArgs, importSpecToWorkspace } from '@scalar/oas-utils/transforms'\nimport type { OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types'\nimport type { ApiReferenceConfiguration } from '@scalar/types/api-reference'\nimport { toRaw } from 'vue'\n\nimport { type ErrorResponse, normalizeError } from '@/libs'\nimport type { StoreContext } from '@/store/store-context'\n\n/** Maps the specs by URL */\nexport const specDictionary: Record<string, { hash: number; schema: OpenAPIV3.Document | OpenAPIV3_1.Document }> = {}\n\ntype ImportSpecFileArgs = ImportSpecToWorkspaceArgs &\n Pick<ApiReferenceConfiguration, 'servers'> & {\n dereferencedDocument?: OpenAPIV3_1.Document\n }\n\n/** Generate the import functions from a store context */\nexport function importSpecFileFactory({\n requestMutators,\n collectionMutators,\n serverMutators,\n tagMutators,\n securitySchemeMutators,\n requestExampleMutators,\n workspaceMutators,\n workspaces,\n}: StoreContext) {\n const importSpecFile = async (\n _spec: string | Record<string, any> | undefined,\n workspaceUid: string,\n options: ImportSpecFileArgs = {},\n ) => {\n const spec = toRaw(_spec)\n const workspaceEntities = await importSpecToWorkspace(spec, options)\n\n if (workspaceEntities.error) {\n console.group('IMPORT ERRORS')\n workspaceEntities.importWarnings.forEach((w) => console.warn(w))\n console.groupEnd()\n\n return undefined\n }\n\n // Store the schema for live updates\n if (options.documentUrl && typeof spec === 'string') {\n specDictionary[options.documentUrl] = {\n hash: createHash(spec),\n schema: workspaceEntities.schema,\n }\n }\n\n // Add all basic entities to the store\n // WARNING: We expect all internal references to be set between entities at this point\n workspaceEntities.examples.forEach((e) => requestExampleMutators.add(e))\n workspaceEntities.requests.forEach((r) => requestMutators.add(r))\n workspaceEntities.tags.forEach((t) => tagMutators.add(t))\n workspaceEntities.servers.forEach((s) => serverMutators.add(s))\n workspaceEntities.securitySchemes.forEach((s) => securitySchemeMutators.add(s))\n collectionMutators.add(workspaceEntities.collection)\n\n // Add the collection UID to the workspace\n workspaceMutators.edit(workspaceUid as Workspace['uid'], 'collections', [\n ...(workspaces[workspaceUid]?.collections ?? []),\n workspaceEntities.collection.uid,\n ])\n\n return workspaceEntities\n }\n\n /**\n * Function to fetch and import a spec from a URL\n *\n * returns true for success\n */\n async function importSpecFromUrl(\n url: string,\n workspaceUid: string,\n {\n proxyUrl,\n ...options\n }: Omit<ImportSpecFileArgs, 'documentUrl'> & Pick<ApiReferenceConfiguration, 'proxyUrl'> = {},\n ): Promise<ErrorResponse<Awaited<ReturnType<typeof importSpecFile>>>> {\n try {\n const spec = await fetchDocument(url, proxyUrl)\n\n return [\n null,\n await importSpecFile(spec, workspaceUid, {\n documentUrl: url,\n ...options,\n }),\n ]\n } catch (error) {\n console.error('Failed to fetch spec from URL:', error)\n return [normalizeError(error), null]\n }\n }\n\n return {\n importSpecFile,\n importSpecFromUrl,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport { iterateTitle } from '@scalar/helpers/string/iterate-title'\nimport { type Request, type RequestExample, createExampleFromRequest } from '@scalar/oas-utils/entities/spec'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Create top level examples storage for the workspace */\nexport function createStoreRequestExamples(useLocalStorage: boolean) {\n /**\n * Each request has multiple examples associated with it\n * An example is a set of request params that is saved to the example\n * Multiple test cases can each be saved as an example and switched between\n */\n const requestExamples = reactive<Record<string, RequestExample>>({})\n const requestExampleMutators = mutationFactory(\n requestExamples,\n reactive({}),\n useLocalStorage && LS_KEYS.REQUEST_EXAMPLE,\n )\n\n return {\n requestExamples,\n requestExampleMutators,\n }\n}\n\n/** Extended example data that needs store context */\nexport function extendedExampleDataFactory({\n requestExamples,\n requestExampleMutators,\n requestMutators,\n requests,\n}: StoreContext) {\n /** Ensure we add to the base examples as well as the request it is in */\n const addRequestExample = (request: Request, _name?: string) => {\n const name =\n _name ??\n iterateTitle((request.summary ?? 'Example') + ' #1', (t) =>\n request.examples.some((uid) => requestExamples[uid]?.name === t),\n )\n\n const example = createExampleFromRequest(request, name)\n\n // Add the example to the store\n requestExampleMutators.add(example)\n\n // Add the uid to the request\n requestMutators.edit(request.uid, 'examples', [...request.examples, example.uid])\n\n return example\n }\n\n /** Ensure we remove from the base as well as from the request it is in */\n const deleteRequestExample = (requestExample: RequestExample) => {\n if (!requestExample.requestUid) {\n return\n }\n\n // Remove from request\n requestMutators.edit(\n requestExample.requestUid,\n 'examples',\n requests[requestExample.requestUid]?.examples.filter((uid) => uid !== requestExample.uid) || [],\n )\n\n // Remove from base\n requestExampleMutators.delete(requestExample.uid)\n }\n\n return {\n addRequestExample,\n deleteRequestExample,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport { iterateTitle } from '@scalar/helpers/string/iterate-title'\nimport {\n type Collection,\n type Request,\n type RequestPayload,\n type Tag,\n createExampleFromRequest,\n requestSchema,\n} from '@scalar/oas-utils/entities/spec'\nimport { schemaModel } from '@scalar/oas-utils/helpers'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { extendedTagDataFactory } from '@/store/tags'\n\nimport type { StoreContext } from './store-context'\n\n/** Create top level request handlers for a workspace */\nexport function createStoreRequests(useLocalStorage: boolean) {\n /** Local list of all requests (will be associated with a database collection) */\n const requests = reactive<Record<string, Request>>({})\n const requestMutators = mutationFactory(requests, reactive({}), useLocalStorage && LS_KEYS.REQUEST)\n\n return {\n requests,\n requestMutators,\n }\n}\n\ntype AddTag = ReturnType<typeof extendedTagDataFactory>['addTag']\n\n/**\n * Create the extended mutators for request where access to the workspace is required\n */\nexport function extendedRequestDataFactory(\n {\n requestExamples,\n requestExampleMutators,\n requestMutators,\n collectionMutators,\n collections,\n tags,\n tagMutators,\n }: StoreContext,\n // We want the add tag with side effects here so it gets properly added to the colleciton\n addTag: AddTag,\n) {\n /** Add request */\n const addRequest = (payload: RequestPayload, collectionUid: Collection['uid']) => {\n const request = schemaModel(payload, requestSchema, false)\n if (!request) {\n return console.error('INVALID REQUEST DATA', payload)\n }\n\n const collection = collections[collectionUid]\n\n // Create the initial example\n const example = createExampleFromRequest(\n request,\n iterateTitle((request.summary ?? 'Example') + ' #1', (t) =>\n request.examples.some((uid) => t === requestExamples[uid]?.name),\n ),\n )\n request.examples.push(example.uid)\n\n // Add request and example to the workspace\n requestMutators.add(request)\n requestExampleMutators.add(example)\n\n // Add the request to the collection\n if (collection) {\n collectionMutators.edit(collectionUid, 'requests', [...collection.requests, request.uid])\n }\n\n // Add to the tags\n if (request.tags?.length) {\n request.tags.forEach((tagName) => {\n const tagUid = collection?.tags.find((uid) => tags[uid]?.name === tagName)\n\n if (tagUid && tags[tagUid]) {\n tagMutators.edit(tagUid, 'children', [...tags[tagUid].children, request.uid])\n }\n // We must add a new tag\n else {\n addTag({ name: tagName, children: [request.uid] }, collectionUid)\n }\n })\n }\n // Add to the collection children if no tags\n else if (collection) {\n collectionMutators.edit(collectionUid, 'children', [...collection.children, request.uid])\n }\n\n return request\n }\n\n /** Delete request */\n const deleteRequest = (request: Request, collectionUid: Collection['uid']) => {\n const collection = collections[collectionUid]\n\n // Remove all examples\n request.examples.forEach((uid) => requestExampleMutators.delete(uid))\n\n if (collection) {\n // Remove the request from the collection\n collectionMutators.edit(\n collectionUid,\n 'requests',\n collection.requests.filter((r) => r !== request.uid),\n )\n\n // And collection children\n collectionMutators.edit(\n collectionUid,\n 'children',\n collection.children.filter((r) => r !== request.uid),\n )\n\n // And from all tags\n request.tags?.forEach((tagName) => {\n const tagUid = collection.tags.find((uid) => tags[uid]?.name === tagName)\n if (!tagUid) {\n return\n }\n\n tagMutators.edit(tagUid, 'children', tags[tagUid]?.children.filter((r) => r !== request.uid) || [])\n })\n }\n\n // Remove request\n requestMutators.delete(request.uid)\n }\n\n return {\n addRequest,\n deleteRequest,\n findRequestParents: findRequestParentsFactory({ collections, tags }),\n }\n}\n\n/** Factory function to allow testing of the function */\nexport function findRequestParentsFactory({\n collections,\n tags,\n}: {\n collections: Record<string, Collection>\n tags: Record<string, Tag>\n}) {\n /** Recursively find all parent folders (tags and collections) of a request */\n function findRequestParentss(r: Request) {\n const collection = Object.values(collections).find((c) => c.requests?.includes(r.uid))\n if (!collection) {\n return []\n }\n\n // Initialized an empty children array for each tag and once for the top level collection\n const tagChildren = Object.keys(tags).reduce<Record<string, string[]>>(\n (obj, uid) => {\n obj[uid] = []\n return obj\n },\n { [collection?.uid]: [] },\n )\n\n // Recursively add nested children to the tagChildren values\n function addChildren(current: Tag | Collection, parentUids: string[]) {\n parentUids.forEach((p) => tagChildren[p]?.push(...current.children))\n\n // tagChildren[current.uid].push(...current.children)\n\n current.children.forEach((t) => {\n if (tags[t]) {\n addChildren(tags[t], [...parentUids, t])\n }\n })\n }\n addChildren(collection, [collection.uid])\n\n // Return unique parents\n const parents: Set<string> = new Set()\n\n // Anytime a tag has the request somewhere in its tree we make it open\n Object.entries(tagChildren).forEach(([tagUid, totalChildren]) => {\n if (totalChildren.includes(r.uid)) {\n parents.add(tagUid)\n }\n })\n return [...parents]\n }\n\n return findRequestParentss\n}\n\n/** First draft request\" */\nexport function createInitialRequest() {\n const request = requestSchema.parse({\n method: 'get',\n parameters: [],\n path: '',\n summary: 'My First Request',\n examples: [],\n })\n\n return { request }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport {\n type Collection,\n type SecurityScheme,\n type SecuritySchemePayload,\n securitySchemeSchema,\n} from '@scalar/oas-utils/entities/spec'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Create storage entities for security schemes */\nexport function createStoreSecuritySchemes(useLocalStorage: boolean) {\n const securitySchemes = reactive<Record<string, SecurityScheme>>({})\n const securitySchemeMutators = mutationFactory(\n securitySchemes,\n reactive({}),\n useLocalStorage && LS_KEYS.SECURITY_SCHEME,\n )\n\n return {\n securitySchemes,\n securitySchemeMutators,\n }\n}\n\n/** Extended mutators and data for security schemas */\nexport function extendedSecurityDataFactory({\n securitySchemeMutators,\n collectionMutators,\n collections,\n requests,\n requestMutators,\n}: StoreContext) {\n /** Adds a security scheme and appends it to either a collection or a request */\n const addSecurityScheme = (\n payload: SecuritySchemePayload,\n /** Schemes will always live at the collection level */\n collectionUid: Collection['uid'],\n ) => {\n const scheme = securitySchemeSchema.parse(payload)\n securitySchemeMutators.add(scheme)\n\n // Add to collection dictionary\n if (collectionUid && collections[collectionUid]) {\n collectionMutators.edit(collectionUid, 'securitySchemes', [\n ...collections[collectionUid].securitySchemes,\n scheme.uid,\n ])\n }\n\n return scheme\n }\n\n /** Delete a security scheme and remove the key from its corresponding parent */\n const deleteSecurityScheme = (schemeUid: SecurityScheme['uid']) => {\n Object.values(collections).forEach((c) => {\n // Remove the scheme from any collections that reference it (should only be 1 collection)\n if (c.securitySchemes.includes(schemeUid)) {\n collectionMutators.edit(\n c.uid,\n 'securitySchemes',\n c.securitySchemes.filter((s) => s !== schemeUid),\n )\n }\n })\n\n Object.values(requests).forEach((r) => {\n // Remove from any requests that have it as a requirement\n if (r.security?.some((s) => Object.keys(s).includes(schemeUid))) {\n requestMutators.edit(\n r.uid,\n 'security',\n requests[r.uid]?.security?.filter((s) => !Object.keys(s).includes(schemeUid)),\n )\n }\n // Remove from any requests that have it selected\n if (r.selectedSecuritySchemeUids.flat().includes(schemeUid)) {\n requestMutators.edit(\n r.uid,\n 'selectedSecuritySchemeUids',\n r.selectedSecuritySchemeUids?.filter((uid) => {\n if (Array.isArray(uid)) {\n return !uid.includes(schemeUid)\n }\n return uid !== schemeUid\n }),\n )\n }\n })\n\n securitySchemeMutators.delete(schemeUid)\n }\n\n return {\n addSecurityScheme,\n deleteSecurityScheme,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport {\n type Collection,\n type Request,\n type Server,\n type ServerPayload,\n serverSchema,\n} from '@scalar/oas-utils/entities/spec'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Create storage objects for servers */\nexport function createStoreServers(useLocalStorage: boolean) {\n const servers = reactive<Record<string, Server>>({})\n\n const serverMutators = mutationFactory(servers, reactive({}), useLocalStorage && LS_KEYS.SERVER)\n\n return {\n servers,\n serverMutators,\n }\n}\n\n/** Extended mutators and data for servers */\nexport function extendedServerDataFactory({\n serverMutators,\n collections,\n collectionMutators,\n requests,\n requestMutators,\n}: StoreContext) {\n /**\n * Add a server\n * If the collectionUid is included it is added to the collection as well\n */\n const addServer = (payload: ServerPayload, parentUid: string) => {\n const server = serverSchema.parse(payload)\n\n // Add to collection\n if (collections[parentUid]) {\n collectionMutators.edit(parentUid as Collection['uid'], 'servers', [\n ...collections[parentUid].servers,\n server.uid,\n ])\n }\n // Add to request\n else if (requests[parentUid]) {\n requestMutators.edit(parentUid as Request['uid'], 'servers', [...requests[parentUid].servers, server.uid])\n }\n\n // Add to servers\n serverMutators.add(server)\n\n return server\n }\n\n /** Delete a server */\n const deleteServer = (serverUid: Server['uid'], collectionUid: Collection['uid']) => {\n if (!collections[collectionUid]) {\n return\n }\n\n // Remove from parent collection\n collectionMutators.edit(\n collectionUid,\n 'servers',\n collections[collectionUid].servers.filter((uid) => uid !== serverUid),\n )\n\n // Remove from servers\n serverMutators.delete(serverUid)\n }\n\n return {\n addServer,\n deleteServer,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport { type Collection, type Tag, type TagPayload, tagSchema } from '@scalar/oas-utils/entities/spec'\nimport { schemaModel } from '@scalar/oas-utils/helpers'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Create cookie mutators for the workspace */\nexport function createStoreTags(useLocalStorage: boolean) {\n const tags = reactive<Record<string, Tag>>({})\n\n const tagMutators = mutationFactory(tags, reactive({}), useLocalStorage && LS_KEYS.TAG)\n\n return {\n tags,\n tagMutators,\n }\n}\n\n/**\n * Create the extended mutators for tag with side effects\n * TODO:\n * - tag nesting, add/remove into another tag\n */\nexport function extendedTagDataFactory({\n collectionMutators,\n collections,\n requests,\n requestMutators,\n tagMutators,\n}: StoreContext) {\n /** Add tag */\n const addTag = (payload: TagPayload, collectionUid: Collection['uid']) => {\n const collection = collections[collectionUid]\n const tag = schemaModel(payload, tagSchema, false)\n if (!tag || !collection) {\n return console.error('INVALID TAG DATA', payload)\n }\n\n // Add to collection tags\n collectionMutators.edit(collectionUid, 'tags', [...collection.tags, tag.uid])\n\n // Add to parent collection as a child\n collectionMutators.edit(collectionUid, 'children', [...collection.children, tag.uid])\n\n tagMutators.add(tag)\n return tag\n }\n\n /** Delete Tag */\n const deleteTag = (tag: Tag, collectionUid: Collection['uid']) => {\n const collection = collections[collectionUid]\n\n if (!collection) {\n return\n }\n\n // Remove from collection tags\n collectionMutators.edit(\n collectionUid,\n 'tags',\n collection.tags.filter((uid) => uid !== tag.uid),\n )\n\n // Remove from collection children\n collectionMutators.edit(\n collectionUid,\n 'children',\n collection.children.filter((uid) => uid !== tag.uid),\n )\n\n // Loop on each child, just requests for now but will add other tags\n tag.children.forEach((childUid) => {\n const request = requests[childUid]\n if (!request) {\n return\n }\n\n const filteredTags = request.tags?.filter((tagName) => tagName !== tag.name)\n\n // Remove the tagName from the request\n requestMutators.edit(request.uid, 'tags', filteredTags)\n\n // Add to the collection children if there's no more tags\n if (!filteredTags?.length && !collection.children.includes(childUid)) {\n collectionMutators.edit(collectionUid, 'children', [...collection.children, childUid])\n }\n })\n\n tagMutators.delete(tag.uid)\n }\n\n return { addTag, deleteTag }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport { collectionSchema, requestExampleSchema } from '@scalar/oas-utils/entities/spec'\nimport { type Workspace, workspaceSchema } from '@scalar/oas-utils/entities/workspace'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\nimport { createInitialRequest } from './requests'\n\n/** Create storage for workspace entities */\nexport function createStoreWorkspaces(useLocalStorage: boolean) {\n /** Active workspace object (will be associated with an entry in the workspace collection) */\n const workspaces = reactive<Record<string, Workspace>>({})\n const workspaceMutators = mutationFactory(workspaces, reactive({}), useLocalStorage && LS_KEYS.WORKSPACE)\n\n return {\n workspaces,\n workspaceMutators,\n }\n}\n\n/** Workspace entities that require store context */\nexport function extendedWorkspaceDataFactory({\n workspaces,\n workspaceMutators,\n collectionMutators,\n requestMutators,\n requestExampleMutators,\n}: StoreContext) {\n const addWorkspace = (payload: Partial<Workspace> = {}) => {\n // Create some example data\n const { request } = createInitialRequest()\n\n const example = requestExampleSchema.parse({\n name: 'Example',\n requestUid: request.uid,\n })\n\n request.examples.push(example.uid)\n\n const collection = collectionSchema.parse({\n info: {\n title: 'Drafts',\n },\n children: [request.uid],\n requests: [request.uid],\n })\n\n const workspace = workspaceSchema.parse({\n ...payload,\n collections: [collection.uid],\n })\n\n // Add all entities\n requestExampleMutators.add(example)\n requestMutators.add(request)\n collectionMutators.add(collection)\n workspaceMutators.add(workspace)\n\n return workspace\n }\n\n /** Prevent deletion of the default workspace */\n const deleteWorkspace = (uid: Workspace['uid']) => {\n if (Object.keys(workspaces).length <= 1) {\n console.warn('The last workspace cannot be deleted.')\n return\n }\n workspaceMutators.delete(uid)\n }\n\n return {\n addWorkspace,\n deleteWorkspace,\n }\n}\n","import { useModal } from '@scalar/components'\nimport type { RequestEvent, SecurityScheme } from '@scalar/oas-utils/entities/spec'\nimport type { Path, PathValue } from '@scalar/object-utils/nested'\nimport type { ApiReferenceConfiguration } from '@scalar/types/api-reference'\nimport { inject, reactive, ref, toRaw } from 'vue'\n\nimport { createStoreCollections, extendedCollectionDataFactory } from '@/store/collections'\nimport { createStoreCookies } from '@/store/cookies'\nimport { createStoreEnvironments, extendedEnvironmentDataFactory } from '@/store/environment'\nimport { createStoreEvents } from '@/store/events'\nimport { importSpecFileFactory } from '@/store/import-spec'\nimport { createStoreRequestExamples, extendedExampleDataFactory } from '@/store/request-example'\nimport { createStoreRequests, extendedRequestDataFactory } from '@/store/requests'\nimport { createStoreSecuritySchemes, extendedSecurityDataFactory } from '@/store/security-schemes'\nimport { createStoreServers, extendedServerDataFactory } from '@/store/servers'\nimport type { StoreContext } from '@/store/store-context'\nimport { createStoreTags, extendedTagDataFactory } from '@/store/tags'\nimport { createStoreWorkspaces, extendedWorkspaceDataFactory } from '@/store/workspace'\n\nexport type UpdateScheme = <P extends Path<SecurityScheme>>(\n path: P,\n value: NonNullable<PathValue<SecurityScheme, P>>,\n) => void\n\ndeclare global {\n interface Window {\n dataDump: () => void\n }\n}\n\nexport type CreateWorkspaceStoreOptions = {\n /**\n * When true, changes made to the store will be saved in the browser's localStorage.\n *\n * @default true\n */\n useLocalStorage: boolean\n} & Pick<ApiReferenceConfiguration, 'proxyUrl' | 'showSidebar' | 'hideClientButton' | 'theme' | '_integration'>\n\n/**\n * Factory function for creating the centralized store for the API client.\n *\n * This store manages all data and state for the application.\n * It should be instantiated once and injected into the app's root component.\n */\nexport const createWorkspaceStore = ({\n useLocalStorage = true,\n showSidebar = true,\n proxyUrl,\n theme,\n hideClientButton = false,\n _integration,\n}: CreateWorkspaceStoreOptions) => {\n // ---------------------------------------------------------------------------\n // Initialize all storage objects\n\n const { collections, collectionMutators } = createStoreCollections(useLocalStorage)\n const { tags, tagMutators } = createStoreTags(useLocalStorage)\n const { requests, requestMutators } = createStoreRequests(useLocalStorage)\n const { requestExamples, requestExampleMutators } = createStoreRequestExamples(useLocalStorage)\n const { cookies, cookieMutators } = createStoreCookies(useLocalStorage)\n const { environments, environmentMutators } = createStoreEnvironments(useLocalStorage)\n const { servers, serverMutators } = createStoreServers(useLocalStorage)\n const { securitySchemes, securitySchemeMutators } = createStoreSecuritySchemes(useLocalStorage)\n const { workspaces, workspaceMutators } = createStoreWorkspaces(useLocalStorage)\n\n // ---------------------------------------------------------------------------\n // Extended Mutators - Adds side effects as needed\n\n // Provide the workspace to the extended mutator factories\n const storeContext: StoreContext = {\n collections,\n collectionMutators,\n tags,\n tagMutators,\n requests,\n requestMutators,\n requestExamples,\n requestExampleMutators,\n cookies,\n cookieMutators,\n environments,\n environmentMutators,\n servers,\n serverMutators,\n securitySchemes,\n securitySchemeMutators,\n workspaces,\n workspaceMutators,\n }\n const { addTag, deleteTag } = extendedTagDataFactory(storeContext)\n const { addRequest, deleteRequest, findRequestParents } = extendedRequestDataFactory(storeContext, addTag)\n const { deleteEnvironment } = extendedEnvironmentDataFactory(storeContext)\n const { addServer, deleteServer } = extendedServerDataFactory(storeContext)\n const { addCollection, deleteCollection } = extendedCollectionDataFactory(storeContext)\n const { addRequestExample, deleteRequestExample } = extendedExampleDataFactory(storeContext)\n const { addWorkspace, deleteWorkspace } = extendedWorkspaceDataFactory(storeContext)\n const { addSecurityScheme, deleteSecurityScheme } = extendedSecurityDataFactory(storeContext)\n const { addCollectionEnvironment, removeCollectionEnvironment } = extendedCollectionDataFactory(storeContext)\n\n // ---------------------------------------------------------------------------\n // OTHER HELPER DATA\n /** Running request history list */\n const requestHistory = reactive<RequestEvent[]>([])\n\n const { importSpecFile, importSpecFromUrl } = importSpecFileFactory(storeContext)\n\n /** Helper function to manage the sidebar width */\n const sidebarWidth = ref((useLocalStorage ? localStorage?.getItem('sidebarWidth') : undefined) || '280px')\n\n // Set the sidebar width\n const setSidebarWidth = (width: string) => {\n sidebarWidth.value = width\n if (useLocalStorage) {\n localStorage?.setItem('sidebarWidth', width)\n }\n }\n\n /** This state is to be used by the API Client Modal component to control the modal */\n const modalState = useModal()\n\n // Set some defaults on all workspaces\n Object.values(workspaces).forEach(({ uid }) => {\n if (proxyUrl) {\n workspaceMutators.edit(uid, 'proxyUrl', proxyUrl)\n }\n if (theme) {\n workspaceMutators.edit(uid, 'themeId', theme)\n }\n })\n\n /**\n * For debugging purposes, expose this method for dumping the data stores\n */\n if (typeof window !== 'undefined') {\n window.dataDump = () => ({\n collections: toRaw(collections),\n cookies: toRaw(cookies),\n environments: toRaw(environments),\n requestExamples: toRaw(requestExamples),\n requests: toRaw(requests),\n securitySchemes: toRaw(securitySchemes),\n servers: toRaw(servers),\n tags: toRaw(tags),\n workspaces: toRaw(workspaces),\n })\n }\n\n // ---------------------------------------------------------------------------\n // Events Busses\n const events = createStoreEvents()\n\n return {\n // ---------------------------------------------------------------------------\n // STATE\n workspaces,\n collections,\n tags,\n cookies,\n environments,\n requestExamples,\n requests,\n servers,\n securitySchemes,\n modalState,\n events,\n sidebarWidth,\n setSidebarWidth,\n proxyUrl,\n // ---------------------------------------------------------------------------\n // CONFIGURATION \"PROPS\"\n // TODO: move these to their own store\n hideClientButton,\n showSidebar,\n integration: _integration,\n // ---------------------------------------------------------------------------\n // METHODS\n importSpecFile,\n importSpecFromUrl,\n cookieMutators,\n collectionMutators: {\n ...collectionMutators,\n rawAdd: collectionMutators.add,\n add: addCollection,\n delete: deleteCollection,\n addEnvironment: addCollectionEnvironment,\n removeEnvironment: removeCollectionEnvironment,\n },\n environmentMutators: {\n ...environmentMutators,\n delete: deleteEnvironment,\n },\n requestMutators: {\n ...requestMutators,\n rawAdd: requestMutators.add,\n add: addRequest,\n delete: deleteRequest,\n },\n findRequestParents,\n requestExampleMutators: {\n ...requestExampleMutators,\n rawAdd: requestExampleMutators.add,\n add: addRequestExample,\n delete: deleteRequestExample,\n },\n requestHistory,\n securitySchemeMutators: {\n ...securitySchemeMutators,\n rawAdd: securitySchemeMutators.add,\n add: addSecurityScheme,\n delete: deleteSecurityScheme,\n },\n serverMutators: {\n ...serverMutators,\n rawAdd: serverMutators.add,\n add: addServer,\n delete: deleteServer,\n },\n tagMutators: {\n ...tagMutators,\n rawAdd: tagMutators.add,\n add: addTag,\n delete: deleteTag,\n },\n workspaceMutators: {\n ...workspaceMutators,\n rawAdd: workspaceMutators.add,\n add: addWorkspace,\n delete: deleteWorkspace,\n },\n addCollectionEnvironment,\n removeCollectionEnvironment,\n }\n}\n\nexport type WorkspaceStore = ReturnType<typeof createWorkspaceStore>\n/** Set as a string so that different instances of api-client can reference inject the same store */\nexport const WORKSPACE_SYMBOL = 'WORKSPACE_SYMBOL' as const\n\n/**\n * Global hook which contains the store for the whole app\n *\n * The rawAdd methods are the mutator.add methods. Some add methods have been replaced when we need some side effects\n * ex: add examples when adding a request\n */\nexport const useWorkspace = (): WorkspaceStore => {\n const store = inject<WorkspaceStore>(WORKSPACE_SYMBOL)\n if (!store) {\n throw new Error('Workspace store not provided')\n }\n return store\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,IAAY,SAAL,yBAAA,QAAA;AACL,QAAA,aAAA;AACA,QAAA,cAAA;AACA,QAAA,aAAA;AACA,QAAA,gBAAA;AACA,QAAA,YAAA;AACA,QAAA,iBAAA;AACA,QAAA,aAAA;AACA,QAAA,eAAA;AACA,QAAA,cAAA;;KACD;;AAGD,IAAM,uBAAuB;;AAG7B,SAAgB,oBAAoB,IAA6B;CAC/D,MAAM,YAAY,GAAG,OAAO,OAAO;AAEnC,KAAI,UACF,cAAa,QAAQ,sBAAsB,GAAG,YAAY;;;AAK9D,SAAS,4BAA4B;CAEnC,MAAM,kBAAkB,aAAa,QAAQ,qBAAqB;AAGlE,KAAI,CAAC,gBACH,QAAO,EACL,MAAM,qBACP;AAIH,QAAO;EACL,MAAM;EACN,QAAQ,GACL,OAAO,YAAY,iBACrB;EACF;;;AAIH,IAAM,gBAAgB,CACpB;CACE,MAAM;CACN,MAAM;CACN,iBAAiB,OAAO;CACxB,WAAW,IAA6B,WAAoC;EAC1E,MAAM;EACN,QAAQ;GAAE,GAAG,GAAG;GAAQ,SAAS;GAAW;EAC7C;CACD,UAAU;EACR;GACE,MAAM;GACN,MAAM,YAAY,OAAO;GACzB,iBAAiB,OAAO;GACzB;EACD;GACE,MAAM;GACN,MAAM,YAAY,OAAO,QAAQ,aAAa,OAAO;GACrD,iBAAiB,OAAO;GACzB;EACD;GACE,MAAM;GACN,MAAM,eAAe,OAAO;GAC5B,iBAAiB,OAAO;GACxB,WAAW,KAA8B,UAAmC;AAC1E,WAAO,EACL,MAAM,uBACP;;GAEH,UAAU;IACR;KACE,MAAM;KACN,MAAM;KACN,iBAAiB,OAAO;KACzB;IACD;KACE,MAAM;KACN,MAAM;KACN,iBAAiB,OAAO;KACxB,UAAU,CACR;MACE,MAAM;MACN,MAAM,IAAI,OAAO;MACjB,iBAAiB,OAAO;MACzB,CACF;KACF;IACD;KACE,MAAM;KACN,MAAM;KACN,iBAAiB,OAAO;KACzB;IACD;KACE,MAAM;KACN,MAAM;KACN,iBAAiB,OAAO;KACzB;IACD;KACE,MAAM;KACN,MAAM;KACN,iBAAiB,OAAO;KACzB;IACD;KACE,MAAM;KACN,MAAM;KACN,iBAAiB,OAAO;KACzB;IACD;KACE,MAAM;KACN,MAAM;KACN,iBAAiB,OAAO;KACzB;IACD;KACE,MAAM;KACN,MAAM;KACN,iBAAiB,OAAO;KACzB;IACF;GACF;EACF;CACF,CACF;;AAGD,IAAa,cAAc;CACzB;EACE,MAAM;EACN,MAAM;EACN,UAAU;EACX;CACD;EACE,MAAM;EACN,MAAM;EACN,UAAU;GACR,MAAM;GACN,QAAQ,GACL,OAAO,YAAY,WACrB;GACF;EACF;CACD;EACE,MAAM;EACN,MAAM,eAAe,OAAO;EAC5B,UAAU,EACR,MAAM,gBACP;EACD,UAAU;EACX;CACF;;AAGD,IAAa,SAAS;CACpB;EACE,MAAM;EACN,MAAM;EACN,UAAU;EACX;CACD;EACE,MAAM;EACN,MAAM;EACN,UAAU;GACR,MAAM;GACN,QAAQ,GACL,OAAO,YAAY,WACrB;GACF;EACF;CACD;EACE,MAAM;EACN,MAAM,eAAe,OAAO;EAC5B,UAAU,EACR,MAAM,gBACP;EACD,UAAU;GACR,GAAG;GACH;IACE,MAAM;IACN,MAAM;IACN,W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EACA;EACD;;;AAKH,IAAa,mBAAmB;;;;;;;AAQhC,IAAa,qBAAqC;CAChD,MAAM,QAAQ,OAAuB,iBAAiB;AACtD,KAAI,CAAC,MACH,OAAM,IAAI,MAAM,+BAA+B;AAEjD,QAAO"}
1
+ {"version":3,"file":"store-DnlAQK5d.js","names":[],"sources":["../src/routes.ts","../src/store/router-params.ts","../src/store/active-entities.ts","../src/store/collections.ts","../src/store/cookies.ts","../src/store/environment.ts","../src/libs/event-bus.ts","../src/store/events.ts","../src/hooks/useClientConfig.ts","../src/libs/find-request.ts","../src/libs/get-request-uid-by-path-method.ts","../src/libs/local-storage.ts","../src/libs/create-client.ts","../src/libs/env-helpers.ts","../src/libs/environment-parser.ts","../src/libs/isUrl.ts","../src/libs/getOpenApiDocumentDetails.ts","../src/libs/hot-keys.ts","../src/libs/postman.ts","../src/store/import-spec.ts","../src/store/request-example.ts","../src/store/requests.ts","../src/store/security-schemes.ts","../src/store/servers.ts","../src/store/tags.ts","../src/store/workspace.ts","../src/store/store.ts"],"sourcesContent":["import type { RouteLocationNormalized, RouteRecordRaw } from 'vue-router'\n\nexport enum PathId {\n Request = 'request',\n Examples = 'examples',\n Cookies = 'cookies',\n Collection = 'collection',\n Schema = 'schema',\n Environment = 'environment',\n Servers = 'servers',\n Workspace = 'workspace',\n Settings = 'settings',\n}\n\n/** Tracks the active workspace in localStorage for when the client reloads */\nconst ACTIVE_WORKSPACE_KEY = 'activeWorkspace' as const\n\n/** Save the active workspace in localStorage for when the client reloads */\nexport function saveActiveWorkspace(to: RouteLocationNormalized) {\n const workspace = to.params[PathId.Workspace]\n\n if (workspace) {\n localStorage.setItem(ACTIVE_WORKSPACE_KEY, `${workspace}`)\n }\n}\n\n/** Redirect to the saved workspace or the default workspace */\nfunction redirectToActiveWorkspace() {\n // Access localStorage\n const activeWorkspace = localStorage.getItem(ACTIVE_WORKSPACE_KEY)\n\n // Fallback\n if (!activeWorkspace) {\n return {\n name: 'workspace.default',\n }\n }\n\n // Redirect to active workspace\n return {\n name: 'request.root',\n params: {\n [PathId.Workspace]: activeWorkspace,\n },\n }\n}\n\n/** Shared request routes between modal and app */\nconst requestRoutes = [\n {\n name: 'request.root',\n path: '',\n component: () => import('@/views/Request/RequestRoot.vue'),\n redirect: (to: RouteLocationNormalized, _from: RouteLocationNormalized) => ({\n name: 'request',\n params: { ...to.params, request: 'default' },\n }),\n children: [\n {\n name: 'request',\n path: `request/:${PathId.Request}`,\n component: () => import('@/views/Request/Request.vue'),\n },\n {\n name: 'request.examples',\n path: `request/:${PathId.Request}/examples/:${PathId.Examples}`,\n component: () => import('@/views/Request/Request.vue'),\n },\n {\n name: 'collection',\n path: `collection/:${PathId.Collection}`,\n component: () => import('@/views/Collection/Collection.vue'),\n redirect: (_to: RouteLocationNormalized, _from: RouteLocationNormalized) => {\n return {\n name: 'collection.overview',\n }\n },\n children: [\n {\n name: 'collection.overview',\n path: 'overview',\n component: () => import('@/views/Collection/CollectionOverview.vue'),\n },\n {\n name: 'collection.servers',\n path: 'servers',\n component: () => import('@/views/Collection/CollectionServers.vue'),\n children: [\n {\n name: 'collection.servers.edit',\n path: `:${PathId.Servers}`,\n component: () => import('@/views/Collection/CollectionServers.vue'),\n },\n ],\n },\n {\n name: 'collection.environment',\n path: 'environment',\n component: () => import('@/views/Collection/CollectionEnvironment.vue'),\n },\n {\n name: 'collection.authentication',\n path: 'authentication',\n component: () => import('@/views/Collection/CollectionAuthentication.vue'),\n },\n {\n name: 'collection.cookies',\n path: 'cookies',\n component: () => import('@/views/Collection/CollectionCookies.vue'),\n },\n {\n name: 'collection.scripts',\n path: 'scripts',\n component: () => import('@/views/Collection/CollectionScripts.vue'),\n },\n {\n name: 'collection.sync',\n path: 'sync',\n component: () => import('@/views/Collection/CollectionSync.vue'),\n },\n {\n name: 'collection.settings',\n path: 'settings',\n component: () => import('@/views/Collection/CollectionSettings.vue'),\n },\n ],\n },\n ],\n },\n] as RouteRecordRaw[]\n\n/** Routes required by the API client modal */\nexport const modalRoutes = [\n {\n name: 'root',\n path: '/',\n redirect: redirectToActiveWorkspace,\n },\n {\n name: 'workspace.default',\n path: '/workspace',\n redirect: {\n name: 'workspace',\n params: {\n [PathId.Workspace]: 'default',\n },\n },\n },\n {\n name: 'workspace',\n path: `/workspace/:${PathId.Workspace}`,\n redirect: {\n name: 'request.root',\n },\n children: requestRoutes,\n },\n] as RouteRecordRaw[]\n\n/** Routes for the API client app */\nexport const routes = [\n {\n name: 'root',\n path: '/',\n redirect: redirectToActiveWorkspace,\n },\n {\n name: 'workspace.default',\n path: '/workspace',\n redirect: {\n name: 'request.root',\n params: {\n [PathId.Workspace]: 'default',\n },\n },\n },\n {\n name: 'workspace',\n path: `/workspace/:${PathId.Workspace}`,\n redirect: {\n name: 'request.root',\n },\n children: [\n ...requestRoutes,\n {\n name: 'environment.default',\n path: 'environment',\n redirect: (to: RouteLocationNormalized, _from: RouteLocationNormalized) => ({\n name: 'environment',\n params: { ...to.params, [PathId.Environment]: 'default' },\n }),\n },\n {\n name: 'environment',\n path: `environment/:${PathId.Environment}`,\n component: () => import('@/views/Environment/Environment.vue'),\n },\n {\n name: 'environment.collection',\n path: `environment/:${PathId.Collection}/:${PathId.Environment}`,\n component: () => import('@/views/Environment/Environment.vue'),\n props: true,\n },\n {\n name: 'cookies.default',\n path: 'cookies',\n redirect: (to: RouteLocationNormalized, _from: RouteLocationNormalized) => ({\n name: 'cookies',\n params: { ...to.params, [PathId.Cookies]: 'default' },\n }),\n },\n {\n name: 'cookies',\n path: `cookies/:${PathId.Cookies}`,\n component: () => import('@/views/Cookies/Cookies.vue'),\n },\n {\n name: 'servers.default',\n path: 'servers',\n redirect: (to: RouteLocationNormalized, _from: RouteLocationNormalized) => ({\n name: 'servers',\n params: {\n ...to.params,\n [PathId.Collection]: 'default',\n [PathId.Servers]: 'default',\n },\n }),\n },\n {\n name: 'settings.default',\n path: 'settings',\n redirect: (to: RouteLocationNormalized, _from: RouteLocationNormalized) => ({\n name: 'settings',\n params: { ...to.params, [PathId.Settings]: 'general' },\n }),\n },\n {\n name: 'settings',\n path: `settings/:${PathId.Settings}`,\n component: () => import('@/views/Settings/Settings.vue'),\n },\n ],\n },\n] as RouteRecordRaw[]\n","import type { Cookie } from '@scalar/oas-utils/entities/cookie'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { Collection, Request, RequestExample, Server } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport type { Router } from 'vue-router'\n\nimport { PathId } from '@/routes'\n\n/** Getter function for router parameters */\nexport function getRouterParams(router?: Router) {\n return () => {\n const pathParams = {\n [PathId.Collection]: 'default' as Collection['uid'],\n [PathId.Environment]: 'default' as Environment['uid'],\n [PathId.Request]: 'default' as Request['uid'],\n [PathId.Examples]: 'default' as RequestExample['uid'],\n [PathId.Schema]: 'default' as string,\n [PathId.Cookies]: 'default' as Cookie['uid'],\n [PathId.Servers]: 'default' as Server['uid'],\n [PathId.Workspace]: 'default' as Workspace['uid'],\n [PathId.Settings]: 'default' as string,\n } as const\n\n const currentRoute = router?.currentRoute.value\n\n if (currentRoute) {\n ;(Object.keys(pathParams) as (keyof typeof pathParams)[]).forEach((k) => {\n if (currentRoute.params[k]) {\n // @ts-expect-error this gives us good types without redoing PathId :)\n pathParams[k] = currentRoute.params[k]\n }\n })\n }\n\n return pathParams\n }\n}\n","import type { Cookie } from '@scalar/oas-utils/entities/cookie'\nimport { type Environment, environmentSchema } from '@scalar/oas-utils/entities/environment'\nimport type { Collection, Request, RequestExample, Server } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { isDefined } from '@scalar/oas-utils/helpers'\nimport { type InjectionKey, computed, inject } from 'vue'\nimport type { Router } from 'vue-router'\n\nimport { flattenEnvVars } from '@/libs/string-template'\nimport { PathId } from '@/routes'\n\nimport { getRouterParams } from './router-params'\n\ntype CreateActiveEntitiesStoreParams = {\n collections: Record<string, Collection>\n environments: Record<string, Environment>\n requestExamples: Record<string, RequestExample>\n requests: Record<string, Request>\n servers: Record<string, Server>\n workspaces: Record<string, Workspace>\n router?: Router\n}\n\nexport type EnvVariable = {\n key: string\n value: any\n source: 'global' | 'collection'\n}\n\n/**\n * Create the active entities store\n *\n * We need the factory function to pass the router instance\n */\nexport const createActiveEntitiesStore = ({\n collections,\n requestExamples,\n requests,\n router,\n servers,\n workspaces,\n}: CreateActiveEntitiesStoreParams) => {\n /** Gives the required UID usually per route */\n const activeRouterParams = computed(getRouterParams(router))\n\n /** The currently selected workspace OR the first one */\n const activeWorkspace = computed(\n () => workspaces[activeRouterParams.value[PathId.Workspace]] ?? Object.values(workspaces)[0],\n )\n\n /** Ordered list of the active workspace's collections with drafts last */\n const activeWorkspaceCollections = computed(\n () =>\n activeWorkspace.value?.collections\n .map((uid) => collections[uid])\n .filter(isDefined)\n .sort((a, b) => {\n if (a.info?.title === 'Drafts') {\n return 1\n }\n if (b.info?.title === 'Drafts') {\n return -1\n }\n return 0\n }) ?? [],\n )\n\n /** Simplified list of servers in the workspace for displaying */\n const activeWorkspaceServers = computed(() =>\n activeWorkspaceCollections.value?.flatMap((collection) => collection.servers.map((uid) => servers[uid])),\n )\n\n /** Simplified list of requests in the workspace for displaying */\n const activeWorkspaceRequests = computed(\n () => activeWorkspaceCollections.value?.flatMap((collection) => collection.requests) ?? [],\n )\n\n /** The currently selected environment */\n const activeEnvironment = computed(() => {\n if (!activeWorkspace.value?.activeEnvironmentId) {\n return environmentSchema.parse({\n uid: 'default',\n color: '#FFFFFF',\n name: 'No Environment',\n value: JSON.stringify(activeWorkspace.value?.environments, null, 2),\n })\n }\n\n const activeEnvironmentCollection = activeWorkspaceCollections.value.find(\n (c) => c['x-scalar-environments']?.[activeWorkspace.value?.activeEnvironmentId ?? ''],\n )\n\n if (activeEnvironmentCollection && activeWorkspace.value?.activeEnvironmentId) {\n return environmentSchema.parse({\n uid: activeWorkspace.value.activeEnvironmentId,\n name: activeWorkspace.value.activeEnvironmentId,\n value: JSON.stringify(\n activeEnvironmentCollection['x-scalar-environments']?.[activeWorkspace.value?.activeEnvironmentId]?.variables,\n null,\n 2,\n ),\n color:\n activeEnvironmentCollection['x-scalar-environments']?.[activeWorkspace.value?.activeEnvironmentId]?.color ||\n '#FFFFFF',\n isDefault: false,\n })\n }\n\n return environmentSchema.parse({\n uid: 'default',\n color: '#FFFFFF',\n name: 'No Environment',\n value: JSON.stringify(activeWorkspace.value.environments, null, 2),\n })\n })\n\n /**\n * Request associated with the current route\n *\n * undefined must be handled as we may have no requests\n */\n const activeRequest = computed(() => {\n const key = activeRouterParams.value[PathId.Request]\n\n // Can use this fallback to get an active request\n const collection =\n collections[activeRouterParams.value.collection] || collections[activeWorkspace.value?.collections[0] ?? '']\n\n return requests[key] || requests[collection?.requests[0] ?? ''] || Object.values(requests)[0]\n })\n\n /** Grabs the currently active example using the path param */\n const activeExample = computed(() => {\n const key =\n activeRouterParams.value[PathId.Examples] === 'default'\n ? activeRequest.value?.examples[0] || ''\n : activeRouterParams.value[PathId.Examples]\n\n return requestExamples[key]\n })\n\n /**\n * First collection that the active request is in\n */\n const activeCollection = computed(() => {\n // Grab the collection from route parameters.\n const collection = collections[activeRouterParams.value[PathId.Collection]]\n\n if (collection) {\n return collection\n }\n\n // If no collection is found, try to grab the collection from the request.\n const requestUid = activeRequest.value?.uid\n if (requestUid) {\n return Object.values(collections).find((c) => c.requests?.includes(requestUid))\n }\n\n // If no collection is found, try to grab the collection from the workspace.\n const fallbackUid = activeWorkspace.value?.collections[0] ?? collections[0]?.uid ?? ''\n\n return collections[fallbackUid]\n })\n\n /** The currently selected server in the addressBar */\n const activeServer = computed(() => {\n // Request has a selected server\n if (activeRequest.value?.selectedServerUid) {\n // Return server if selected\n const server = servers[activeRequest.value.selectedServerUid]\n if (server) {\n return server\n }\n }\n\n // Collection has a selected server\n if (activeCollection.value?.selectedServerUid) {\n // Return server if selected\n const server = servers[activeCollection.value.selectedServerUid]\n if (server) {\n return server\n }\n }\n\n return undefined\n })\n\n /** Cookie associated with the current route */\n const activeCookieId = computed(() =>\n activeRouterParams.value[PathId.Cookies] === 'default'\n ? (activeWorkspace.value?.cookies[0] ?? ('default' as Cookie['uid']))\n : activeRouterParams.value[PathId.Cookies],\n )\n\n /**\n * Active list all available substitution variables. Server variables\n * will be populated into the environment on spec loading\n */\n const activeEnvVariables = computed<EnvVariable[]>(() => {\n const globalEnvironment = activeWorkspace.value?.environments ?? {}\n const collectionEnvironment = activeEnvironment.value.uid ? JSON.parse(activeEnvironment.value.value) : {}\n\n const globalEnvVars: EnvVariable[] = flattenEnvVars(globalEnvironment).map(([key, value]) => ({\n key,\n value,\n source: 'global',\n }))\n\n const collectionEnvVars: EnvVariable[] = flattenEnvVars(collectionEnvironment).map(([key, value]) => ({\n key,\n value,\n source: 'collection',\n }))\n\n const mergedEnvVars = new Map<string, EnvVariable>()\n\n collectionEnvVars.forEach((envVar) => {\n mergedEnvVars.set(envVar.key, envVar)\n })\n\n globalEnvVars.forEach((envVar) => {\n if (!mergedEnvVars.has(envVar.key)) {\n mergedEnvVars.set(envVar.key, envVar)\n }\n })\n\n return Array.from(mergedEnvVars.values())\n })\n\n return {\n activeCollection,\n activeCookieId,\n activeExample,\n activeRequest,\n activeRouterParams,\n activeEnvironment,\n activeServer,\n activeWorkspace,\n activeWorkspaceCollections,\n activeWorkspaceServers,\n activeEnvVariables,\n activeWorkspaceRequests,\n }\n}\n\nexport type ActiveEntitiesStore = ReturnType<typeof createActiveEntitiesStore>\nexport const ACTIVE_ENTITIES_SYMBOL = Symbol() as InjectionKey<ActiveEntitiesStore>\n\n/**\n * The active entities store\n *\n * This store returns anything related to the currently active entities\n * The only reason this is a store and not a simple hook is due to storing the current router here\n *\n * @deprecated due to components being used outside of the client now, we should prop drill instead of this hook/store\n */\nexport const useActiveEntities = (): ActiveEntitiesStore => {\n const store = inject(ACTIVE_ENTITIES_SYMBOL)\n if (!store) {\n throw new Error('Active entities store not provided')\n }\n return store\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport {\n type Collection,\n type CollectionPayload,\n type XScalarEnvironment,\n collectionSchema,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Initiate the workspace collections */\nexport function createStoreCollections(useLocalStorage: boolean) {\n const collections = reactive<Record<string, Collection>>({})\n const collectionMutators = mutationFactory(collections, reactive({}), useLocalStorage && LS_KEYS.COLLECTION)\n\n return {\n collections,\n collectionMutators,\n }\n}\n\n/** Extended mutators and data for collections that required workspace access */\nexport function extendedCollectionDataFactory({\n requests,\n requestMutators,\n requestExamples,\n requestExampleMutators,\n workspaces,\n workspaceMutators,\n collections,\n collectionMutators,\n tagMutators,\n serverMutators,\n}: StoreContext) {\n const addCollection = (payload: CollectionPayload, workspaceUid: Workspace['uid']) => {\n const collection = collectionSchema.parse(payload)\n const workspace = workspaces[workspaceUid]\n if (workspace) {\n workspaceMutators.edit(workspaceUid, 'collections', [...workspace.collections, collection.uid])\n }\n\n collectionMutators.add(collection)\n\n return collection\n }\n\n const deleteCollection = (collection: Collection, workspace: Workspace) => {\n if (!workspace.uid) {\n return\n }\n\n if (collections[collection.uid]?.info?.title === 'Drafts') {\n console.warn('The drafts collection cannot be deleted')\n return\n }\n\n if (Object.values(collections).length === 1) {\n console.warn('You must have at least one collection')\n return\n }\n\n // Handle data cleanup\n // NOTE: This is only for local memory management; unassociated objects will not be synced\n\n // Remove all tags\n collection.tags.forEach((uid) => tagMutators.delete(uid))\n\n // Remove requests\n collection.requests.forEach((uid) => {\n const request = requests[uid]\n if (!request) {\n return\n }\n\n requestMutators.delete(uid)\n request.examples.forEach((e) => requestExamples[e] && requestExampleMutators.delete(e))\n })\n\n // Remove servers\n collection.servers.forEach((uid) => {\n if (uid) {\n serverMutators.delete(uid)\n }\n })\n\n // Remove collection from workspace\n workspaceMutators.edit(\n workspace.uid,\n 'collections',\n workspace.collections.filter((uid) => uid !== collection.uid),\n )\n\n collectionMutators.delete(collection.uid)\n }\n\n const addCollectionEnvironment = (\n environmentName: string,\n environment: XScalarEnvironment,\n collectionUid: Collection['uid'],\n ) => {\n const collection = collections[collectionUid]\n if (collection) {\n const currentEnvironments = collection['x-scalar-environments'] || {}\n collectionMutators.edit(collectionUid, 'x-scalar-environments', {\n ...currentEnvironments,\n [environmentName]: environment,\n })\n }\n }\n\n const removeCollectionEnvironment = (environmentName: string, collectionUid: Collection['uid']) => {\n const collection = collections[collectionUid]\n if (collection) {\n const currentEnvironments = collection['x-scalar-environments'] || {}\n if (environmentName in currentEnvironments) {\n delete currentEnvironments[environmentName]\n collectionMutators.edit(collectionUid, 'x-scalar-environments', currentEnvironments)\n }\n }\n }\n\n return {\n addCollection,\n deleteCollection,\n addCollectionEnvironment,\n removeCollectionEnvironment,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport type { Cookie } from '@scalar/oas-utils/entities/cookie'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\n/** Create cookie mutators for the workspace */\nexport function createStoreCookies(useLocalStorage: boolean) {\n const cookies = reactive<Record<string, Cookie>>({})\n\n const cookieMutators = mutationFactory(cookies, reactive({}), useLocalStorage && LS_KEYS.COOKIE)\n\n return {\n cookies,\n cookieMutators,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport { type Environment, environmentSchema } from '@scalar/oas-utils/entities/environment'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Generate reactive environments for the workspace */\nexport function createStoreEnvironments(useLocalStorage: boolean) {\n /** Initialize default environment */\n const environments = reactive<Record<string, Environment>>({})\n const environmentMutators = mutationFactory(environments, reactive({}), useLocalStorage && LS_KEYS.ENVIRONMENT)\n\n // Add default environment\n environmentMutators.add(\n environmentSchema.parse({\n uid: 'default',\n name: 'Default Environment',\n color: '#FFFFFF',\n value: JSON.stringify({ exampleKey: 'exampleValue' }, null, 2),\n isDefault: true,\n }),\n )\n\n return {\n environments,\n environmentMutators,\n }\n}\n\n/** Extended environment data factory where workspace access is needed */\nexport function extendedEnvironmentDataFactory({ environmentMutators }: StoreContext) {\n /** prevent deletion of the default environment */\n const deleteEnvironment = (uid: Environment['uid']) => {\n if (uid === 'default') {\n console.warn('Default environment cannot be deleted.')\n return\n }\n environmentMutators.delete(uid)\n }\n\n return { deleteEnvironment }\n}\n","export type EventBusListener<P = any> = (payload?: P) => void\n\nexport type EventBus<P> = {\n /**\n * Subscribe to an event. When calling emit, the listeners will execute.\n * @param listener watch listener.\n * @returns a stop function to remove the current callback.\n */\n on: (listener: EventBusListener<P>) => () => void\n /**\n * Similar to `on`, but only fires once\n * @param listener watch listener.\n * @returns a stop function to remove the current callback.\n */\n once: (listener: EventBusListener<P>) => () => void\n /**\n * Emit an event, the corresponding event listeners will execute.\n * @param event data sent.\n */\n emit: (payload?: P) => void\n /**\n * Remove the corresponding listener.\n * @param listener watch listener.\n */\n off: (listener: EventBusListener<P>) => void\n /**\n * Clear all events\n */\n reset: () => void\n /**\n * Fetches an array of all active listeners\n */\n listeners: () => EventBusListener<P>[]\n}\n\n/**\n * Creates a ClientEvent with a payload of type P\n *\n * Modified from `@vueuse/core/useEventBus`\n * @see https://github.com/vueuse/vueuse/tree/v10.10.0/packages/core/useEventBus\n */\nexport function createEventBus<P = any>(): EventBus<P> {\n const listeners = new Set<EventBusListener<P>>()\n\n function on(listener: EventBusListener<P>) {\n listeners.add(listener)\n\n const _off = () => off(listener)\n return _off\n }\n\n function once(listener: EventBusListener<P>) {\n function _listener(...args: any[]) {\n off(_listener)\n listener(...args)\n }\n return on(_listener)\n }\n\n function off(listener: EventBusListener<P>): void {\n listeners.delete(listener)\n }\n\n function reset() {\n listeners.clear()\n }\n\n function emit(payload?: P) {\n listeners?.forEach((v) => v(payload))\n }\n\n return {\n on,\n once,\n off,\n emit,\n reset,\n listeners: () => Array.from(listeners),\n }\n}\n","import type { CommandPaletteEvent } from '@/components/CommandPalette/TheCommandPalette.vue'\nimport { createEventBus } from '@/libs/event-bus'\nimport type { HotKeyEvent } from '@/libs/hot-keys'\nimport type { RequestStatus } from '@/libs/send-request'\n\n/** Create the store for the api client events */\nexport function createStoreEvents() {\n return {\n /**\n * Event bus to execute requests, usually triggered by the send button in the address bar\n * OR the keyboard shortcut\n */\n executeRequest: createEventBus<{ requestUid?: string }>(),\n /**\n * Event bus to focus the address bar or send button\n */\n focusAddressBar: createEventBus(),\n /**\n * Event bus to cancel requests, usually triggered by response loading overlay\n */\n cancelRequest: createEventBus(),\n /**\n * Event bus to keep track of when a request is started, stopped, or aborted\n */\n requestStatus: createEventBus<RequestStatus>(),\n /**\n * Event bus for controlling the Command Palette\n *\n * @param commandName - the command name you wish to execute, leave empty for the full palette\n */\n commandPalette: createEventBus<CommandPaletteEvent>(),\n /**\n * Event bus for handling hot keys\n */\n hotKeys: createEventBus<HotKeyEvent>(),\n }\n}\n","import { type ApiClientConfiguration, apiClientConfigurationSchema } from '@scalar/types/api-reference'\nimport { type InjectionKey, type Ref, inject, ref } from 'vue'\n\nexport const CLIENT_CONFIGURATION_SYMBOL = Symbol() as InjectionKey<Ref<ApiClientConfiguration>>\n\n/** Hook for easy access to the reference configuration */\nexport const useClientConfig = () => inject(CLIENT_CONFIGURATION_SYMBOL, ref(apiClientConfigurationSchema.parse({})))\n","import type { Request } from '@scalar/oas-utils/entities/spec'\n\n/** Convert path string like '/planets/{planetId}' to regex pattern /\\/planets/([^/]+)/ */\nexport const pathToRegex = (path: string) => {\n const regxStr =\n '^' + // start anchor\n path\n .replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&') // escape special regex chars\n .replace(/\\\\\\{([^}]+)\\\\\\}/g, '([^/]+)') + // replace {param} with capture group\n '(\\\\?.*)?$' // optional query parameters at the end\n\n return new RegExp(regxStr)\n}\n\n/**\n * Takes a path and method and returns the request that matches the path and method while taking\n * path params into account by converting to a regex. Will also return the path params if they exist.\n *\n * @example path can be /planets/{planetId} OR /planets/1\n */\nexport const findRequestByPathMethod = (path: string, method: string, requests: Request[]) => {\n let pathParams: { key: string; value: string }[] = []\n\n const request = requests.find((r) => {\n if (r.method.toLowerCase() !== method.toLowerCase()) {\n return false\n }\n if (r.path === path) {\n return true\n }\n\n const regex = pathToRegex(r.path)\n const match = path.match(regex)\n\n // Extract path params from the match\n if (match) {\n pathParams = match.slice(1).flatMap((value, index) => {\n const key = r.path.split('{')[index + 1]?.split('}')[0]\n if (!key) {\n return []\n }\n return [{ key, value }]\n })\n return true\n }\n\n return false\n })\n\n return { request, pathParams }\n}\n","import type { Operation } from '@scalar/oas-utils/entities/spec'\n\nimport type { OpenClientPayload } from '@/libs/create-client'\nimport { findRequestByPathMethod } from '@/libs/find-request'\n\n/**\n * Get the request uid by path and method\n */\nexport const getRequestUidByPathMethod = (\n requests: Record<string, Operation>,\n payload?: Omit<OpenClientPayload, '_source'>,\n) => {\n const { requestUid, method, path } = payload ?? {}\n\n // If requestUid is provided, return it directly\n if (requestUid) {\n return requestUid\n }\n\n // In case theres no path or method provided, return the first\n if (!path || !method) {\n return Object.keys(requests)[0]\n }\n\n // Convert requests record to array for findRequestByPathMethod\n const requestsArray = Object.values(requests)\n\n // First try to find exact match (prioritize exact paths over pattern matches)\n const exactMatch = requestsArray.find(\n (item) => item.path.toLowerCase() === path.toLowerCase() && item.method.toLowerCase() === method.toLowerCase(),\n )\n\n if (exactMatch) {\n return exactMatch.uid\n }\n\n // If no exact match, use pattern matching logic for path parameters\n const { request } = findRequestByPathMethod(path, method, requestsArray)\n\n return request?.uid || Object.keys(requests)[0]\n}\n","import { cookieSchema } from '@scalar/oas-utils/entities/cookie'\nimport { environmentSchema } from '@scalar/oas-utils/entities/environment'\nimport {\n collectionSchema,\n requestExampleSchema,\n requestSchema,\n securitySchemeSchema,\n serverSchema,\n tagSchema,\n} from '@scalar/oas-utils/entities/spec'\nimport { workspaceSchema } from '@scalar/oas-utils/entities/workspace'\nimport { schemaModel } from '@scalar/oas-utils/helpers'\nimport { DATA_VERSION, DATA_VERSION_LS_LEY, migrator } from '@scalar/oas-utils/migrations'\nimport type { ZodSchema } from 'zod'\n\nimport type { WorkspaceStore } from '@/store'\n\n/** Loads the migrated resource into the mutator safely */\nconst loadResources = <T extends (object & { uid: string })[]>(\n resources: T,\n schema: ZodSchema<T[number], any>,\n add: (payload: T[number]) => void | T[number],\n) =>\n resources.forEach((payload) => {\n // Use schema model for safe parsing\n const resource = schemaModel(payload, schema, false)\n\n // Success, a failure should log a warning in the console already through the schema model\n if (resource) {\n add(resource)\n }\n })\n\n/**\n * Loads all resources from localStorage and applies any migrations, then loads into mutators\n * We use the raw mutator.add here instead of the custom ones because we do NOT want any side effects\n *\n * Currently not working for workspace\n */\nexport const loadAllResources = (mutators: WorkspaceStore) => {\n const {\n collectionMutators,\n cookieMutators,\n environmentMutators,\n tagMutators,\n requestExampleMutators,\n requestMutators,\n serverMutators,\n securitySchemeMutators,\n workspaceMutators,\n } = mutators\n\n try {\n // Hit our local storage data migrator\n const {\n collections,\n cookies,\n environments,\n requestExamples,\n requests,\n servers,\n securitySchemes,\n tags,\n workspaces,\n } = migrator().arrays\n\n // Load the migrated data up into the mutators with safe parsing\n // TODO: we should probably make rawAdd -> add, and add a new name for adding with side effects\n loadResources(collections, collectionSchema, collectionMutators.rawAdd)\n loadResources(cookies, cookieSchema, cookieMutators.add)\n loadResources(environments, environmentSchema, environmentMutators.add)\n loadResources(requestExamples, requestExampleSchema, requestExampleMutators.rawAdd)\n loadResources(requests, requestSchema, requestMutators.rawAdd)\n loadResources(servers, serverSchema, serverMutators.rawAdd)\n loadResources(securitySchemes, securitySchemeSchema, securitySchemeMutators.rawAdd)\n loadResources(tags, tagSchema, tagMutators.rawAdd)\n loadResources(workspaces, workspaceSchema, workspaceMutators.rawAdd)\n\n // Set localStorage version for future migrations\n localStorage.setItem(DATA_VERSION_LS_LEY, DATA_VERSION)\n } catch (e) {\n console.error(e)\n }\n}\n","import { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport type { SecurityScheme } from '@scalar/oas-utils/entities/spec'\nimport { type Workspace, workspaceSchema } from '@scalar/oas-utils/entities/workspace'\nimport { DATA_VERSION, DATA_VERSION_LS_LEY } from '@scalar/oas-utils/migrations'\nimport type { Path, PathValue } from '@scalar/object-utils/nested'\nimport type { OpenAPI } from '@scalar/openapi-types'\nimport { type ApiClientConfiguration, apiClientConfigurationSchema } from '@scalar/types/api-reference'\nimport { type Component, createApp, ref, watch } from 'vue'\nimport type { Router } from 'vue-router'\n\nimport { CLIENT_CONFIGURATION_SYMBOL } from '@/hooks/useClientConfig'\nimport { type ClientLayout, LAYOUT_SYMBOL } from '@/hooks/useLayout'\nimport { SIDEBAR_SYMBOL, createSidebarState } from '@/hooks/useSidebar'\nimport { getRequestUidByPathMethod } from '@/libs/get-request-uid-by-path-method'\nimport { loadAllResources } from '@/libs/local-storage'\nimport { PLUGIN_MANAGER_SYMBOL, createPluginManager } from '@/plugins'\nimport { ACTIVE_ENTITIES_SYMBOL, createActiveEntitiesStore } from '@/store/active-entities'\nimport { WORKSPACE_SYMBOL, type WorkspaceStore, createWorkspaceStore } from '@/store/store'\n\nexport type OpenClientPayload = (\n | {\n path: string\n method: OpenAPI.HttpMethod | Uppercase<OpenAPI.HttpMethod>\n requestUid?: never\n }\n | {\n path?: never\n method?: never\n requestUid: string\n }\n) & {\n _source?: 'api-reference' | 'gitbook'\n}\n\nexport type CreateApiClientParams = {\n /** Element to mount the references to */\n el: HTMLElement | null\n /** Main vue app component to create the vue app */\n appComponent: Component\n /** Configuration object for API client */\n configuration?: Partial<ApiClientConfiguration>\n /** Read only version of the client app */\n isReadOnly?: boolean\n /** Persist the workspace to localStoragfe */\n persistData?: boolean\n /**\n * Will attempt to mount the references immediately\n * For SSR this may need to be blocked and done client side\n */\n mountOnInitialize?: boolean\n /** Instance of a vue router */\n router: Router\n /** In case the store has been instantiated beforehand */\n store?: WorkspaceStore | undefined\n /**\n * The layout of the client\n * @see {@link ClientLayout}\n */\n layout?: ClientLayout\n}\n\n/**\n * ApiClient type\n *\n * We need to do this due to some typescript type propagation errors\n * This is pretty much add properties as they are needed\n */\nexport type ApiClient = Omit<ReturnType<typeof createApiClient>, 'app' | 'store'> & {\n /** Add properties as they are needed, see above */\n app: { unmount: () => void }\n /**\n * The main workspace store from the client\n * These refs don't wanna play nice with typescript, if we need them we can de-reference them\n */\n store: Omit<WorkspaceStore, 'router' | 'events' | 'sidebarWidth' | 'proxyUrl' | 'requestHistory'>\n}\n\n/**\n * Sync method to create the api client vue app and store\n *\n * This method will NOT import the spec, just create the modal so you must use update/updateConfig before opening\n */\nexport const createApiClient = ({\n el,\n appComponent,\n configuration: _configuration = {},\n isReadOnly = false,\n store: _store,\n persistData = true,\n mountOnInitialize = true,\n layout = 'desktop',\n router,\n}: CreateApiClientParams) => {\n // Parse the config\n const configuration = ref(apiClientConfigurationSchema.parse(_configuration))\n\n // Create the store if it wasn't passed in\n const store =\n _store ||\n createWorkspaceStore({\n proxyUrl: configuration.value.proxyUrl,\n theme: configuration.value.theme,\n showSidebar: configuration.value.showSidebar ?? true,\n hideClientButton: configuration.value.hideClientButton ?? false,\n _integration: configuration.value._integration,\n useLocalStorage: persistData,\n })\n\n // Create the router based active entities store\n const activeEntities = createActiveEntitiesStore({ ...store, router })\n\n // Create the sidebar state\n const sidebarState = createSidebarState({ layout })\n\n // Create the plugin manager\n const pluginManager = createPluginManager({\n plugins: configuration.value.plugins ?? [],\n })\n\n // Safely check for localStorage availability\n const hasLocalStorage = () => {\n try {\n return typeof window !== 'undefined' && window.localStorage !== undefined\n } catch {\n return false\n }\n }\n\n // Load from localStorage if available and enabled\n if (hasLocalStorage() && localStorage.getItem(LS_KEYS.WORKSPACE) && !isReadOnly) {\n try {\n const size: Record<string, string> = {}\n let _lsTotal = 0\n let _xLen = 0\n let _key = ''\n\n for (_key in localStorage) {\n if (!Object.hasOwn(localStorage, _key)) {\n continue\n }\n _xLen = (localStorage[_key].length + _key.length) * 2\n _lsTotal += _xLen\n size[_key] = (_xLen / 1024).toFixed(2) + ' KB'\n }\n size['Total'] = (_lsTotal / 1024).toFixed(2) + ' KB'\n console.table(size)\n\n loadAllResources(store)\n } catch (error) {\n console.warn('Failed to load from localStorage:', error)\n }\n }\n // Create the default store\n else if (!isReadOnly && !configuration.value.url && !configuration.value.content) {\n // Create default workspace\n store.workspaceMutators.add({\n uid: 'default' as Workspace['uid'],\n name: 'Workspace',\n proxyUrl: configuration.value.proxyUrl,\n })\n\n if (hasLocalStorage()) {\n try {\n localStorage.setItem(DATA_VERSION_LS_LEY, DATA_VERSION)\n } catch (error) {\n console.warn('Failed to set localStorage version:', error)\n }\n }\n }\n // Add a barebones workspace if we want to load a spec in the modal\n else {\n const workspace = workspaceSchema.parse({\n uid: 'default',\n name: 'Workspace',\n proxyUrl: configuration.value.proxyUrl,\n })\n store.workspaceMutators.rawAdd(workspace)\n }\n\n const app = createApp(appComponent)\n app.use(router)\n // Provide the workspace store for the useWorkspace hook\n app.provide(WORKSPACE_SYMBOL, store)\n // Provide the layout for the useLayout hook\n app.provide(LAYOUT_SYMBOL, layout)\n // Provide the active entities store\n app.provide(ACTIVE_ENTITIES_SYMBOL, activeEntities)\n // Provide the sidebar state\n app.provide(SIDEBAR_SYMBOL, sidebarState)\n // Provide the client config\n app.provide(CLIENT_CONFIGURATION_SYMBOL, configuration)\n // Provide the plugin manager\n app.provide(PLUGIN_MANAGER_SYMBOL, pluginManager)\n // Set an id prefix for useId so we don't have collisions with other Vue apps\n app.config.idPrefix = 'scalar-client'\n\n const {\n collectionMutators,\n importSpecFile,\n importSpecFromUrl,\n modalState,\n requests,\n securitySchemes,\n securitySchemeMutators,\n servers,\n workspaceMutators,\n requestExampleMutators,\n } = store\n const { activeCollection, activeWorkspace } = activeEntities\n\n // Mount the vue app\n const mount = (mountingEl = el) => {\n if (!mountingEl) {\n console.error(\n '[@scalar/api-client-modal] Could not create the API client.',\n 'Invalid HTML element provided.',\n 'Read more: https://github.com/scalar/scalar/tree/main/packages/api-client',\n )\n\n return\n }\n app.mount(mountingEl)\n }\n if (mountOnInitialize) {\n mount()\n }\n\n /** Route to the specified method and path */\n const route = (payload?: OpenClientPayload) => {\n // Find the request from path + method\n const resolvedRequestUid = getRequestUidByPathMethod(requests, payload)\n\n // Redirect to the request\n if (resolvedRequestUid) {\n router.push({\n name: 'request',\n query: payload?._source ? { source: payload._source } : {},\n params: {\n workspace: 'default',\n request: resolvedRequestUid,\n },\n })\n } else {\n console.warn('[@scalar/api-client] Could not find request for path and method', payload)\n }\n }\n\n /** Reset the client store */\n const resetStore = () => {\n store.collectionMutators.reset()\n store.requestMutators.reset()\n store.requestExampleMutators.reset()\n store.securitySchemeMutators.reset()\n store.serverMutators.reset()\n store.tagMutators.reset()\n workspaceMutators.edit(activeWorkspace.value?.uid, 'collections', [])\n }\n\n return {\n /** The vue app instance for the modal, be careful with this */\n app,\n resetStore,\n /**\n * Update the API client config\n *\n * Deletes the current store before importing again for now, in the future will Diff and only update what is needed\n */\n updateConfig: async (_newConfig: Partial<ApiClientConfiguration>) => {\n const newConfig = apiClientConfigurationSchema.parse(_newConfig)\n\n // When to rigger rebuilding the store (until we diff) this is just a temp hack BUT do not put anything that\n // has a default here as it will always trigger as the config has already been parsed\n if (\n newConfig.url ||\n newConfig.content ||\n newConfig.servers ||\n newConfig.authentication ||\n newConfig.slug ||\n newConfig.title ||\n newConfig.baseServerURL ||\n newConfig.proxyUrl ||\n newConfig.showSidebar\n ) {\n // Update the spec, reset the store first\n resetStore()\n\n /** Add any extra properties to the config */\n const config = {\n ...newConfig,\n useCollectionSecurity: isReadOnly,\n }\n\n // Update the config ref\n configuration.value = config\n\n if (newConfig.url) {\n await importSpecFromUrl(newConfig.url, activeWorkspace.value?.uid ?? 'default', config)\n } else if (newConfig.content) {\n await importSpecFile(newConfig.content, activeWorkspace.value?.uid ?? 'default', config)\n } else {\n console.error(\n '[@scalar/api-client-modal] Could not create the API client.',\n 'Please provide an OpenAPI document: { url: \"…\" }',\n 'Read more: https://github.com/scalar/scalar/tree/main/packages/api-client',\n )\n }\n }\n },\n /** Update the currently selected server via URL */\n updateServer: (serverUrl: string) => {\n const server = Object.values(servers).find((s) => s.url === serverUrl)\n\n if (server && activeCollection.value) {\n collectionMutators.edit(activeCollection.value?.uid, 'selectedServerUid', server.uid)\n }\n },\n /** Update the currently selected server via URL */\n onUpdateServer: (callback: (url: string) => void) => {\n watch(\n () => activeCollection.value?.selectedServerUid,\n (uid) => {\n const server = Object.values(servers).find((s) => s.uid === uid)\n if (server?.url) {\n callback(server.url)\n }\n },\n )\n },\n /**\n * Update the auth values, we currently don't change the auth selection\n */\n updateAuth: <P extends Path<SecurityScheme>>({\n nameKey,\n propertyKey,\n value,\n }: {\n nameKey: string\n propertyKey: P\n value: NonNullable<PathValue<SecurityScheme, P>>\n }) => {\n const schemes = Object.values(securitySchemes)\n const scheme = schemes.find((s) => s.nameKey === nameKey)\n\n if (scheme) {\n securitySchemeMutators.edit(scheme.uid, propertyKey, value)\n }\n },\n /** Route to a method + path */\n route,\n\n /** Open the API client modal and optionally route to a request */\n open: (payload?: OpenClientPayload) => {\n const { method, path, requestUid } = payload ?? {}\n if ((method && path) || requestUid) {\n route(payload)\n }\n\n // Open the modal\n modalState.open = true\n },\n /** Mount the references to a given element */\n mount,\n /** State for controlling the modal */\n modalState,\n /* The workspace store */\n store,\n /** Update the currently selected example */\n updateExample: (exampleKey: string, operationId: string) => {\n if (!exampleKey || !operationId) {\n return\n }\n\n const request = Object.values(requests).find(\n ({ operationId: reqOperationId, path }) => reqOperationId === operationId || path === operationId,\n )\n if (!request) {\n return\n }\n\n const contentType = Object.keys(request.requestBody?.content || {})[0] || ''\n const example = request.requestBody?.content?.[contentType]?.examples?.[exampleKey]\n if (!example) {\n return\n }\n\n requestExampleMutators.edit(request.examples[0], 'body.raw.value', prettyPrintJson(example.value))\n },\n }\n}\n","import type { Environment } from '@scalar/oas-utils/entities/environment'\n\nexport type EnvVariables = { key: string; value: string; source: 'global' | 'collection' }[]\n\nexport type EnvConfig = {\n variables: Record<string, string | { default: string; description?: string | undefined }>\n color?: string | undefined\n description?: string | undefined\n}\n\n/** Gets the color of an environment with default fallback */\nexport function getEnvColor(environment: Environment): string {\n return environment?.color || '#FFFFFF'\n}\n","import type { EnvVariables } from '@/libs/env-helpers'\n\n/** Parses the active environment variables and extracts key-value pairs. */\nexport function parseEnvVariables(activeEnvVariables: EnvVariables) {\n return activeEnvVariables.flatMap((variable) => {\n if (variable.key === 'value') {\n try {\n const parsedValue = JSON.parse(variable.value)\n return Object.keys(parsedValue).map((key) => ({\n key,\n value: parsedValue[key],\n source: variable.source,\n }))\n } catch (_e) {\n // Skip invalid environment editor JSON entries\n }\n }\n return [variable]\n })\n}\n","import { isValidUrl } from '@scalar/oas-utils/helpers'\n\n/** Checks whether the given string is an URL */\nexport function isUrl(input: string | null) {\n if (!input) {\n return false\n }\n if (!(input.startsWith('http://') || input.startsWith('https://'))) {\n return false\n }\n\n return isValidUrl(input)\n}\n","import { json, yaml } from '@scalar/oas-utils/helpers'\n\nimport { isUrl } from './isUrl'\n\nexport type OpenApiDocumentDetails = {\n version: string\n type: 'json' | 'yaml'\n title: string | undefined\n}\n\n/** Try to extract details from the info */\nfunction tryGetInfo(info: any) {\n return {\n title: typeof info?.title === 'string' ? `${info?.title}` : undefined,\n }\n}\n\n/**\n * Get the base Swagger/OpenAPI details from the given string\n */\nexport function getOpenApiDocumentDetails(input: string | null): OpenApiDocumentDetails | undefined {\n if (!input || isUrl(input)) {\n return undefined\n }\n\n try {\n const result = json.parse(input ?? '')\n\n if (typeof result?.openapi === 'string') {\n return {\n version: `OpenAPI ${result.openapi}`,\n type: 'json',\n ...tryGetInfo(result.info),\n }\n }\n\n if (typeof result?.swagger === 'string') {\n return {\n version: `Swagger ${result.swagger}`,\n type: 'json',\n ...tryGetInfo(result.info),\n }\n }\n\n return undefined\n } catch {\n //\n }\n\n try {\n const result = yaml.parse(input ?? '')\n\n if (typeof result?.openapi === 'string') {\n return {\n version: `OpenAPI ${result.openapi}`,\n type: 'yaml',\n ...tryGetInfo(result.info),\n }\n }\n\n if (typeof result?.swagger === 'string') {\n return {\n version: `Swagger ${result.swagger}`,\n type: 'yaml',\n ...tryGetInfo(result.info),\n }\n }\n\n return undefined\n } catch {\n //\n }\n\n return undefined\n}\n","import { isMacOS } from '@scalar/helpers/general/is-mac-os'\nimport type { HotkeyEventName, KeydownKey } from '@scalar/oas-utils/entities/hotkeys'\nimport type { HotKeyConfig, HotKeyModifiers } from '@scalar/oas-utils/entities/workspace'\n\nimport type { EventBus } from '@/libs'\n\nexport type HotKeyEvent = Partial<Record<HotkeyEventName, KeyboardEvent>>\n\n/**\n * These are unrelated to an input so they will still fire if we are in one,\n * this is not for a textarea in which you should be able to use arrow keys, enter etc\n */\nconst inputHotkeys = [\n 'Escape',\n 'ArrowDown',\n 'ArrowUp',\n 'Enter',\n 'F1',\n 'F2',\n 'F3',\n 'F4',\n 'F5',\n 'F6',\n 'F7',\n 'F8',\n 'F9',\n 'F10',\n 'F11',\n 'F12',\n]\n\n/**\n * Default set of keybindings\n *\n * Passing an empty object for hotkeys will disable them\n *\n * TODO we can add a merge or overwrite option\n *\n * The modifier can be set by the user but defaults to ctrl for windows/linux and meta for macos\n *\n * For the modifier key:\n * - if you leave it blank it can be true or false\n * - if you explicitly set it, the event must match ex: modifier false will not trigger if the modifier was pressed\n */\nexport const DEFAULT_HOTKEYS: HotKeyConfig = {\n Escape: { event: 'closeModal' },\n Enter: { event: 'executeRequest', modifiers: ['default'] },\n b: { event: 'toggleSidebar', modifiers: ['default'] },\n k: { event: 'openCommandPalette', modifiers: ['default'] },\n l: { event: 'focusAddressBar', modifiers: ['default'] },\n}\n\n/** Checks if we are in an \"input\" */\nexport const isInput = (ev: KeyboardEvent) => {\n if (!(ev.target instanceof HTMLElement)) {\n return false\n }\n const target = ev.target\n\n // For actual inputs we would like to allow certain hotkeys to go through even without modifiers\n if (target.tagName === 'INPUT') {\n return !inputHotkeys.includes(ev.key)\n }\n if (target.tagName === 'TEXTAREA') {\n return true\n }\n if (target.getAttribute('contenteditable')) {\n return true\n }\n if (target.contentEditable === 'true') {\n return true\n }\n\n return false\n}\n\nconst MODIFIER_DICT = {\n Alt: 'altKey',\n Control: 'ctrlKey',\n Shift: 'shiftKey',\n Meta: 'metaKey',\n} as const\n\n/** Converts our modifier config to the eventKey */\nexport const getModifiers = (modifiers: HotKeyModifiers) =>\n modifiers.map((modifier) => (modifier === 'default' ? (isMacOS() ? 'metaKey' : 'ctrlKey') : MODIFIER_DICT[modifier]))\n\n/**\n * Global keydown handler for hotkeys\n *\n * This is the brain of the operation, we turn keybindings -> events\n */\nexport const handleHotKeyDown = (\n ev: KeyboardEvent,\n eventBus: EventBus<HotKeyEvent>,\n { hotKeys = DEFAULT_HOTKEYS, modifiers = ['default'] as HotKeyModifiers } = {},\n) => {\n const key = ev.key === ' ' ? 'Space' : (ev.key as KeydownKey)\n const hotKeyEvent = hotKeys[key]\n\n // Match the event with possible hotkeys\n if (hotKeyEvent) {\n // For escape we always send it\n if (key === 'Escape') {\n eventBus.emit({ [hotKeyEvent.event]: ev })\n } else {\n const _modifiers = getModifiers(hotKeyEvent.modifiers || modifiers)\n const areModifiersPressed = _modifiers.every((mod) => ev[mod] === true)\n\n // We send even in inputs if there is a modifier\n if (areModifiersPressed) {\n eventBus.emit({ [hotKeyEvent.event]: ev })\n }\n // Check if we are in an input as modifier === 'undefined'\n else if (!isInput(ev) && hotKeyEvent.modifiers === undefined) {\n eventBus.emit({ [hotKeyEvent.event]: ev })\n }\n }\n }\n}\n","import { convert } from '@scalar/postman-to-openapi'\n\n/** Checks if the given content is a Postman collection */\nexport function isPostmanCollection(content: string): boolean {\n try {\n const parsed = JSON.parse(content)\n const isPostman =\n parsed.info?._postman_id !== undefined && new URL(parsed.info?.schema).host === 'schema.getpostman.com'\n return isPostman\n } catch (_error) {\n return false\n }\n}\n\n/** Converts a Postman collection JSON string to an OpenAPI JSON string */\nexport function convertPostmanToOpenApi(postmanJson: string): string {\n try {\n const postmanCollection = JSON.parse(postmanJson)\n const openApiDoc = convert(postmanCollection)\n return JSON.stringify(openApiDoc, null, 2)\n } catch (_error) {\n throw new Error('Failed to convert Postman collection to OpenAPI')\n }\n}\n\n/** Extracts details from a Postman collection JSON string */\nexport function getPostmanDocumentDetails(content: string): {\n type: string\n title: string\n version: string\n} | null {\n try {\n if (isPostmanCollection(content)) {\n const parsed = JSON.parse(content)\n return {\n type: 'json',\n title: parsed.info?.name || 'Postman Collection',\n version: parsed.info?.version || '1.0',\n }\n }\n return null\n } catch {\n return null\n }\n}\n","import type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { createHash, fetchDocument } from '@scalar/oas-utils/helpers'\nimport { type ImportSpecToWorkspaceArgs, importSpecToWorkspace } from '@scalar/oas-utils/transforms'\nimport type { OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types'\nimport type { ApiReferenceConfiguration } from '@scalar/types/api-reference'\nimport { toRaw } from 'vue'\n\nimport { type ErrorResponse, normalizeError } from '@/libs'\nimport type { StoreContext } from '@/store/store-context'\n\n/** Maps the specs by URL */\nexport const specDictionary: Record<string, { hash: number; schema: OpenAPIV3.Document | OpenAPIV3_1.Document }> = {}\n\ntype ImportSpecFileArgs = ImportSpecToWorkspaceArgs &\n Pick<ApiReferenceConfiguration, 'servers'> & {\n dereferencedDocument?: OpenAPIV3_1.Document\n }\n\n/** Generate the import functions from a store context */\nexport function importSpecFileFactory({\n requestMutators,\n collectionMutators,\n serverMutators,\n tagMutators,\n securitySchemeMutators,\n requestExampleMutators,\n workspaceMutators,\n workspaces,\n}: StoreContext) {\n const importSpecFile = async (\n _spec: string | Record<string, any> | undefined,\n workspaceUid: string,\n options: ImportSpecFileArgs = {},\n ) => {\n const spec = toRaw(_spec)\n const workspaceEntities = await importSpecToWorkspace(spec, options)\n\n if (workspaceEntities.error) {\n console.group('IMPORT ERRORS')\n workspaceEntities.importWarnings.forEach((w) => console.warn(w))\n console.groupEnd()\n\n return undefined\n }\n\n // Store the schema for live updates\n if (options.documentUrl && typeof spec === 'string') {\n specDictionary[options.documentUrl] = {\n hash: createHash(spec),\n schema: workspaceEntities.schema,\n }\n }\n\n // Add all basic entities to the store\n // WARNING: We expect all internal references to be set between entities at this point\n workspaceEntities.examples.forEach((e) => requestExampleMutators.add(e))\n workspaceEntities.requests.forEach((r) => requestMutators.add(r))\n workspaceEntities.tags.forEach((t) => tagMutators.add(t))\n workspaceEntities.servers.forEach((s) => serverMutators.add(s))\n workspaceEntities.securitySchemes.forEach((s) => securitySchemeMutators.add(s))\n collectionMutators.add(workspaceEntities.collection)\n\n // Add the collection UID to the workspace\n workspaceMutators.edit(workspaceUid as Workspace['uid'], 'collections', [\n ...(workspaces[workspaceUid]?.collections ?? []),\n workspaceEntities.collection.uid,\n ])\n\n return workspaceEntities\n }\n\n /**\n * Function to fetch and import a spec from a URL\n *\n * returns true for success\n */\n async function importSpecFromUrl(\n url: string,\n workspaceUid: string,\n {\n proxyUrl,\n ...options\n }: Omit<ImportSpecFileArgs, 'documentUrl'> & Pick<ApiReferenceConfiguration, 'proxyUrl'> = {},\n ): Promise<ErrorResponse<Awaited<ReturnType<typeof importSpecFile>>>> {\n try {\n const spec = await fetchDocument(url, proxyUrl)\n\n return [\n null,\n await importSpecFile(spec, workspaceUid, {\n documentUrl: url,\n ...options,\n }),\n ]\n } catch (error) {\n console.error('Failed to fetch spec from URL:', error)\n return [normalizeError(error), null]\n }\n }\n\n return {\n importSpecFile,\n importSpecFromUrl,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport { iterateTitle } from '@scalar/helpers/string/iterate-title'\nimport { type Request, type RequestExample, createExampleFromRequest } from '@scalar/oas-utils/entities/spec'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Create top level examples storage for the workspace */\nexport function createStoreRequestExamples(useLocalStorage: boolean) {\n /**\n * Each request has multiple examples associated with it\n * An example is a set of request params that is saved to the example\n * Multiple test cases can each be saved as an example and switched between\n */\n const requestExamples = reactive<Record<string, RequestExample>>({})\n const requestExampleMutators = mutationFactory(\n requestExamples,\n reactive({}),\n useLocalStorage && LS_KEYS.REQUEST_EXAMPLE,\n )\n\n return {\n requestExamples,\n requestExampleMutators,\n }\n}\n\n/** Extended example data that needs store context */\nexport function extendedExampleDataFactory({\n requestExamples,\n requestExampleMutators,\n requestMutators,\n requests,\n}: StoreContext) {\n /** Ensure we add to the base examples as well as the request it is in */\n const addRequestExample = (request: Request, _name?: string) => {\n const name =\n _name ??\n iterateTitle((request.summary ?? 'Example') + ' #1', (t) =>\n request.examples.some((uid) => requestExamples[uid]?.name === t),\n )\n\n const example = createExampleFromRequest(request, name)\n\n // Add the example to the store\n requestExampleMutators.add(example)\n\n // Add the uid to the request\n requestMutators.edit(request.uid, 'examples', [...request.examples, example.uid])\n\n return example\n }\n\n /** Ensure we remove from the base as well as from the request it is in */\n const deleteRequestExample = (requestExample: RequestExample) => {\n if (!requestExample.requestUid) {\n return\n }\n\n // Remove from request\n requestMutators.edit(\n requestExample.requestUid,\n 'examples',\n requests[requestExample.requestUid]?.examples.filter((uid) => uid !== requestExample.uid) || [],\n )\n\n // Remove from base\n requestExampleMutators.delete(requestExample.uid)\n }\n\n return {\n addRequestExample,\n deleteRequestExample,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport { iterateTitle } from '@scalar/helpers/string/iterate-title'\nimport {\n type Collection,\n type Request,\n type RequestPayload,\n type Tag,\n createExampleFromRequest,\n requestSchema,\n} from '@scalar/oas-utils/entities/spec'\nimport { schemaModel } from '@scalar/oas-utils/helpers'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { extendedTagDataFactory } from '@/store/tags'\n\nimport type { StoreContext } from './store-context'\n\n/** Create top level request handlers for a workspace */\nexport function createStoreRequests(useLocalStorage: boolean) {\n /** Local list of all requests (will be associated with a database collection) */\n const requests = reactive<Record<string, Request>>({})\n const requestMutators = mutationFactory(requests, reactive({}), useLocalStorage && LS_KEYS.REQUEST)\n\n return {\n requests,\n requestMutators,\n }\n}\n\ntype AddTag = ReturnType<typeof extendedTagDataFactory>['addTag']\n\n/**\n * Create the extended mutators for request where access to the workspace is required\n */\nexport function extendedRequestDataFactory(\n {\n requestExamples,\n requestExampleMutators,\n requestMutators,\n collectionMutators,\n collections,\n tags,\n tagMutators,\n }: StoreContext,\n // We want the add tag with side effects here so it gets properly added to the colleciton\n addTag: AddTag,\n) {\n /** Add request */\n const addRequest = (payload: RequestPayload, collectionUid: Collection['uid']) => {\n const request = schemaModel(payload, requestSchema, false)\n if (!request) {\n return console.error('INVALID REQUEST DATA', payload)\n }\n\n const collection = collections[collectionUid]\n\n // Create the initial example\n const example = createExampleFromRequest(\n request,\n iterateTitle((request.summary ?? 'Example') + ' #1', (t) =>\n request.examples.some((uid) => t === requestExamples[uid]?.name),\n ),\n )\n request.examples.push(example.uid)\n\n // Add request and example to the workspace\n requestMutators.add(request)\n requestExampleMutators.add(example)\n\n // Add the request to the collection\n if (collection) {\n collectionMutators.edit(collectionUid, 'requests', [...collection.requests, request.uid])\n }\n\n // Add to the tags\n if (request.tags?.length) {\n request.tags.forEach((tagName) => {\n const tagUid = collection?.tags.find((uid) => tags[uid]?.name === tagName)\n\n if (tagUid && tags[tagUid]) {\n tagMutators.edit(tagUid, 'children', [...tags[tagUid].children, request.uid])\n }\n // We must add a new tag\n else {\n addTag({ name: tagName, children: [request.uid] }, collectionUid)\n }\n })\n }\n // Add to the collection children if no tags\n else if (collection) {\n collectionMutators.edit(collectionUid, 'children', [...collection.children, request.uid])\n }\n\n return request\n }\n\n /** Delete request */\n const deleteRequest = (request: Request, collectionUid: Collection['uid']) => {\n const collection = collections[collectionUid]\n\n // Remove all examples\n request.examples.forEach((uid) => requestExampleMutators.delete(uid))\n\n if (collection) {\n // Remove the request from the collection\n collectionMutators.edit(\n collectionUid,\n 'requests',\n collection.requests.filter((r) => r !== request.uid),\n )\n\n // And collection children\n collectionMutators.edit(\n collectionUid,\n 'children',\n collection.children.filter((r) => r !== request.uid),\n )\n\n // And from all tags\n request.tags?.forEach((tagName) => {\n const tagUid = collection.tags.find((uid) => tags[uid]?.name === tagName)\n if (!tagUid) {\n return\n }\n\n tagMutators.edit(tagUid, 'children', tags[tagUid]?.children.filter((r) => r !== request.uid) || [])\n })\n }\n\n // Remove request\n requestMutators.delete(request.uid)\n }\n\n return {\n addRequest,\n deleteRequest,\n findRequestParents: findRequestParentsFactory({ collections, tags }),\n }\n}\n\n/** Factory function to allow testing of the function */\nexport function findRequestParentsFactory({\n collections,\n tags,\n}: {\n collections: Record<string, Collection>\n tags: Record<string, Tag>\n}) {\n /** Recursively find all parent folders (tags and collections) of a request */\n function findRequestParentss(r: Request) {\n const collection = Object.values(collections).find((c) => c.requests?.includes(r.uid))\n if (!collection) {\n return []\n }\n\n // Initialized an empty children array for each tag and once for the top level collection\n const tagChildren = Object.keys(tags).reduce<Record<string, string[]>>(\n (obj, uid) => {\n obj[uid] = []\n return obj\n },\n { [collection?.uid]: [] },\n )\n\n // Recursively add nested children to the tagChildren values\n function addChildren(current: Tag | Collection, parentUids: string[]) {\n parentUids.forEach((p) => tagChildren[p]?.push(...current.children))\n\n // tagChildren[current.uid].push(...current.children)\n\n current.children.forEach((t) => {\n if (tags[t]) {\n addChildren(tags[t], [...parentUids, t])\n }\n })\n }\n addChildren(collection, [collection.uid])\n\n // Return unique parents\n const parents: Set<string> = new Set()\n\n // Anytime a tag has the request somewhere in its tree we make it open\n Object.entries(tagChildren).forEach(([tagUid, totalChildren]) => {\n if (totalChildren.includes(r.uid)) {\n parents.add(tagUid)\n }\n })\n return [...parents]\n }\n\n return findRequestParentss\n}\n\n/** First draft request\" */\nexport function createInitialRequest() {\n const request = requestSchema.parse({\n method: 'get',\n parameters: [],\n path: '',\n summary: 'My First Request',\n examples: [],\n })\n\n return { request }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport {\n type Collection,\n type SecurityScheme,\n type SecuritySchemePayload,\n securitySchemeSchema,\n} from '@scalar/oas-utils/entities/spec'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Create storage entities for security schemes */\nexport function createStoreSecuritySchemes(useLocalStorage: boolean) {\n const securitySchemes = reactive<Record<string, SecurityScheme>>({})\n const securitySchemeMutators = mutationFactory(\n securitySchemes,\n reactive({}),\n useLocalStorage && LS_KEYS.SECURITY_SCHEME,\n )\n\n return {\n securitySchemes,\n securitySchemeMutators,\n }\n}\n\n/** Extended mutators and data for security schemas */\nexport function extendedSecurityDataFactory({\n securitySchemeMutators,\n collectionMutators,\n collections,\n requests,\n requestMutators,\n}: StoreContext) {\n /** Adds a security scheme and appends it to either a collection or a request */\n const addSecurityScheme = (\n payload: SecuritySchemePayload,\n /** Schemes will always live at the collection level */\n collectionUid: Collection['uid'],\n ) => {\n const scheme = securitySchemeSchema.parse(payload)\n securitySchemeMutators.add(scheme)\n\n // Add to collection dictionary\n if (collectionUid && collections[collectionUid]) {\n collectionMutators.edit(collectionUid, 'securitySchemes', [\n ...collections[collectionUid].securitySchemes,\n scheme.uid,\n ])\n }\n\n return scheme\n }\n\n /** Delete a security scheme and remove the key from its corresponding parent */\n const deleteSecurityScheme = (schemeUid: SecurityScheme['uid']) => {\n Object.values(collections).forEach((c) => {\n // Remove the scheme from any collections that reference it (should only be 1 collection)\n if (c.securitySchemes.includes(schemeUid)) {\n collectionMutators.edit(\n c.uid,\n 'securitySchemes',\n c.securitySchemes.filter((s) => s !== schemeUid),\n )\n }\n })\n\n Object.values(requests).forEach((r) => {\n // Remove from any requests that have it as a requirement\n if (r.security?.some((s) => Object.keys(s).includes(schemeUid))) {\n requestMutators.edit(\n r.uid,\n 'security',\n requests[r.uid]?.security?.filter((s) => !Object.keys(s).includes(schemeUid)),\n )\n }\n // Remove from any requests that have it selected\n if (r.selectedSecuritySchemeUids.flat().includes(schemeUid)) {\n requestMutators.edit(\n r.uid,\n 'selectedSecuritySchemeUids',\n r.selectedSecuritySchemeUids?.filter((uid) => {\n if (Array.isArray(uid)) {\n return !uid.includes(schemeUid)\n }\n return uid !== schemeUid\n }),\n )\n }\n })\n\n securitySchemeMutators.delete(schemeUid)\n }\n\n return {\n addSecurityScheme,\n deleteSecurityScheme,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport {\n type Collection,\n type Request,\n type Server,\n type ServerPayload,\n serverSchema,\n} from '@scalar/oas-utils/entities/spec'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Create storage objects for servers */\nexport function createStoreServers(useLocalStorage: boolean) {\n const servers = reactive<Record<string, Server>>({})\n\n const serverMutators = mutationFactory(servers, reactive({}), useLocalStorage && LS_KEYS.SERVER)\n\n return {\n servers,\n serverMutators,\n }\n}\n\n/** Extended mutators and data for servers */\nexport function extendedServerDataFactory({\n serverMutators,\n collections,\n collectionMutators,\n requests,\n requestMutators,\n}: StoreContext) {\n /**\n * Add a server\n * If the collectionUid is included it is added to the collection as well\n */\n const addServer = (payload: ServerPayload, parentUid: string) => {\n const server = serverSchema.parse(payload)\n\n // Add to collection\n if (collections[parentUid]) {\n collectionMutators.edit(parentUid as Collection['uid'], 'servers', [\n ...collections[parentUid].servers,\n server.uid,\n ])\n }\n // Add to request\n else if (requests[parentUid]) {\n requestMutators.edit(parentUid as Request['uid'], 'servers', [...requests[parentUid].servers, server.uid])\n }\n\n // Add to servers\n serverMutators.add(server)\n\n return server\n }\n\n /** Delete a server */\n const deleteServer = (serverUid: Server['uid'], collectionUid: Collection['uid']) => {\n if (!collections[collectionUid]) {\n return\n }\n\n // Remove from parent collection\n collectionMutators.edit(\n collectionUid,\n 'servers',\n collections[collectionUid].servers.filter((uid) => uid !== serverUid),\n )\n\n // Remove from servers\n serverMutators.delete(serverUid)\n }\n\n return {\n addServer,\n deleteServer,\n }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport { type Collection, type Tag, type TagPayload, tagSchema } from '@scalar/oas-utils/entities/spec'\nimport { schemaModel } from '@scalar/oas-utils/helpers'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\n/** Create cookie mutators for the workspace */\nexport function createStoreTags(useLocalStorage: boolean) {\n const tags = reactive<Record<string, Tag>>({})\n\n const tagMutators = mutationFactory(tags, reactive({}), useLocalStorage && LS_KEYS.TAG)\n\n return {\n tags,\n tagMutators,\n }\n}\n\n/**\n * Create the extended mutators for tag with side effects\n * TODO:\n * - tag nesting, add/remove into another tag\n */\nexport function extendedTagDataFactory({\n collectionMutators,\n collections,\n requests,\n requestMutators,\n tagMutators,\n}: StoreContext) {\n /** Add tag */\n const addTag = (payload: TagPayload, collectionUid: Collection['uid']) => {\n const collection = collections[collectionUid]\n const tag = schemaModel(payload, tagSchema, false)\n if (!tag || !collection) {\n return console.error('INVALID TAG DATA', payload)\n }\n\n // Add to collection tags\n collectionMutators.edit(collectionUid, 'tags', [...collection.tags, tag.uid])\n\n // Add to parent collection as a child\n collectionMutators.edit(collectionUid, 'children', [...collection.children, tag.uid])\n\n tagMutators.add(tag)\n return tag\n }\n\n /** Delete Tag */\n const deleteTag = (tag: Tag, collectionUid: Collection['uid']) => {\n const collection = collections[collectionUid]\n\n if (!collection) {\n return\n }\n\n // Remove from collection tags\n collectionMutators.edit(\n collectionUid,\n 'tags',\n collection.tags.filter((uid) => uid !== tag.uid),\n )\n\n // Remove from collection children\n collectionMutators.edit(\n collectionUid,\n 'children',\n collection.children.filter((uid) => uid !== tag.uid),\n )\n\n // Loop on each child, just requests for now but will add other tags\n tag.children.forEach((childUid) => {\n const request = requests[childUid]\n if (!request) {\n return\n }\n\n const filteredTags = request.tags?.filter((tagName) => tagName !== tag.name)\n\n // Remove the tagName from the request\n requestMutators.edit(request.uid, 'tags', filteredTags)\n\n // Add to the collection children if there's no more tags\n if (!filteredTags?.length && !collection.children.includes(childUid)) {\n collectionMutators.edit(collectionUid, 'children', [...collection.children, childUid])\n }\n })\n\n tagMutators.delete(tag.uid)\n }\n\n return { addTag, deleteTag }\n}\n","import { LS_KEYS } from '@scalar/helpers/object/local-storage'\nimport { collectionSchema, requestExampleSchema } from '@scalar/oas-utils/entities/spec'\nimport { type Workspace, workspaceSchema } from '@scalar/oas-utils/entities/workspace'\nimport { mutationFactory } from '@scalar/object-utils/mutator-record'\nimport { reactive } from 'vue'\n\nimport type { StoreContext } from '@/store/store-context'\n\nimport { createInitialRequest } from './requests'\n\n/** Create storage for workspace entities */\nexport function createStoreWorkspaces(useLocalStorage: boolean) {\n /** Active workspace object (will be associated with an entry in the workspace collection) */\n const workspaces = reactive<Record<string, Workspace>>({})\n const workspaceMutators = mutationFactory(workspaces, reactive({}), useLocalStorage && LS_KEYS.WORKSPACE)\n\n return {\n workspaces,\n workspaceMutators,\n }\n}\n\n/** Workspace entities that require store context */\nexport function extendedWorkspaceDataFactory({\n workspaces,\n workspaceMutators,\n collectionMutators,\n requestMutators,\n requestExampleMutators,\n}: StoreContext) {\n const addWorkspace = (payload: Partial<Workspace> = {}) => {\n // Create some example data\n const { request } = createInitialRequest()\n\n const example = requestExampleSchema.parse({\n name: 'Example',\n requestUid: request.uid,\n })\n\n request.examples.push(example.uid)\n\n const collection = collectionSchema.parse({\n info: {\n title: 'Drafts',\n },\n children: [request.uid],\n requests: [request.uid],\n })\n\n const workspace = workspaceSchema.parse({\n ...payload,\n collections: [collection.uid],\n })\n\n // Add all entities\n requestExampleMutators.add(example)\n requestMutators.add(request)\n collectionMutators.add(collection)\n workspaceMutators.add(workspace)\n\n return workspace\n }\n\n /** Prevent deletion of the default workspace */\n const deleteWorkspace = (uid: Workspace['uid']) => {\n if (Object.keys(workspaces).length <= 1) {\n console.warn('The last workspace cannot be deleted.')\n return\n }\n workspaceMutators.delete(uid)\n }\n\n return {\n addWorkspace,\n deleteWorkspace,\n }\n}\n","import { useModal } from '@scalar/components'\nimport type { RequestEvent, SecurityScheme } from '@scalar/oas-utils/entities/spec'\nimport type { Path, PathValue } from '@scalar/object-utils/nested'\nimport type { ApiReferenceConfiguration } from '@scalar/types/api-reference'\nimport { inject, reactive, ref, toRaw } from 'vue'\n\nimport { createStoreCollections, extendedCollectionDataFactory } from '@/store/collections'\nimport { createStoreCookies } from '@/store/cookies'\nimport { createStoreEnvironments, extendedEnvironmentDataFactory } from '@/store/environment'\nimport { createStoreEvents } from '@/store/events'\nimport { importSpecFileFactory } from '@/store/import-spec'\nimport { createStoreRequestExamples, extendedExampleDataFactory } from '@/store/request-example'\nimport { createStoreRequests, extendedRequestDataFactory } from '@/store/requests'\nimport { createStoreSecuritySchemes, extendedSecurityDataFactory } from '@/store/security-schemes'\nimport { createStoreServers, extendedServerDataFactory } from '@/store/servers'\nimport type { StoreContext } from '@/store/store-context'\nimport { createStoreTags, extendedTagDataFactory } from '@/store/tags'\nimport { createStoreWorkspaces, extendedWorkspaceDataFactory } from '@/store/workspace'\n\nexport type UpdateScheme = <P extends Path<SecurityScheme>>(\n path: P,\n value: NonNullable<PathValue<SecurityScheme, P>>,\n) => void\n\ndeclare global {\n interface Window {\n dataDump: () => void\n }\n}\n\nexport type CreateWorkspaceStoreOptions = {\n /**\n * When true, changes made to the store will be saved in the browser's localStorage.\n *\n * @default true\n */\n useLocalStorage: boolean\n} & Pick<ApiReferenceConfiguration, 'proxyUrl' | 'showSidebar' | 'hideClientButton' | 'theme' | '_integration'>\n\n/**\n * Factory function for creating the centralized store for the API client.\n *\n * This store manages all data and state for the application.\n * It should be instantiated once and injected into the app's root component.\n */\nexport const createWorkspaceStore = ({\n useLocalStorage = true,\n showSidebar = true,\n proxyUrl,\n theme,\n hideClientButton = false,\n _integration,\n}: CreateWorkspaceStoreOptions) => {\n // ---------------------------------------------------------------------------\n // Initialize all storage objects\n\n const { collections, collectionMutators } = createStoreCollections(useLocalStorage)\n const { tags, tagMutators } = createStoreTags(useLocalStorage)\n const { requests, requestMutators } = createStoreRequests(useLocalStorage)\n const { requestExamples, requestExampleMutators } = createStoreRequestExamples(useLocalStorage)\n const { cookies, cookieMutators } = createStoreCookies(useLocalStorage)\n const { environments, environmentMutators } = createStoreEnvironments(useLocalStorage)\n const { servers, serverMutators } = createStoreServers(useLocalStorage)\n const { securitySchemes, securitySchemeMutators } = createStoreSecuritySchemes(useLocalStorage)\n const { workspaces, workspaceMutators } = createStoreWorkspaces(useLocalStorage)\n\n // ---------------------------------------------------------------------------\n // Extended Mutators - Adds side effects as needed\n\n // Provide the workspace to the extended mutator factories\n const storeContext: StoreContext = {\n collections,\n collectionMutators,\n tags,\n tagMutators,\n requests,\n requestMutators,\n requestExamples,\n requestExampleMutators,\n cookies,\n cookieMutators,\n environments,\n environmentMutators,\n servers,\n serverMutators,\n securitySchemes,\n securitySchemeMutators,\n workspaces,\n workspaceMutators,\n }\n const { addTag, deleteTag } = extendedTagDataFactory(storeContext)\n const { addRequest, deleteRequest, findRequestParents } = extendedRequestDataFactory(storeContext, addTag)\n const { deleteEnvironment } = extendedEnvironmentDataFactory(storeContext)\n const { addServer, deleteServer } = extendedServerDataFactory(storeContext)\n const { addCollection, deleteCollection } = extendedCollectionDataFactory(storeContext)\n const { addRequestExample, deleteRequestExample } = extendedExampleDataFactory(storeContext)\n const { addWorkspace, deleteWorkspace } = extendedWorkspaceDataFactory(storeContext)\n const { addSecurityScheme, deleteSecurityScheme } = extendedSecurityDataFactory(storeContext)\n const { addCollectionEnvironment, removeCollectionEnvironment } = extendedCollectionDataFactory(storeContext)\n\n // ---------------------------------------------------------------------------\n // OTHER HELPER DATA\n /** Running request history list */\n const requestHistory = reactive<RequestEvent[]>([])\n\n const { importSpecFile, importSpecFromUrl } = importSpecFileFactory(storeContext)\n\n /** Helper function to manage the sidebar width */\n const sidebarWidth = ref((useLocalStorage ? localStorage?.getItem('sidebarWidth') : undefined) || '280px')\n\n // Set the sidebar width\n const setSidebarWidth = (width: string) => {\n sidebarWidth.value = width\n if (useLocalStorage) {\n localStorage?.setItem('sidebarWidth', width)\n }\n }\n\n /** This state is to be used by the API Client Modal component to control the modal */\n const modalState = useModal()\n\n // Set some defaults on all workspaces\n Object.values(workspaces).forEach(({ uid }) => {\n if (proxyUrl) {\n workspaceMutators.edit(uid, 'proxyUrl', proxyUrl)\n }\n if (theme) {\n workspaceMutators.edit(uid, 'themeId', theme)\n }\n })\n\n /**\n * For debugging purposes, expose this method for dumping the data stores\n */\n if (typeof window !== 'undefined') {\n window.dataDump = () => ({\n collections: toRaw(collections),\n cookies: toRaw(cookies),\n environments: toRaw(environments),\n requestExamples: toRaw(requestExamples),\n requests: toRaw(requests),\n securitySchemes: toRaw(securitySchemes),\n servers: toRaw(servers),\n tags: toRaw(tags),\n workspaces: toRaw(workspaces),\n })\n }\n\n // ---------------------------------------------------------------------------\n // Events Busses\n const events = createStoreEvents()\n\n return {\n // ---------------------------------------------------------------------------\n // STATE\n workspaces,\n collections,\n tags,\n cookies,\n environments,\n requestExamples,\n requests,\n servers,\n securitySchemes,\n modalState,\n events,\n sidebarWidth,\n setSidebarWidth,\n proxyUrl,\n // ---------------------------------------------------------------------------\n // CONFIGURATION \"PROPS\"\n // TODO: move these to their own store\n hideClientButton,\n showSidebar,\n integration: _integration,\n // ---------------------------------------------------------------------------\n // METHODS\n importSpecFile,\n importSpecFromUrl,\n cookieMutators,\n collectionMutators: {\n ...collectionMutators,\n rawAdd: collectionMutators.add,\n add: addCollection,\n delete: deleteCollection,\n addEnvironment: addCollectionEnvironment,\n removeEnvironment: removeCollectionEnvironment,\n },\n environmentMutators: {\n ...environmentMutators,\n delete: deleteEnvironment,\n },\n requestMutators: {\n ...requestMutators,\n rawAdd: requestMutators.add,\n add: addRequest,\n delete: deleteRequest,\n },\n findRequestParents,\n requestExampleMutators: {\n ...requestExampleMutators,\n rawAdd: requestExampleMutators.add,\n add: addRequestExample,\n delete: deleteRequestExample,\n },\n requestHistory,\n securitySchemeMutators: {\n ...securitySchemeMutators,\n rawAdd: securitySchemeMutators.add,\n add: addSecurityScheme,\n delete: deleteSecurityScheme,\n },\n serverMutators: {\n ...serverMutators,\n rawAdd: serverMutators.add,\n add: addServer,\n delete: deleteServer,\n },\n tagMutators: {\n ...tagMutators,\n rawAdd: tagMutators.add,\n add: addTag,\n delete: deleteTag,\n },\n workspaceMutators: {\n ...workspaceMutators,\n rawAdd: workspaceMutators.add,\n add: addWorkspace,\n delete: deleteWorkspace,\n },\n addCollectionEnvironment,\n removeCollectionEnvironment,\n }\n}\n\nexport type WorkspaceStore = ReturnType<typeof createWorkspaceStore>\n/** Set as a string so that different instances of api-client can reference inject the same store */\nexport const WORKSPACE_SYMBOL = 'WORKSPACE_SYMBOL' as const\n\n/**\n * Global hook which contains the store for the whole app\n *\n * The rawAdd methods are the mutator.add methods. Some add methods have been replaced when we need some side effects\n * ex: add examples when adding a request\n */\nexport const useWorkspace = (): WorkspaceStore => {\n const store = inject<WorkspaceStore>(WORKSPACE_SYMBOL)\n if (!store) {\n throw new Error('Workspace store not provided')\n }\n return store\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,IAAY,SAAL,yBAAA,QAAA;AACL,QAAA,aAAA;AACA,QAAA,cAAA;AACA,QAAA,aAAA;AACA,QAAA,gBAAA;AACA,QAAA,YAAA;AACA,QAAA,iBAAA;AACA,QAAA,aAAA;AACA,QAAA,eAAA;AACA,QAAA,cAAA;;KACD;;AAGD,IAAM,uBAAuB;;AAG7B,SAAgB,oBAAoB,IAA6B;CAC/D,MAAM,YAAY,GAAG,OAAO,OAAO;AAEnC,KAAI,UACF,cAAa,QAAQ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QAAQ;GACT;EACD,iBAAiB;GACf,GAAG;GACH,QAAQ,gBAAgB;GACxB,KAAK;GACL,QAAQ;GACT;EACD;EACA,wBAAwB;GACtB,GAAG;GACH,QAAQ,uBAAuB;GAC/B,KAAK;GACL,QAAQ;GACT;EACD;EACA,wBAAwB;GACtB,GAAG;GACH,QAAQ,uBAAuB;GAC/B,KAAK;GACL,QAAQ;GACT;EACD,gBAAgB;GACd,GAAG;GACH,QAAQ,eAAe;GACvB,KAAK;GACL,QAAQ;GACT;EACD,aAAa;GACX,GAAG;GACH,QAAQ,YAAY;GACpB,KAAK;GACL,QAAQ;GACT;EACD,mBAAmB;GACjB,GAAG;GACH,QAAQ,kBAAkB;GAC1B,KAAK;GACL,QAAQ;GACT;EACD;EACA;EACD;;;AAKH,IAAa,mBAAmB;;;;;;;AAQhC,IAAa,qBAAqC;CAChD,MAAM,QAAQ,OAAuB,iBAAiB;AACtD,KAAI,CAAC,MACH,OAAM,IAAI,MAAM,+BAA+B;AAEjD,QAAO"}
@@ -8,9 +8,9 @@ import type { AuthMeta, ServerMeta, WorkspaceEventBus } from '@scalar/workspace-
8
8
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
9
9
  import type { OpenApiDocument, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
10
10
  import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
11
- import type { ClientLayout } from '@/hooks';
12
- import type { ExtendedScalarCookie } from '@/v2/blocks/request-block/RequestBlock.vue';
13
- import type { MergedSecuritySchemes } from '@/v2/blocks/scalar-auth-selector-block/helpers/merge-security';
11
+ import type { ClientLayout } from '../../../hooks/index.js';
12
+ import type { ExtendedScalarCookie } from '../../../v2/blocks/request-block/RequestBlock.vue';
13
+ import type { MergedSecuritySchemes } from '../../../v2/blocks/scalar-auth-selector-block/helpers/merge-security';
14
14
  /**
15
15
  * OperationBlock
16
16
  *