import{container as j}from"@mdit/plugin-container";import{utoa as C,entries as E,keys as Oe,endsWith as xe,deepAssign as N,fromEntries as B,isAbsoluteUrl as W,Logger as Re,getLocales as Se,getBundlerName as Pe,addViteConfig as Ie,addViteSsrNoExternal as De,addCustomElement as A,MATHML_TAGS as q,addViteOptimizeDepsExclude as M,addViteSsrExternal as I,addViteOptimizeDepsInclude as Me,addChainWebpack as _e}from"vuepress-shared/node";import{tab as H}from"@mdit/plugin-tab";import{ensureLeadingSlash as Y,resolveLocalePath as K,isPlainObject as $,ensureEndingSlash as Ee,isArray as Te}from"@vuepress/shared";import{hash as Ne,logger as Ae,getDirname as Ue,path as Q,colors as D}from"@vuepress/utils";import{uml as X}from"@mdit/plugin-uml";import{align as Le}from"@mdit/plugin-align";import{attrs as Fe}from"@mdit/plugin-attrs";import{figure as ze}from"@mdit/plugin-figure";import{footnote as Ge}from"@mdit/plugin-footnote";import{imgLazyload as Je}from"@mdit/plugin-img-lazyload";import{imgMark as Ve}from"@mdit/plugin-img-mark";import{imgSize as Be}from"@mdit/plugin-img-size";import{include as We}from"@mdit/plugin-include";import{katex as qe}from"@mdit/plugin-katex";import{mark as He}from"@mdit/plugin-mark";import{generateMathjaxStyle as Ye,createMathjaxInstance as Ke,mathjax as Qe}from"@mdit/plugin-mathjax";import{stylize as Xe}from"@mdit/plugin-stylize";import{sub as Ze}from"@mdit/plugin-sub";import{sup as et}from"@mdit/plugin-sup";import{tasklist as tt}from"@mdit/plugin-tasklist";import{useSassPalettePlugin as nt}from"vuepress-plugin-sass-palette";import{createRequire as ot}from"node:module";const Z=n=>{j(n,{name:"chart",openRender:(e,r)=>{const t=e[r].info.trimStart().slice(5).trim(),o=`chart-${r}`;let a="{}",s="";for(let i=r;i<e.length;i++){const{type:l,content:y,info:d}=e[i];if(l==="container_chart_close")break;y&&(l==="fence"&&(d==="json"?(a=C(y),s="json"):(d==="js"||d==="javascript")&&(a=C(y),s="js")),e[i].type="chart_empty",e[i].hidden=!0)}return`<ChartJS id="${o}" config="${a}" ${t?`title="${encodeURIComponent(t)}" `:""}type="${s}">`},closeRender:()=>"</ChartJS>"})},ee={useBabel:!1,jsLib:[],cssLib:[],codepenLayout:"left",codepenEditors:"101",babel:"https://unpkg.com/@babel/standalone/babel.min.js",vue:"https://unpkg.com/vue/dist/vue.global.prod.js",react:"https://unpkg.com/react/umd/react.production.min.js",reactDOM:"https://unpkg.com/react-dom/umd/react-dom.production.min.js"},U=n=>e=>j(e,{name:n,openRender:(r,t)=>{const o=r[t].info.trimStart().slice(n.length).trim();let a="";const s={};for(let i=t;i<r.length;i++){const{type:l,content:y,info:d}=r[i];if(l===`container_${n}_close`)break;y&&l==="fence"&&(d==="json"?a=C(y):s[d]=y)}return`
<CodeDemo id="code-demo-${t}" type="${n.split("-")[0]}"${o?` title="${encodeURIComponent(o)}"`:""}${a?` config="${a}"`:""} code="${C(JSON.stringify(s))}">
`},closeRender:()=>"</CodeDemo>"}),te=U("normal-demo"),ne=U("vue-demo"),oe=U("react-demo"),re=n=>{H(n,{name:"code-tabs",tabsOpenRenderer:({active:e,data:r},t,o)=>{const{meta:a}=t[o],s=r.map(({title:i,id:l})=>({title:i,...l?{id:l}:{}}));return`<CodeTabs id="${o}" :data='${JSON.stringify(s).replace(/'/g,"&#39")}'${e!==-1?` :active="${e}"`:""}${a.id?` tab-id="${a.id}"`:""}>
`},tabsCloseRenderer:()=>`</CodeTabs>
`,tabOpenRenderer:({index:e},r,t)=>{let o=!1;for(let a=t;a<r.length;a++){const{block:s,type:i}=r[a];if(s){if(i==="code-tabs_tab_close")break;if(i==="fence"&&!o){o=!0;continue}r[a].type="code_tab_empty",r[a].hidden=!0}}return`<template #tab${e}="{ title, value, isActive }">
`},tabCloseRenderer:()=>`</template>
`})},ae=(n,e)=>{const r=n[e],t=`echarts-${e}`,{content:o,info:a}=r,s=a.trim().split(":",2)[1];return`<ECharts id="${t}" config="${C(o)}"${s?` title="${encodeURIComponent(s)}"`:""}></ECharts>`},se=n=>{const e=n.renderer.rules.fence;n.renderer.rules.fence=(...r)=>{const[t,o]=r,{info:a}=t[o];return a.split(":",2)[0]==="echarts"?ae(t,o):e(...r)},n.renderer.rules.echarts=ae,j(n,{name:"echarts",openRender:(r,t)=>{const o=r[t].info.trimStart().slice(7).trim(),a=`echarts-${t}`;let s="{}",i=!1;for(let l=t;l<r.length;l++){const{type:y,content:d,info:c}=r[l];if(y==="container_echarts_close")break;d&&(y==="fence"&&(c==="json"?s=d:(c==="js"||c==="javascript")&&(s=d,i=!0)),r[l].type="echarts_empty",r[l].hidden=!0)}return`<ECharts id="${a}" config="${C(s)}"${o?` title="${encodeURIComponent(o)}"`:""}${i?' type="js"':""}>`},closeRender:()=>"</ECharts>"})},ie=(n,e)=>{const r=n[e],t=`flowchart-${e}`,{content:o,info:a}=r;return`<FlowChart id="${t}" code="${C(o)}" preset="${a.trim().split(":",2)[1]||"vue"}"></FlowChart>`},le=n=>{const e=n.renderer.rules.fence;n.renderer.rules.fence=(...r)=>{const[t,o]=r,{info:a}=t[o],s=a.split(":",2)[0];return s==="flow"||s==="flowchart"?ie(t,o):e(...r)},n.renderer.rules.flowchart=ie},pe=(n,e={})=>{["info","note","tip","warning","danger"].forEach(r=>{n.use(j,{name:r,openRender:(t,o,a,s)=>{var i;let l=t[o].info.trim().slice(r.length).trim();if(!l){const{filePathRelative:y}=s,d=Y(y??""),c=K(e,d);l=(i=e[c])==null?void 0:i[r]}return`<div class="hint-container ${r}">
<p class="hint-container-title">${l||r}</p>
`},closeRender:()=>`</div>
`})}),n.use(r=>j(r,{name:"details",openRender:(t,o,a,s)=>{var i;let l=t[o].info.trim().slice(7).trim();if(!l){const{filePathRelative:y}=s,d=Y(y??""),c=K(e,d);l=(i=e[c])==null?void 0:i.details}return`<details class="hint-container details"><summary>${l||"Details"}</summary>
`},closeRender:()=>`</details>
`}))},me=(n,e)=>{const r=n[e],t=`mermaid-${e}`,{content:o}=r;return`<Mermaid id="${t}" code="${C(o)}"></Mermaid>`},w=(n,e,r)=>`<Mermaid id="mermaid-${r}" code="${C(`${n}
${e.split(`
`).map(t=>t?`  ${t}`:"").join(`
`)}`)}"></Mermaid>`,ce=n=>{const e=n.renderer.rules.fence;n.renderer.rules.fence=(...r)=>{const[t,o]=r,{content:a,info:s}=t[o];return s.trim()==="mermaid"?me(...r):s.trim()==="sequence"?w("sequenceDiagram",a,o):s.trim()==="class"?w("classDiagram",a,o):s.trim()==="state"?w("stateDiagram-v2",a,o):s.trim()==="er"?w("erDiagram",a,o):s.trim()==="journey"?w("journey",a,o):s.trim()==="gantt"?w("gantt",a,o):s.trim()==="pie"?w("pie",a,o):s.trim()==="git-graph"?w("gitGraph",a,o):s.trim()==="c4c"?w("C4Context",a,o):s.trim()==="mindmap"?w("mindmap",a,o):e(...r)},n.renderer.rules.mermaid=me},rt=n=>n.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#039;"),de="@",at=["file","import","setting"],st=n=>(e,r,t,o)=>{let a=e.bMarks[r]+e.tShift[r],s=e.eMarks[r];if(e.src[a]!==":")return!1;let i=a+1;for(;i<=s&&e.src[i]===":";)i+=1;const l=i-a;if(l<3)return!1;const y=e.src.slice(a,i),d=e.src.slice(i,s),c=d.trimStart().split(" ",2)[0],v=d.trimStart().slice(n.length).trim();if(c.trim()!==n)return!1;if(o)return!0;let u=r,g=!1;for(;u<t&&(u+=1,a=e.bMarks[u]+e.tShift[u],s=e.eMarks[u],!(a<s&&e.sCount[u]<e.blkIndent));)if(e.src[a]===":"&&e.sCount[u]-e.blkIndent<4){for(i=a+1;i<=s&&e.src[i]===":";i++);if(i-a>=l&&(i=e.skipSpaces(i),i>=s)){g=!0;break}}const m=e.parentType,f=e.lineMax;e.parentType=`${n}`,e.lineMax=u-(g?1:0);const k=e.push(`${n}_open`,"template",1);k.markup=y,k.block=!0,k.info=v,k.map=[r,u-(g?1:0)],e.md.block.tokenize(e,r+1,u-(g?1:0));const S=e.push(`${n}_close`,"template",-1);return S.markup=e.src.slice(a,i),S.block=!0,e.parentType=m,e.lineMax=f,e.line=u+(g?1:0),!0},it=n=>(e,r,t,o)=>{let a=e.bMarks[r]+e.tShift[r],s=e.eMarks[r];const i=`${de}${n}`;if(e.src.charAt(a)!=="@")return!1;let l;for(l=0;l<i.length;l++)if(i[l]!==e.src[a+l])return!1;const y=e.src.slice(a,a+l),d=e.src.slice(a+l,s);if(o)return!0;let c=r,v=!1;for(;c<t&&(c+=1,a=e.bMarks[c]+e.tShift[c],s=e.eMarks[c],!(a<s&&e.sCount[c]<e.blkIndent));)if(e.src[a]===de&&e.sCount[c]<=e.sCount[r]){let k=!0;for(l=0;l<i.length;l++)if(i[l]!==e.src[a+l]){k=!1;break}if(k){v=!0,c-=1;break}}const u=e.parentType,g=e.lineMax;e.parentType=`${n}`,e.lineMax=c;const m=e.push(`${n}_open`,"template",1);m.block=!0,m.markup=y,m.info=d.trim(),m.map=[r,c],e.md.block.tokenize(e,r+1,c);const f=e.push(`${n}_close`,"template",-1);return f.block=!0,f.markup="",e.parentType=u,e.lineMax=g,e.line=c+(v?1:0),!0},_=(n,{name:e="playground",component:r="Playground",propsGetter:t}={name:"playground",component:"Playground",propsGetter:o=>({key:o.key,title:o.title||"",files:encodeURIComponent(JSON.stringify(o.files)),settings:encodeURIComponent(JSON.stringify(o.settings||{}))})})=>{n.block.ruler.before("fence",`${e}`,st(e),{alt:["paragraph","reference","blockquote","list"]}),at.forEach(o=>{n.block.ruler.__rules__.find(({name:a})=>a==="marker")||n.block.ruler.before("fence","tab",it(o),{alt:["paragraph","reference","blockquote","list"]})}),n.renderer.rules[`${e}_open`]=(o,a)=>{const{info:s}=o[a],i={key:Ne(`playground${a}-${s}`),title:encodeURIComponent(s),settings:{},files:{}};let l=null,y=!1;for(let c=a;c<o.length;c++){const{block:v,type:u,info:g,content:m}=o[c];if(v){if(u===`${e}_close`)break;if(u===`${e}_open`)continue;if(u==="file_open"){if(!g)continue;l=g}else u==="import_open"&&(i.importMap=l=g||"import-map.json");if(u==="setting_open"&&(y=!0),u==="setting_close"&&(y=!1),u==="file_close"||u==="import_close"||u==="setting_close"||!m){o[c].type=`${e}_empty`,o[c].hidden=!0;continue}y?u==="fence"&&g==="json"&&(i.settings=JSON.parse(m.trim())):u==="fence"&&l&&(i.files[l]={ext:g,content:m}),o[c].type=`${e}_empty`,o[c].hidden=!0}}const d=t(i);return`<${r} ${E(d).map(([c,v])=>`${c}="${rt(v)}"`).join(" ")}>
`},n.renderer.rules[`${e}_close`]=()=>`</${r}>
`},lt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",pt=(n,e,r)=>{if(n==null)return"";let t,o,a,s={},i={},l="",y="",d="",c=2,v=3,u=2,g=[],m=0,f=0;for(a=0;a<n.length;a+=1)if(l=n.charAt(a),Object.prototype.hasOwnProperty.call(s,l)||(s[l]=v++,i[l]=!0),y=d+l,Object.prototype.hasOwnProperty.call(s,y))d=y;else{if(Object.prototype.hasOwnProperty.call(i,d)){if(d.charCodeAt(0)<256){for(t=0;u>t;t++)m<<=1,f==e-1?(f=0,g.push(r(m)),m=0):f++;for(o=d.charCodeAt(0),t=0;8>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(r(m)),m=0):f++,o>>=1}else{for(o=1,t=0;u>t;t++)m=m<<1|o,f==e-1?(f=0,g.push(r(m)),m=0):f++,o=0;for(o=d.charCodeAt(0),t=0;16>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(r(m)),m=0):f++,o>>=1}c--,c==0&&(c=Math.pow(2,u),u++),delete i[d]}else for(o=s[d],t=0;u>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(r(m)),m=0):f++,o>>=1;c--,c==0&&(c=Math.pow(2,u),u++),s[y]=v++,d=String(l)}if(d!==""){if(Object.prototype.hasOwnProperty.call(i,d)){if(d.charCodeAt(0)<256){for(t=0;u>t;t++)m<<=1,f==e-1?(f=0,g.push(r(m)),m=0):f++;for(o=d.charCodeAt(0),t=0;8>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(r(m)),m=0):f++,o>>=1}else{for(o=1,t=0;u>t;t++)m=m<<1|o,f==e-1?(f=0,g.push(r(m)),m=0):f++,o=0;for(o=d.charCodeAt(0),t=0;16>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(r(m)),m=0):f++,o>>=1}c--,c==0&&(c=Math.pow(2,u),u++),delete i[d]}else for(o=s[d],t=0;u>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(r(m)),m=0):f++,o>>=1;c--,c==0&&(c=Math.pow(2,u),u++)}for(o=2,t=0;u>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(r(m)),m=0):f++,o>>=1;for(;;){if(m<<=1,f==e-1){g.push(r(m));break}f++}return g.join("")},mt=n=>pt(n,6,e=>lt.charAt(e)),ct=[{name:"help",type:"boolean"},{name:"help",type:"boolean"},{name:"watch",type:"boolean"},{name:"preserveWatchOutput",type:"boolean"},{name:"listFiles",type:"boolean"},{name:"explainFiles",type:"boolean"},{name:"listEmittedFiles",type:"boolean"},{name:"pretty",type:"boolean"},{name:"traceResolution",type:"boolean"},{name:"diagnostics",type:"boolean"},{name:"extendedDiagnostics",type:"boolean"},{name:"generateCpuProfile",type:"string"},{name:"generateTrace",type:"string"},{name:"incremental",type:"boolean"},{name:"assumeChangesOnlyAffectDirectDependencies",type:"boolean"},{name:"locale",type:"string"},{name:"all",type:"boolean"},{name:"version",type:"boolean"},{name:"init",type:"boolean"},{name:"project",type:"string"},{name:"build",type:"boolean"},{name:"showConfig",type:"boolean"},{name:"listFilesOnly",type:"boolean"},{name:"target",type:{es3:0,es5:1,es6:2,es2015:2,es2016:3,es2017:4,es2018:5,es2019:6,es2020:7,es2021:8,es2022:9,esnext:99}},{name:"module",type:{none:0,commonjs:1,amd:2,system:4,umd:3,es6:5,es2015:5,es2020:6,es2022:7,esnext:99,node16:100,nodenext:199}},{name:"lib",type:"list"},{name:"allowJs",type:"boolean"},{name:"checkJs",type:"boolean"},{name:"jsx",type:{preserve:1,"react-native":3,react:2,"react-jsx":4,"react-jsxdev":5}},{name:"declaration",type:"boolean"},{name:"declarationMap",type:"boolean"},{name:"emitDeclarationOnly",type:"boolean"},{name:"sourceMap",type:"boolean"},{name:"outFile",type:"string"},{name:"outDir",type:"string"},{name:"rootDir",type:"string"},{name:"composite",type:"boolean"},{name:"tsBuildInfoFile",type:"string"},{name:"removeComments",type:"boolean"},{name:"noEmit",type:"boolean"},{name:"importHelpers",type:"boolean"},{name:"importsNotUsedAsValues",type:{remove:0,preserve:1,error:2}},{name:"downlevelIteration",type:"boolean"},{name:"isolatedModules",type:"boolean"},{name:"strict",type:"boolean"},{name:"noImplicitAny",type:"boolean"},{name:"strictNullChecks",type:"boolean"},{name:"strictFunctionTypes",type:"boolean"},{name:"strictBindCallApply",type:"boolean"},{name:"strictPropertyInitialization",type:"boolean"},{name:"noImplicitThis",type:"boolean"},{name:"useUnknownInCatchVariables",type:"boolean"},{name:"alwaysStrict",type:"boolean"},{name:"noUnusedLocals",type:"boolean"},{name:"noUnusedParameters",type:"boolean"},{name:"exactOptionalPropertyTypes",type:"boolean"},{name:"noImplicitReturns",type:"boolean"},{name:"noFallthroughCasesInSwitch",type:"boolean"},{name:"noUncheckedIndexedAccess",type:"boolean"},{name:"noImplicitOverride",type:"boolean"},{name:"noPropertyAccessFromIndexSignature",type:"boolean"},{name:"moduleResolution",type:{node:2,classic:1,node16:3,nodenext:99}},{name:"baseUrl",type:"string"},{name:"paths",type:"object"},{name:"rootDirs",type:"list"},{name:"typeRoots",type:"list"},{name:"types",type:"list"},{name:"allowSyntheticDefaultImports",type:"boolean"},{name:"esModuleInterop",type:"boolean"},{name:"preserveSymlinks",type:"boolean"},{name:"allowUmdGlobalAccess",type:"boolean"},{name:"moduleSuffixes",type:"list"},{name:"sourceRoot",type:"string"},{name:"mapRoot",type:"string"},{name:"inlineSourceMap",type:"boolean"},{name:"inlineSources",type:"boolean"},{name:"experimentalDecorators",type:"boolean"},{name:"emitDecoratorMetadata",type:"boolean"},{name:"jsxFactory",type:"string"},{name:"jsxFragmentFactory",type:"string"},{name:"jsxImportSource",type:"string"},{name:"resolveJsonModule",type:"boolean"},{name:"out",type:"string"},{name:"reactNamespace",type:"string"},{name:"skipDefaultLibCheck",type:"boolean"},{name:"charset",type:"string"},{name:"emitBOM",type:"boolean"},{name:"newLine",type:{crlf:0,lf:1}},{name:"noErrorTruncation",type:"boolean"},{name:"noLib",type:"boolean"},{name:"noResolve",type:"boolean"},{name:"stripInternal",type:"boolean"},{name:"disableSizeLimit",type:"boolean"},{name:"disableSourceOfProjectReferenceRedirect",type:"boolean"},{name:"disableSolutionSearching",type:"boolean"},{name:"disableReferencedProjectLoad",type:"boolean"},{name:"noImplicitUseStrict",type:"boolean"},{name:"noEmitHelpers",type:"boolean"},{name:"noEmitOnError",type:"boolean"},{name:"preserveConstEnums",type:"boolean"},{name:"declarationDir",type:"string"},{name:"skipLibCheck",type:"boolean"},{name:"allowUnusedLabels",type:"boolean"},{name:"allowUnreachableCode",type:"boolean"},{name:"suppressExcessPropertyErrors",type:"boolean"},{name:"suppressImplicitAnyIndexErrors",type:"boolean"},{name:"forceConsistentCasingInFileNames",type:"boolean"},{name:"maxNodeModuleJsDepth",type:"number"},{name:"noStrictGenericChecks",type:"boolean"},{name:"useDefineForClassFields",type:"boolean"},{name:"preserveValueImports",type:"boolean"},{name:"keyofStringsOnly",type:"boolean"},{name:"plugins",type:"list"},{name:"moduleDetection",type:{auto:2,legacy:1,force:3}}],ue=(n,e={})=>{const r=`#code/${mt(n)}`,t=E(e).map(([o,a])=>{const s=ct.find(l=>l.name===o);if(!s||a===null||a===void 0)return"";const{type:i}=s;if($(i)){const l=i[a];return(l==null?void 0:l.toString())||""}return`${o}=${encodeURIComponent(a)}`}).filter(o=>o.length).join("&");return`${t?`?${t}`:""}${r}`},fe=({service:n="https://www.typescriptlang.org/play",...e}={})=>({name:"playground#ts",propsGetter:({title:r="",files:t,settings:o,key:a})=>{const s=Oe(t).filter(l=>xe(l,".ts"));s.length!==1&&console.error("TS playground only support 1 ts file");const i=`${n}${ue(t[s[0]].content,N({},o||{},e))}`;return{key:a,title:r,link:encodeURIComponent(i)}}}),dt=["html","js","ts","vue","jsx","tsx","json"],ye="https://sfc.vuejs.org/vue.runtime.esm-browser.js",ge="https://sfc.vuejs.org/server-renderer.esm-browser.js",he=(n={})=>({name:"playground#vue",propsGetter:e=>{const{title:r="",files:t,settings:o,key:a}=e,s={service:"https://sfc.vuejs.org/",dev:!1,ssr:!1,...n,...o},i=B(E(t).filter(([,{ext:l}])=>dt.includes(l)).map(([l,{content:y}])=>{if(l==="import-map.json"){const d=JSON.parse(y);return[l,JSON.stringify(N({imports:{vue:ye,...s.ssr?{"vue/server-renderer":ge}:{}}},d))]}return[l,y]}));return s.ssr&&!i["import-map.json"]&&(i["import-map.json"]=JSON.stringify({imports:{vue:ye,"vue/server-renderer":ge}},null,2)),{key:a,title:r,link:encodeURIComponent(`${s.service}#${s.dev?"__DEV__":""}${s.ssr?"__SSR__":""}${Buffer.from(JSON.stringify(i)).toString("base64")}`)}}}),be=n=>{n.use(X,{name:"presentation",open:"slidestart",close:"slideend",render:(e,r)=>{const t=e[r],o=`presentation-${r}`,{content:a,info:s}=t;return`<Presentation id="${o}" code="${C(a)}" theme="${s.trim()||"auto"}"></Presentation>`}})},$e=n=>{H(n,{name:"tabs",tabsOpenRenderer:({active:e,data:r},t,o)=>{const{meta:a}=t[o],s=r.map(({title:i,id:l})=>({title:i,...l?{id:l}:{}}));return`<Tabs id="${o}" :data='${JSON.stringify(s).replace(/'/g,"&#39")}'${e!==-1?` :active="${e}"`:""}${a.id?` tab-id="${a.id}"`:""}>
`},tabsCloseRenderer:()=>`</Tabs>
`,tabOpenRenderer:({index:e})=>`<template #tab${e}="{ title, value, isActive }">
`,tabCloseRenderer:()=>`</template>
`})},ve=n=>{j(n,{name:"v-pre",openRender:()=>`<div v-pre>
`,closeRender:()=>`</div>
`})},L={autoResize:!0,showCode:!1,showCompileOutput:!1,showImportMap:!0,clearConsole:!1,layout:"vertical",ssr:!1},ut=["html","js","ts","vue","jsx","tsx","json"],ft=n=>Buffer.from(JSON.stringify(B(E(n).filter(([,{ext:e}])=>ut.includes(e)).map(([e,r])=>[e,r.content])))).toString("base64"),Ce=n=>{n.use(_,{name:"vue-playground",component:"VuePlayground",propsGetter:({title:e="",key:r,files:t,settings:o})=>({title:e,key:r,settings:encodeURIComponent(JSON.stringify(o||{})),files:encodeURIComponent(ft(t))})})},ke={"/en/":{info:"Info",note:"Note",tip:"Tips",warning:"Note",danger:"Warning",details:"Details"},"/zh/":{info:"相关信息",note:"注",tip:"提示",warning:"注意",danger:"警告",details:"详情"},"/zh-tw/":{info:"相關信息",note:"注",tip:"提示",warning:"注意",danger:"警告",details:"詳情"},"/de/":{info:"Information",note:"Notiz",tip:"Tips",warning:"Warnung",danger:"Gefahr",details:"Details"},"/de-at/":{info:"Information",note:"Note",tip:"Tips",warning:"Notiz",danger:"Warnung",details:"Details"},"/vi/":{info:"Thông tin",note:"Note",tip:"Tips",warning:"Lưu ý",danger:"Cẩn thận",details:"Chi tiết"},"/uk/":{info:"Інформація",note:"Note",tip:"Поради",warning:"Примітка",danger:"Увага",details:"Деталь"},"/ru/":{info:"Инфо",note:"Заметка",tip:"Совет",warning:"Примечание",danger:"Предупреждение",details:"Подробности"},"/br/":{info:"Informativo",note:"Note",tip:"Dicas",warning:"Avisos",danger:"Cuidado",details:"Detalhe"},"/pl/":{info:"Info",note:"Notatka",tip:"Porady",warning:"Notatka",danger:"Ostrzeżenie",details:"Dane"},"/sk/":{info:"Info",note:"Poznámka",tip:"Tip",warning:"Upozornenie",danger:"Pozor",details:"Podrobnosti"},"/fr/":{info:"Info",note:"Note",tip:"Conseil",warning:"Note",danger:"Avertissement",details:"Details"},"/es/":{info:"Información",note:"Nota",tip:"Consejos",warning:"Aviso",danger:"Advertencia",details:"Detalles"},"/ja/":{info:"関連情報",note:"注",tip:"ヒント",warning:"注意",danger:"警告",details:"詳細"},"/tr/":{info:"Bilgi",note:"Not",tip:"Tavsiye",warning:"Uyarı",danger:"Tehlike",details:"Detay"},"/ko/":{info:"정보",note:"노트",tip:"팁",warning:"경고",danger:"위험",details:"세부사항"},"/fi/":{info:"Tietoa",note:"Huomautus",tip:"Vinkki",warning:"Varoitus",danger:"Vaara",details:"Yksityiskohdat"}},yt=(n,e)=>{const{linkCheck:r="dev"}=e;return typeof r=="boolean"?r:r==="always"||n.env.isDev&&r==="dev"||n.env.isBuild&&r==="build"||!1},we=(n,e)=>{const r=n.filePathRelative||n.path,{pages:t}=e,o=n.links.filter(({raw:s})=>s.match(/.md((?:\?|#).*)?$/)),a=[...o.filter(({raw:s})=>!W(s)).filter(({relative:s})=>t.every(({filePathRelative:i})=>i!==decodeURI(s))),...o.filter(({raw:s})=>W(s)).filter(({absolute:s})=>t.every(({filePathRelative:i})=>!i||`${e.options.base}${i}`!==decodeURI(s)))].map(({raw:s})=>s);a.length&&Ae.warn(`Broken links found in ${r}: ${a.join(", ")}`)},gt=Ue(import.meta.url),T=new Re("vuepress-plugin-md-enhance"),b=Ee(Q.resolve(gt,"../client")),O=({options:n,deprecatedOption:e,newOption:r,msg:t="",scope:o=""})=>{if(e in n){if(T.warn(`${D.magenta(e)} is ${D.yellow("deprecated")}${o?` in ${o}`:""}, please use "${D.magenta(r)}" instead.${t?`
${t}`:""}`),r.includes(".")){const a=r.split(".");let s=n;a.forEach((i,l)=>{l!==a.length-1?(s[i]=s[i]||{},s=s[i]):s[i]=n[e]})}else n[r]=n[e];delete n[e]}},F=(n,e,r="",t="")=>{e in n&&(T.error(`"${D.magenta(e)}" is ${D.red("removed")}${t?`, please use ${D.magenta(t)} instead.`:" and no longer supported"}${r?`
${r}`:""}`),t||delete n[e])},ht=n=>{O({options:n,deprecatedOption:"codegroup",newOption:"codetabs"}),O({options:n,deprecatedOption:"lazyload",newOption:"imgLazyload"}),O({options:n,deprecatedOption:"imageLazyload",newOption:"imgLazyload"}),O({options:n,deprecatedOption:"imageMark",newOption:"imgMark"}),O({options:n,deprecatedOption:"imageSize",newOption:"imgSize"}),O({options:n,deprecatedOption:"mdImport",newOption:"include"}),O({options:n,deprecatedOption:"tex",newOption:"katex"}),O({options:n,deprecatedOption:"vpre",newOption:"vPre"}),O({options:n,deprecatedOption:"imageTitle",newOption:"figure"}),F(n,"enableAll"),F(n,"lineNumbers"),F(n,"imageFix")},bt=n=>{n.use(j,{name:"demo",openRender:(e,r)=>{const{info:t}=e[r],o=/\[(.*)\]/u.exec(t),a=/^ demo\s*(?:\[.*?\])?\s*(.*)\s*$/u.exec(t);let s="";const i={};for(let l=r;l<e.length;l++){const{type:y,content:d,info:c}=e[l];if(y==="container_demo_close")break;d&&y==="fence"&&(c==="json"?s=C(d):i[c]=d)}return`
<CodeDemo id="code-demo-${r}" type="${(o==null?void 0:o[1])||"normal"}"${a?` title="${encodeURIComponent(a[1])}"`:""}${s?` config="${s}"`:""} code="${C(JSON.stringify(i))}">
`},closeRender:()=>"</CodeDemo>"})},$t=n=>{n.use(j,{name:"code-group",openRender:(e,r,t,o)=>(T.warn(`Deprecated code-group syntax found${o.filePathRelative?`in ${o.filePathRelative}`:""}, you should use code tabs instead. See https://plugin-md-enhance.vuejs.press/guide/code-tabs.html`),`<CodeGroup>
`),closeRender:()=>`</CodeGroup>
`}),n.use(j,{name:"code-group-item",openRender:(e,r)=>{const{info:t}=e[r],o=t.split(":").pop()==="active";return`<CodeGroupItem title="${o?t.replace(/:active$/,""):t}"${o?" active":""}>
`},closeRender:()=>`</CodeGroupItem>
`})},vt=n=>{X(n,{name:"flowchart",open:"flowstart",close:"flowend",render:(e,r)=>{console.warn('"@flowstart ... @flowend" is deprecated, you should use ```flow ... ``` instead.');const t=e[r],o=`flowchart-${r}`,{content:a,info:s}=t;return`<FlowChart id="${o}" code="${C(a)}" preset="${s.trim()||"vue"}"></FlowChart>`}})},Ct=ot(import.meta.url),kt=async(n,e,r=!0)=>{let t="",o="";const a=(s,i=!1)=>s in e?Boolean(e[s]):i&&"gfm"in e&&e.gfm||!1;return a("chart")&&(t+=`import ChartJS from "${b}components/ChartJS.js";
`,o+=`app.component("ChartJS", ChartJS);
`),a("codetabs")&&(t+=`import CodeTabs from "${b}components/CodeTabs.js";
`,o+=`app.component("CodeTabs", CodeTabs);
`,r&&(t+=`import { hasGlobalComponent } from "${Q.resolve(Ct.resolve("vuepress-shared/client"))}";
import { CodeGroup, CodeGroupItem } from "${b}compact/index.js";
`,o+=`if(!hasGlobalComponent("CodeGroup", app))
  app.component("CodeGroup", CodeGroup);
