@backstage/plugin-techdocs 1.10.4-next.1 → 1.10.5-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +1 -1
  3. package/alpha/package.json +1 -1
  4. package/dist/EntityPageDocs.esm.js +23 -0
  5. package/dist/EntityPageDocs.esm.js.map +1 -0
  6. package/dist/Router.esm.js +47 -0
  7. package/dist/Router.esm.js.map +1 -0
  8. package/dist/alpha.esm.js +6 -7
  9. package/dist/alpha.esm.js.map +1 -1
  10. package/dist/api.esm.js +11 -0
  11. package/dist/api.esm.js.map +1 -0
  12. package/dist/{esm/routes-VopnMGN0.esm.js → client.esm.js} +2 -14
  13. package/dist/client.esm.js.map +1 -0
  14. package/dist/helpers.esm.js +8 -0
  15. package/dist/helpers.esm.js.map +1 -0
  16. package/dist/home/components/DefaultTechDocsHome.esm.js +15 -0
  17. package/dist/home/components/DefaultTechDocsHome.esm.js.map +1 -0
  18. package/dist/{esm/DocsCardGrid-AWTYz1vR.esm.js → home/components/Grids/DocsCardGrid.esm.js} +4 -4
  19. package/dist/home/components/Grids/DocsCardGrid.esm.js.map +1 -0
  20. package/dist/home/components/Grids/EntityListDocsGrid.esm.js +68 -0
  21. package/dist/home/components/Grids/EntityListDocsGrid.esm.js.map +1 -0
  22. package/dist/home/components/Tables/DocsTable.esm.js +87 -0
  23. package/dist/home/components/Tables/DocsTable.esm.js.map +1 -0
  24. package/dist/home/components/Tables/EntityListDocsTable.esm.js +50 -0
  25. package/dist/home/components/Tables/EntityListDocsTable.esm.js.map +1 -0
  26. package/dist/home/components/Tables/actions.esm.js +37 -0
  27. package/dist/home/components/Tables/actions.esm.js.map +1 -0
  28. package/dist/home/components/Tables/columns.esm.js +51 -0
  29. package/dist/home/components/Tables/columns.esm.js.map +1 -0
  30. package/dist/{esm/TechDocsCustomHome-CTmEWYTg.esm.js → home/components/TechDocsCustomHome.esm.js} +5 -17
  31. package/dist/home/components/TechDocsCustomHome.esm.js.map +1 -0
  32. package/dist/home/components/TechDocsIndexPage.esm.js +11 -0
  33. package/dist/home/components/TechDocsIndexPage.esm.js.map +1 -0
  34. package/dist/home/components/TechDocsPageWrapper.esm.js +22 -0
  35. package/dist/home/components/TechDocsPageWrapper.esm.js.map +1 -0
  36. package/dist/home/components/TechDocsPicker.esm.js +22 -0
  37. package/dist/home/components/TechDocsPicker.esm.js.map +1 -0
  38. package/dist/index.esm.js +17 -125
  39. package/dist/index.esm.js.map +1 -1
  40. package/dist/plugin.esm.js +97 -0
  41. package/dist/plugin.esm.js.map +1 -0
  42. package/dist/reader/components/TechDocsBuildLogs.esm.js +94 -0
  43. package/dist/reader/components/TechDocsBuildLogs.esm.js.map +1 -0
  44. package/dist/reader/components/TechDocsNotFound.esm.js +33 -0
  45. package/dist/reader/components/TechDocsNotFound.esm.js.map +1 -0
  46. package/dist/reader/components/TechDocsReaderPage/TechDocsReaderPage.esm.js +42 -0
  47. package/dist/reader/components/TechDocsReaderPage/TechDocsReaderPage.esm.js.map +1 -0
  48. package/dist/reader/components/TechDocsReaderPage/index.esm.js +2 -0
  49. package/dist/reader/components/TechDocsReaderPage/index.esm.js.map +1 -0
  50. package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.esm.js +77 -0
  51. package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.esm.js.map +1 -0
  52. package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContentAddons.esm.js +43 -0
  53. package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContentAddons.esm.js.map +1 -0
  54. package/dist/reader/components/TechDocsReaderPageContent/dom.esm.js +203 -0
  55. package/dist/reader/components/TechDocsReaderPageContent/dom.esm.js.map +1 -0
  56. package/dist/reader/components/TechDocsReaderPageContent/useNavigateUrl.esm.js +36 -0
  57. package/dist/reader/components/TechDocsReaderPageContent/useNavigateUrl.esm.js.map +1 -0
  58. package/dist/reader/components/TechDocsReaderPageHeader/TechDocsReaderPageHeader.esm.js +101 -0
  59. package/dist/reader/components/TechDocsReaderPageHeader/TechDocsReaderPageHeader.esm.js.map +1 -0
  60. package/dist/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js +77 -0
  61. package/dist/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js.map +1 -0
  62. package/dist/reader/components/TechDocsReaderProvider.esm.js +19 -0
  63. package/dist/reader/components/TechDocsReaderProvider.esm.js.map +1 -0
  64. package/dist/reader/components/TechDocsStateIndicator.esm.js +101 -0
  65. package/dist/reader/components/TechDocsStateIndicator.esm.js.map +1 -0
  66. package/dist/reader/components/useReaderState.esm.js +163 -0
  67. package/dist/reader/components/useReaderState.esm.js.map +1 -0
  68. package/dist/reader/transformers/addBaseUrl.esm.js +56 -0
  69. package/dist/reader/transformers/addBaseUrl.esm.js.map +1 -0
  70. package/dist/reader/transformers/addGitFeedbackLink.esm.js +53 -0
  71. package/dist/reader/transformers/addGitFeedbackLink.esm.js.map +1 -0
  72. package/dist/reader/transformers/addLinkClickListener.esm.js +23 -0
  73. package/dist/reader/transformers/addLinkClickListener.esm.js.map +1 -0
  74. package/dist/reader/transformers/addSidebarToggle.esm.js +27 -0
  75. package/dist/reader/transformers/addSidebarToggle.esm.js.map +1 -0
  76. package/dist/reader/transformers/copyToClipboard.esm.js +68 -0
  77. package/dist/reader/transformers/copyToClipboard.esm.js.map +1 -0
  78. package/dist/reader/transformers/html/hooks/iframes.esm.js +19 -0
  79. package/dist/reader/transformers/html/hooks/iframes.esm.js.map +1 -0
  80. package/dist/reader/transformers/html/hooks/links.esm.js +20 -0
  81. package/dist/reader/transformers/html/hooks/links.esm.js.map +1 -0
  82. package/dist/reader/transformers/html/transformer.esm.js +36 -0
  83. package/dist/reader/transformers/html/transformer.esm.js.map +1 -0
  84. package/dist/reader/transformers/onCssReady.esm.js +24 -0
  85. package/dist/reader/transformers/onCssReady.esm.js.map +1 -0
  86. package/dist/reader/transformers/removeMkdocsHeader.esm.js +10 -0
  87. package/dist/reader/transformers/removeMkdocsHeader.esm.js.map +1 -0
  88. package/dist/reader/transformers/renderReactElement.esm.js +18 -0
  89. package/dist/reader/transformers/renderReactElement.esm.js.map +1 -0
  90. package/dist/reader/transformers/rewriteDocLinks.esm.js +37 -0
  91. package/dist/reader/transformers/rewriteDocLinks.esm.js.map +1 -0
  92. package/dist/reader/transformers/scrollIntoNavigation.esm.js +21 -0
  93. package/dist/reader/transformers/scrollIntoNavigation.esm.js.map +1 -0
  94. package/dist/reader/transformers/simplifyMkdocsFooter.esm.js +11 -0
  95. package/dist/reader/transformers/simplifyMkdocsFooter.esm.js.map +1 -0
  96. package/dist/reader/transformers/styles/rules/animations.esm.js +13 -0
  97. package/dist/reader/transformers/styles/rules/animations.esm.js.map +1 -0
  98. package/dist/reader/transformers/styles/rules/extensions.esm.js +72 -0
  99. package/dist/reader/transformers/styles/rules/extensions.esm.js.map +1 -0
  100. package/dist/reader/transformers/styles/rules/layout.esm.js +224 -0
  101. package/dist/reader/transformers/styles/rules/layout.esm.js.map +1 -0
  102. package/dist/reader/transformers/styles/rules/reset.esm.js +14 -0
  103. package/dist/reader/transformers/styles/rules/reset.esm.js.map +1 -0
  104. package/dist/reader/transformers/styles/rules/rules.esm.js +18 -0
  105. package/dist/reader/transformers/styles/rules/rules.esm.js.map +1 -0
  106. package/dist/reader/transformers/styles/rules/typeset.esm.js +91 -0
  107. package/dist/reader/transformers/styles/rules/typeset.esm.js.map +1 -0
  108. package/dist/reader/transformers/styles/rules/variables.esm.js +126 -0
  109. package/dist/reader/transformers/styles/rules/variables.esm.js.map +1 -0
  110. package/dist/reader/transformers/styles/transformer.esm.js +27 -0
  111. package/dist/reader/transformers/styles/transformer.esm.js.map +1 -0
  112. package/dist/reader/transformers/transformer.esm.js +17 -0
  113. package/dist/reader/transformers/transformer.esm.js.map +1 -0
  114. package/dist/routes.esm.js +15 -0
  115. package/dist/routes.esm.js.map +1 -0
  116. package/dist/search/components/TechDocsSearch.esm.js +95 -0
  117. package/dist/search/components/TechDocsSearch.esm.js.map +1 -0
  118. package/dist/{esm/TechDocsSearchResultListItem-4Qzh5-3s.esm.js → search/components/TechDocsSearchResultListItem.esm.js} +1 -1
  119. package/dist/search/components/TechDocsSearchResultListItem.esm.js.map +1 -0
  120. package/package.json +20 -20
  121. package/dist/esm/DocsCardGrid-AWTYz1vR.esm.js.map +0 -1
  122. package/dist/esm/Router-jrzAl2lO.esm.js +0 -162
  123. package/dist/esm/Router-jrzAl2lO.esm.js.map +0 -1
  124. package/dist/esm/TechDocsCustomHome-CTmEWYTg.esm.js.map +0 -1
  125. package/dist/esm/TechDocsIndexPage-BCP1ggek.esm.js +0 -257
  126. package/dist/esm/TechDocsIndexPage-BCP1ggek.esm.js.map +0 -1
  127. package/dist/esm/TechDocsReaderPage-jsKVX28r.esm.js +0 -1925
  128. package/dist/esm/TechDocsReaderPage-jsKVX28r.esm.js.map +0 -1
  129. package/dist/esm/TechDocsSearchResultListItem-4Qzh5-3s.esm.js.map +0 -1
  130. package/dist/esm/index-up5BptkF.esm.js +0 -47
  131. package/dist/esm/index-up5BptkF.esm.js.map +0 -1
  132. package/dist/esm/routes-VopnMGN0.esm.js.map +0 -1
