@qualcomm-ui/mdx-vite 3.8.1 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +9 -9
- package/dist/cli.js.map +1 -1
- package/dist/docs-plugin/generate-page-map.d.ts.map +1 -1
- package/dist/index.js +28 -28
- package/dist/index.js.map +1 -1
- package/dist/search-indexer-DOffnbB9.js +14 -0
- package/dist/{search-indexer-D3Y9DkgK.js.map → search-indexer-DOffnbB9.js.map} +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/search-indexer-D3Y9DkgK.js +0 -14
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{execSync as e}from"node:child_process";import{dirname as t,join as n,posix as r,resolve as i}from"node:path";import{readFileSync as a}from"node:fs";import{access as o}from"node:fs/promises";import{cosmiconfigSync as s}from"cosmiconfig";import{z as c}from"zod";import l from"chalk";import{defined as u}from"@qualcomm-ui/utils/guard";import d from"remark-mdx";import f from"remark-parse";import p from"remark-stringify";import{unified as m}from"unified";import{EXIT as ee,SKIP as te,visit as h}from"unist-util-visit";import{UniqueIdService as ne,isNavBadge as re}from"@qualcomm-ui/mdx-common";import{createHash as g}from"node:crypto";import _ from"remark-frontmatter";import ie from"remark-parse-frontmatter";import v from"remark-gfm";import{remove as y}from"unist-util-remove";import{toString as ae}from"mdast-util-to-string";import b from"typescript";import{sortBy as oe}from"lodash-es";import{v4 as x}from"uuid";import{capitalCase as S}from"@qualcomm-ui/utils/change-case";function C(e){return e.replaceAll(`\\`,`/`)}function se(e){return e.endsWith(`/`)?e.substring(0,e.length-1):e}function w(){return{with:e=>c.object(e)}}var T=w().with({id:c.never().optional(),sectionTitle:c.string().optional(),separator:c.boolean().optional()}),E=w().with({children:c.array(c.lazy(()=>E)).optional(),expanded:c.boolean().optional(),group:c.string().optional(),groupOrder:c.string().array().optional(),hidden:c.boolean().optional(),hideBreadcrumbs:c.boolean().optional(),hideFromSearch:c.boolean().optional(),hidePageLinks:c.boolean().optional(),hideSideNav:c.boolean().optional(),hideToc:c.boolean().optional(),id:c.string(),ignoreRouteMetaOrder:c.boolean().optional(),restricted:c.boolean().optional(),sectionTitle:c.never().optional(),separator:c.never().optional(),sideNavTitle:c.string().optional(),title:c.string().optional()}),ce=w().with({includeInSearchIndex:c.boolean().optional()}),le=w().with({contents:c.string(),id:c.string(),processAsMdx:c.boolean().optional(),title:c.string().optional()}),ue=c.object({exclude:c.array(c.string()).optional(),include:c.array(c.string()).optional()}).optional(),de=w().with({outputPath:c.string().optional()}),fe=w().with({depths:c.array(c.number()).optional(),minContentLength:c.number().optional(),outputPath:c.string().optional()}),pe=w().with({envFile:c.string().optional(),id:c.string()}),me=w().with({baseUrl:c.string().optional(),exclude:c.array(c.string()).optional(),extraFiles:c.array(le).optional(),frontmatter:ue,integrations:c.object({openWebUi:c.array(pe).optional()}).optional(),outputPath:c.string().optional(),pageIdPrefix:c.string().optional(),pages:de.optional(),sections:fe.optional()}),D=w().with({appDirectory:c.string().optional(),disableCache:c.boolean().optional(),headings:c.array(c.union([c.literal(`h1`),c.literal(`h2`),c.literal(`h3`),c.literal(`h4`),c.literal(`h5`),c.literal(`h6`)])).optional(),hotUpdateIgnore:c.instanceof(RegExp).optional(),knowledge:me.optional(),navConfig:c.array(c.union([E,T])).optional(),pageDirectory:c.string().optional(),pageTimestampMetadata:c.union([c.literal(`off`),c.literal(`timestamp`),c.literal(`user-and-timestamp`)]).optional(),routingStrategy:c.union([c.literal(`vite-generouted`),c.literal(`react-router-directory-groups`),c.any()]).optional(),throwOnError:c.boolean().optional(),typeDocProps:c.string().optional(),typeDocPropsOptions:ce.optional(),validatePageLinks:c.boolean().optional()}),he=class{constructor(e){return this.options=e,this}getCosmiconfig(){let e=s(`qui-docs`),t=this.options.configFile?e.load(this.options.configFile):e.search();if(!t)throw Error(`Config file not found. Please consult the docs at https://docs.qui.qualcomm.com/guide/page-setup#config`);return t}resolveConfigFromCosmiconfig(e){let t=D.safeParse(e.config);if(!t.success)throw console.dir(t.error.issues,{depth:10}),Error(`Failed to parse config file.`);let n=t.data;return{...n,appDirectory:n.appDirectory||`app`,filePath:e.filepath,pageDirectory:n.pageDirectory?se(n.pageDirectory):`routes`,validatePageLinks:n.validatePageLinks??!0}}loadConfig(){let e=this.getCosmiconfig();return this.resolveConfigFromCosmiconfig(e)}};function O(e){let t=e.replace(/[<>]/g,``).replace(/[^\w\s-]/g,``).trim();return t.includes(` `)?t.toLowerCase().replace(/\s+/g,`-`).replace(/^-+|-+$/g,``):(t.match(/[A-Z]/g)||[]).length>=2?t.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1-$2`).toLowerCase():t.toLowerCase()}var k=class{constructor(){this.seenIds=new Map}reset(){this.seenIds.clear()}createSlug(e){let t=O(e),n=this.seenIds.get(t)||0;return this.seenIds.set(t,n+1),n>0?`${t}-${n}`:t}},ge=w().with({categories:c.string().array().optional(),description:c.string().optional(),group:c.string().optional(),hidden:c.boolean().optional(),hideBreadcrumbs:c.boolean().optional(),hideFromSearch:c.boolean().optional(),hidePageLinks:c.boolean().optional(),hideSideNav:c.boolean().optional(),hideToc:c.boolean().optional(),id:c.string().optional(),restricted:c.boolean().optional(),sideNavTitle:c.string().optional(),title:c.string(),updatedBy:c.string().optional(),updatedOn:c.string().optional()});function _e(t,n){let r=new Map;if(n===`off`)return r;try{let a=e(`git rev-parse --show-toplevel`,{encoding:`utf-8`}).trim(),o=e(`git log --format="COMMIT%x09${n===`user-and-timestamp`?`%cI%x09%aN`:`%cI`}" --name-only -- "${t}/**/*.mdx"`,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`]}),s={};for(let e of o.split(`
|
|
2
|
+
`))if(e.startsWith(`COMMIT `)){let t=e.split(` `);s=n===`user-and-timestamp`?{updatedBy:t[2],updatedOn:t[1]}:{updatedOn:t[1]}}else if(e.trim()){let t=i(a,e.trim());r.has(t)||r.set(t,s)}}catch{}return r}var A=class{constructor(e,t=`off`){this.enabled=e,this.pageTimestampMetadata=t,this.cachedFileCount=0,this.gitMetadataMap=new Map,this.logWarnings=!0,this.mdxCache={}}hash(e){return g(`md5`).update(e).digest(`hex`)}reset(){this.cachedFileCount=0}readCache(e){return this.mdxCache[e]||null}checkCache(e,t){if(!this.enabled)return;let n=this.hash(t),r=this.mdxCache[e];if(r?.md5===n)return this.cachedFileCount++,{collectedLinks:r.collectedLinks,frontmatter:r.frontmatter,page:r.page,pageDocProps:r.pageDocProps,pageDocPropSections:r.pageDocPropSections}}parseFrontmatter(e,t,n){let r;if(n)r={data:{frontmatter:n}};else{let e=t.substring(0,t.indexOf(`
|
|
3
|
+
---`)+4);r=m().use(f).use(_,[`yaml`]).use(ie).use(p).processSync(e)}let i=r.data.frontmatter??{title:``};if(!i.title){let e=t.split(`
|
|
4
|
+
`).find(e=>e.startsWith(`# `));e&&(i.title=e.substring(2).trim())}!i.title&&this.logWarnings&&console.debug(l.red.bold(`Missing title:`),e);let a=ge.safeParse(i);return a.success||(console.debug(`${l.redBright.bold(`Invalid frontmatter detected for file`)}: ${e}\n`),console.debug(l.redBright.bold(`Please check the following fields:`)),a.error.issues.map(e=>{console.debug(`- ${e.path.join(`.`)}`)})),i}enrichWithGitMetadata(e,t,n){let r=this.mdxCache[e];if(!this.enabled||!r){let n=this.gitMetadataMap.get(e)??{};!t.updatedOn&&n.updatedOn&&(t.updatedOn=n.updatedOn),!t.updatedBy&&n.updatedBy&&(t.updatedBy=n.updatedBy)}else !n&&r&&(!t.updatedOn&&r.frontmatter.updatedOn&&(t.updatedOn=r.frontmatter.updatedOn),!t.updatedBy&&r.frontmatter.updatedBy&&(t.updatedBy=r.frontmatter.updatedBy))}readFileSync(e){let t=a(e,`utf-8`),n=this.checkCache(e,t),r=this.parseFrontmatter(e,t,n?.frontmatter);return this.enrichWithGitMetadata(e,r,n),{cached:n,fileContents:t,frontmatter:r}}updateCache(e,t,n){this.enabled&&(this.mdxCache[e]={...n,md5:this.hash(t)})}};function j(e){if(!e.value)return[];if(typeof e.value==`string`)return[e.value];if(e.value.type===`mdxJsxAttributeValueExpression`){let t=e.value.data?.estree;if(!t?.body?.[0]||t.body[0].type!==`ExpressionStatement`)return[];let n=t.body[0].expression;if(n.type===`ArrayExpression`){let e=[];for(let t of n.elements)t?.type===`Literal`&&typeof t.value==`string`&&e.push(t.value);return e}if(n.type===`Literal`&&typeof n.value==`string`)return[n.value]}return[]}var ve=/^\[!(NOTE|TIP|SUCCESS|WARNING|CAUTION)(\/.*)?\]/i,M=()=>e=>{h(e,`blockquote`,e=>{let t=``,n=``,r=!0,i=e.children.map(e=>{if(r&&e.type===`paragraph`){let i=e.children[0],a=i.type===`text`?i.value:``,o=ve,s=a.match(o);if(s&&(r=!1,t=s[1].toLocaleLowerCase(),n=s[2]||t.toLocaleUpperCase(),a.includes(`
|
|
5
|
+
`)&&(e.children[0]={type:`text`,value:a.replace(o,``).replace(/^\n+/,``)}),!a.includes(`
|
|
6
|
+
`))){let t=[];e.children.forEach((e,n)=>{n!==0&&(n===1&&e.type===`break`||t.push(e))}),e.children=[...t]}}return e});n=n.replace(/^\//,``),t&&(e.data={hName:`div`,hProperties:{class:`qui-notification__root`,"data-emphasis":be[t]||`neutral`,"data-orientation":`vertical`,dir:`auto`}},e.children=[{children:[N(t)],data:{hProperties:{class:`qui-notification__icon`,"data-inline-notification-part":`status-icon`}},type:`paragraph`},{children:[{type:`text`,value:n}],data:{hProperties:{class:`qui-notification__label`,dir:`auto`}},type:`paragraph`},{children:i,data:{hName:`div`,hProperties:{class:`qui-notification__description`,dir:`auto`}},type:`blockquote`}])})};function N(e){return{children:ye[e]??[],data:{hName:`svg`,hProperties:{ariaHidden:`true`,class:`lucide`,fill:`transparent`,height:`20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,width:`20`}},type:`emphasis`}}var ye={caution:[{children:[],data:{hName:`polygon`,hProperties:{points:`7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2`}},type:`emphasis`},{children:[],data:{hName:`line`,hProperties:{x1:`12`,x2:`12`,y1:`8`,y2:`12`}},type:`emphasis`},{children:[],data:{hName:`line`,hProperties:{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`}},type:`emphasis`}],note:[{children:[],data:{hName:`circle`,hProperties:{cx:`12`,cy:`12`,r:`10`}},type:`emphasis`},{children:[],data:{hName:`path`,hProperties:{d:`M12 16v-4`}},type:`emphasis`},{children:[],data:{hName:`path`,hProperties:{d:`M12 8h.01`}},type:`emphasis`}],success:[{children:[],data:{hName:`path`,hProperties:{d:`M20 6 9 17l-5-5`}},type:`emphasis`}],tip:[{children:[],data:{hName:`path`,hProperties:{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`}},type:`emphasis`},{children:[],data:{hName:`path`,hProperties:{d:`M9 18h6`}},type:`emphasis`},{children:[],data:{hName:`path`,hProperties:{d:`M10 22h4`}},type:`emphasis`}],warning:[{children:[],data:{hName:`path`,hProperties:{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`}},type:`emphasis`},{children:[],data:{hName:`path`,hProperties:{d:`M12 9v4`}},type:`emphasis`},{children:[],data:{hName:`path`,hProperties:{d:`M12 17h.01`}},type:`emphasis`}]},be={caution:`danger`,note:`neutral`,success:`success`,tip:`info`,warning:`warning`};function P(e){if(!e)return{label:null,remainingMeta:``,tabsGroup:null};let t=e.match(/tabs=["']([^"']+)["']|tabs=(\S+)/),n=e.match(/label=["']([^"']+)["']|label=(\S+)/),r=t?t[1]||t[2]:null;return{label:n?n[1]||n[2]:null,remainingMeta:e.replace(/\s*tabs=["']([^"']+)["']/g,``).replace(/\s*tabs=(\S+)/g,``).replace(/\s*label=["']([^"']+)["']/g,``).replace(/\s*label=(\S+)/g,``).trim(),tabsGroup:r}}function xe(e,t,n){let r=[],i=e;for(;i<t.children.length;){let e=t.children[i];if(!e||e.type!==`code`)break;let a=e;if(!a.meta)break;let{label:o,remainingMeta:s,tabsGroup:c}=P(a.meta);if(!c||!o||c!==n||(a.meta=s||void 0,r.push({index:i,label:o,meta:s||void 0,tabsGroup:c}),s&&s.includes(`end`)))break;i++}return r}function Se(e,t){let n={attributes:[],children:[],name:`CodeTabs`,type:`mdxJsxFlowElement`};return e.forEach(e=>{let r=t.children[e.index],i=[{name:`label`,type:`mdxJsxAttribute`,value:e.label}];e.meta&&i.push({name:`meta`,type:`mdxJsxAttribute`,value:e.meta});let a={attributes:i,children:[{lang:r.lang,meta:r.meta,type:`code`,value:r.value}],name:`CodeTab`,type:`mdxJsxFlowElement`};n.children.push(a)}),[n]}var Ce=()=>e=>{let t=[];h(e,`code`,(e,n,r)=>{if(!e.meta||!r||n===void 0)return;let{label:i,tabsGroup:a}=P(e.meta);if(!a||!i||t.some(e=>e.parent===r&&n>=e.startIndex&&n<e.endIndex))return;let o=xe(n,r,a);if(o.length>1){let e=o[0].index,n=o[o.length-1].index+1,i=Se(o,r);t.push({endIndex:n,parent:r,replacement:i,startIndex:e})}}),t.sort((e,t)=>t.startIndex-e.startIndex).forEach(e=>{e.parent.children.splice(e.startIndex,e.endIndex-e.startIndex,...e.replacement)})};function we(e){let t=e.trim();return t.startsWith(`[`)&&t.endsWith(`]`)?t.slice(1,-1).split(`,`).map(e=>e.trim()).filter(Boolean):t}function F(e){let t={},n=e.split(`
|
|
7
|
+
`);for(let e of n){let n=e.trim();if(!n||n===`:::`)continue;let r=n.indexOf(`:`);if(r===-1)continue;let i=n.slice(0,r).trim(),a=n.slice(r+1).trim();i&&a&&(t[i]=we(a))}return t}function I(e){return e.split(`
|
|
8
|
+
`).map(e=>e.trim()).filter(e=>e&&e!==`:::`)}var L=(e={})=>t=>{let n=[];h(t,`paragraph`,(t,r,i)=>{if(!i||r===void 0)return;let a=t.children[0];if(a?.type!==`text`)return;let o=a.value,s=o.match(/^:::\s*meta\s*/),c=o.match(/^:::\s*terms\s*/);if(!s&&!c)return;let l=s||c,u=!!c;if(o.includes(`:::`)&&o.lastIndexOf(`:::`)>l[0].length){let t=o.slice(l[0].length),a=t.lastIndexOf(`:::`),s=t.slice(0,a);if(u){let t=I(s);if(t.length>0){let n=e.terms;e.terms=Array.isArray(n)?[...n,...t]:t}}else{let t=F(s);Object.assign(e,t)}return n.push({index:r,parent:i}),te}let d=o;for(let e=1;e<t.children.length;e++){let n=t.children[e];n.type===`text`&&(d+=n.value)}let f=d.slice(l[0].length),p=f.lastIndexOf(`:::`);if(p!==-1){let t=f.slice(0,p);if(u){let n=I(t);if(n.length>0){let t=e.terms;e.terms=Array.isArray(t)?[...t,...n]:n}}else{let n=F(t);Object.assign(e,n)}return n.push({index:r,parent:i}),te}});for(let e=n.length-1;e>=0;e--){let{index:t,parent:r}=n[e];r.children.splice(t,1)}},Te=()=>e=>{h(e,`mdxFlowExpression`,(e,t,n)=>{if(e.value.trim()!==`frontmatter.description`||t===void 0||!n)return;let r={attributes:[{name:`className`,type:`mdxJsxAttribute`,value:`mdx qui-docs__page-description`}],children:[e],name:`p`,type:`mdxJsxFlowElement`};n.children[t]=r})},Ee=/^\s*frontmatter\.(\w+)\s*$/;function De(e){let t=e;return(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)&&typeof t.value==`string`}var R=e=>t=>{h(t,(t,n,r)=>{if(!De(t)||n===void 0||!r)return;let i=t.value.match(Ee);if(!i)return;let a=e[i[1]];if(typeof a==`string`||typeof a==`number`){let e={type:`text`,value:String(a)};r.children[n]=e}})},Oe=()=>e=>{h(e,`heading`,(e,t,n)=>{if(t===void 0||!n||e.depth!==1)return;let r={attributes:[],children:e.children,name:`PageHeader`,type:`mdxJsxFlowElement`};return n.children[t]=r,ee})},z=()=>(e,t,n)=>{y(e,e=>e.type===`code`&&e.lang===`mermaid`),n()},B=()=>(e,t,n)=>{y(e,`mdxjsEsm`),y(e,`mdxJsxFlowElement`),y(e,`mdxJsxTextElement`),n()},ke={};function Ae(e=``,t){return e?()=>{let n=t||ke,r=n.prefix||``,i=new Set(n.allowedLevels||[2,3,4]),a=new Map;function o(e){let t=e.replace(/[<>]/g,``).replace(/[^\w\s-]/g,``).trim(),n;n=t.includes(` `)?t.toLowerCase().replace(/\s+/g,`-`).replace(/^-+|-+$/g,``):(t.match(/[A-Z]/g)||[]).length>=2?t.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1-$2`).toLowerCase():t.toLowerCase();let r=a.get(n)||0;return a.set(n,r+1),r>0?`${n}-${r}`:n}return t=>{a.clear(),h(t,`heading`,t=>{if(i.has(t.depth)){let n=r+o(ae(t));t.children=[{children:t.children,type:`link`,url:`${e}#${n}`}]}})}}:()=>{}}function V(e){return e.match(/^:::\s*serialize-jsx\s*$/)}function je(e){return e.trim()===`:::`}function Me(e){return!!V(e)||!!je(e)}var H=e=>e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`;function U(e){return()=>t=>{h(t,`paragraph`,(t,n,r)=>{if(!r||n===void 0)return;let i=t.children[0];if(i?.type!==`text`||!V(i.value))return;let a=n+1,o=[];for(;a<r.children.length;){let e=r.children[a];if(e.type===`paragraph`){let t=e.children[0];if(t?.type===`text`&&je(t.value))break}o.push(e),a++}a>=r.children.length||r.children.splice(n,a-n+1,...o.filter(e))})}}var Ne=U(H),W=U(e=>!H(e));function G(e){return e.match(/^:::\s*spoiler\s*(.*)$/)}function K(e){return e.trim()===`:::`}function q(e){return!!G(e)||K(e)}var Pe=(e={})=>{let{defaultSummary:t=`Open spoiler`,detailsClassName:n=[],summaryClassName:r=[]}=e;return e=>{h(e,`paragraph`,(e,i,a)=>{if(!a||i===void 0)return;let o=e.children[0];if(o?.type!==`text`)return;let s=G(o.value);if(!s)return;let c=s[1].trim()||t,l=i+1,u=[];for(;l<a.children.length;){let e=a.children[l];if(e.type===`paragraph`){let t=e.children[0];if(t?.type===`text`&&K(t.value.trim()))break}u.push(e),l++}if(l>=a.children.length)return;let d={attributes:r.length?[{name:`className`,type:`mdxJsxAttribute`,value:r.join(` `)}]:[],children:[{children:[{type:`text`,value:c}],type:`paragraph`}],name:`SpoilerSummary`,type:`mdxJsxFlowElement`},f={attributes:[],children:u,name:`SpoilerContent`,type:`mdxJsxFlowElement`},p={attributes:n.length?[{name:`className`,type:`mdxJsxAttribute`,value:n.join(` `)}]:[],children:[d,f],name:`SpoilerRoot`,type:`mdxJsxFlowElement`};a.children.splice(i,l-i+1,p)})}},J=new Set([2,3,4]);function Fe(e){let t=e.match(/^h([1-6])(?:-h([1-6]))?$/);if(!t)return;let n=Number(t[1]),r=t[2]?Number(t[2]):n;if(n>r)return;let i=new Set;for(let e=n;e<=r;e++)i.add(e);return i}function Ie(e){return e.type===`heading`}function Le(e){return e.match(/^:::\s*steps(?:\s+(h[1-6](?:-h[1-6])?))?\s*$/)}function Re(e){return e.match(/^:::\s*\/steps\s*$/)}function ze(e){return!!(Le(e)||Re(e))}var Be=()=>e=>{h(e,`paragraph`,(e,t,n)=>{if(!n||t===void 0)return;let r=e.children[0];if(r?.type!==`text`)return;let i=Le(r.value);if(!i)return;let a=i[1]?Fe(i[1])??J:J,o=t+1,s=[];for(;o<n.children.length;){let e=n.children[o];if(e.type===`paragraph`){let t=e.children[0];if(t?.type===`text`&&Re(t.value))break}Ie(e)&&a.has(e.depth)&&(e.data={...e.data,hProperties:{...e.data?.hProperties,"data-step":``}}),s.push(e),o++}if(o>=n.children.length)return;let c={attributes:[],children:s,name:`HeadingSteps`,type:`mdxJsxFlowElement`};n.children.splice(t,o-t+1,c)})};function Y(e={}){let t=m().use(f);if(e.mdx&&t.use(d),e.frontmatter&&t.use(_,[`yaml`]),e.removeJsx&&t.use(B),e.removeMermaidCodeBlocks&&t.use(z),e.gfm&&t.use(v),e.alerts&&t.use(M),e.interpolateFrontmatter&&t.use(R,e.interpolateFrontmatter),e.extractMeta&&t.use(L,e.extractMeta),e.plugins)for(let n of e.plugins)Array.isArray(n)?t.use(...n):t.use(n);return e.output===`md`&&t.use(p),t}function Ve(e){if(e.name!==`unionWithPick`||!e.value||typeof e.value==`string`)return null;let t=e.value.data?.estree;if(!t?.body?.[0]||t.body[0].type!==`ExpressionStatement`)return null;let n=t.body[0].expression;if(n.type!==`ObjectExpression`)return null;let r={};for(let e of n.properties){if(e.type!==`Property`||e.key.type!==`Identifier`||e.value.type!==`ArrayExpression`)continue;let t=e.key.name,n=[];for(let t of e.value.elements)t?.type===`Literal`&&typeof t.value==`string`&&n.push(t.value);r[t]=n}return r}var He=[`TypeDocProps`,`TypeDocAttributes`,`TypeDocAngularAttributes`,`TypeDocFunction`],Ue=class{constructor(e){this.docPropsEntries=[],this.idService=new ne,this.pageDocProps={},this.getTypeDocPropsNodes=()=>(e,t,n)=>{h(e,`mdxJsxFlowElement`,e=>{if(e&&`name`in e&&He.includes(e.name)){let t=e.attributes?.find(e=>e.name===`name`),n=e.attributes?.find(e=>e.name===`omitFrom`),r=n?j(n):void 0;if(t){let e=j(t);for(let t of e)this.docPropsEntries.push({name:t,omitFrom:r}),t.endsWith(`Props`)&&this.docPropsEntries.push({name:t.slice(0,-5),omitFrom:r})}let i=e.attributes?.find(e=>e.name===`unionWithPick`);if(i)try{let e=Ve(i);e&&this.docPropsEntries.push(...Object.keys(e).map(e=>({name:e,omitFrom:r})))}catch{}}}),n()},this.props=e}reset(){this.idService.reset(),this.docPropsEntries=[]}build(e,t){if(m().use(d).use(this.getTypeDocPropsNodes).use(f).use(p).processSync(e),!this.docPropsEntries.length)return null;for(let e of t)this.idService.add(e.id);return this.docPropsEntries.map(e=>{let t=this.props[e.name];if(!t)return[];let n=new Set((e.omitFrom??[]).map(e=>{let t=this.props[e];return t?[t.props,t.input,t.output,t.publicMethods].reduce((e,t)=>(t&&e.push(...t.map(e=>e.name)),e),[]):[]}).flat(1).filter(Boolean)),r=[],i=e=>{if(!e)return;let t=[];for(let i of e){if(n.has(i.name))continue;let e=this.idService.add(i.name);t.push({...i,id:e}),r.push(this.assembleProp(i,e))}return t},a=t.resolvedType,o=a?.type===`signature`&&a.functionParameters?.length?this.assembleFunctionParams(a.functionParameters,r):void 0;return this.pageDocProps[e.name]={...this.props[e.name],input:i(t.input),output:i(t.output),props:i(t.props),publicMethods:i(t.publicMethods),resolvedType:o?{...a,functionParameters:o}:a},r}).flat()}getDocProps(){return this.docPropsEntries.reduce((e,t)=>{let n=this.pageDocProps[t.name];return n&&(e[t.name]=n),e},{})}assembleFunctionParams(e,t){return e.map(e=>{let n=this.idService.add(e.name);t.push(this.assembleProp(e,n));let r=e.args?.length?this.assembleFunctionParams(e.args,t):void 0;return{...e,args:r,id:n}})}assembleProp(e,t){let n={headingLevel:4,id:t,tagName:`a`,textContent:e.name},r=e.comment;return r?{content:[{tagName:`p`,text:[r.summary.map(e=>e.text.replaceAll(`
|
|
9
|
+
`,` `)).join(``)]}],heading:n}:{content:[],heading:n}}},We=[`https://`,`http://`,`mailto:`,`tel:`];function Ge(e){return We.some(t=>e.startsWith(t))}function Ke(e,t){if(Ge(e))return null;let[n,i]=e.split(`#`,2),a;if(!n||n===`./`||n===`.`)a=t;else if(n.startsWith(`/`))a=n;else{let e=t.endsWith(`/`)?t:r.dirname(t);a=r.resolve(e,n)}return a!==`/`&&a.endsWith(`/`)&&(a=a.slice(0,-1)),{fragment:i||void 0,pathname:a}}function qe(e,t,n){let r=[];return h(e,`link`,e=>{let i=Ke(e.url,n);i&&r.push({fragment:i.fragment,sourceFile:t,sourcePathname:n,targetPathname:i.pathname,url:e.url})}),r}function Je(e,t){let n=e.attributes.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return typeof n?.value==`string`?n.value:void 0}function Ye(e){let t=new Set,n=e=>{if(e.name!==`a`)return;let n=Je(e,`id`);n&&t.add(n)};return h(e,`mdxJsxFlowElement`,n),h(e,`mdxJsxTextElement`,n),t}function Xe(e,t,n,r){let i=[];for(let a of e){let e=t[a.targetPathname];if(!e){i.push({...a,reason:`page-not-found`});continue}if(a.fragment){let t=e.toc?.some(e=>e.id===a.fragment),o=n?.[a.targetPathname]?.has(a.fragment),s=r?.[a.targetPathname]?.has(a.fragment);!t&&!o&&!s&&i.push({...a,reason:`fragment-not-found`})}}return i}function Ze(e){if(e.length===0)return;let t=new Map;for(let n of e){let e=t.get(n.sourcePathname)??[];e.push(n),t.set(n.sourcePathname,e)}console.debug(`\n${l.yellowBright.bold(`Found ${e.length} broken link${e.length===1?``:`s`}:`)}`);for(let[e,n]of t){console.debug(`\n ${l.blueBright.bold(e)}`);for(let e of n){let t=e.reason===`page-not-found`?`page not found`:`fragment "#${e.fragment}" not found`;console.debug(` ${l.red(`x`)} ${e.url} — ${t}`)}}console.debug(``)}async function X(e){return o(e).then(()=>!0).catch(()=>!1)}function Z(e){return g(`md5`).update(e).digest(`hex`)}function Qe(e){return e===`// preview`||/^\{\s*\/\*\s*preview\s*\*\/\s*\}$/.test(e)||/^<!--\s*preview\s*-->$/.test(e)}function $e(e){return e.split(`
|
|
10
|
+
`).filter(e=>!Qe(e.trim())).join(`
|
|
11
|
+
`)}function et(e){let t=b.createSourceFile(`temp.ts`,e,b.ScriptTarget.Latest,!1,b.ScriptKind.TSX),n=[];for(let e of t.statements)if(b.isImportDeclaration(e)&&b.isStringLiteral(e.moduleSpecifier)){let t=e.moduleSpecifier.text;t.startsWith(`.`)&&n.push(t)}return n}async function tt(e,r){let a=i(t(r),e);for(let e of[`.ts`,`.tsx`,`.js`,`.jsx`,``]){let t=a+e;if(await X(t))return t}if(await X(a)){let e=n(a,`index.ts`);if(await X(e))return e}return null}function nt(){return()=>e=>{h(e,`link`,e=>{let t=``;h(e,`text`,e=>{t+=e.value}),Object.assign(e,{children:void 0,type:`inlineCode`,url:void 0,value:t})})}}var rt=m().use(v).use(p),it=m().use(v).use(nt()).use(p),at=class{constructor(e){this.depths=new Set(e?.depths??[1,2,3,4]),this.minContentLength=e?.minContentLength??0,this.pageIdPrefix=e?.pageIdPrefix??``}extract(e,t){let n=[],r=[],i=[{depth:1,text:t.title}],a=new k,o=null,s=()=>{if(!o||o.nodes.length===0)return;let e=this.buildSectionEntry(o,t);e&&e.content.length>=this.minContentLength&&n.push(e)};for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`yaml`)if(n.type===`heading`){let e=n;if(!this.depths.has(e.depth)){o?o.nodes.push(n):o={headerPath:i.map(e=>e.text),headingLevel:i[i.length-1]?.depth??1,nodes:[],startIndex:t};continue}for(s();i.length>0&&i[i.length-1].depth>=e.depth;)i.pop();let c=ae(e);i.push({depth:e.depth,text:c});let l;e.depth>1&&(l=a.createSlug(c),r.push({headingLevel:e.depth,id:l,tagName:`h${e.depth}`,textContent:c})),o={anchorId:l,headerPath:i.map(e=>e.text),headingLevel:e.depth,nodes:[],startIndex:t}}else o?o.nodes.push(n):o={headerPath:i.map(e=>e.text),headingLevel:i[i.length-1]?.depth??1,nodes:[n],startIndex:t}}return s(),{sections:n,toc:r}}extractPage(e,t){let n=e.children.filter(e=>e.type!==`yaml`);if(n.length===0)return null;let r=this.nodesToRawContent(n).trim();if(!r)return null;let i={content:r,pageId:`${this.pageIdPrefix}${t.id}`,pathname:t.pathname};return{content:r,hash:Z(JSON.stringify(i)),pageId:`${this.pageIdPrefix}${t.id}`,pathname:t.pathname,title:t.title}}buildSectionEntry(e,t){let{nodes:n,terms:r}=this.extractTerms(e.nodes),i=[],a=[],o=[];for(let e of n)if(e.type===`code`){let t=e;if(t.data?.typeDocProps){let{name:e,props:n,since:r}=t.data.typeDocProps;o.push({props:n,since:r,type:e})}a.push({code:t.value,language:t.lang??``})}else e.type===`text`&&(ze(e.value.trim())||q(e.value.trim()))||i.push(e);let s=this.nodesToRawContent(n),c=this.nodesToContent(i),l=this.generateSectionId(e.headerPath),u=t.url&&e.anchorId?`${t.url}#${e.anchorId}`:void 0,d={headerPath:e.headerPath,pageFrontmatter:Object.keys(t.frontmatter).length?t.frontmatter:void 0,pageId:`${this.pageIdPrefix}${t.id}`,rawContent:s.trim(),terms:r.length?r:void 0,types:o.length?o:void 0,url:u},f=Z(JSON.stringify(d));return{...d,codeExamples:a.length?a:void 0,content:c.trim(),hash:f,headingLevel:e.headingLevel,sectionId:l}}extractTerms(e){let t=[],n=[];for(let r of e){if(r.type===`paragraph`){let e=r.children??[],t=e[0];if(t?.type===`text`){let r=t.value;if(r.match(/^:::\s*terms\s*/)){let t=r;for(let n=1;n<e.length;n++){let r=e[n];r.type===`text`?t+=r.value:r.type===`softBreak`&&(t+=`
|
|
12
|
+
`)}let i=this.parseTermsBlock(t);n.push(...i);continue}}}t.push(r)}return{nodes:t,terms:n}}parseTermsBlock(e){let t=e.replace(/^:::\s*terms\s*/,``),n=t.lastIndexOf(`:::`);return(n===-1?t:t.slice(0,n)).split(`
|
|
13
|
+
`).map(e=>e.trim()).filter(e=>e&&e!==`:::`)}nodesToRawContent(e){let t={children:e,type:`root`};return rt.stringify(t)}nodesToContent(e){let t={children:structuredClone(e),type:`root`},n=it.runSync(t);return it.stringify(n)}generateSectionId(e){return e.map(e=>O(e)).join(`-`)}};function Q(e,t){let n=t[e[0]];if(n)return e.length===1?n:e.slice(1).reduce((e,t)=>e?.children?.[t],n)}var ot=class{get navItems(){return this._navItems}constructor(e,t){this.initialRoutes=[],this.flatNavItems=[],this._navItems=[],this.navMeta=t,this.metaJson=e}add(e,t,n){this.initialRoutes.push({pageFrontmatter:t,pageSection:e,routeMeta:n})}reset(){this.initialRoutes=[],this.flatNavItems=[],this._navItems=[]}navItemSort(e,t,n){if(e.depth!==t.depth)return e.depth-t.depth;if(e.order&&!t.order)return-1;if(!e.order&&t.order)return 1;if(e.order&&t.order&&e.order!==t.order)return e.order-t.order;if(n&&e.group&&t.group){let r=e.group?n.indexOf(e.group):-1,i=t.group?n.indexOf(t.group):-1;if(r!==i){if(r!==-1&&i!==-1)return r-i;if(r!==-1)return-1;if(i!==-1)return 1}}if(e.group!==t.group){if(!e.group&&t.group)return-1;if(e.group&&!t.group)return 1;if(e.group&&t.group)return e.group.localeCompare(t.group)}return e.title.localeCompare(t.title)}resolveSideNavTitle(e,t,n){return(u(t.sideNavTitle)?t.sideNavTitle||``:e.sideNavTitle||``)||n}buildNavItem({pageFrontmatter:e,pageSection:{pathname:t,pathSegments:n,title:r},routeMeta:i}){let a=e?.id||``;if(!n.length&&t===`/`){let n=i||Q(a?[a]:[],this.metaJson);if(!n)return;this.flatNavItems.push({depth:1,expanded:n?.expanded||!1,id:`/`,order:n?.order,pathname:t,pathSegments:[],title:this.resolveSideNavTitle(e,n,n?.title||r)})}n.forEach((i,a)=>{let o=a+1;if(!this.flatNavItems.find(e=>n.slice(0,o).every((t,n)=>t===e.pathSegments[n]))){let s=a===n.length-1,c=n.slice(0,o),l=Q(s?n:c,this.metaJson)??{};this.flatNavItems.push({badges:s?this.extractBadges(e):void 0,depth:o,expanded:l?.expanded||!1,group:s?l.group||e.group:l.group,id:`/${c.join(`/`)}`,items:[],order:l?.order,pathname:s?t:void 0,pathSegments:c,title:this.resolveSideNavTitle(s?e:{},l,l?.title?l.title:s?r:S(i))})}})}ensureParent(e){let t=e.pathSegments,n=this.navItems,r,i;for(let e=0;e<t.length-1;e++){let a=t[e];if(r=n?.find(t=>t.pathSegments[e]===a),r){n=r.items??[],i=r;continue}if(i){let r=t.slice(0,e+1),o=Q(r,this.metaJson);n=[];let s={depth:r.length,id:`/routes/${r.join(`/`)}`,items:n,pathSegments:r,title:a},c=o?{...s,expanded:o.expanded,order:o.order,restricted:o.restricted,title:o.title??a}:s;i.items=i.items?[...i.items,c]:[c]}i=r}}nestedInsert(e,t,n){let r=t[0],i=n.find(e=>e.pathSegments[e.pathSegments.length-1]===r);i?this.nestedInsert(e,t.slice(1),i.items??[]):t.length===1&&n.push(e)}buildNestedNavItems(){for(let e=0;e<this.flatNavItems.length;e++){let t=this.flatNavItems[e];if(t.depth===1){this.navItems.push(t);continue}this.ensureParent(t),this.nestedInsert(t,t.pathSegments,this.navItems)}}sortNestedNavItems(e,t){e.sort((e,n)=>this.navItemSort(e,n,t)),e.forEach(e=>{if(e.items?.length){let t=Q(e.pathSegments,this.metaJson);this.sortNestedNavItems(e.items,t?.groupOrder)}})}build(){oe(this.initialRoutes,e=>e.pageSection.pathSegments.length).map(e=>this.buildNavItem(e)),this.buildNestedNavItems();let e=Q([],this.metaJson);return this.sortNestedNavItems(this.navItems,e?.groupOrder),this.navMeta&&Object.entries(this.navMeta).forEach(([e,t])=>{this._navItems.splice(parseInt(e),0,{depth:1,id:x(),pathSegments:[],sectionTitle:t.sectionTitle,separator:t.separator,title:``})}),this._navItems=this.groupNavItems(this.navItems),this._navItems=this.buildSearchMeta(this.navItems,[]),this.navItems}groupNavItems(e){let t=[],n=new Set;for(let r of e)r.group&&!n.has(r.group)&&(n.add(r.group),t.push({depth:r.depth,group:r.group,id:x(),pathSegments:[],sectionTitle:r.group,title:``})),t.push({...r,items:r.items?this.groupNavItems(r.items):void 0});return t}buildSearchMeta(e,t){let n=``,r=[];for(let i of e){let e={...i};if(e.sectionTitle?n=e.sectionTitle:e.separator&&(n=``),!e.separator){let r=n?[...t,n]:[...t],i=[...e.searchMeta||[],...r];i.length&&(e.searchMeta=[...i]),e.items&&=this.buildSearchMeta(e.items,r)}r.push(e)}return r}extractBadges(e){let t=e.badges;if(t&&typeof t==`object`&&Array.isArray(t))return t.filter(e=>re(e)&&!e.hideFromNav)}};function st(e){return`/${e.join(`/`)}`}function ct(e,t,n){return e.reduce((r,i,a)=>{let o=e.slice(0,a+1);if(a===e.length-1)return r.push(n),r;let s=Q(o,t);return s?.title?r.push(s.title):r.push(lt(i)),r},[])}function lt(e){return e.split(`-`).map(e=>/\b(a|an|and|but|or|in|on|at)\b/.test(e)?e:S(e)).join(` `)}function ut(e){let t=e.endsWith(`mdx`)?`mdx`:`tsx`,n=e.substring(0,e.lastIndexOf(`.${t}`)).split(`/`);return n[n.length-1]===`index`?n.slice(0,n.length-1):n}var dt=/[\/\\.]/;function ft(e){return dt.test(e)}var pt=/((^|[.]|[+]\/)(index|_index))(\/[^\/]+)?$|(\/_?index\/)/;function mt(e,t,n=`$`){let r=typeof n==`string`?{paramPrefixChar:n}:n,i=r.paramPrefixChar??`$`,a=r.directoryMode??!1,o=[],s=0,c=``,l=`START`,u=`NORMAL`,d=!1;if(e.endsWith(`_layout`))return[];if(/\+\/_\./.test(e)&&(e=e.replace(/\+\/_\./g,`_+/`)),/\+\//.test(e)&&(e=e.replace(/\+\//g,`.`),d=!0),a&&/\//.test(e)){if(e.endsWith(`.route`)){let t=e.lastIndexOf(`/`);t>=0&&(e=`${e.substring(0,t).replace(/\//g,`.`)}/${e.substring(t+1)}`)}else e=e.replace(/\//g,`.`);d=!0}let f=/\//.test(e);if((d&&f||!d)&&!(e.endsWith(`.route`)||e.endsWith(`.index`))){let t=e.lastIndexOf(`/`);t>=0&&(e=e.substring(0,t))}let p=e=>{e&&o.push(e)};for(;s<e.length;){let t=e[s];switch(l){case`START`:if(c.includes(i)&&!(c.startsWith(i)||c.startsWith(`(${i}`)))throw Error(`Route params must start with prefix char ${i}: ${c}`);if(c.includes(`(`)&&!c.startsWith(`(`)&&!c.endsWith(`)`))throw Error(`Optional routes must start and end with parentheses: ${c}`);p(c),c=``,l=`PATH`;continue;case`PATH`:if(ft(t)&&u===`NORMAL`){l=`START`;break}else if(t===`[`){u=`ESCAPE`;break}else if(t===`]`){u=`NORMAL`;break}c+=t;break}s++}return p(c),(o.at(-1)===`route`||o.at(-1)===`index`||o.at(-1)===`_index`||o.at(-1)===`_route`)&&(o=o.slice(0,-1)),!t&&d&&o.at(-1)?.startsWith(`_`)&&(o=o.slice(0,-1)),o}function ht(e){let t=e.substring(0,e.lastIndexOf(`.`));return mt(t,pt.test(t))}function gt(e){let t=e.substring(0,e.lastIndexOf(`.`));return _t(t)?[]:mt(t,pt.test(t),{directoryMode:!0})}function _t(e){let t=e.split(`/`);for(let e=0;e<t.length-1;e++){let n=t[e];if(n.startsWith(`_`)&&!n.includes(`+`))return!0}return!1}function vt(e,t,n){let r=e.substring(e.indexOf(t)+t.length+1);if(typeof n==`function`)return n(r);switch(n){case`vite-generouted`:return ut(r);case`react-router-directory-groups`:return gt(r);default:return ht(r)}}function $(e,t,r,i){if(typeof i==`string`&&i===`vite-generouted`){let i=/(\(.*\))|(\[.*\])/;return e.map(e=>e.replace(r,``)).filter(e=>e.endsWith(`.${t}`)&&!e.includes(`/_`)&&!e.includes(`/+`)).map(e=>e.split(`/`).filter(e=>!i.test(e)).join(`/`)).map(e=>n(r,e))}return typeof i==`string`&&i===`react-router-directory-groups`?e.filter(e=>e.endsWith(t)&&!e.includes(`$`)&&!yt(e,r)):e.filter(e=>e.endsWith(t)&&!e.includes(`$`))}function yt(e,t){let n=(e.startsWith(t)?e.slice(t.length):e).split(`/`).filter(Boolean);for(let e=0;e<n.length-1;e++){let t=n[e];if(t.startsWith(`_`)&&!t.includes(`+`))return!0}return!1}function bt(e,t){let n=0;return e.reduce((e,r,i)=>{if(!(`id`in r))return(`separator`in r||`sectionTitle`in r)&&(t[i-n]=r),e;let a=r;return(a.ignoreRouteMetaOrder||a.hidden)&&n++,e[a.id]={children:a.children?bt(a.children,t):void 0,expanded:a.expanded,group:a.group,groupOrder:a.groupOrder,hidden:a.hidden,hideBreadcrumbs:a.hideBreadcrumbs,hideFromSearch:a.hideFromSearch,hidePageLinks:a.hidePageLinks,hideSideNav:a.hideSideNav,hideToc:a.hideToc,order:a.ignoreRouteMetaOrder?void 0:i+1,restricted:a.restricted,title:a.title},e},{})}var xt=class{get cachedFileCount(){return this.mdxFileReader.cachedFileCount}get pageDocProps(){return this._pageDocProps}get mdxFileCount(){return this._mdxFileCount}get navItems(){return this.navBuilder.navItems}get pageMap(){return this._pageMap}get searchIndex(){return this._searchIndex}reset(){this.mdxFileReader.reset(),this._collectedLinks=[],this._anchorIds={},this._docPropIds={},this._pageMap={},this._searchIndex=[]}constructor(e,t=!0,n={}){this._collectedLinks=[],this._anchorIds={},this._docPropIds={},this.routeMetaNav={},this._pageDocProps={},this._mdxFileCount=0,this._pageMap={},this._searchIndex=[],this.config=e,this.logWarnings=t,this.allowedHeadings=new Set(Array.from(e?.headings||[`h2`,`h3`,`h4`])),this.metaJson=bt(this.config.navConfig??[],this.routeMetaNav);let r=Array.from(this.allowedHeadings).map(e=>parseInt(e.charAt(1)));this.sectionExtractor=n.sectionExtractor||new at({depths:[1,...r]}),this.navBuilder=n.navBuilder||new ot(this.metaJson,this.routeMetaNav),this.docPropsIndexer=n.docPropsIndexer||new Ue(this.config.typeDocProps??{}),this.mdxFileReader=n.mdxFileReader||new A(process.env.NODE_ENV===`development`&&!this.config.disableCache,this.config.pageTimestampMetadata)}getPageEntry(e,t){let n=e.replace(this.config.srcDir,``),r=vt(n,this.config.pageDirectory,this.config.routingStrategy),i=st(r),a=Q(r.length===0?t.id?[t.id]:[`_index`]:r,this.metaJson)??{};return{categories:t.categories??ct(r,this.metaJson,a?.title||t.title||``),data:t,description:t.description,hidden:u(a.hidden)?a.hidden:t.hidden,hideBreadcrumbs:u(a.hideBreadcrumbs)?a.hideBreadcrumbs:t.hideBreadcrumbs,hideFromSearch:u(a.hideFromSearch)?a.hideFromSearch:t.hideFromSearch,hidePageLinks:u(a.hidePageLinks)?a.hidePageLinks:t.hidePageLinks,hideSideNav:u(a.hideSideNav)?a.hideSideNav:t.hideSideNav,hideToc:u(a.hideToc)?a.hideToc:t.hideToc,id:n,pathname:i,pathSegments:r,restricted:u(a.restricted)?a.restricted:t.restricted,title:u(a.title)?a.title||``:t.title||``,updatedBy:t.updatedBy,updatedOn:t.updatedOn}}compileMdxFile(e){let{cached:t,fileContents:n,frontmatter:r}=this.mdxFileReader.readFileSync(e),i={changed:{},filePath:e},a;if(!t){let t=this.mdxFileReader.readCache(e);if(t){let e=JSON.stringify(t.frontmatter),n=JSON.stringify(r);a=t.page,e!==n&&(i.changed.frontmatter=!0)}}this.docPropsIndexer.reset();let o=this.getPageEntry(e,r);!o.categories.length&&o.title&&(o.categories=[o.title]),o.hidden||this.navBuilder.add(o,r),this._pageMap[o.pathname]=o;let s,c=[];try{if(this.config.validatePageLinks){let e=Ye(Y({frontmatter:!0,mdx:!0}).parse(n));e.size&&(this._anchorIds[o.pathname]=e)}if(t?.page)s=t.page,c=t.collectedLinks,this._collectedLinks.push(...c);else{let t=Y({alerts:!0,extractMeta:{},frontmatter:!0,gfm:!0,interpolateFrontmatter:r,mdx:!0,plugins:[W],removeJsx:!0,removeMermaidCodeBlocks:!0}),i=t.runSync(t.parse(n));this.config.validatePageLinks&&(c=qe(i,e,o.pathname),this._collectedLinks.push(...c));let a={frontmatter:r,id:o.id,pathname:o.pathname,title:o.title,url:o.pathname},{sections:l,toc:u}=this.sectionExtractor.extract(i,a);s={sections:l,toc:u}}}catch(t){if(console.debug(`${l.yellowBright.bold(`Failed to parse mdx page content.`)} ${l.blueBright.bold(e)}`),this.config.throwOnError)throw Error(t);return{metadata:i,pageSections:[o]}}let{sections:u,toc:d}=s;if(a)for(let e=0;e<d.length;e++){let t=a.toc[e],n=d[e];if(t?.id!==n.id){i.changed.toc=!0;break}}d.length&&(this._pageMap[o.pathname].toc=d);let f=[],p={};if(this.config.typeDocProps&&(f=t?.pageDocPropSections||(this.docPropsIndexer.build(n,d)??[]),p=t?.pageDocProps||this.docPropsIndexer.getDocProps()),(f.length||Object.keys(p).length)&&(this._pageDocProps[o.pathname]=p,this.config.validatePageLinks)){let e=new Set;for(let t of f)t.heading?.id&&e.add(t.heading.id);e.size&&(this._docPropIds[o.pathname]=e)}if(t||this.mdxFileReader.updateCache(e,n,{collectedLinks:c,frontmatter:r,page:s,pageDocProps:p,pageDocPropSections:f}),r.hideFromSearch||!u.length&&!f.length)return{metadata:i,pageSections:[o]};let m=[...this.formatContentSections(u,o)];return this.config.typeDocPropsOptions?.includeInSearchIndex&&m.push(...this.formatDocPropSections(f,o)),{metadata:i,pageSections:m}}formatContentSections(e,{toc:t,...n}){return e.map((e,t)=>{let r=e.headerPath.at(-1)??n.title;return{...n,content:e.content||void 0,heading:r,headingLevel:e.headingLevel,href:e.url??n.pathname,id:`${n.id}-${t}`}})}formatDocPropSections(e,{toc:t,...n}){return e.map((e,t)=>{let r=e.content.map(e=>e.text.join(` `)).join(` `);return{...n,content:r||void 0,heading:e.heading?.textContent??n.title,headingLevel:e.heading?.headingLevel,href:e.heading?`${n.pathname}#${e.heading.id}`:n.pathname,id:`${n.id}-${t}-prop`,isDocProp:!0}})}compileTsxFile(e){let t=this.getPageEntry(e,{}),n=Q(t.pathSegments.length===0?[`_index`]:t.pathSegments,this.metaJson);return n?(t.hidden||this.navBuilder.add(t,{},n),this._pageMap[t.pathname]=t,t):null}buildIndex(e,t=!0){this.logWarnings=t,this.mdxFileReader.logWarnings=t;let n=e.map(C);this.navBuilder.reset(),this.reset();let r=$(n,`mdx`,this.config.srcDir,this.config.routingStrategy);this._mdxFileCount=r.length,(!this.mdxFileReader.enabled||this.mdxFileReader.gitMetadataMap.size===0)&&(this.mdxFileReader.gitMetadataMap=_e(this.config.srcDir,this.mdxFileReader.pageTimestampMetadata));let i=r.map(e=>this.compileMdxFile(e)),a=i.map(e=>e.pageSections).flat();return $(n,`tsx`,this.config.srcDir,this.config.routingStrategy).map(e=>this.compileTsxFile(e)),this._searchIndex.push(...a.filter(e=>!e.hideFromSearch)),this.navBuilder.build(),this.config.validatePageLinks&&Ze(Xe(this._collectedLinks,this._pageMap,this._docPropIds,this._anchorIds)),i}};export{A,R as C,N as D,Ce as E,E as F,C as I,he as M,D as N,M as O,T as P,Oe as S,L as T,W as _,Z as a,B as b,$e as c,Y as d,ze as f,Me as g,Pe as h,at as i,k as j,j as k,tt as l,q as m,vt as n,X as o,Be as p,st as r,et as s,xt as t,He as u,Ne as v,Te as w,z as x,Ae as y};
|
|
14
|
+
//# sourceMappingURL=search-indexer-DOffnbB9.js.map
|