if(!hasGlobalComponent("CodeGroupItem", app))
  app.component("CodeGroupItem", CodeGroupItem);
`)),a("container")&&(t+=`import "${b}styles/container/index.scss";
`),a("demo")&&(t+=`import CodeDemo from "${b}components/CodeDemo.js";
`,o+=`app.component("CodeDemo", CodeDemo);
`),a("echarts")&&(t+=`import ECharts from "${b}components/ECharts.js";
`,o+=`app.component("ECharts", ECharts);
`),a("figure",!0)&&(t+=`import "${b}styles/figure.scss";
`),a("flowchart")&&(t+=`import FlowChart from "${b}components/FlowChart.js";
`,o+=`app.component("FlowChart", FlowChart);
`),a("footnote",!0)&&(t+=`import "${b}styles/footnote.scss";
`),a("imgMark",!0)&&(t+=`import "${b}styles/image-mark.scss";
`),a("mermaid")&&(t+=`import Mermaid from "${b}components/Mermaid.js";
`,o+=`app.component("Mermaid", Mermaid);
`),a("presentation")&&(t+=`import Presentation from "${b}components/Presentation.js";
`,o+=`app.component("Presentation", Presentation);
`),a("playground")&&(t+=`import Playground from "${b}components/Playground.js";
`,o+=`app.component("Playground", Playground);
`),a("tabs")&&(t+=`import Tabs from "${b}components/Tabs.js";
`,o+=`app.component("Tabs", Tabs);
`),a("tasklist",!0)&&(t+=`import "${b}styles/tasklist.scss";
`),a("katex")&&(t+=`import "${b}styles/katex.scss";
`),a("vuePlayground")&&(t+=`import { defineAsyncComponent } from "vue";
`,o+=`app.component("VuePlayground", defineAsyncComponent(() => import("${b}components/VuePlayground.js")));
    `),a("mathjax")&&(t+=`import "./mathjax.css";