@@ -1,1925 +0,0 @@
1
- import React, { useReducer, useRef, useMemo, createContext, useContext, useState, useEffect, useCallback, Children } from 'react';
2
- import { useParams, useNavigate, useLocation, useOutlet } from 'react-router-dom';
3
- import { LogViewer, ErrorPage, useSidebarPinState, Content, HeaderLabel, Header, Page } from '@backstage/core-components';
4
- import { techdocsStorageApiRef, useTechDocsReaderPage, SHADOW_DOM_STYLE_LOAD_EVENT, useShadowDomStylesLoading, useTechDocsAddons, TechDocsAddonLocations, useShadowRootElements, TechDocsShadowDom, TECHDOCS_ADDONS_WRAPPER_KEY, TECHDOCS_ADDONS_KEY, TechDocsReaderPageProvider } from '@backstage/plugin-techdocs-react';
5
- import Grid from '@material-ui/core/Grid';
6
- import { makeStyles, createStyles, lighten, alpha, useTheme, withStyles, ThemeProvider } from '@material-ui/core/styles';
7
- import { SearchContextProvider, useSearch, SearchAutocomplete } from '@backstage/plugin-search-react';
8
- import { TechDocsSearchResultListItem } from './TechDocsSearchResultListItem-4Qzh5-3s.esm.js';
9
- import CircularProgress from '@material-ui/core/CircularProgress';
10
- import Button from '@material-ui/core/Button';
11
- import Alert from '@material-ui/lab/Alert';
12
- import Drawer from '@material-ui/core/Drawer';
13
- import IconButton from '@material-ui/core/IconButton';
14
- import Typography from '@material-ui/core/Typography';
15
- import Close from '@material-ui/icons/Close';
16
- import { useApi, configApiRef, useAnalytics, useRouteRef, useRouteRefParams, getComponentData } from '@backstage/core-plugin-api';
17
- import useAsync from 'react-use/esm/useAsync';
18
- import useAsyncRetry from 'react-use/esm/useAsyncRetry';
19
- import useMediaQuery from '@material-ui/core/useMediaQuery';
20
- import { scmIntegrationsApiRef } from '@backstage/integration-react';
21
- import DOMPurify from 'dompurify';
22
- import { replaceGithubUrlType } from '@backstage/integration';
23
- import FeedbackOutlinedIcon from '@material-ui/icons/FeedbackOutlined';
24
- import parseGitUrl from 'git-url-parse';
25
- import MenuIcon from '@material-ui/icons/Menu';
26
- import SvgIcon from '@material-ui/core/SvgIcon';
27
- import Tooltip from '@material-ui/core/Tooltip';
28
- import useCopyToClipboard from 'react-use/esm/useCopyToClipboard';
29
- import Portal from '@material-ui/core/Portal';
30
- import Helmet from 'react-helmet';
31
- import Skeleton from '@material-ui/lab/Skeleton';
32
- import CodeIcon from '@material-ui/icons/Code';
33
- import { getEntityRelations, EntityRefLink, EntityRefLinks } from '@backstage/plugin-catalog-react';
34
- import { RELATION_OWNED_BY } from '@backstage/catalog-model';
35
- import { capitalize } from 'lodash';
36
- import { r as rootRouteRef, b as rootDocsRouteRef } from './routes-VopnMGN0.esm.js';
37
- import Toolbar from '@material-ui/core/Toolbar';
38
- import Menu from '@material-ui/core/Menu';
39
- import Box from '@material-ui/core/Box';
40
- import SettingsIcon from '@material-ui/icons/Settings';
41
- import { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';
42
-
43
- function calculateDisplayState({
44
- contentLoading,
45
- content,
46
- activeSyncState
47
- }) {
48
- if (contentLoading) {
49
- return "CHECKING";
50
- }
51
- if (activeSyncState === "BUILD_READY_RELOAD") {
52
- return "CHECKING";
53
- }
54
- if (!content && activeSyncState === "CHECKING") {
55
- return "CHECKING";
56
- }
57
- if (!content && activeSyncState === "BUILDING") {
58
- return "INITIAL_BUILD";
59
- }
60
- if (!content) {
61
- return "CONTENT_NOT_FOUND";
62
- }
63
- if (activeSyncState === "BUILDING") {
64
- return "CONTENT_STALE_REFRESHING";
65
- }
66
- if (activeSyncState === "BUILD_READY") {
67
- return "CONTENT_STALE_READY";
68
- }
69
- if (activeSyncState === "ERROR") {
70
- return "CONTENT_STALE_ERROR";
71
- }
72
- return "CONTENT_FRESH";
73
- }
74
- function reducer(oldState, action) {
75
- const newState = { ...oldState };
76
- switch (action.type) {
77
- case "sync":
78
- if (action.state === "CHECKING") {
79
- newState.buildLog = [];
80
- }
81
- newState.activeSyncState = action.state;
82
- newState.syncError = action.syncError;
83
- break;
84
- case "contentLoading":
85
- newState.contentLoading = true;
86
- newState.contentError = void 0;
87
- break;
88
- case "content":
89
- if (typeof action.path === "string") {
90
- newState.path = action.path;
91
- }
92
- newState.contentLoading = false;
93
- newState.content = action.content;
94
- newState.contentError = action.contentError;
95
- break;
96
- case "buildLog":
97
- newState.buildLog = newState.buildLog.concat(action.log);
98
- break;
99
- default:
100
- throw new Error();
101
- }
102
- if (["BUILD_READY", "BUILD_READY_RELOAD"].includes(newState.activeSyncState) && ["contentLoading", "content"].includes(action.type)) {
103
- newState.activeSyncState = "UP_TO_DATE";
104
- newState.buildLog = [];
105
- }
106
- return newState;
107
- }
108
- function useReaderState(kind, namespace, name, path) {
109
- var _a, _b;
110
- const [state, dispatch] = useReducer(reducer, {
111
- activeSyncState: "CHECKING",
112
- path,
113
- contentLoading: true,
114
- buildLog: []
115
- });
116
- const techdocsStorageApi = useApi(techdocsStorageApiRef);
117
- const { retry: contentReload } = useAsyncRetry(async () => {
118
- dispatch({ type: "contentLoading" });
119
- try {
120
- const entityDocs = await techdocsStorageApi.getEntityDocs(
121
- { kind, namespace, name },
122
- path
123
- );
124
- dispatch({ type: "content", content: entityDocs, path });
125
- return entityDocs;
126
- } catch (e) {
127
- dispatch({ type: "content", contentError: e, path });
128
- }
129
- return void 0;
130
- }, [techdocsStorageApi, kind, namespace, name, path]);
131
- const contentRef = useRef({
132
- content: void 0,
133
- reload: () => {
134
- }
135
- });
136
- contentRef.current = { content: state.content, reload: contentReload };
137
- useAsync(async () => {
138
- dispatch({ type: "sync", state: "CHECKING" });
139
- const buildingTimeout = setTimeout(() => {
140
- dispatch({ type: "sync", state: "BUILDING" });
141
- }, 1e3);
142
- try {
143
- const result = await techdocsStorageApi.syncEntityDocs(
144
- {
145
- kind,
146
- namespace,
147
- name
148
- },
149
- (log) => {
150
- dispatch({ type: "buildLog", log });
151
- }
152
- );
153
- switch (result) {
154
- case "updated":
155
- if (!contentRef.current.content) {
156
- contentRef.current.reload();
157
- dispatch({ type: "sync", state: "BUILD_READY_RELOAD" });
158
- } else {
159
- dispatch({ type: "sync", state: "BUILD_READY" });
160
- }
161
- break;
162
- case "cached":
163
- dispatch({ type: "sync", state: "UP_TO_DATE" });
164
- break;
165
- default:
166
- dispatch({
167
- type: "sync",
168
- state: "ERROR",
169
- syncError: new Error("Unexpected return state")
170
- });
171
- break;
172
- }
173
- } catch (e) {
174
- dispatch({ type: "sync", state: "ERROR", syncError: e });
175
- } finally {
176
- clearTimeout(buildingTimeout);
177
- }
178
- }, [kind, name, namespace, techdocsStorageApi, dispatch, contentRef]);
179
- const displayState = useMemo(
180
- () => calculateDisplayState({
181
- activeSyncState: state.activeSyncState,
182
- contentLoading: state.contentLoading,
183
- content: state.content
184
- }),
185
- [state.activeSyncState, state.content, state.contentLoading]
186
- );
187
- return {
188
- state: displayState,
189
- contentReload,
190
- path: state.path,
191
- content: state.content,
192
- contentErrorMessage: (_a = state.contentError) == null ? void 0 : _a.toString(),
193
- syncErrorMessage: (_b = state.syncError) == null ? void 0 : _b.toString(),
194
- buildLog: state.buildLog
195
- };
196
- }
197
-
198
- const TechDocsReaderContext = createContext({});
199
- const useTechDocsReader = () => useContext(TechDocsReaderContext);
200
- const TechDocsReaderProvider = (props) => {
201
- const { children } = props;
202
- const { "*": path = "" } = useParams();
203
- const { entityRef } = useTechDocsReaderPage();
204
- const { kind, namespace, name } = entityRef;
205
- const value = useReaderState(kind, namespace, name, path);
206
- return /* @__PURE__ */ React.createElement(TechDocsReaderContext.Provider, { value }, children instanceof Function ? children(value) : children);
207
- };
208
- const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, null, /* @__PURE__ */ React.createElement(Component, { ...props }));
209
-
210
- const isTechDocsSearchResult = (option) => {
211
- return option == null ? void 0 : option.document;
212
- };
213
- const TechDocsSearchBar = (props) => {
214
- const { entityId, entityTitle, debounceTime = 150 } = props;
215
- const [open, setOpen] = useState(false);
216
- const navigate = useNavigate();
217
- const {
218
- setFilters,
219
- result: { loading, value: searchVal }
220
- } = useSearch();
221
- const [options, setOptions] = useState([]);
222
- useEffect(() => {
223
- let mounted = true;
224
- if (mounted && searchVal) {
225
- const searchResults = searchVal.results.slice(0, 10);
226
- setOptions(searchResults);
227
- }
228
- return () => {
229
- mounted = false;
230
- };
231
- }, [loading, searchVal]);
232
- const { kind, name, namespace } = entityId;
233
- useEffect(() => {
234
- setFilters((prevFilters) => {
235
- return {
236
- ...prevFilters,
237
- kind,
238
- namespace,
239
- name
240
- };
241
- });
242
- }, [kind, namespace, name, setFilters]);
243
- const handleSelection = (_, selection) => {
244
- if (isTechDocsSearchResult(selection)) {
245
- const { location } = selection.document;
246
- navigate(location);
247
- }
248
- };
249
- return /* @__PURE__ */ React.createElement(
250
- SearchAutocomplete,
251
- {
252
- "data-testid": "techdocs-search-bar",
253
- size: "small",
254
- open,
255
- getOptionLabel: () => "",
256
- filterOptions: (x) => {
257
- return x;
258
- },
259
- onClose: () => {
260
- setOpen(false);
261
- },
262
- onFocus: () => {
263
- setOpen(true);
264
- },
265
- onChange: handleSelection,
266
- blurOnSelect: true,
267
- noOptionsText: "No results found",
268
- value: null,
269
- options,
270
- renderOption: ({ document, highlight }) => /* @__PURE__ */ React.createElement(
271
- TechDocsSearchResultListItem,
272
- {
273
- result: document,
274
- lineClamp: 3,
275
- asListItem: false,
276
- asLink: false,
277
- title: document.title,
278
- highlight
279
- }
280
- ),
281
- loading,
282
- inputDebounceTime: debounceTime,
283
- inputPlaceholder: `Search ${entityTitle || entityId.name} docs`,
284
- freeSolo: false
285
- }
286
- );
287
- };
288
- const TechDocsSearch = (props) => {
289
- const initialState = {
290
- term: "",
291
- types: ["techdocs"],
292
- pageCursor: "",
293
- filters: props.entityId
294
- };
295
- return /* @__PURE__ */ React.createElement(SearchContextProvider, { initialState }, /* @__PURE__ */ React.createElement(TechDocsSearchBar, { ...props }));
296
- };
297
-
298
- const useDrawerStyles = makeStyles(
299
- (theme) => createStyles({
300
- paper: {
301
- width: "100%",
302
- [theme.breakpoints.up("sm")]: {
303
- width: "75%"
304
- },
305
- [theme.breakpoints.up("md")]: {
306
- width: "50%"
307
- },
308
- padding: theme.spacing(2.5)
309
- },
310
- root: {
311
- height: "100%",
312
- overflow: "hidden"
313
- },
314
- logs: {
315
- background: theme.palette.background.default
316
- }
317
- })
318
- );
319
- const TechDocsBuildLogsDrawerContent = ({
320
- buildLog,
321
- onClose
322
- }) => {
323
- const classes = useDrawerStyles();
324
- const logText = buildLog.length === 0 ? "Waiting for logs..." : buildLog.join("\n");
325
- return /* @__PURE__ */ React.createElement(
326
- Grid,
327
- {
328
- container: true,
329
- direction: "column",
330
- className: classes.root,
331
- spacing: 0,
332
- wrap: "nowrap"
333
- },
334
- /* @__PURE__ */ React.createElement(
335
- Grid,
336
- {
337
- item: true,
338
- container: true,
339
- justifyContent: "space-between",
340
- alignItems: "center",
341
- spacing: 0,
342
- wrap: "nowrap"
343
- },
344
- /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Build Details"),
345
- /* @__PURE__ */ React.createElement(
346
- IconButton,
347
- {
348
- key: "dismiss",
349
- title: "Close the drawer",
350
- onClick: onClose,
351
- color: "inherit"
352
- },
353
- /* @__PURE__ */ React.createElement(Close, null)
354
- )
355
- ),
356
- /* @__PURE__ */ React.createElement(Grid, { item: true, xs: true }, /* @__PURE__ */ React.createElement(LogViewer, { text: logText, classes: { root: classes.logs } }))
357
- );
358
- };
359
- const TechDocsBuildLogs = ({ buildLog }) => {
360
- const classes = useDrawerStyles();
361
- const [open, setOpen] = useState(false);
362
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, { color: "inherit", onClick: () => setOpen(true) }, "Show Build Logs"), /* @__PURE__ */ React.createElement(
363
- Drawer,
364
- {
365
- classes: { paper: classes.paper },
366
- anchor: "right",
367
- open,
368
- onClose: () => setOpen(false)
369
- },
370
- /* @__PURE__ */ React.createElement(
371
- TechDocsBuildLogsDrawerContent,
372
- {
373
- buildLog,
374
- onClose: () => setOpen(false)
375
- }
376
- )
377
- ));
378
- };
379
-
380
- const TechDocsNotFound = ({ errorMessage }) => {
381
- const techdocsBuilder = useApi(configApiRef).getOptionalString("techdocs.builder");
382
- const analyticsApi = useAnalytics();
383
- const { entityRef } = useTechDocsReaderPage();
384
- const location = useLocation();
385
- useEffect(() => {
386
- const { pathname, search, hash } = location;
387
- analyticsApi.captureEvent("not-found", `${pathname}${search}${hash}`, {
388
- attributes: entityRef
389
- });
390
- }, [analyticsApi, entityRef, location]);
391
- let additionalInfo = "";
392
- if (techdocsBuilder !== "local") {
393
- additionalInfo = "Note that techdocs.builder is not set to 'local' in your config, which means this Backstage app will not generate docs if they are not found. Make sure the project's docs are generated and published by some external process (e.g. CI/CD pipeline). Or change techdocs.builder to 'local' to generate docs from this Backstage instance.";
394
- }
395
- return /* @__PURE__ */ React.createElement(
396
- ErrorPage,
397
- {
398
- status: "404",
399
- statusMessage: errorMessage || "Documentation not found",
400
- additionalInfo
401
- }
402
- );
403
- };
404
-
405
- const useStyles$2 = makeStyles((theme) => ({
406
- root: {
407
- marginBottom: theme.spacing(2)
408
- },
409
- message: {
410
- // `word-break: break-word` is deprecated, but gives legacy support to browsers not supporting `overflow-wrap` yet
411
- // https://developer.mozilla.org/en-US/docs/Web/CSS/word-break
412
- wordBreak: "break-word",
413
- overflowWrap: "anywhere"
414
- }
415
- }));
416
- const TechDocsStateIndicator = () => {
417
- let StateAlert = null;
418
- const classes = useStyles$2();
419
- const {
420
- state,
421
- contentReload,
422
- contentErrorMessage,
423
- syncErrorMessage,
424
- buildLog
425
- } = useTechDocsReader();
426
- if (state === "INITIAL_BUILD") {
427
- StateAlert = /* @__PURE__ */ React.createElement(
428
- Alert,
429
- {
430
- classes: { root: classes.root },
431
- variant: "outlined",
432
- severity: "info",
433
- icon: /* @__PURE__ */ React.createElement(CircularProgress, { size: "24px" }),
434
- action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, { buildLog })
435
- },
436
- "Documentation is accessed for the first time and is being prepared. The subsequent loads are much faster."
437
- );
438
- }
439
- if (state === "CONTENT_STALE_REFRESHING") {
440
- StateAlert = /* @__PURE__ */ React.createElement(
441
- Alert,
442
- {
443
- variant: "outlined",
444
- severity: "info",
445
- icon: /* @__PURE__ */ React.createElement(CircularProgress, { size: "24px" }),
446
- action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, { buildLog }),
447
- classes: { root: classes.root }
448
- },
449
- "A newer version of this documentation is being prepared and will be available shortly."
450
- );
451
- }
452
- if (state === "CONTENT_STALE_READY") {
453
- StateAlert = /* @__PURE__ */ React.createElement(
454
- Alert,
455
- {
456
- variant: "outlined",
457
- severity: "success",
458
- action: /* @__PURE__ */ React.createElement(Button, { color: "inherit", onClick: () => contentReload() }, "Refresh"),
459
- classes: { root: classes.root }
460
- },
461
- "A newer version of this documentation is now available, please refresh to view."
462
- );
463
- }
464
- if (state === "CONTENT_STALE_ERROR") {
465
- StateAlert = /* @__PURE__ */ React.createElement(
466
- Alert,
467
- {
468
- variant: "outlined",
469
- severity: "error",
470
- action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, { buildLog }),
471
- classes: { root: classes.root, message: classes.message }
472
- },
473
- "Building a newer version of this documentation failed.",
474
- " ",
475
- syncErrorMessage
476
- );
477
- }
478
- if (state === "CONTENT_NOT_FOUND") {
479
- StateAlert = /* @__PURE__ */ React.createElement(React.Fragment, null, syncErrorMessage && /* @__PURE__ */ React.createElement(
480
- Alert,
481
- {
482
- variant: "outlined",
483
- severity: "error",
484
- action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, { buildLog }),
485
- classes: { root: classes.root, message: classes.message }
486
- },
487
- "Building a newer version of this documentation failed.",
488
- " ",
489
- syncErrorMessage
490
- ), /* @__PURE__ */ React.createElement(TechDocsNotFound, { errorMessage: contentErrorMessage }));
491
- }
492
- return StateAlert;
493
- };
494
-
495
- const MKDOCS_CSS = /main\.[A-Fa-f0-9]{8}\.min\.css$/;
496
- const GOOGLE_FONTS = /^https:\/\/fonts\.googleapis\.com/;
497
- const GSTATIC_FONTS = /^https:\/\/fonts\.gstatic\.com/;
498
- const isLink = (node) => node.nodeName === "LINK";
499
- const isSafe$1 = (node) => {
500
- const href = (node == null ? void 0 : node.getAttribute("href")) || "";
501
- const isMkdocsCss = href.match(MKDOCS_CSS);
502
- const isGoogleFonts = href.match(GOOGLE_FONTS);
503
- const isGstaticFonts = href.match(GSTATIC_FONTS);
504
- return isMkdocsCss || isGoogleFonts || isGstaticFonts;
505
- };
506
- const removeUnsafeLinks = (node) => {
507
- if (isLink(node) && !isSafe$1(node)) {
508
- node.remove();
509
- }
510
- return node;
511
- };
512
-
513
- const isIframe = (node) => node.nodeName === "IFRAME";
514
- const isSafe = (node, hosts) => {
515
- const src = node.getAttribute("src") || "";
516
- try {
517
- const { host } = new URL(src);
518
- return hosts.includes(host);
519
- } catch {
520
- return false;
521
- }
522
- };
523
- const removeUnsafeIframes = (hosts) => (node) => {
524
- if (isIframe(node) && !isSafe(node, hosts)) {
525
- node.remove();
526
- }
527
- return node;
528
- };
529
-
530
- const useSanitizerConfig = () => {
531
- const configApi = useApi(configApiRef);
532
- return useMemo(() => {
533
- return configApi.getOptionalConfig("techdocs.sanitizer");
534
- }, [configApi]);
535
- };
536
- const useSanitizerTransformer = () => {
537
- const config = useSanitizerConfig();
538
- return useCallback(
539
- async (dom) => {
540
- const hosts = config == null ? void 0 : config.getOptionalStringArray("allowedIframeHosts");
541
- DOMPurify.addHook("beforeSanitizeElements", removeUnsafeLinks);
542
- const tags = ["link"];
543
- if (hosts) {
544
- tags.push("iframe");
545
- DOMPurify.addHook("beforeSanitizeElements", removeUnsafeIframes(hosts));
546
- }
547
- return DOMPurify.sanitize(dom.outerHTML, {
548
- ADD_TAGS: tags,
549
- FORBID_TAGS: ["style"],
550
- WHOLE_DOCUMENT: true,
551
- RETURN_DOM: true
552
- });
553
- },
554
- [config]
555
- );
556
- };
557
-
558
- var variables = ({ theme }) => `
559
- /*================== Variables ==================*/
560
- /*
561
- As the MkDocs output is rendered in shadow DOM, the CSS variable definitions on the root selector are not applied. Instead, they have to be applied on :host.
562
- As there is no way to transform the served main*.css yet (for example in the backend), we have to copy from main*.css and modify them.
563
- */
564
-
565
- :host {
566
- /* FONT */
567
- --md-default-fg-color: ${theme.palette.text.primary};
568
- --md-default-fg-color--light: ${theme.palette.text.secondary};
569
- --md-default-fg-color--lighter: ${lighten(theme.palette.text.secondary, 0.7)};
570
- --md-default-fg-color--lightest: ${lighten(
571
- theme.palette.text.secondary,
572
- 0.3
573
- )};
574
-
575
- /* BACKGROUND */
576
- --md-default-bg-color:${theme.palette.background.default};
577
- --md-default-bg-color--light: ${theme.palette.background.paper};
578
- --md-default-bg-color--lighter: ${lighten(
579
- theme.palette.background.paper,
580
- 0.7
581
- )};
582
- --md-default-bg-color--lightest: ${lighten(
583
- theme.palette.background.paper,
584
- 0.3
585
- )};
586
-
587
- /* PRIMARY */
588
- --md-primary-fg-color: ${theme.palette.primary.main};
589
- --md-primary-fg-color--light: ${theme.palette.primary.light};
590
- --md-primary-fg-color--dark: ${theme.palette.primary.dark};
591
- --md-primary-bg-color: ${theme.palette.primary.contrastText};
592
- --md-primary-bg-color--light: ${lighten(
593
- theme.palette.primary.contrastText,
594
- 0.7
595
- )};
596
-
597
- /* ACCENT */
598
- --md-accent-fg-color: var(--md-primary-fg-color);
599
-
600
- /* SHADOW */
601
- --md-shadow-z1: ${theme.shadows[1]};
602
- --md-shadow-z2: ${theme.shadows[2]};
603
- --md-shadow-z3: ${theme.shadows[3]};
604
-
605
- /* EXTENSIONS */
606
- --md-admonition-fg-color: var(--md-default-fg-color);
607
- --md-admonition-bg-color: var(--md-default-bg-color);
608
- /* Admonitions and others are using SVG masks to define icons. These masks are defined as CSS variables. */
609
- --md-admonition-icon--note: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>');
610
- --md-admonition-icon--abstract: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 5h16v2H4V5m0 4h16v2H4V9m0 4h16v2H4v-2m0 4h10v2H4v-2z"/></svg>');
611
- --md-admonition-icon--info: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 9h-2V7h2m0 10h-2v-6h2m-1-9A10 10 0 002 12a10 10 0 0010 10 10 10 0 0010-10A10 10 0 0012 2z"/></svg>');
612
- --md-admonition-icon--tip: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.55 11.2c-.23-.3-.5-.56-.76-.82-.65-.6-1.4-1.03-2.03-1.66C13.3 7.26 13 4.85 13.91 3c-.91.23-1.75.75-2.45 1.32-2.54 2.08-3.54 5.75-2.34 8.9.04.1.08.2.08.33 0 .22-.15.42-.35.5-.22.1-.46.04-.64-.12a.83.83 0 01-.15-.17c-1.1-1.43-1.28-3.48-.53-5.12C5.89 10 5 12.3 5.14 14.47c.04.5.1 1 .27 1.5.14.6.4 1.2.72 1.73 1.04 1.73 2.87 2.97 4.84 3.22 2.1.27 4.35-.12 5.96-1.6 1.8-1.66 2.45-4.32 1.5-6.6l-.13-.26c-.2-.46-.47-.87-.8-1.25l.05-.01m-3.1 6.3c-.28.24-.73.5-1.08.6-1.1.4-2.2-.16-2.87-.82 1.19-.28 1.89-1.16 2.09-2.05.17-.8-.14-1.46-.27-2.23-.12-.74-.1-1.37.18-2.06.17.38.37.76.6 1.06.76 1 1.95 1.44 2.2 2.8.04.14.06.28.06.43.03.82-.32 1.72-.92 2.27h.01z"/></svg>');
613
- --md-admonition-icon--success: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2m-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
614
- --md-admonition-icon--question: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.07 11.25l-.9.92C13.45 12.89 13 13.5 13 15h-2v-.5c0-1.11.45-2.11 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41a2 2 0 00-2-2 2 2 0 00-2 2H8a4 4 0 014-4 4 4 0 014 4 3.2 3.2 0 01-.93 2.25M13 19h-2v-2h2M12 2A10 10 0 002 12a10 10 0 0010 10 10 10 0 0010-10c0-5.53-4.5-10-10-10z"/></svg>');
615
- --md-admonition-icon--warning: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 14h-2v-4h2m0 8h-2v-2h2M1 21h22L12 2 1 21z"/></svg>');
616
- --md-admonition-icon--failure: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2c5.53 0 10 4.47 10 10s-4.47 10-10 10S2 17.53 2 12 6.47 2 12 2m3.59 5L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41 15.59 7z"/></svg>');
617
- --md-admonition-icon--danger: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.5 20l4.86-9.73H13V4l-5 9.73h3.5V20M12 2c2.75 0 5.1 1 7.05 2.95C21 6.9 22 9.25 22 12s-1 5.1-2.95 7.05C17.1 21 14.75 22 12 22s-5.1-1-7.05-2.95C3 17.1 2 14.75 2 12s1-5.1 2.95-7.05C6.9 3 9.25 2 12 2z"/></svg>');
618
- --md-admonition-icon--bug: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 12h-4v-2h4m0 6h-4v-2h4m6-6h-2.81a5.985 5.985 0 00-1.82-1.96L17 4.41 15.59 3l-2.17 2.17a6.002 6.002 0 00-2.83 0L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8z"/></svg>');
619
- --md-admonition-icon--example: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.25-7a.75.75 0 01.75.75c0 .2-.08.39-.21.52L3.12 13H5v1H2v-.92L4 11H2v-1h2.25z"/></svg>');
620
- --md-admonition-icon--quote: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 17h3l2-4V7h-6v6h3M6 17h3l2-4V7H5v6h3l-2 4z"/></svg>');
621
- --md-footnotes-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.42L5.83 13H21V7h-2z"/></svg>');
622
- --md-details-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>');
623
- --md-tasklist-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/></svg>');
624
- --md-tasklist-icon--checked: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
625
- --md-nav-icon--prev: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>');
626
- --md-nav-icon--next: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>');
627
- --md-toc-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>');
628
- --md-clipboard-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1z"/></svg>');
629
- --md-search-result-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h7c-.41-.25-.8-.56-1.14-.9-.33-.33-.61-.7-.86-1.1H6V4h7v5h5v1.18c.71.16 1.39.43 2 .82V8l-6-6m6.31 16.9c1.33-2.11.69-4.9-1.4-6.22-2.11-1.33-4.91-.68-6.22 1.4-1.34 2.11-.69 4.89 1.4 6.22 1.46.93 3.32.93 4.79.02L22 23.39 23.39 22l-3.08-3.1m-3.81.1a2.5 2.5 0 0 1-2.5-2.5 2.5 2.5 0 0 1 2.5-2.5 2.5 2.5 0 0 1 2.5 2.5 2.5 2.5 0 0 1-2.5 2.5z"/></svg>');
630
- --md-source-forks-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm0 2.122a2.25 2.25 0 1 0-1.5 0v.878A2.25 2.25 0 0 0 5.75 8.5h1.5v2.128a2.251 2.251 0 1 0 1.5 0V8.5h1.5a2.25 2.25 0 0 0 2.25-2.25v-.878a2.25 2.25 0 1 0-1.5 0v.878a.75.75 0 0 1-.75.75h-4.5A.75.75 0 0 1 5 6.25v-.878zm3.75 7.378a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm3-8.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5z"/></svg>');
631
- --md-source-repositories-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 1 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 0 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 0 1 1-1h8zM5 12.25v3.25a.25.25 0 0 0 .4.2l1.45-1.087a.25.25 0 0 1 .3 0L8.6 15.7a.25.25 0 0 0 .4-.2v-3.25a.25.25 0 0 0-.25-.25h-3.5a.25.25 0 0 0-.25.25z"/></svg>');
632
- --md-source-stars-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.75.75 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694v.001z"/></svg>');
633
- --md-source-version-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 0 1 .25-.25h5.025a.25.25 0 0 1 .177.073l6.25 6.25a.25.25 0 0 1 0 .354l-5.025 5.025a.25.25 0 0 1-.354 0l-6.25-6.25a.25.25 0 0 1-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 0 1 0 2.474l-5.026 5.026a1.75 1.75 0 0 1-2.474 0l-6.25-6.25A1.75 1.75 0 0 1 1 7.775zM6 5a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>');
634
- --md-version-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="m310.6 246.6-127.1 128c-7.1 6.3-15.3 9.4-23.5 9.4s-16.38-3.125-22.63-9.375l-127.1-128C.224 237.5-2.516 223.7 2.438 211.8S19.07 192 32 192h255.1c12.94 0 24.62 7.781 29.58 19.75s3.12 25.75-6.08 34.85z"/></svg>');
635
- }
636
-
637
- :host > * {
638
- /* CODE */
639
- --md-code-fg-color: ${theme.palette.text.primary};
640
- --md-code-bg-color: ${theme.palette.background.paper};
641
- --md-code-hl-color: ${alpha(theme.palette.warning.main, 0.5)};
642
- --md-code-hl-keyword-color: ${theme.palette.type === "dark" ? theme.palette.primary.light : theme.palette.primary.dark};
643
- --md-code-hl-function-color: ${theme.palette.type === "dark" ? theme.palette.secondary.light : theme.palette.secondary.dark};
644
- --md-code-hl-string-color: ${theme.palette.type === "dark" ? theme.palette.success.light : theme.palette.success.dark};
645
- --md-code-hl-number-color: ${theme.palette.type === "dark" ? theme.palette.error.light : theme.palette.error.dark};
646
- --md-code-hl-constant-color: var(--md-code-hl-function-color);
647
- --md-code-hl-special-color: var(--md-code-hl-function-color);
648
- --md-code-hl-name-color: var(--md-code-fg-color);
649
- --md-code-hl-comment-color: var(--md-default-fg-color--light);
650
- --md-code-hl-generic-color: var(--md-default-fg-color--light);
651
- --md-code-hl-variable-color: var(--md-default-fg-color--light);
652
- --md-code-hl-operator-color: var(--md-default-fg-color--light);
653
- --md-code-hl-punctuation-color: var(--md-default-fg-color--light);
654
-
655
- /* TYPESET */
656
- --md-typeset-font-size: 1rem;
657
- --md-typeset-color: var(--md-default-fg-color);
658
- --md-typeset-a-color: ${theme.palette.link};
659
- --md-typeset-table-color: ${theme.palette.text.primary};
660
- --md-typeset-del-color: ${theme.palette.type === "dark" ? alpha(theme.palette.error.dark, 0.5) : alpha(theme.palette.error.light, 0.5)};
661
- --md-typeset-ins-color: ${theme.palette.type === "dark" ? alpha(theme.palette.success.dark, 0.5) : alpha(theme.palette.success.light, 0.5)};
662
- --md-typeset-mark-color: ${theme.palette.type === "dark" ? alpha(theme.palette.warning.dark, 0.5) : alpha(theme.palette.warning.light, 0.5)};
663
- }
664
-
665
- @media screen and (max-width: 76.1875em) {
666
- :host > * {
667
- /* TYPESET */
668
- --md-typeset-font-size: .9rem;
669
- }
670
- }
671
-
672
- @media screen and (max-width: 600px) {
673
- :host > * {
674
- /* TYPESET */
675
- --md-typeset-font-size: .7rem;
676
- }
677
- }
678
- `;
679
-
680
- var reset = ({ theme }) => `
681
- /*================== Reset ==================*/
682
-
683
- body {
684
- --md-text-color: var(--md-default-fg-color);
685
- --md-text-link-color: var(--md-accent-fg-color);
686
- --md-text-font-family: ${theme.typography.fontFamily};
687
- font-family: var(--md-text-font-family);
688
- background-color: unset;
689
- }
690
- `;
691
-
692
- const SIDEBAR_WIDTH = "224px";
693
- var layout = ({ theme, sidebar }) => `
694
- /*================== Layout ==================*/
695
-
696
- /* mkdocs material v9 compat */
697
- .md-nav__title {
698
- color: var(--md-default-fg-color);
699
- }
700
-
701
- .md-grid {
702
- max-width: 100%;
703
- margin: 0;
704
- }
705
-
706
- .md-nav {
707
- font-size: calc(var(--md-typeset-font-size) * 0.9);
708
- }
709
- .md-nav__link {
710
- display: flex;
711
- align-items: center;
712
- justify-content: space-between;
713
- }
714
- .md-nav__icon {
715
- height: 20px !important;
716
- width: 20px !important;
717
- margin-left:${theme.spacing(1)}px;
718
- }
719
- .md-nav__icon svg {
720
- margin: 0;
721
- width: 20px !important;
722
- height: 20px !important;
723
- }
724
- .md-nav__icon:after {
725
- width: 20px !important;
726
- height: 20px !important;
727
- }
728
-
729
- .md-nav__item--active > .md-nav__link, a.md-nav__link--active {
730
- text-decoration: underline;
731
- color: var(--md-typeset-a-color);
732
- }
733
-
734
- .md-main__inner {
735
- margin-top: 0;
736
- }
737
-
738
- .md-sidebar {
739
- bottom: 75px;
740
- position: fixed;
741
- width: 16rem;
742
- overflow-y: auto;
743
- overflow-x: hidden;
744
- scrollbar-color: rgb(193, 193, 193) #eee;
745
- scrollbar-width: thin;
746
- }
747
- .md-sidebar .md-sidebar__scrollwrap {
748
- width: calc(12.1rem);
749
- }
750
- .md-sidebar--secondary {
751
- right: ${theme.spacing(3)}px;
752
- }
753
- .md-sidebar::-webkit-scrollbar {
754
- width: 5px;
755
- }
756
- .md-sidebar::-webkit-scrollbar-button {
757
- width: 5px;
758
- height: 5px;
759
- }
760
- .md-sidebar::-webkit-scrollbar-track {
761
- background: #eee;
762
- border: 1 px solid rgb(250, 250, 250);
763
- box-shadow: 0px 0px 3px #dfdfdf inset;
764
- border-radius: 3px;
765
- }
766
- .md-sidebar::-webkit-scrollbar-thumb {
767
- width: 5px;
768
- background: rgb(193, 193, 193);
769
- border: transparent;
770
- border-radius: 3px;
771
- }
772
- .md-sidebar::-webkit-scrollbar-thumb:hover {
773
- background: rgb(125, 125, 125);
774
- }
775
-
776
- .md-content {
777
- max-width: calc(100% - 16rem * 2);
778
- margin-left: 16rem;
779
- margin-bottom: 50px;
780
- }
781
-
782
- .md-footer {
783
- position: fixed;
784
- bottom: 0px;
785
- pointer-events: none;
786
- }
787
-
788
- .md-footer-nav__link, .md-footer__link {
789
- pointer-events: all;
790
- }
791
-
792
- .md-footer__title {
793
- background-color: unset;
794
- }
795
- .md-footer-nav__link, .md-footer__link {
796
- width: 16rem;
797
- }
798
-
799
- .md-dialog {
800
- background-color: unset;
801
- }
802
-
803
- @media screen and (min-width: 76.25em) {
804
- .md-sidebar {
805
- height: auto;
806
- }
807
- }
808
-
809
- @media screen and (max-width: 76.1875em) {
810
- .md-nav {
811
- transition: none !important;
812
- background-color: var(--md-default-bg-color)
813
- }
814
- .md-nav--primary .md-nav__title {
815
- cursor: auto;
816
- color: var(--md-default-fg-color);
817
- font-weight: 700;
818
- white-space: normal;
819
- line-height: 1rem;
820
- height: auto;
821
- display: flex;
822
- flex-flow: column;
823
- row-gap: 1.6rem;
824
- padding: 1.2rem .8rem .8rem;
825
- background-color: var(--md-default-bg-color);
826
- }
827
- .md-nav--primary .md-nav__title~.md-nav__list {
828
- box-shadow: none;
829
- }
830
- .md-nav--primary .md-nav__title ~ .md-nav__list > :first-child {
831
- border-top: none;
832
- }
833
- .md-nav--primary .md-nav__title .md-nav__button {
834
- display: none;
835
- }
836
- .md-nav--primary .md-nav__title .md-nav__icon {
837
- color: var(--md-default-fg-color);
838
- position: static;
839
- height: auto;
840
- margin: 0 0 0 -0.2rem;
841
- }
842
- .md-nav--primary > .md-nav__title [for="none"] {
843
- padding-top: 0;
844
- }
845
- .md-nav--primary .md-nav__item {
846
- border-top: none;
847
- }
848
- .md-nav--primary :is(.md-nav__title,.md-nav__item) {
849
- font-size : var(--md-typeset-font-size);
850
- }
851
- .md-nav .md-source {
852
- display: none;
853
- }
854
-
855
- .md-sidebar {
856
- height: 100%;
857
- }
858
- .md-sidebar--primary {
859
- width: 12.1rem !important;
860
- z-index: 200;
861
- left: ${sidebar.isPinned ? `calc(-12.1rem + ${SIDEBAR_WIDTH})` : "calc(-12.1rem + 72px)"} !important;
862
- }
863
- .md-sidebar--secondary:not([hidden]) {
864
- display: none;
865
- }
866
-
867
- .md-content {
868
- max-width: 100%;
869
- margin-left: 0;
870
- }
871
-
872
- .md-header__button {
873
- margin: 0.4rem 0;
874
- margin-left: 0.4rem;
875
- padding: 0;
876
- }
877
-
878
- .md-overlay {
879
- left: 0;
880
- }
881
-
882
- .md-footer {
883
- position: static;
884
- padding-left: 0;
885
- }
886
- .md-footer-nav__link {
887
- /* footer links begin to overlap at small sizes without setting width */
888
- width: 50%;
889
- }
890
- }
891
-
892
- @media screen and (max-width: 600px) {
893
- .md-sidebar--primary {
894
- left: -12.1rem !important;
895
- width: 12.1rem;
896
- }
897
- }
898
-
899
-
900
- @media print {
901
- .md-sidebar,
902
- #toggle-sidebar {
903
- display: none;
904
- }
905
-
906
- .md-content {
907
- margin: 0;
908
- width: 100%;
909
- max-width: 100%;
910
- }
911
- }
912
- `;
913
-
914
- const headings = ["h1", "h2", "h3", "h4", "h5", "h6"];
915
- var typeset = ({ theme }) => `
916
- /*================== Typeset ==================*/
917
-
918
- .md-typeset {
919
- font-size: var(--md-typeset-font-size);
920
- }
921
-
922
- ${headings.reduce((style, heading) => {
923
- var _a;
924
- const htmlFontSize = (_a = theme.typography.htmlFontSize) != null ? _a : 16;
925
- const styles = theme.typography[heading];
926
- const { lineHeight, fontFamily, fontWeight, fontSize } = styles;
927
- const calculate = (value) => {
928
- let factor = 1;
929
- if (typeof value === "number") {
930
- factor = value / htmlFontSize * 0.6;
931
- }
932
- if (typeof value === "string") {
933
- factor = value.replace("rem", "");
934
- }
935
- return `calc(${factor} * var(--md-typeset-font-size))`;
936
- };
937
- return style.concat(`
938
- .md-typeset ${heading} {
939
- color: var(--md-default-fg-color);
940
- line-height: ${lineHeight};
941
- font-family: ${fontFamily};
942
- font-weight: ${fontWeight};
943
- font-size: ${calculate(fontSize)};
944
- }
945
- `);
946
- }, "")}
947
-
948
- .md-typeset .md-content__button {
949
- color: var(--md-default-fg-color);
950
- }
951
-
952
- .md-typeset hr {
953
- border-bottom: 0.05rem dotted ${theme.palette.divider};
954
- }
955
-
956
- .md-typeset details {
957
- font-size: var(--md-typeset-font-size) !important;
958
- }
959
- .md-typeset details summary {
960
- padding-left: 2.5rem !important;
961
- }
962
- .md-typeset details summary:before,
963
- .md-typeset details summary:after {
964
- top: 50% !important;
965
- width: 20px !important;
966
- height: 20px !important;
967
- transform: rotate(0deg) translateY(-50%) !important;
968
- }
969
- .md-typeset details[open] > summary:after {
970
- transform: rotate(90deg) translateX(-50%) !important;
971
- }
972
-
973
- .md-typeset blockquote {
974
- color: var(--md-default-fg-color--light);
975
- border-left: 0.2rem solid var(--md-default-fg-color--light);
976
- }
977
-
978
- .md-typeset table:not([class]) {
979
- font-size: var(--md-typeset-font-size);
980
- border: 1px solid var(--md-default-fg-color);
981
- border-bottom: none;
982
- border-collapse: collapse;
983
- }
984
- .md-typeset table:not([class]) th {
985
- font-weight: bold;
986
- }
987
- .md-typeset table:not([class]) td, .md-typeset table:not([class]) th {
988
- border-bottom: 1px solid var(--md-default-fg-color);
989
- }
990
-
991
- .md-typeset pre > code::-webkit-scrollbar-thumb {
992
- background-color: hsla(0, 0%, 0%, 0.32);
993
- }
994
- .md-typeset pre > code::-webkit-scrollbar-thumb:hover {
995
- background-color: hsla(0, 0%, 0%, 0.87);
996
- }
997
-
998
- .md-typeset code {
999
- word-break: keep-all;
1000
- }
1001
- `;
1002
-
1003
- var animations = () => `
1004
- /*================== Animations ==================*/
1005
- /*
1006
- Disable CSS animations on link colors as they lead to issues in dark mode.
1007
- The dark mode color theme is applied later and theirfore there is always an animation from light to dark mode when navigation between pages.
1008
- */
1009
- .md-dialog, .md-nav__link, .md-footer__link, .md-typeset a, .md-typeset a::before, .md-typeset .headerlink {
1010
- transition: none;
1011
- }
1012
- `;
1013
-
1014
- var extensions = ({ theme }) => `
1015
- /*================== Extensions ==================*/
1016
-
1017
- /* HIGHLIGHT */
1018
- .highlight .md-clipboard:after {
1019
- content: unset;
1020
- }
1021
-
1022
- .highlight .nx {
1023
- color: ${theme.palette.type === "dark" ? "#ff53a3" : "#ec407a"};
1024
- }
1025
-
1026
- /* CODE HILITE */
1027
- .codehilite .gd {
1028
- background-color: ${theme.palette.type === "dark" ? "rgba(248,81,73,0.65)" : "#fdd"};
1029
- }
1030
-
1031
- .codehilite .gi {
1032
- background-color: ${theme.palette.type === "dark" ? "rgba(46,160,67,0.65)" : "#dfd"};
1033
- }
1034
-
1035
- /* TABBED */
1036
- .tabbed-set>input:nth-child(1):checked~.tabbed-labels>:nth-child(1),
1037
- .tabbed-set>input:nth-child(2):checked~.tabbed-labels>:nth-child(2),
1038
- .tabbed-set>input:nth-child(3):checked~.tabbed-labels>:nth-child(3),
1039
- .tabbed-set>input:nth-child(4):checked~.tabbed-labels>:nth-child(4),
1040
- .tabbed-set>input:nth-child(5):checked~.tabbed-labels>:nth-child(5),
1041
- .tabbed-set>input:nth-child(6):checked~.tabbed-labels>:nth-child(6),
1042
- .tabbed-set>input:nth-child(7):checked~.tabbed-labels>:nth-child(7),
1043
- .tabbed-set>input:nth-child(8):checked~.tabbed-labels>:nth-child(8),
1044
- .tabbed-set>input:nth-child(9):checked~.tabbed-labels>:nth-child(9),
1045
- .tabbed-set>input:nth-child(10):checked~.tabbed-labels>:nth-child(10),
1046
- .tabbed-set>input:nth-child(11):checked~.tabbed-labels>:nth-child(11),
1047
- .tabbed-set>input:nth-child(12):checked~.tabbed-labels>:nth-child(12),
1048
- .tabbed-set>input:nth-child(13):checked~.tabbed-labels>:nth-child(13),
1049
- .tabbed-set>input:nth-child(14):checked~.tabbed-labels>:nth-child(14),
1050
- .tabbed-set>input:nth-child(15):checked~.tabbed-labels>:nth-child(15),
1051
- .tabbed-set>input:nth-child(16):checked~.tabbed-labels>:nth-child(16),
1052
- .tabbed-set>input:nth-child(17):checked~.tabbed-labels>:nth-child(17),
1053
- .tabbed-set>input:nth-child(18):checked~.tabbed-labels>:nth-child(18),
1054
- .tabbed-set>input:nth-child(19):checked~.tabbed-labels>:nth-child(19),
1055
- .tabbed-set>input:nth-child(20):checked~.tabbed-labels>:nth-child(20) {
1056
- color: var(--md-accent-fg-color);
1057
- border-color: var(--md-accent-fg-color);
1058
- }
1059
-
1060
- /* TASK-LIST */
1061
- .task-list-control .task-list-indicator::before {
1062
- background-color: ${theme.palette.action.disabledBackground};
1063
- }
1064
- .task-list-control [type="checkbox"]:checked + .task-list-indicator:before {
1065
- background-color: ${theme.palette.success.main};
1066
- }
1067
-
1068
- /* ADMONITION */
1069
- .admonition {
1070
- font-size: var(--md-typeset-font-size) !important;
1071
- }
1072
- .admonition .admonition-title {
1073
- padding-left: 2.5rem !important;
1074
- }
1075
-
1076
- .admonition .admonition-title:before {
1077
- top: 50% !important;
1078
- width: 20px !important;
1079
- height: 20px !important;
1080
- transform: translateY(-50%) !important;
1081
- }
1082
- `;
1083
-
1084
- const rules = [
1085
- variables,
1086
- reset,
1087
- layout,
1088
- typeset,
1089
- animations,
1090
- extensions
1091
- ];
1092
-
1093
- const useSidebar = () => useSidebarPinState();
1094
- const useRuleStyles = () => {
1095
- const sidebar = useSidebar();
1096
- const theme = useTheme();
1097
- return useMemo(() => {
1098
- const options = { theme, sidebar };
1099
- return rules.reduce((styles, rule) => styles + rule(options), "");
1100
- }, [theme, sidebar]);
1101
- };
1102
- const useStylesTransformer = () => {
1103
- const styles = useRuleStyles();
1104
- return useCallback(
1105
- (dom) => {
1106
- dom.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", `<style>${styles}</style>`);
1107
- return dom;
1108
- },
1109
- [styles]
1110
- );
1111
- };
1112
-
1113
- const isSvgNeedingInlining = (attrName, attrVal, apiOrigin) => {
1114
- const isSrcToSvg = attrName === "src" && attrVal.endsWith(".svg");
1115
- const isRelativeUrl = !attrVal.match(/^([a-z]*:)?\/\//i);
1116
- const pointsToOurBackend = attrVal.startsWith(apiOrigin);
1117
- return isSrcToSvg && (isRelativeUrl || pointsToOurBackend);
1118
- };
1119
- const addBaseUrl = ({
1120
- techdocsStorageApi,
1121
- entityId,
1122
- path
1123
- }) => {
1124
- return async (dom) => {
1125
- const apiOrigin = await techdocsStorageApi.getApiOrigin();
1126
- const updateDom = async (list, attributeName) => {
1127
- for (const elem of list) {
1128
- if (elem.hasAttribute(attributeName)) {
1129
- const elemAttribute = elem.getAttribute(attributeName);
1130
- if (!elemAttribute)
1131
- return;
1132
- const newValue = await techdocsStorageApi.getBaseUrl(
1133
- elemAttribute,
1134
- entityId,
1135
- path
1136
- );
1137
- if (isSvgNeedingInlining(attributeName, elemAttribute, apiOrigin)) {
1138
- try {
1139
- const svg = await fetch(newValue, { credentials: "include" });
1140
- const svgContent = await svg.text();
1141
- elem.setAttribute(
1142
- attributeName,
1143
- `data:image/svg+xml;base64,${btoa(
1144
- unescape(encodeURIComponent(svgContent))
1145
- )}`
1146
- );
1147
- } catch (e) {
1148
- elem.setAttribute("alt", `Error: ${elemAttribute}`);
1149
- }
1150
- } else {
1151
- elem.setAttribute(attributeName, newValue);
1152
- }
1153
- }
1154
- }
1155
- };
1156
- await Promise.all([
1157
- updateDom(dom.querySelectorAll("img"), "src"),
1158
- updateDom(dom.querySelectorAll("script"), "src"),
1159
- updateDom(dom.querySelectorAll("source"), "src"),
1160
- updateDom(dom.querySelectorAll("link"), "href"),
1161
- updateDom(dom.querySelectorAll("a[download]"), "href")
1162
- ]);
1163
- return dom;
1164
- };
1165
- };
1166
-
1167
- let ReactDOMPromise;
1168
- if (process.env.HAS_REACT_DOM_CLIENT) {
1169
- ReactDOMPromise = import('react-dom/client');
1170
- } else {
1171
- ReactDOMPromise = import('react-dom');
1172
- }
1173
- function renderReactElement(element, root) {
1174
- ReactDOMPromise.then((ReactDOM) => {
1175
- if ("createRoot" in ReactDOM) {
1176
- ReactDOM.createRoot(root).render(element);
1177
- } else {
1178
- ReactDOM.render(element, root);
1179
- }
1180
- });
1181
- }
1182
-
1183
- const addGitFeedbackLink = (scmIntegrationsApi) => {
1184
- return (dom) => {
1185
- var _a;
1186
- const sourceAnchor = dom.querySelector(
1187
- '[title="Edit this page"]'
1188
- );
1189
- if (!sourceAnchor || !sourceAnchor.href) {
1190
- return dom;
1191
- }
1192
- const sourceURL = new URL(sourceAnchor.href);
1193
- const integration = scmIntegrationsApi.byUrl(sourceURL);
1194
- if ((integration == null ? void 0 : integration.type) !== "github" && (integration == null ? void 0 : integration.type) !== "gitlab") {
1195
- return dom;
1196
- }
1197
- const title = ((_a = dom.querySelector("article>h1")) == null ? void 0 : _a.childNodes[0].textContent) || "";
1198
- const issueTitle = encodeURIComponent(`Documentation Feedback: ${title}`);
1199
- const issueDesc = encodeURIComponent(
1200
- `Page source:
1201
- ${sourceAnchor.href}
1202
-
1203
- Feedback:`
1204
- );
1205
- const gitUrl = (integration == null ? void 0 : integration.type) === "github" ? replaceGithubUrlType(sourceURL.href, "blob") : sourceURL.href;
1206
- const gitInfo = parseGitUrl(gitUrl);
1207
- const repoPath = `/${gitInfo.organization}/${gitInfo.name}`;
1208
- const feedbackLink = sourceAnchor.cloneNode();
1209
- switch (integration == null ? void 0 : integration.type) {
1210
- case "gitlab":
1211
- feedbackLink.href = `${sourceURL.origin}${repoPath}/issues/new?issue[title]=${issueTitle}&issue[description]=${issueDesc}`;
1212
- break;
1213
- case "github":
1214
- feedbackLink.href = `${sourceURL.origin}${repoPath}/issues/new?title=${issueTitle}&body=${issueDesc}`;
1215
- break;
1216
- default:
1217
- return dom;
1218
- }
1219
- renderReactElement(React.createElement(FeedbackOutlinedIcon), feedbackLink);
1220
- feedbackLink.style.paddingLeft = "5px";
1221
- feedbackLink.title = "Leave feedback for this page";
1222
- feedbackLink.id = "git-feedback-link";
1223
- sourceAnchor == null ? void 0 : sourceAnchor.insertAdjacentElement("beforebegin", feedbackLink);
1224
- return dom;
1225
- };
1226
- };
1227
-
1228
- const addSidebarToggle = () => {
1229
- return (dom) => {
1230
- const mkdocsToggleSidebar = dom.querySelector(
1231
- '.md-header label[for="__drawer"]'
1232
- );
1233
- const article = dom.querySelector("article");
1234
- if (!mkdocsToggleSidebar || !article) {
1235
- return dom;
1236
- }
1237
- const toggleSidebar = mkdocsToggleSidebar.cloneNode();
1238
- renderReactElement(React.createElement(MenuIcon), toggleSidebar);
1239
- toggleSidebar.id = "toggle-sidebar";
1240
- toggleSidebar.title = "Toggle Sidebar";
1241
- toggleSidebar.classList.add("md-content__button");
1242
- toggleSidebar.style.setProperty("padding", "0 0 0 5px");
1243
- toggleSidebar.style.setProperty("margin", "0.4rem 0 0.4rem 0.4rem");
1244
- article == null ? void 0 : article.prepend(toggleSidebar);
1245
- return dom;
1246
- };
1247
- };
1248
-
1249
- const rewriteDocLinks = () => {
1250
- return (dom) => {
1251
- const updateDom = (list, attributeName) => {
1252
- Array.from(list).filter((elem) => elem.hasAttribute(attributeName)).forEach((elem) => {
1253
- const elemAttribute = elem.getAttribute(attributeName);
1254
- if (elemAttribute) {
1255
- if (elemAttribute.match(/^https?:\/\//i)) {
1256
- elem.setAttribute("target", "_blank");
1257
- }
1258
- try {
1259
- const normalizedWindowLocation = normalizeUrl(
1260
- window.location.href
1261
- );
1262
- elem.setAttribute(
1263
- attributeName,
1264
- new URL(elemAttribute, normalizedWindowLocation).toString()
1265
- );
1266
- } catch (_e) {
1267
- elem.replaceWith(elem.textContent || elemAttribute);
1268
- }
1269
- }
1270
- });
1271
- };
1272
- updateDom(Array.from(dom.getElementsByTagName("a")), "href");
1273
- return dom;
1274
- };
1275
- };
1276
- function normalizeUrl(input) {
1277
- const url = new URL(input);
1278
- if (!url.pathname.endsWith("/") && !url.pathname.endsWith(".html")) {
1279
- url.pathname += "/";
1280
- }
1281
- return url.toString();
1282
- }
1283
-
1284
- const addLinkClickListener = ({
1285
- baseUrl,
1286
- onClick
1287
- }) => {
1288
- return (dom) => {
1289
- Array.from(dom.getElementsByTagName("a")).forEach((elem) => {
1290
- elem.addEventListener("click", (e) => {
1291
- const target = elem;
1292
- const href = target.getAttribute("href");
1293
- if (!href)
1294
- return;
1295
- if (href.startsWith(baseUrl) && !elem.hasAttribute("download")) {
1296
- e.preventDefault();
1297
- onClick(e, href);
1298
- }
1299
- });
1300
- });
1301
- return dom;
1302
- };
1303
- };
1304
-
1305
- const CopyToClipboardTooltip = withStyles((theme) => ({
1306
- tooltip: {
1307
- fontSize: "inherit",
1308
- color: theme.palette.text.primary,
1309
- margin: 0,
1310
- padding: theme.spacing(0.5),
1311
- backgroundColor: "transparent",
1312
- boxShadow: "none"
1313
- }
1314
- }))(Tooltip);
1315
- const CopyToClipboardIcon = () => /* @__PURE__ */ React.createElement(SvgIcon, null, /* @__PURE__ */ React.createElement("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }));
1316
- const CopyToClipboardButton = ({ text }) => {
1317
- const [open, setOpen] = useState(false);
1318
- const [, copyToClipboard2] = useCopyToClipboard();
1319
- const handleClick = useCallback(() => {
1320
- copyToClipboard2(text);
1321
- setOpen(true);
1322
- }, [text, copyToClipboard2]);
1323
- const handleClose = useCallback(() => {
1324
- setOpen(false);
1325
- }, [setOpen]);
1326
- return /* @__PURE__ */ React.createElement(
1327
- CopyToClipboardTooltip,
1328
- {
1329
- title: "Copied to clipboard",
1330
- placement: "left",
1331
- open,
1332
- onClose: handleClose,
1333
- leaveDelay: 1e3
1334
- },
1335
- /* @__PURE__ */ React.createElement(
1336
- IconButton,
1337
- {
1338
- style: { color: "inherit" },
1339
- className: "md-clipboard md-icon",
1340
- onClick: handleClick
1341
- },
1342
- /* @__PURE__ */ React.createElement(CopyToClipboardIcon, null)
1343
- )
1344
- );
1345
- };
1346
- const copyToClipboard = (theme) => {
1347
- return (dom) => {
1348
- var _a;
1349
- const codes = dom.querySelectorAll("pre > code");
1350
- for (const code of codes) {
1351
- const text = code.textContent || "";
1352
- const container = document.createElement("div");
1353
- (_a = code == null ? void 0 : code.parentElement) == null ? void 0 : _a.prepend(container);
1354
- renderReactElement(
1355
- /* @__PURE__ */ React.createElement(ThemeProvider, { theme }, /* @__PURE__ */ React.createElement(CopyToClipboardButton, { text })),
1356
- container
1357
- );
1358
- }
1359
- return dom;
1360
- };
1361
- };
1362
-
1363
- const removeMkdocsHeader = () => {
1364
- return (dom) => {
1365
- var _a;
1366
- (_a = dom.querySelector(".md-header")) == null ? void 0 : _a.remove();
1367
- return dom;
1368
- };
1369
- };
1370
-
1371
- const simplifyMkdocsFooter = () => {
1372
- return (dom) => {
1373
- var _a, _b;
1374
- (_a = dom.querySelector(".md-footer .md-copyright")) == null ? void 0 : _a.remove();
1375
- (_b = dom.querySelector(".md-footer-copyright")) == null ? void 0 : _b.remove();
1376
- return dom;
1377
- };
1378
- };
1379
-
1380
- const onCssReady = ({
1381
- onLoading,
1382
- onLoaded
1383
- }) => {
1384
- return (dom) => {
1385
- onLoading();
1386
- dom.addEventListener(
1387
- SHADOW_DOM_STYLE_LOAD_EVENT,
1388
- function handleShadowDomStyleLoad() {
1389
- onLoaded();
1390
- dom.removeEventListener(
1391
- SHADOW_DOM_STYLE_LOAD_EVENT,
1392
- handleShadowDomStyleLoad
1393
- );
1394
- }
1395
- );
1396
- return dom;
1397
- };
1398
- };
1399
-
1400
- const scrollIntoNavigation = () => {
1401
- return (dom) => {
1402
- setTimeout(() => {
1403
- const activeNavItems = dom == null ? void 0 : dom.querySelectorAll(`li.md-nav__item--active`);
1404
- if (activeNavItems.length !== 0) {
1405
- activeNavItems.forEach((activeNavItem) => {
1406
- const checkbox = activeNavItem == null ? void 0 : activeNavItem.querySelector("input");
1407
- if (!(checkbox == null ? void 0 : checkbox.checked)) {
1408
- checkbox == null ? void 0 : checkbox.click();
1409
- }
1410
- });
1411
- const lastItem = activeNavItems[activeNavItems.length - 1];
1412
- lastItem.scrollIntoView();
1413
- }
1414
- }, 200);
1415
- return dom;
1416
- };
1417
- };
1418
-
1419
- const transform = async (html, transformers) => {
1420
- let dom;
1421
- if (typeof html === "string") {
1422
- dom = new DOMParser().parseFromString(html, "text/html").documentElement;
1423
- } else if (html instanceof Element) {
1424
- dom = html;
1425
- } else {
1426
- throw new Error("dom is not a recognized type");
1427
- }
1428
- for (const transformer of transformers) {
1429
- dom = await transformer(dom);
1430
- }
1431
- return dom;
1432
- };
1433
-
1434
- function resolveUrlToRelative(url, baseUrl) {
1435
- const parsedAppUrl = new URL(baseUrl);
1436
- const appUrlPath = `${parsedAppUrl.origin}${parsedAppUrl.pathname.replace(
1437
- /\/$/,
1438
- ""
1439
- )}`;
1440
- const relativeUrl = url.replace(appUrlPath, "").replace(/^\/+/, "");
1441
- const parsedUrl = new URL(`http://localhost/${relativeUrl}`);
1442
- return `${parsedUrl.pathname}${parsedUrl.search}${parsedUrl.hash}`;
1443
- }
1444
- function useNavigateUrl() {
1445
- const navigate = useNavigate();
1446
- const configApi = useApi(configApiRef);
1447
- const appBaseUrl = configApi.getOptionalString("app.baseUrl");
1448
- const navigateFn = useCallback(
1449
- (to) => {
1450
- let url = to;
1451
- if (appBaseUrl) {
1452
- try {
1453
- url = resolveUrlToRelative(to, appBaseUrl);
1454
- } catch (err) {
1455
- }
1456
- }
1457
- navigate(url);
1458
- },
1459
- [navigate, appBaseUrl]
1460
- );
1461
- return navigateFn;
1462
- }
1463
-
1464
- const MOBILE_MEDIA_QUERY = "screen and (max-width: 76.1875em)";
1465
- const useTechDocsReaderDom = (entityRef) => {
1466
- const navigate = useNavigateUrl();
1467
- const theme = useTheme();
1468
- const isMobileMedia = useMediaQuery(MOBILE_MEDIA_QUERY);
1469
- const sanitizerTransformer = useSanitizerTransformer();
1470
- const stylesTransformer = useStylesTransformer();
1471
- const analytics = useAnalytics();
1472
- const techdocsStorageApi = useApi(techdocsStorageApiRef);
1473
- const scmIntegrationsApi = useApi(scmIntegrationsApiRef);
1474
- const { state, path, content: rawPage } = useTechDocsReader();
1475
- const [dom, setDom] = useState(null);
1476
- const isStyleLoading = useShadowDomStylesLoading(dom);
1477
- const updateSidebarPositionAndHeight = useCallback(() => {
1478
- if (!dom)
1479
- return;
1480
- const sidebars = dom.querySelectorAll(".md-sidebar");
1481
- sidebars.forEach((element) => {
1482
- var _a, _b, _c, _d;
1483
- if (isMobileMedia) {
1484
- element.style.top = "0px";
1485
- } else {
1486
- const page = document == null ? void 0 : document.querySelector(".techdocs-reader-page");
1487
- const pageTop = (_a = page == null ? void 0 : page.getBoundingClientRect().top) != null ? _a : 0;
1488
- let domTop = (_b = dom.getBoundingClientRect().top) != null ? _b : 0;
1489
- const tabs = dom.querySelector(".md-container > .md-tabs");
1490
- const tabsHeight = (_c = tabs == null ? void 0 : tabs.getBoundingClientRect().height) != null ? _c : 0;
1491
- if (domTop < pageTop) {
1492
- domTop = pageTop;
1493
- }
1494
- const scrollbarTopPx = Math.max(domTop, 0) + tabsHeight;
1495
- element.style.top = `${scrollbarTopPx}px`;
1496
- const footer = dom.querySelector(".md-container > .md-footer");
1497
- const scrollbarEndPx = (_d = footer == null ? void 0 : footer.getBoundingClientRect().top) != null ? _d : window.innerHeight;
1498
- element.style.height = `${scrollbarEndPx - scrollbarTopPx}px`;
1499
- }
1500
- element.style.setProperty("opacity", "1");
1501
- });
1502
- }, [dom, isMobileMedia]);
1503
- useEffect(() => {
1504
- window.addEventListener("resize", updateSidebarPositionAndHeight);
1505
- window.addEventListener("scroll", updateSidebarPositionAndHeight, true);
1506
- return () => {
1507
- window.removeEventListener("resize", updateSidebarPositionAndHeight);
1508
- window.removeEventListener(
1509
- "scroll",
1510
- updateSidebarPositionAndHeight,
1511
- true
1512
- );
1513
- };
1514
- }, [dom, updateSidebarPositionAndHeight]);
1515
- const updateFooterWidth = useCallback(() => {
1516
- if (!dom)
1517
- return;
1518
- const footer = dom.querySelector(".md-footer");
1519
- if (footer) {
1520
- footer.style.width = `${dom.getBoundingClientRect().width}px`;
1521
- }
1522
- }, [dom]);
1523
- useEffect(() => {
1524
- window.addEventListener("resize", updateFooterWidth);
1525
- return () => {
1526
- window.removeEventListener("resize", updateFooterWidth);
1527
- };
1528
- }, [dom, updateFooterWidth]);
1529
- useEffect(() => {
1530
- if (!isStyleLoading) {
1531
- updateFooterWidth();
1532
- updateSidebarPositionAndHeight();
1533
- }
1534
- }, [
1535
- state,
1536
- isStyleLoading,
1537
- updateFooterWidth,
1538
- updateSidebarPositionAndHeight
1539
- ]);
1540
- const preRender = useCallback(
1541
- (rawContent, contentPath) => transform(rawContent, [
1542
- sanitizerTransformer,
1543
- addBaseUrl({
1544
- techdocsStorageApi,
1545
- entityId: entityRef,
1546
- path: contentPath
1547
- }),
1548
- rewriteDocLinks(),
1549
- addSidebarToggle(),
1550
- removeMkdocsHeader(),
1551
- simplifyMkdocsFooter(),
1552
- addGitFeedbackLink(scmIntegrationsApi),
1553
- stylesTransformer
1554
- ]),
1555
- [
1556
- // only add dependencies that are in state or memorized variables to avoid unnecessary calls between re-renders
1557
- entityRef,
1558
- scmIntegrationsApi,
1559
- techdocsStorageApi,
1560
- sanitizerTransformer,
1561
- stylesTransformer
1562
- ]
1563
- );
1564
- const postRender = useCallback(
1565
- async (transformedElement) => transform(transformedElement, [
1566
- scrollIntoNavigation(),
1567
- copyToClipboard(theme),
1568
- addLinkClickListener({
1569
- baseUrl: window.location.origin,
1570
- onClick: (event, url) => {
1571
- var _a, _b;
1572
- const modifierActive = event.ctrlKey || event.metaKey;
1573
- const parsedUrl = new URL(url);
1574
- const linkText = ((_a = event.target) == null ? void 0 : _a.innerText) || url;
1575
- const to = url.replace(window.location.origin, "");
1576
- analytics.captureEvent("click", linkText, { attributes: { to } });
1577
- if (parsedUrl.hash) {
1578
- if (modifierActive) {
1579
- window.open(url, "_blank");
1580
- } else {
1581
- navigate(url);
1582
- (_b = transformedElement == null ? void 0 : transformedElement.querySelector(`[id="${parsedUrl.hash.slice(1)}"]`)) == null ? void 0 : _b.scrollIntoView();
1583
- }
1584
- } else {
1585
- if (modifierActive) {
1586
- window.open(url, "_blank");
1587
- } else {
1588
- navigate(url);
1589
- }
1590
- }
1591
- }
1592
- }),
1593
- // disable MkDocs drawer toggling ('for' attribute => checkbox mechanism)
1594
- onCssReady({
1595
- onLoading: () => {
1596
- },
1597
- onLoaded: () => {
1598
- var _a;
1599
- (_a = transformedElement.querySelector(".md-nav__title")) == null ? void 0 : _a.removeAttribute("for");
1600
- }
1601
- }),
1602
- // hide sidebars until their positions are updated
1603
- onCssReady({
1604
- onLoading: () => {
1605
- const sidebars = Array.from(
1606
- transformedElement.querySelectorAll(".md-sidebar")
1607
- );
1608
- sidebars.forEach((element) => {
1609
- element.style.setProperty("opacity", "0");
1610
- });
1611
- },
1612
- onLoaded: () => {
1613
- }
1614
- })
1615
- ]),
1616
- [theme, navigate, analytics]
1617
- );
1618
- useEffect(() => {
1619
- if (!rawPage)
1620
- return () => {
1621
- };
1622
- let shouldReplaceContent = true;
1623
- preRender(rawPage, path).then(async (preTransformedDomElement) => {
1624
- if (!(preTransformedDomElement == null ? void 0 : preTransformedDomElement.innerHTML)) {
1625
- return;
1626
- }
1627
- if (!shouldReplaceContent) {
1628
- return;
1629
- }
1630
- window.scroll({ top: 0 });
1631
- const postTransformedDomElement = await postRender(
1632
- preTransformedDomElement
1633
- );
1634
- setDom(postTransformedDomElement);
1635
- });
1636
- return () => {
1637
- shouldReplaceContent = false;
1638
- };
1639
- }, [rawPage, path, preRender, postRender]);
1640
- return dom;
1641
- };
1642
-
1643
- const TechDocsReaderPageContentAddons = () => {
1644
- const addons = useTechDocsAddons();
1645
- const { shadowRoot } = useTechDocsReaderPage();
1646
- const contentElement = shadowRoot == null ? void 0 : shadowRoot.querySelector(
1647
- '[data-md-component="content"]'
1648
- );
1649
- const primarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector(
1650
- 'div[data-md-component="sidebar"][data-md-type="navigation"], div[data-md-component="navigation"]'
1651
- );
1652
- let primarySidebarAddonLocation = primarySidebarElement == null ? void 0 : primarySidebarElement.querySelector(
1653
- '[data-techdocs-addons-location="primary sidebar"]'
1654
- );
1655
- if (!primarySidebarAddonLocation) {
1656
- primarySidebarAddonLocation = document.createElement("div");
1657
- primarySidebarAddonLocation.setAttribute(
1658
- "data-techdocs-addons-location",
1659
- "primary sidebar"
1660
- );
1661
- primarySidebarElement == null ? void 0 : primarySidebarElement.prepend(primarySidebarAddonLocation);
1662
- }
1663
- const secondarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector(
1664
- 'div[data-md-component="sidebar"][data-md-type="toc"], div[data-md-component="toc"]'
1665
- );
1666
- let secondarySidebarAddonLocation = secondarySidebarElement == null ? void 0 : secondarySidebarElement.querySelector(
1667
- '[data-techdocs-addons-location="secondary sidebar"]'
1668
- );
1669
- if (!secondarySidebarAddonLocation) {
1670
- secondarySidebarAddonLocation = document.createElement("div");
1671
- secondarySidebarAddonLocation.setAttribute(
1672
- "data-techdocs-addons-location",
1673
- "secondary sidebar"
1674
- );
1675
- secondarySidebarElement == null ? void 0 : secondarySidebarElement.prepend(secondarySidebarAddonLocation);
1676
- }
1677
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Portal, { container: primarySidebarAddonLocation }, addons.renderComponentsByLocation(TechDocsAddonLocations.PrimarySidebar)), /* @__PURE__ */ React.createElement(Portal, { container: contentElement }, addons.renderComponentsByLocation(TechDocsAddonLocations.Content)), /* @__PURE__ */ React.createElement(Portal, { container: secondarySidebarAddonLocation }, addons.renderComponentsByLocation(TechDocsAddonLocations.SecondarySidebar)));
1678
- };
1679
-
1680
- const useStyles$1 = makeStyles({
1681
- search: {
1682
- width: "100%",
1683
- "@media (min-width: 76.1875em)": {
1684
- width: "calc(100% - 34.4rem)",
1685
- margin: "0 auto"
1686
- },
1687
- "@media print": {
1688
- display: "none"
1689
- }
1690
- }
1691
- });
1692
- const TechDocsReaderPageContent = withTechDocsReaderProvider(
1693
- (props) => {
1694
- var _a;
1695
- const { withSearch = true, onReady } = props;
1696
- const classes = useStyles$1();
1697
- const {
1698
- entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },
1699
- entityRef,
1700
- setShadowRoot
1701
- } = useTechDocsReaderPage();
1702
- const dom = useTechDocsReaderDom(entityRef);
1703
- const path = window.location.pathname;
1704
- const hash = window.location.hash;
1705
- const isStyleLoading = useShadowDomStylesLoading(dom);
1706
- const [hashElement] = useShadowRootElements([`[id="${hash.slice(1)}"]`]);
1707
- useEffect(() => {
1708
- var _a2;
1709
- if (isStyleLoading)
1710
- return;
1711
- if (hash) {
1712
- if (hashElement) {
1713
- hashElement.scrollIntoView();
1714
- }
1715
- } else {
1716
- (_a2 = document == null ? void 0 : document.querySelector("header")) == null ? void 0 : _a2.scrollIntoView();
1717
- }
1718
- }, [path, hash, hashElement, isStyleLoading]);
1719
- const handleAppend = useCallback(
1720
- (newShadowRoot) => {
1721
- setShadowRoot(newShadowRoot);
1722
- if (onReady instanceof Function) {
1723
- onReady();
1724
- }
1725
- },
1726
- [setShadowRoot, onReady]
1727
- );
1728
- if (entityMetadataLoading === false && !entityMetadata)
1729
- return /* @__PURE__ */ React.createElement(ErrorPage, { status: "404", statusMessage: "PAGE NOT FOUND" });
1730
- if (!dom) {
1731
- return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { xs: 12, item: true }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null))));
1732
- }
1733
- return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { xs: 12, item: true }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null)), withSearch && /* @__PURE__ */ React.createElement(Grid, { className: classes.search, xs: "auto", item: true }, /* @__PURE__ */ React.createElement(
1734
- TechDocsSearch,
1735
- {
1736
- entityId: entityRef,
1737
- entityTitle: (_a = entityMetadata == null ? void 0 : entityMetadata.metadata) == null ? void 0 : _a.title
1738
- }
1739
- )), /* @__PURE__ */ React.createElement(Grid, { xs: 12, item: true }, /* @__PURE__ */ React.createElement(TechDocsShadowDom, { element: dom, onAppend: handleAppend }, /* @__PURE__ */ React.createElement(TechDocsReaderPageContentAddons, null)))));
1740
- }
1741
- );
1742
- const Reader = TechDocsReaderPageContent;
1743
-
1744
- const skeleton = /* @__PURE__ */ React.createElement(Skeleton, { animation: "wave", variant: "text", height: 40 });
1745
- const TechDocsReaderPageHeader = (props) => {
1746
- const { children } = props;
1747
- const addons = useTechDocsAddons();
1748
- const configApi = useApi(configApiRef);
1749
- const {
1750
- title,
1751
- setTitle,
1752
- subtitle,
1753
- setSubtitle,
1754
- entityRef,
1755
- metadata: { value: metadata, loading: metadataLoading },
1756
- entityMetadata: { value: entityMetadata, loading: entityMetadataLoading }
1757
- } = useTechDocsReaderPage();
1758
- useEffect(() => {
1759
- if (!metadata)
1760
- return;
1761
- setTitle(metadata.site_name);
1762
- setSubtitle(() => {
1763
- let { site_description } = metadata;
1764
- if (!site_description || site_description === "None") {
1765
- site_description = "";
1766
- }
1767
- return site_description;
1768
- });
1769
- }, [metadata, setTitle, setSubtitle]);
1770
- const appTitle = configApi.getOptional("app.title") || "Backstage";
1771
- const tabTitle = [title, subtitle, appTitle].filter(Boolean).join(" | ");
1772
- const { locationMetadata, spec } = entityMetadata || {};
1773
- const lifecycle = spec == null ? void 0 : spec.lifecycle;
1774
- const ownedByRelations = entityMetadata ? getEntityRelations(entityMetadata, RELATION_OWNED_BY) : [];
1775
- const docsRootLink = useRouteRef(rootRouteRef)();
1776
- const labels = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1777
- HeaderLabel,
1778
- {
1779
- label: capitalize((entityMetadata == null ? void 0 : entityMetadata.kind) || "entity"),
1780
- value: /* @__PURE__ */ React.createElement(
1781
- EntityRefLink,
1782
- {
1783
- color: "inherit",
1784
- entityRef,
1785
- title: entityMetadata == null ? void 0 : entityMetadata.metadata.title,
1786
- defaultKind: "Component"
1787
- }
1788
- )
1789
- }
1790
- ), ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(
1791
- HeaderLabel,
1792
- {
1793
- label: "Owner",
1794
- value: /* @__PURE__ */ React.createElement(
1795
- EntityRefLinks,
1796
- {
1797
- color: "inherit",
1798
- entityRefs: ownedByRelations,
1799
- defaultKind: "group"
1800
- }
1801
- )
1802
- }
1803
- ), lifecycle ? /* @__PURE__ */ React.createElement(HeaderLabel, { label: "Lifecycle", value: String(lifecycle) }) : null, locationMetadata && locationMetadata.type !== "dir" && locationMetadata.type !== "file" ? /* @__PURE__ */ React.createElement(
1804
- HeaderLabel,
1805
- {
1806
- label: "",
1807
- value: /* @__PURE__ */ React.createElement(Grid, { container: true, direction: "column", alignItems: "center" }, /* @__PURE__ */ React.createElement(Grid, { style: { padding: 0 }, item: true }, /* @__PURE__ */ React.createElement(CodeIcon, { style: { marginTop: "-25px" } })), /* @__PURE__ */ React.createElement(Grid, { style: { padding: 0 }, item: true }, "Source")),
1808
- url: locationMetadata.target
1809
- }
1810
- ) : null);
1811
- const noEntMetadata = !entityMetadataLoading && entityMetadata === void 0;
1812
- const noTdMetadata = !metadataLoading && metadata === void 0;
1813
- if (noEntMetadata || noTdMetadata)
1814
- return null;
1815
- return /* @__PURE__ */ React.createElement(
1816
- Header,
1817
- {
1818
- type: "Documentation",
1819
- typeLink: docsRootLink,
1820
- title: title || skeleton,
1821
- subtitle: subtitle === "" ? void 0 : subtitle || skeleton
1822
- },
1823
- /* @__PURE__ */ React.createElement(Helmet, { titleTemplate: "%s" }, /* @__PURE__ */ React.createElement("title", null, tabTitle)),
1824
- labels,
1825
- children,
1826
- addons.renderComponentsByLocation(TechDocsAddonLocations.Header)
1827
- );
1828
- };
1829
-
1830
- const useStyles = makeStyles((theme) => ({
1831
- root: {
1832
- gridArea: "pageSubheader",
1833
- flexDirection: "column",
1834
- minHeight: "auto",
1835
- padding: theme.spacing(3, 3, 0),
1836
- "@media print": {
1837
- display: "none"
1838
- }
1839
- }
1840
- }));
1841
- const TechDocsReaderPageSubheader = (props) => {
1842
- const classes = useStyles();
1843
- const [anchorEl, setAnchorEl] = useState(null);
1844
- const handleClick = useCallback((event) => {
1845
- setAnchorEl(event.currentTarget);
1846
- }, []);
1847
- const handleClose = useCallback(() => {
1848
- setAnchorEl(null);
1849
- }, []);
1850
- const {
1851
- entityMetadata: { value: entityMetadata, loading: entityMetadataLoading }
1852
- } = useTechDocsReaderPage();
1853
- const addons = useTechDocsAddons();
1854
- const subheaderAddons = addons.renderComponentsByLocation(
1855
- TechDocsAddonLocations.Subheader
1856
- );
1857
- const settingsAddons = addons.renderComponentsByLocation(TechDocsAddonLocations.Settings);
1858
- if (!subheaderAddons && !settingsAddons)
1859
- return null;
1860
- if (entityMetadataLoading === false && !entityMetadata)
1861
- return null;
1862
- return /* @__PURE__ */ React.createElement(Toolbar, { classes, ...props.toolbarProps }, /* @__PURE__ */ React.createElement(
1863
- Box,
1864
- {
1865
- display: "flex",
1866
- justifyContent: "flex-end",
1867
- width: "100%",
1868
- flexWrap: "wrap"
1869
- },
1870
- subheaderAddons,
1871
- settingsAddons ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Tooltip, { title: "Settings" }, /* @__PURE__ */ React.createElement(
1872
- IconButton,
1873
- {
1874
- "aria-controls": "tech-docs-reader-page-settings",
1875
- "aria-haspopup": "true",
1876
- onClick: handleClick
1877
- },
1878
- /* @__PURE__ */ React.createElement(SettingsIcon, null)
1879
- )), /* @__PURE__ */ React.createElement(
1880
- Menu,
1881
- {
1882
- id: "tech-docs-reader-page-settings",
1883
- getContentAnchorEl: null,
1884
- anchorEl,
1885
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
1886
- open: Boolean(anchorEl),
1887
- onClose: handleClose,
1888
- keepMounted: true
1889
- },
1890
- /* @__PURE__ */ React.createElement("div", null, settingsAddons)
1891
- )) : null
1892
- ));
1893
- };
1894
-
1895
- const TechDocsReaderLayout = (props) => {
1896
- const { withSearch, withHeader = true } = props;
1897
- return /* @__PURE__ */ React.createElement(Page, { themeId: "documentation" }, withHeader && /* @__PURE__ */ React.createElement(TechDocsReaderPageHeader, null), /* @__PURE__ */ React.createElement(TechDocsReaderPageSubheader, null), /* @__PURE__ */ React.createElement(TechDocsReaderPageContent, { withSearch }));
1898
- };
1899
- const TechDocsReaderPage = (props) => {
1900
- const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);
1901
- const { children, entityRef = { kind, name, namespace } } = props;
1902
- const outlet = useOutlet();
1903
- if (!children) {
1904
- const childrenList = outlet ? Children.toArray(outlet.props.children) : [];
1905
- const grandChildren = childrenList.flatMap(
1906
- (child) => {
1907
- var _a, _b;
1908
- return (_b = (_a = child == null ? void 0 : child.props) == null ? void 0 : _a.children) != null ? _b : [];
1909
- }
1910
- );
1911
- const page = grandChildren.find(
1912
- (grandChild) => !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) && !getComponentData(grandChild, TECHDOCS_ADDONS_KEY)
1913
- );
1914
- return /* @__PURE__ */ React.createElement(CookieAuthRefreshProvider, { pluginId: "techdocs" }, /* @__PURE__ */ React.createElement(TechDocsReaderPageProvider, { entityRef }, page || /* @__PURE__ */ React.createElement(TechDocsReaderLayout, null)));
1915
- }
1916
- return /* @__PURE__ */ React.createElement(CookieAuthRefreshProvider, { pluginId: "techdocs" }, /* @__PURE__ */ React.createElement(TechDocsReaderPageProvider, { entityRef }, ({ metadata, entityMetadata, onReady }) => /* @__PURE__ */ React.createElement("div", { className: "techdocs-reader-page" }, /* @__PURE__ */ React.createElement(Page, { themeId: "documentation" }, children instanceof Function ? children({
1917
- entityRef,
1918
- techdocsMetadataValue: metadata.value,
1919
- entityMetadataValue: entityMetadata.value,
1920
- onReady
1921
- }) : children))));
1922
- };
1923
-
1924
- export { Reader as R, TechDocsReaderPage as T, TechDocsReaderLayout as a, TechDocsReaderProvider as b, TechDocsReaderPageHeader as c, TechDocsReaderPageContent as d, TechDocsReaderPageSubheader as e, TechDocsSearch as f };
1925
- //# sourceMappingURL=TechDocsReaderPage-jsKVX28r.esm.js.map