@mintlify/validation 0.1.238 → 0.1.239

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 (38) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/mint-config/schemas/v2/index.d.ts +784 -1132
  4. package/dist/mint-config/schemas/v2/properties/feedback.d.ts +14 -0
  5. package/dist/mint-config/schemas/v2/properties/feedback.js +8 -0
  6. package/dist/mint-config/schemas/v2/properties/navigation/anchors.d.ts +8 -12
  7. package/dist/mint-config/schemas/v2/properties/navigation/anchors.js +1 -1
  8. package/dist/mint-config/schemas/v2/properties/navigation/dropdown.d.ts +6 -12
  9. package/dist/mint-config/schemas/v2/properties/navigation/dropdown.js +1 -1
  10. package/dist/mint-config/schemas/v2/properties/navigation/global.d.ts +47 -96
  11. package/dist/mint-config/schemas/v2/properties/navigation/groups.d.ts +12 -10
  12. package/dist/mint-config/schemas/v2/properties/navigation/index.d.ts +97 -166
  13. package/dist/mint-config/schemas/v2/properties/navigation/index.js +1 -1
  14. package/dist/mint-config/schemas/v2/properties/navigation/languages.d.ts +17 -21
  15. package/dist/mint-config/schemas/v2/properties/navigation/languages.js +1 -1
  16. package/dist/mint-config/schemas/v2/properties/navigation/pages.d.ts +1 -0
  17. package/dist/mint-config/schemas/v2/properties/navigation/tabs.d.ts +8 -12
  18. package/dist/mint-config/schemas/v2/properties/navigation/tabs.js +1 -1
  19. package/dist/mint-config/schemas/v2/properties/navigation/version.d.ts +3 -7
  20. package/dist/mint-config/schemas/v2/properties/navigation/version.js +1 -1
  21. package/dist/mint-config/schemas/v2/properties/reusable/icon.d.ts +4 -3
  22. package/dist/mint-config/schemas/v2/properties/reusable/icon.js +1 -1
  23. package/dist/mint-config/schemas/v2/properties/seo.d.ts +1 -1
  24. package/dist/mint-config/schemas/v2/properties/seo.js +1 -0
  25. package/dist/mint-config/schemas/v2/properties/topbar.d.ts +22 -0
  26. package/dist/mint-config/schemas/v2/properties/topbar.js +1 -1
  27. package/dist/mint-config/schemas/v2/themes/mint.d.ts +196 -283
  28. package/dist/mint-config/schemas/v2/themes/prism.d.ts +196 -283
  29. package/dist/mint-config/schemas/v2/themes/quill.d.ts +196 -283
  30. package/dist/mint-config/schemas/v2/themes/reusable/index.d.ts +110 -167
  31. package/dist/mint-config/schemas/v2/themes/reusable/index.js +2 -0
  32. package/dist/mint-config/schemas/v2/themes/venus.d.ts +196 -283
  33. package/dist/mint-config/upgrades/updateNavigationToDocsConfig.d.ts +10 -0
  34. package/dist/mint-config/upgrades/updateNavigationToDocsConfig.js +240 -0
  35. package/dist/mint-config/upgrades/upgradeToDocsConfig.d.ts +6 -0
  36. package/dist/mint-config/upgrades/upgradeToDocsConfig.js +223 -0
  37. package/dist/tsconfig.build.tsbuildinfo +1 -1
  38. package/package.json +2 -2