`),n.writeTemp("md-enhance/config.js",`import { defineClientConfig } from "@vuepress/client";
${t}

export default defineClientConfig({
  enhance: ({ app }) => {
${o.split(`
`).map(s=>`    ${s}`).join(`
`)}
  },
});
`)},wt=`mjx-container {
  overflow-x: auto;
}
`,jt=async(n,e)=>{await n.writeTemp("md-enhance/mathjax.css",`${Ye(e)}
${wt}`)},Ot=async(n,e)=>{const r=["reveal","revealMarkdown",...e.map(t=>`reveal${t[0].toUpperCase()}${t.substring(1)}`)];await n.writeTemp("md-enhance/reveal.js",`import { ${r.join(", ")} } from "${b}reveal/index.js";

export const useReveal = () => [${r.map(t=>`${t}()`).join(", ")}];
`)},xt=(n={gfm:!0},e=!0)=>r=>{e&&ht(n),r.env.isDebug&&T.info("Options:",n);const t=(p,h=!1)=>p in n?Boolean(n[p]):h&&"gfm"in n&&n.gfm||!1,o=Se({app:r,name:"md-enhance",default:ke,config:n.locales}),a=t("chart"),s=t("echarts"),i=t("flowchart"),l=t("footnote",!0),y=t("imgMark",!0),d=t("tasklist",!0),c=t("mermaid"),v=t("presentation"),u=t("katex"),g=t("mathjax"),m=t("vuePlayground"),f=yt(r,n),k={macros:{"\\liiiint":"\\int\\!\\!\\!\\iiint","\\iiiint":"\\int\\!\\!\\!\\!\\iiint","\\idotsint":"\\int\\!\\cdots\\!\\int"},...$(n.katex)?n.katex:{}},S=n.mathjax===!1?null:Ke($(n.mathjax)?n.mathjax:{}),z=$(n.presentation)&&Te(n.presentation.plugins)?n.presentation.plugins:[];nt(r,{id:"hope"});let G=!1;return{name:"vuepress-plugin-md-enhance",define:()=>({MARKDOWN_ENHANCE_DELAY:n.delay||800,CODE_DEMO_OPTIONS:{...ee,...$(n.demo)?n.demo:{}},MERMAID_OPTIONS:$(n.mermaid)?n.mermaid:{},REVEAL_CONFIG:$(n.presentation)&&$(n.presentation.revealConfig)?n.presentation.revealConfig:{},VUE_PLAYGROUND_OPTIONS:$(n.vuePlayground)?N({},L,n.vuePlayground):L}),extendsBundlerOptions:(p,h)=>{var x,P,J;if(Pe(h)==="vite"){const R=(J=(P=(x=p.viteOptions)==null?void 0:x.build)==null?void 0:P.rollupOptions)==null?void 0:J.onwarn;Ie(p,h,{build:{rollupOptions:{onwarn(V,je){V.message.includes("Use of eval")||R==null||R(V,je)}}}})}De(p,h,["fflate","vuepress-shared"]),u&&k.output!=="html"?A(p,h,q):g&&(A(p,h,/^mjx-/),S!=null&&S.documentOptions.enableAssistiveMml&&A(p,h,q)),a&&(M(p,h,"chart.js/auto/auto.mjs"),I(p,h,"chart.js")),s&&(M(p,h,"echarts"),I(p,h,"echarts")),i&&(M(p,h,"flowchart.ts"),I(p,h,"flowchart.ts")),c&&(M(p,h,"mermaid"),I(p,h,"mermaid")),v&&(M(p,h,["reveal.js/dist/reveal.esm.js","reveal.js/plugin/markdown/markdown.esm.js",...z.map(R=>`reveal.js/plugin/${R}/${R}.esm.js`)]),I(p,h,"reveal.js")),m&&(Me(p,h,"@vue/repl"),I(p,h,"@vue/repl"),_e(p,h,R=>{R.module.set("exprContextCritical",!1),R.module.set("unknownContextCritical",!1)}))},extendsMarkdown:p=>{if(t("gfm")&&(p.options.linkify=!0),t("attrs")&&p.use(Fe,$(n.attrs)?n.attrs:{}),t("align")&&p.use(Le),t("container")&&p.use(pe,o),t("imgLazyload")&&p.use(Je),t("figure")&&p.use(ze),y&&p.use(Ve,$(n.imgMark)?n.imgMark:{}),t("imgSize")&&p.use(Be),t("sup")&&p.use(et),t("sub")&&p.use(Ze),l&&p.use(Ge),t("mark")&&p.use(He),d&&p.use(tt,[$(n.tasklist)?n.tasklist:{}]),(t("vPre")||e)&&p.use(ve),u?p.use(qe,k):g&&p.use(Qe,S),t("include")&&p.use(We,{currentPath:h=>h.filePath,...$(n.include)?n.include:{}}),t("stylize")&&p.use(Xe,{config:n.stylize,localConfigGetter:h=>{var x;return((x=h.frontmatter)==null?void 0:x.stylize)||null}}),t("codetabs")&&(p.use(re),e&&p.use($t)),t("tabs")&&p.use($e),i&&(p.use(le),e&&p.use(vt)),a&&p.use(Z),s&&p.use(se),t("demo")&&(p.use(te),p.use(ne),p.use(oe),e&&p.use(bt)),c&&p.use(ce),v&&p.use(be),$(n.playground)){const{presets:h=[],config:x={}}=n.playground;h.forEach(P=>{P==="ts"?p.use(_,fe(x.ts||{})):P==="vue"?p.use(_,he(x.vue||{})):$(P)&&p.use(_,P)})}m&&p.use(Ce)},extendsPage:(p,h)=>{f&&G&&we(p,h)},onInitialized:p=>{G=!0,f&&p.pages.forEach(h=>we(h,p))},onPrepared:async p=>Promise.all([g?jt(p,S):Promise.resolve(),Ot(p,z)]).then(()=>{}),clientConfigFile:p=>kt(p,n,e)}};export{ee as CODE_DEMO_DEFAULT_SETTING,L as DEFAULT_VUE_PLAYGROUND_OPTIONS,Z as chart,re as codeTabs,se as echarts,le as flowchart,fe as getTSPlaygroundPreset,ue as getURL,he as getVuePlaygroundPreset,pe as hint,ke as markdownEnhanceLocales,xt as mdEnhancePlugin,ce as mermaid,te as normalDemo,_ as playground,be as presentation,oe as reactDemo,$e as tabs,ve as vPre,ne as vueDemo,Ce as vuePlayground};
//# sourceMappingURL=index.js.map