@@ -0,0 +1,10 @@
1
+ import { ConfigType } from '@mintlify/models';
2
+ import { NavigationConfig } from '../schemas/v2/properties/navigation/index.js';
3
+ /**
4
+ * Priority
5
+ * 1. versions (including locales)
6
+ * 2. anchors (global anchors)
7
+ * 3. tabs (tabs)
8
+ * 4. groups
9
+ */
10
+ export declare const updateNavigationToDocsConfig: (config: ConfigType) => NavigationConfig;
@@ -0,0 +1,240 @@
1
+ import { omit } from 'lodash';
2
+ const DEFAULT_TAB = {
3
+ tab: 'Documentation',
4
+ };
5
+ const DEFAULT_ANCHOR = {
6
+ anchor: 'Documentation',
7
+ icon: 'book-open',
8
+ hidden: true,
9
+ };
10
+ const filterGroupsByVersion = (groups, versionName) => groups.filter((group) => group.version === versionName || group.version === undefined || !versionName);
11
+ const formatIcon = (icon, iconType) => iconType ? { name: icon, style: iconType } : icon;
12
+ const isAnchor = (division) => 'icon' in division || 'color' in division;
13
+ const isRemoteUrl = (url) => {
14
+ if (!url)
15
+ return false;
16
+ return url.startsWith('https://') || url.startsWith('http://');
17
+ };
18
+ /**
19
+ * Get global divisions from config
20
+ * 1. External links
21
+ * 2. always there
22
+ */
23
+ const getGlobalDivisions = (config) => {
24
+ const { tabs, anchors, versions } = config;
25
+ const globalConfig = {};
26
+ if ((versions === null || versions === void 0 ? void 0 : versions.length) &&
27
+ versions.every((version) => typeof version === 'object' && isRemoteUrl(version.url)))
28
+ globalConfig.versions = versions.map((version) => ({
29
+ version: version.name,
30
+ href: version.url,
31
+ }));
32
+ if ((tabs === null || tabs === void 0 ? void 0 : tabs.length) && tabs.every((tab) => !tab.version && isRemoteUrl(tab.url))) {
33
+ globalConfig.tabs = tabs.map((tab) => (Object.assign(Object.assign({ tab: tab.name, href: tab.url }, (tab.isDefaultHidden ? { hidden: tab.isDefaultHidden } : {})), (tab.openapi ? { openapi: tab.openapi } : {}))));
34
+ }
35
+ if ((anchors === null || anchors === void 0 ? void 0 : anchors.length) && anchors.every((anchor) => !anchor.version && isRemoteUrl(anchor.url))) {
36
+ globalConfig.anchors = anchors.map((anchor) => (Object.assign(Object.assign(Object.assign(Object.assign({ anchor: anchor.name, href: anchor.url }, (anchor.icon ? { icon: formatIcon(anchor.icon, anchor.iconType) } : {})), (typeof anchor.color === 'string'
37
+ ? { color: { light: anchor.color, dark: anchor.color } }
38
+ : {})), (anchor.isDefaultHidden ? { hidden: anchor.isDefaultHidden } : {})), (anchor.openapi ? { openapi: anchor.openapi } : {}))));
39
+ }
40
+ return globalConfig;
41
+ };
42
+ const findPagesForPrefix = (groups, division, versionName) => {
43
+ const matchedGroups = [];
44
+ const unmatchedGroups = [];
45
+ const prefix = division === null || division === void 0 ? void 0 : division.url;
46
+ if (isRemoteUrl(prefix)) {
47
+ return { matchedGroups, unmatchedGroups: groups };
48
+ }
49
+ groups.forEach((group) => {
50
+ const groupPages = [];
51
+ const unmatchedGroupPages = [];
52
+ const isGroupVersionMatch = group.version === versionName || group.version === undefined || !versionName;
53
+ if (isGroupVersionMatch) {
54
+ group.pages.forEach((page) => {
55
+ if (typeof page === 'string') {
56
+ if (!prefix || page.startsWith(prefix)) {
57
+ groupPages.push(page);
58
+ }
59
+ else {
60
+ unmatchedGroupPages.push(page);
61
+ }
62
+ }
63
+ else {
64
+ const { matchedGroups: nestedGroups, unmatchedGroups: nestedUnmatchedGroups } = findPagesForPrefix([page], division, versionName);
65
+ groupPages.push(...nestedGroups);
66
+ if (nestedUnmatchedGroups.length) {
67
+ unmatchedGroupPages.push(page);
68
+ }
69
+ }
70
+ });
71
+ }
72
+ if (groupPages.length) {
73
+ matchedGroups.push(Object.assign(Object.assign({ group: group.group }, (group.icon ? { icon: formatIcon(group.icon, group.iconType) } : {})), { pages: groupPages }));
74
+ }
75
+ if (unmatchedGroupPages.length) {
76
+ unmatchedGroups.push(Object.assign(Object.assign({}, group), { pages: unmatchedGroupPages }));
77
+ }
78
+ });
79
+ return { matchedGroups, unmatchedGroups };
80
+ };
81
+ const processDivisions = (type, divisions = [], navigationGroups = [], shouldInsertRemainingGroups = false, versionName, config) => {
82
+ var _a, _b;
83
+ let remainingGroups = filterGroupsByVersion(navigationGroups, versionName);
84
+ const result = divisions
85
+ .map((division) => {
86
+ if (division.version !== versionName && versionName && division.version) {
87
+ return undefined;
88
+ }
89
+ const baseDivision = Object.assign(Object.assign(Object.assign(Object.assign({}, (type === 'tabs' ? { tab: division.name } : { anchor: division.name })), { href: division.url }), (division.isDefaultHidden ? { hidden: division.isDefaultHidden } : {})), (division.openapi ? { openapi: division.openapi } : {}));
90
+ if (isAnchor(division)) {
91
+ if (division.icon) {
92
+ baseDivision.icon = formatIcon(division.icon, division.iconType);
93
+ }
94
+ if (division.color) {
95
+ baseDivision.color = division.color;
96
+ }
97
+ }
98
+ const { matchedGroups, unmatchedGroups } = findPagesForPrefix(remainingGroups, division, versionName);
99
+ remainingGroups = unmatchedGroups;
100
+ if (matchedGroups.length) {
101
+ return Object.assign(Object.assign({}, omit(baseDivision, 'href')), { groups: matchedGroups });
102
+ }
103
+ return baseDivision;
104
+ })
105
+ .filter(Boolean);
106
+ if (remainingGroups.length && shouldInsertRemainingGroups) {
107
+ const { matchedGroups } = findPagesForPrefix(remainingGroups, undefined, versionName);
108
+ if (type === 'tabs') {
109
+ result.unshift(Object.assign(Object.assign({}, (((_a = config === null || config === void 0 ? void 0 : config.primaryTab) === null || _a === void 0 ? void 0 : _a.name)
110
+ ? { tab: config.primaryTab.name, hidden: config.primaryTab.isDefaultHidden }
111
+ : DEFAULT_TAB)), { groups: matchedGroups }));
112
+ }
113
+ else {
114
+ result.push(Object.assign(Object.assign({}, (((_b = config === null || config === void 0 ? void 0 : config.topAnchor) === null || _b === void 0 ? void 0 : _b.name) ? { anchor: config.topAnchor.name } : DEFAULT_ANCHOR)), { groups: matchedGroups }));
115
+ }
116
+ }
117
+ if (type === 'tabs') {
118
+ return { tabs: result, anchors: [], remainingGroups };
119
+ }
120
+ return { anchors: result, tabs: [], remainingGroups };
121
+ };
122
+ const findPagesForVersionOrLanguage = (groups, version, prefixes) => {
123
+ const matchedGroups = [];
124
+ groups.forEach((group) => {
125
+ const groupPages = [];
126
+ if (group.version === version || group.version === undefined) {
127
+ group.pages.forEach((page) => {
128
+ if (typeof page === 'string') {
129
+ const isGatedByDivision = Object.entries(prefixes).some(([href, versions]) => versions.includes(version) && page.startsWith(href));
130
+ if (isGatedByDivision || Object.keys(prefixes).some((href) => !page.startsWith(href))) {
131
+ groupPages.push(page);
132
+ }
133
+ }
134
+ else {
135
+ const { matchedGroups: nestedGroups } = findPagesForVersionOrLanguage([page], version, prefixes);
136
+ groupPages.push(...nestedGroups);
137
+ }
138
+ });
139
+ }
140
+ if (groupPages.length) {
141
+ matchedGroups.push(Object.assign(Object.assign({ group: group.group }, (group.icon ? { icon: formatIcon(group.icon, group.iconType) } : {})), { pages: groupPages }));
142
+ }
143
+ });
144
+ return { matchedGroups };
145
+ };
146
+ const processVersionsOrLanguages = (versions = [], navigationGroups = [], prefixes) => {
147
+ const isLocale = versions.every((version) => typeof version === 'object' && version.locale);
148
+ const result = versions.map((version) => {
149
+ if (isLocale && typeof version === 'object' && version.locale) {
150
+ const baseLanguage = {
151
+ language: version.locale,
152
+ };
153
+ const { matchedGroups } = findPagesForVersionOrLanguage(navigationGroups, version.name, prefixes);
154
+ return Object.assign(Object.assign({}, baseLanguage), { groups: matchedGroups });
155
+ }
156
+ else {
157
+ const versionName = typeof version === 'string' ? version : version.name;
158
+ const baseVersion = {
159
+ version: versionName,
160
+ };
161
+ const { matchedGroups } = findPagesForVersionOrLanguage(navigationGroups, versionName, prefixes);
162
+ return Object.assign(Object.assign({}, baseVersion), { groups: matchedGroups });
163
+ }
164
+ });
165
+ return {
166
+ isLocale,
167
+ versions: result,
168
+ };
169
+ };
170
+ /**
171
+ * Priority
172
+ * 1. versions (including locales)
173
+ * 2. anchors (global anchors)
174
+ * 3. tabs (tabs)
175
+ * 4. groups
176
+ */
177
+ export const updateNavigationToDocsConfig = (config) => {
178
+ const { navigation: groups, tabs, anchors, versions } = config;
179
+ const { tabs: globalTabs, anchors: globalAnchors, versions: globalVersions, } = getGlobalDivisions(config);
180
+ // process divisions
181
+ const getUpdatedNavigation = (groups, tabs, anchors, versionName, config) => {
182
+ var _a, _b;
183
+ if ((anchors === null || anchors === void 0 ? void 0 : anchors.length) && !(globalAnchors === null || globalAnchors === void 0 ? void 0 : globalAnchors.length)) {
184
+ const { anchors: anchorsResult, remainingGroups } = processDivisions('anchors', anchors, groups, false, versionName, config);
185
+ if (remainingGroups.length) {
186
+ if ((tabs === null || tabs === void 0 ? void 0 : tabs.length) && !(globalTabs === null || globalTabs === void 0 ? void 0 : globalTabs.length)) {
187
+ const { tabs: tabsResult } = processDivisions('tabs', tabs, remainingGroups, true, versionName, config);
188
+ anchorsResult.push(Object.assign(Object.assign({}, (((_a = config === null || config === void 0 ? void 0 : config.topAnchor) === null || _a === void 0 ? void 0 : _a.name) ? { anchor: config.topAnchor.name } : DEFAULT_ANCHOR)), { tabs: tabsResult }));
189
+ }
190
+ else {
191
+ const { matchedGroups } = findPagesForPrefix(remainingGroups, undefined, versionName);
192
+ anchorsResult.push(Object.assign(Object.assign({}, (((_b = config === null || config === void 0 ? void 0 : config.topAnchor) === null || _b === void 0 ? void 0 : _b.name) ? { anchor: config.topAnchor.name } : DEFAULT_ANCHOR)), { groups: matchedGroups }));
193
+ }
194
+ }
195
+ return { anchors: anchorsResult };
196
+ }
197
+ if ((tabs === null || tabs === void 0 ? void 0 : tabs.length) && !(globalTabs === null || globalTabs === void 0 ? void 0 : globalTabs.length)) {
198
+ const { tabs: tabsResult } = processDivisions('tabs', tabs, groups, true, versionName, config);
199
+ return { tabs: tabsResult };
200
+ }
201
+ if (groups.length) {
202
+ const parsedGroups = filterGroupsByVersion(groups, versionName).map((group) => (Object.assign({ group: group.group, pages: group.pages }, (group.icon ? { icon: formatIcon(group.icon, group.iconType) } : {}))));
203
+ return { groups: parsedGroups };
204
+ }
205
+ return undefined;
206
+ };
207
+ if ((versions === null || versions === void 0 ? void 0 : versions.length) && !(globalVersions === null || globalVersions === void 0 ? void 0 : globalVersions.length)) {
208
+ const prefixes = versions.reduce((acc, version) => {
209
+ const versionName = typeof version === 'string' ? version : version.name;
210
+ const anchorPrefixes = anchors === null || anchors === void 0 ? void 0 : anchors.filter((anchor) => anchor.version === versionName && !isRemoteUrl(anchor.url));
211
+ const tabPrefixes = tabs === null || tabs === void 0 ? void 0 : tabs.filter((tab) => tab.version === versionName && !isRemoteUrl(tab.url));
212
+ anchorPrefixes === null || anchorPrefixes === void 0 ? void 0 : anchorPrefixes.forEach((anchor) => (acc[anchor.url] = [...(acc[anchor.url] || []), versionName]));
213
+ tabPrefixes === null || tabPrefixes === void 0 ? void 0 : tabPrefixes.forEach((tab) => (acc[tab.url] = [...(acc[tab.url] || []), versionName]));
214
+ return acc;
215
+ }, {});
216
+ const { versions: versionsResult, isLocale } = processVersionsOrLanguages(versions, groups, prefixes);
217
+ versionsResult.forEach((version, index) => {
218
+ var _a;
219
+ const versionName = typeof versions[index] === 'string'
220
+ ? version.version
221
+ : ((_a = versions[index]) === null || _a === void 0 ? void 0 : _a.name) || version.language;
222
+ const updatedNavigationPerVersion = getUpdatedNavigation(version.groups, tabs, anchors, versionName, config);
223
+ if (updatedNavigationPerVersion) {
224
+ versionsResult[index] = Object.assign(Object.assign({}, omit(version, 'groups')), updatedNavigationPerVersion);
225
+ }
226
+ });
227
+ const navigationConfig = (isLocale ? { languages: versionsResult } : { versions: versionsResult });
228
+ if ((globalTabs === null || globalTabs === void 0 ? void 0 : globalTabs.length) || (globalAnchors === null || globalAnchors === void 0 ? void 0 : globalAnchors.length)) {
229
+ navigationConfig.global = Object.assign(Object.assign({}, ((globalTabs === null || globalTabs === void 0 ? void 0 : globalTabs.length) ? { tabs: globalTabs } : {})), ((globalAnchors === null || globalAnchors === void 0 ? void 0 : globalAnchors.length) ? { anchors: globalAnchors } : {}));
230
+ }
231
+ return navigationConfig;
232
+ }
233
+ const navigationConfig = (getUpdatedNavigation(groups, tabs, anchors, undefined, config) || {
234
+ groups: [],
235
+ });
236
+ if ((globalTabs === null || globalTabs === void 0 ? void 0 : globalTabs.length) || (globalAnchors === null || globalAnchors === void 0 ? void 0 : globalAnchors.length)) {
237
+ navigationConfig.global = Object.assign(Object.assign({}, ((globalTabs === null || globalTabs === void 0 ? void 0 : globalTabs.length) ? { tabs: globalTabs } : {})), ((globalAnchors === null || globalAnchors === void 0 ? void 0 : globalAnchors.length) ? { anchors: globalAnchors } : {}));
238
+ }
239
+ return navigationConfig;
240
+ };
@@ -0,0 +1,6 @@
1
+ import { ConfigType } from '@mintlify/models';
2
+ import { z } from 'zod';
3
+ import { docsConfigSchema } from '../schemas/v2/index.js';
4
+ type ConfigV2Type = z.infer<typeof docsConfigSchema>;
5
+ export declare function upgradeToDocsConfig(config: ConfigType): ConfigV2Type;
6
+ export {};
@@ -0,0 +1,223 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { capitalize } from 'lodash';
13
+ import { updateNavigationToDocsConfig } from './updateNavigationToDocsConfig.js';
14
+ function updateRounded(config) {
15
+ return config.rounded === 'sharp' ? 'sharp' : 'regular';
16
+ }
17
+ function updateEyebrows(config) {
18
+ var _a;
19
+ return ((_a = config.eyebrow) === null || _a === void 0 ? void 0 : _a.display) === 'section' ? 'section' : 'breadcrumbs';
20
+ }
21
+ function updateCodeblocks(config) {
22
+ var _a;
23
+ return ((_a = config.codeBlock) === null || _a === void 0 ? void 0 : _a.mode) === 'dark' ? 'dark' : 'auto';
24
+ }
25
+ function updateApiPlayground(config) {
26
+ var _a, _b, _c, _d;
27
+ const oldMode = (_b = (_a = config.api) === null || _a === void 0 ? void 0 : _a.playground) === null || _b === void 0 ? void 0 : _b.mode;
28
+ const disableProxy = (_d = (_c = config.api) === null || _c === void 0 ? void 0 : _c.playground) === null || _d === void 0 ? void 0 : _d.disableProxy;
29
+ if (!oldMode && disableProxy === undefined)
30
+ return undefined;
31
+ const display = (() => {
32
+ switch (oldMode) {
33
+ case 'show':
34
+ return 'interactive';
35
+ case 'hide':
36
+ case undefined:
37
+ return 'none';
38
+ default:
39
+ return oldMode;
40
+ }
41
+ })();
42
+ const proxy = disableProxy !== undefined ? !disableProxy : undefined;
43
+ return { display, proxy };
44
+ }
45
+ function updateTopbarPrimary(config) {
46
+ const ctaButton = config.topbarCtaButton;
47
+ if ((ctaButton === null || ctaButton === void 0 ? void 0 : ctaButton.type) === undefined || ctaButton.type === 'link') {
48
+ return {
49
+ type: 'button',
50
+ label: ctaButton === null || ctaButton === void 0 ? void 0 : ctaButton.name,
51
+ href: ctaButton === null || ctaButton === void 0 ? void 0 : ctaButton.url,
52
+ };
53
+ }
54
+ return {
55
+ type: 'github',
56
+ href: ctaButton.url,
57
+ };
58
+ }
59
+ function updateFont(config) {
60
+ const font = config.font;
61
+ if (!font)
62
+ return undefined;
63
+ if ('family' in font) {
64
+ return transformFontDetails(font);
65
+ }
66
+ function transformFontDetails(details) {
67
+ const { url } = details, rest = __rest(details, ["url"]);
68
+ return Object.assign(Object.assign({}, rest), (url ? { source: url } : {}));
69
+ }
70
+ if ('headings' in font) {
71
+ font.headings = transformFontDetails(font.headings);
72
+ }
73
+ if ('body' in font) {
74
+ font.body = transformFontDetails(font.body);
75
+ }
76
+ return font;
77
+ }
78
+ function updateFooterSocials(config) {
79
+ var _a, _b, _c;
80
+ if (!((_a = config.footer) === null || _a === void 0 ? void 0 : _a.socials) && !config.footerSocials)
81
+ return undefined;
82
+ const footerSocials = (_c = (_b = config.footer) === null || _b === void 0 ? void 0 : _b.socials) !== null && _c !== void 0 ? _c : config.footerSocials;
83
+ if (Array.isArray(footerSocials)) {
84
+ return footerSocials.reduce((acc, social) => {
85
+ acc[social.type] = social.url;
86
+ return acc;
87
+ }, {});
88
+ }
89
+ return footerSocials;
90
+ }
91
+ export function upgradeToDocsConfig(config) {
92
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
93
+ const fonts = updateFont(config);
94
+ const playground = updateApiPlayground(config);
95
+ const rounded = updateRounded(config);
96
+ const eyebrows = updateEyebrows(config);
97
+ const codeblocks = updateCodeblocks(config);
98
+ const v2Config = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ $schema: 'https://mintlify.com/docs.json', theme: 'mint', name: config.name, colors: {
99
+ primary: config.colors.primary,
100
+ light: config.colors.light,
101
+ dark: config.colors.dark,
102
+ }, favicon: config.favicon, navigation: updateNavigationToDocsConfig(config) }, (config.openapi ? { openapi: config.openapi } : {})), (config.rounded || config.eyebrow || config.codeBlock
103
+ ? {
104
+ styling: {
105
+ rounded,
106
+ eyebrows,
107
+ codeblocks,
108
+ },
109
+ }
110
+ : {})), { logo: config.logo }), (playground || ((_c = (_b = (_a = config.api) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.example) === null || _c === void 0 ? void 0 : _c.languages)
111
+ ? {
112
+ api: Object.assign(Object.assign({}, (playground
113
+ ? Object.assign({ display: playground.display }, (playground.proxy !== undefined ? { proxy: playground.proxy } : {})) : {})), (((_f = (_e = (_d = config.api) === null || _d === void 0 ? void 0 : _d.request) === null || _e === void 0 ? void 0 : _e.example) === null || _f === void 0 ? void 0 : _f.languages)
114
+ ? {
115
+ examples: {
116
+ languages: config.api.request.example.languages,
117
+ },
118
+ }
119
+ : {})),
120
+ }
121
+ : {})), (config.modeToggle
122
+ ? {
123
+ appearance: {
124
+ default: (_g = config.modeToggle.default) !== null && _g !== void 0 ? _g : 'system',
125
+ strict: (_h = config.modeToggle.isHidden) !== null && _h !== void 0 ? _h : false,
126
+ },
127
+ }
128
+ : {})), (config.background || config.backgroundImage
129
+ ? {
130
+ background: Object.assign(Object.assign(Object.assign({}, (config.backgroundImage ? { image: config.backgroundImage } : {})), { decoration: (_k = (_j = config.background) === null || _j === void 0 ? void 0 : _j.style) !== null && _k !== void 0 ? _k : 'none' }), (config.colors.background
131
+ ? {
132
+ color: {
133
+ light: (_l = config.colors.background.light) !== null && _l !== void 0 ? _l : '',
134
+ dark: (_m = config.colors.background.dark) !== null && _m !== void 0 ? _m : '',
135
+ },
136
+ }
137
+ : {})),
138
+ }
139
+ : {})), { topbar: {
140
+ links: (_o = config.topbarLinks) === null || _o === void 0 ? void 0 : _o.map((item) => {
141
+ if (item.type === 'link' || item.type === undefined) {
142
+ return {
143
+ label: item.name,
144
+ href: item.url,
145
+ };
146
+ }
147
+ else {
148
+ return {
149
+ label: capitalize(item.type),
150
+ href: item.url,
151
+ };
152
+ }
153
+ }),
154
+ primary: updateTopbarPrimary(config),
155
+ } }), (config.feedback
156
+ ? {
157
+ feedback: Object.assign(Object.assign(Object.assign({}, (config.feedback.thumbsRating !== undefined
158
+ ? {
159
+ thumbs: config.feedback.thumbsRating,
160
+ }
161
+ : {})), (config.feedback.suggestEdit !== undefined
162
+ ? {
163
+ edits: config.feedback.suggestEdit,
164
+ }
165
+ : {})), (config.feedback.raiseIssue !== undefined
166
+ ? {
167
+ issues: config.feedback.raiseIssue,
168
+ }
169
+ : {})),
170
+ }
171
+ : {})), (config.search
172
+ ? {
173
+ search: config.search,
174
+ }
175
+ : {})), (config.metadata || ((_p = config.seo) === null || _p === void 0 ? void 0 : _p.indexHiddenPages) !== undefined
176
+ ? {
177
+ seo: Object.assign(Object.assign({}, (config.metadata ? { metatags: config.metadata } : {})), { indexing: ((_q = config.seo) === null || _q === void 0 ? void 0 : _q.indexHiddenPages) ? 'navigable' : 'all' }),
178
+ }
179
+ : {})), (config.footer || config.footerSocials
180
+ ? {
181
+ footer: Object.assign(Object.assign({}, (((_r = config.footer) === null || _r === void 0 ? void 0 : _r.socials) || config.footerSocials
182
+ ? { socials: updateFooterSocials(config) }
183
+ : {})), (((_s = config.footer) === null || _s === void 0 ? void 0 : _s.links)
184
+ ? {
185
+ links: config.footer.links.map((group) => {
186
+ return {
187
+ header: group.title,
188
+ items: group.links.map((link) => {
189
+ return {
190
+ label: link.label,
191
+ href: link.url,
192
+ };
193
+ }),
194
+ };
195
+ }),
196
+ }
197
+ : {})),
198
+ }
199
+ : {})), (config.integrations || config.analytics
200
+ ? {
201
+ integrations: Object.assign(Object.assign(Object.assign(Object.assign({}, config.analytics), (((_t = config.integrations) === null || _t === void 0 ? void 0 : _t.intercom)
202
+ ? {
203
+ intercom: {
204
+ appId: config.integrations.intercom,
205
+ },
206
+ }
207
+ : {})), (((_u = config.integrations) === null || _u === void 0 ? void 0 : _u.frontchat)
208
+ ? {
209
+ frontchat: {
210
+ snippetId: config.integrations.frontchat,
211
+ },
212
+ }
213
+ : {})), (((_v = config.integrations) === null || _v === void 0 ? void 0 : _v.osano)
214
+ ? {
215
+ osano: {
216
+ scriptSource: config.integrations.osano,
217
+ },
218
+ }
219
+ : {})),
220
+ }
221
+ : {})), (fonts ? fonts : {}));
222
+ return v2Config;
223
+ }