@wsxjs/wsx-press 0.0.22 → 0.0.24

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/node.cjs CHANGED
@@ -1,47 +1,47 @@
1
- "use strict";var _e=Object.defineProperty;var ie=a=>{throw TypeError(a)};var Ie=(a,t,e)=>t in a?_e(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var k=(a,t,e)=>Ie(a,typeof t!="symbol"?t+"":t,e),Ae=(a,t,e)=>t.has(a)||ie("Cannot "+e);var re=(a,t,e)=>t.has(a)?ie("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,e);var O=(a,t,e)=>(Ae(a,t,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ce=require("glob"),x=require("path"),m=require("fs-extra"),Q=require("typedoc"),je=require("./index-C1_yVVPT.cjs");async function C(a){const t=await Ce.glob("**/*.md",{cwd:a,absolute:!0}),e={};for(const n of t){const i=x.relative(a,n),r=await m.readFile(n,"utf-8"),s=ue(r),l=i.replace(/\.md$/,""),o=x.dirname(i);e[l]={title:s.title||x.basename(n,".md"),category:o==="."?".":o,route:`/docs/${l}`,...s}}return fe(e)}function ue(a){const t=a.match(/^---\n([\s\S]*?)\n---/);if(!t)return{};const e=t[1],n={};return e.split(`
2
- `).forEach(i=>{const r=i.indexOf(":");if(r===-1)return;const s=i.substring(0,r).trim(),l=i.substring(r+1).trim();s&&l&&(s==="title"||s==="description"||s==="category"?n[s]=l:s==="tags"?n.tags=l.replace(/[[\]]/g,"").split(",").map(o=>o.trim()):n[s]=l)}),n}function fe(a){const t=new Map;for(const[e,n]of Object.entries(a)){const i=n.category;t.has(i)||t.set(i,[]),t.get(i).push(e)}for(const[e,n]of t){n.sort();for(let i=0;i<n.length;i++){const r=n[i];a[r].prev=i>0?`/docs/${n[i-1]}`:null,a[r].next=i<n.length-1?`/docs/${n[i+1]}`:null}}return a}async function H(a,t){const e=[];for(const[n,i]of Object.entries(a)){const r=x.join(t,`${n}.md`),l=(await m.readFile(r,"utf-8")).replace(/^---[\s\S]*?---/,"").replace(/```[\s\S]*?```/g,"").replace(/[#*`_[\]()]/g,"").trim();e.push({id:n,title:i.title,category:i.category,route:i.route,content:l.substring(0,500)})}return{documents:e,options:{keys:[{name:"title",weight:.7},{name:"content",weight:.3}],threshold:.3,includeScore:!0,includeMatches:!0}}}async function ge(a){const{entryPoints:t,tsconfig:e,outputDir:n,excludePrivate:i=!0,excludeProtected:r=!1,excludeInternal:s=!0,publicPath:l="/api/"}=a;for(const o of t)if(!await m.pathExists(o))throw new Error(`Entry point not found: ${o}`);if(!await m.pathExists(e))throw new Error(`TypeScript config not found: ${e}`);await m.ensureDir(n);try{const o=await Q.Application.bootstrapWithPlugins({entryPoints:t,tsconfig:e,plugin:["typedoc-plugin-markdown"],theme:"markdown",readme:"none",excludePrivate:i,excludeProtected:r,excludeInternal:s,publicPath:l});o.options.addReader(new Q.TSConfigReader),o.options.addReader(new Q.TypeDocReader);const p=await o.convert();if(!p)throw new Error("Failed to convert TypeScript project");await o.generateDocs(p,n)}catch(o){throw new Error(`Failed to generate API documentation: ${o instanceof Error?o.message:String(o)}`)}}function G(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let I=G();function de(a){I=a}const ke=/[&<>"']/,Pe=new RegExp(ke.source,"g"),xe=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Ee=new RegExp(xe.source,"g"),ve={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},oe=a=>ve[a];function b(a,t){if(t){if(ke.test(a))return a.replace(Pe,oe)}else if(xe.test(a))return a.replace(Ee,oe);return a}const Oe=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Le(a){return a.replace(Oe,(t,e)=>(e=e.toLowerCase(),e==="colon"?":":e.charAt(0)==="#"?e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}const De=/(^|[^\[])\^/g;function d(a,t){let e=typeof a=="string"?a:a.source;t=t||"";const n={replace:(i,r)=>{let s=typeof r=="string"?r:r.source;return s=s.replace(De,"$1"),e=e.replace(i,s),n},getRegex:()=>new RegExp(e,t)};return n}function le(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}const j={exec:()=>null};function ae(a,t){const e=a.replace(/\|/g,(r,s,l)=>{let o=!1,p=s;for(;--p>=0&&l[p]==="\\";)o=!o;return o?"|":" |"}),n=e.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function L(a,t,e){const n=a.length;if(n===0)return"";let i=0;for(;i<n&&a.charAt(n-i-1)===t;)i++;return a.slice(0,n-i)}function qe(a,t){if(a.indexOf(t[1])===-1)return-1;let e=0;for(let n=0;n<a.length;n++)if(a[n]==="\\")n++;else if(a[n]===t[0])e++;else if(a[n]===t[1]&&(e--,e<0))return n;return-1}function ce(a,t,e,n){const i=t.href,r=t.title?b(t.title):null,s=a[1].replace(/\\([\[\]])/g,"$1");if(a[0].charAt(0)!=="!"){n.state.inLink=!0;const l={type:"link",raw:e,href:i,title:r,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,l}return{type:"image",raw:e,href:i,title:r,text:b(s)}}function Ze(a,t){const e=a.match(/^(\s+)(?:```)/);if(e===null)return t;const n=e[1];return t.split(`
3
- `).map(i=>{const r=i.match(/^\s+/);if(r===null)return i;const[s]=r;return s.length>=n.length?i.slice(n.length):i}).join(`
4
- `)}class q{constructor(t){k(this,"options");k(this,"rules");k(this,"lexer");this.options=t||I}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:L(n,`
5
- `)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],i=Ze(n,e[3]||"");return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(/#$/.test(n)){const i=L(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=e[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
6
- $1`);n=L(n.replace(/^ *>[ \t]?/gm,""),`
7
- `);const i=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:e[0],tokens:r,text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim();const i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const s=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let l="",o="",p=!1;for(;t;){let c=!1;if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;l=e[0],t=t.substring(l.length);let u=e[2].split(`
8
- `,1)[0].replace(/^\t+/,N=>" ".repeat(3*N.length)),h=t.split(`
1
+ "use strict";var _e=Object.defineProperty;var ie=a=>{throw TypeError(a)};var Ae=(a,n,e)=>n in a?_e(a,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[n]=e;var k=(a,n,e)=>Ae(a,typeof n!="symbol"?n+"":n,e),Ie=(a,n,e)=>n.has(a)||ie("Cannot "+e);var re=(a,n,e)=>n.has(a)?ie("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(a):n.set(a,e);var O=(a,n,e)=>(Ie(a,n,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ee=require("glob"),x=require("path"),m=require("fs-extra"),Q=require("typedoc"),Ce=require("./index-C1_yVVPT.cjs");async function E(a){const n=await Ee.glob("**/*.md",{cwd:a,absolute:!0}),e={};for(const t of n){const i=x.relative(a,t),r=await m.readFile(t,"utf-8"),s=ue(r),l=i.replace(/\.md$/,""),o=x.dirname(i);e[l]={title:s.title||x.basename(t,".md"),category:s.category||(o==="."?".":o),route:`/docs/${l}`,...s}}return fe(e)}function ue(a){const n=a.match(/^---\n([\s\S]*?)\n---/);if(!n)return{};const e=n[1],t={};return e.split(`
2
+ `).forEach(i=>{const r=i.indexOf(":");if(r===-1)return;const s=i.substring(0,r).trim(),l=i.substring(r+1).trim();if(s&&l)if(s==="title"||s==="description"||s==="category"){let o=l.replace(/^["']|["']$/g,"");o.includes("&")&&(o=o.replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")),t[s]=o}else if(s==="order"){const o=Number.parseInt(l,10);Number.isNaN(o)||(t.order=o)}else s==="tags"?t.tags=l.replace(/[[\]]/g,"").split(",").map(o=>o.trim()):t[s]=l}),t}function fe(a){const n=new Map;for(const[e,t]of Object.entries(a)){const i=t.category;n.has(i)||n.set(i,[]),n.get(i).push(e)}for(const[e,t]of n){t.sort((i,r)=>{const s=a[i].order??Number.MAX_SAFE_INTEGER,l=a[r].order??Number.MAX_SAFE_INTEGER;return s!==l?s-l:i.localeCompare(r)});for(let i=0;i<t.length;i++){const r=t[i];a[r].prev=i>0?`/docs/${t[i-1]}`:null,a[r].next=i<t.length-1?`/docs/${t[i+1]}`:null}}return a}async function H(a,n){const e=[];for(const[t,i]of Object.entries(a)){const r=x.join(n,`${t}.md`),l=(await m.readFile(r,"utf-8")).replace(/^---[\s\S]*?---/,"").replace(/```[\s\S]*?```/g,"").replace(/[#*`_[\]()]/g,"").trim();e.push({id:t,title:i.title,category:i.category,route:i.route,content:l.substring(0,500)})}return{documents:e,options:{keys:[{name:"title",weight:.7},{name:"content",weight:.3}],threshold:.3,includeScore:!0,includeMatches:!0}}}async function ge(a){const{entryPoints:n,tsconfig:e,outputDir:t,excludePrivate:i=!0,excludeProtected:r=!1,excludeInternal:s=!0,publicPath:l="/api/"}=a;for(const o of n)if(!await m.pathExists(o))throw new Error(`Entry point not found: ${o}`);if(!await m.pathExists(e))throw new Error(`TypeScript config not found: ${e}`);await m.ensureDir(t);try{const o=await Q.Application.bootstrapWithPlugins({entryPoints:n,tsconfig:e,plugin:["typedoc-plugin-markdown"],theme:"markdown",readme:"none",excludePrivate:i,excludeProtected:r,excludeInternal:s,publicPath:l});o.options.addReader(new Q.TSConfigReader),o.options.addReader(new Q.TypeDocReader);const p=await o.convert();if(!p)throw new Error("Failed to convert TypeScript project");await o.generateDocs(p,t)}catch(o){throw new Error(`Failed to generate API documentation: ${o instanceof Error?o.message:String(o)}`)}}function G(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let A=G();function de(a){A=a}const ke=/[&<>"']/,je=new RegExp(ke.source,"g"),xe=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Pe=new RegExp(xe.source,"g"),ve={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},oe=a=>ve[a];function b(a,n){if(n){if(ke.test(a))return a.replace(je,oe)}else if(xe.test(a))return a.replace(Pe,oe);return a}const Oe=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Le(a){return a.replace(Oe,(n,e)=>(e=e.toLowerCase(),e==="colon"?":":e.charAt(0)==="#"?e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}const De=/(^|[^\[])\^/g;function d(a,n){let e=typeof a=="string"?a:a.source;n=n||"";const t={replace:(i,r)=>{let s=typeof r=="string"?r:r.source;return s=s.replace(De,"$1"),e=e.replace(i,s),t},getRegex:()=>new RegExp(e,n)};return t}function le(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}const C={exec:()=>null};function ae(a,n){const e=a.replace(/\|/g,(r,s,l)=>{let o=!1,p=s;for(;--p>=0&&l[p]==="\\";)o=!o;return o?"|":" |"}),t=e.split(/ \|/);let i=0;if(t[0].trim()||t.shift(),t.length>0&&!t[t.length-1].trim()&&t.pop(),n)if(t.length>n)t.splice(n);else for(;t.length<n;)t.push("");for(;i<t.length;i++)t[i]=t[i].trim().replace(/\\\|/g,"|");return t}function L(a,n,e){const t=a.length;if(t===0)return"";let i=0;for(;i<t&&a.charAt(t-i-1)===n;)i++;return a.slice(0,t-i)}function qe(a,n){if(a.indexOf(n[1])===-1)return-1;let e=0;for(let t=0;t<a.length;t++)if(a[t]==="\\")t++;else if(a[t]===n[0])e++;else if(a[t]===n[1]&&(e--,e<0))return t;return-1}function ce(a,n,e,t){const i=n.href,r=n.title?b(n.title):null,s=a[1].replace(/\\([\[\]])/g,"$1");if(a[0].charAt(0)!=="!"){t.state.inLink=!0;const l={type:"link",raw:e,href:i,title:r,text:s,tokens:t.inlineTokens(s)};return t.state.inLink=!1,l}return{type:"image",raw:e,href:i,title:r,text:b(s)}}function Ne(a,n){const e=a.match(/^(\s+)(?:```)/);if(e===null)return n;const t=e[1];return n.split(`
3
+ `).map(i=>{const r=i.match(/^\s+/);if(r===null)return i;const[s]=r;return s.length>=t.length?i.slice(t.length):i}).join(`
4
+ `)}class q{constructor(n){k(this,"options");k(this,"rules");k(this,"lexer");this.options=n||A}space(n){const e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){const e=this.rules.block.code.exec(n);if(e){const t=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:L(t,`
5
+ `)}}}fences(n){const e=this.rules.block.fences.exec(n);if(e){const t=e[0],i=Ne(t,e[3]||"");return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(n){const e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(/#$/.test(t)){const i=L(t,"#");(this.options.pedantic||!i||/ $/.test(i))&&(t=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){const e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:e[0]}}blockquote(n){const e=this.rules.block.blockquote.exec(n);if(e){let t=e[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
6
+ $1`);t=L(t.replace(/^ *>[ \t]?/gm,""),`
7
+ `);const i=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(t);return this.lexer.state.top=i,{type:"blockquote",raw:e[0],tokens:r,text:t}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim();const i=t.length>1,r={type:"list",raw:"",ordered:i,start:i?+t.slice(0,-1):"",loose:!1,items:[]};t=i?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=i?t:"[*+-]");const s=new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`);let l="",o="",p=!1;for(;n;){let c=!1;if(!(e=s.exec(n))||this.rules.block.hr.test(n))break;l=e[0],n=n.substring(l.length);let u=e[2].split(`
8
+ `,1)[0].replace(/^\t+/,M=>" ".repeat(3*M.length)),h=n.split(`
9
9
  `,1)[0],f=0;this.options.pedantic?(f=2,o=u.trimStart()):(f=e[2].search(/[^ ]/),f=f>4?1:f,o=u.slice(f),f+=e[1].length);let w=!1;if(!u&&/^ *$/.test(h)&&(l+=h+`
10
- `,t=t.substring(h.length+1),c=!0),!c){const N=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),te=new RegExp(`^ {0,${Math.min(3,f-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),ne=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:\`\`\`|~~~)`),se=new RegExp(`^ {0,${Math.min(3,f-1)}}#`);for(;t;){const F=t.split(`
11
- `,1)[0];if(h=F,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),ne.test(h)||se.test(h)||N.test(h)||te.test(t))break;if(h.search(/[^ ]/)>=f||!h.trim())o+=`
10
+ `,n=n.substring(h.length+1),c=!0),!c){const M=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),te=new RegExp(`^ {0,${Math.min(3,f-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),ne=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:\`\`\`|~~~)`),se=new RegExp(`^ {0,${Math.min(3,f-1)}}#`);for(;n;){const F=n.split(`
11
+ `,1)[0];if(h=F,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),ne.test(h)||se.test(h)||M.test(h)||te.test(n))break;if(h.search(/[^ ]/)>=f||!h.trim())o+=`
12
12
  `+h.slice(f);else{if(w||u.search(/[^ ]/)>=4||ne.test(u)||se.test(u)||te.test(u))break;o+=`
13
13
  `+h}!w&&!h.trim()&&(w=!0),l+=F+`
14
- `,t=t.substring(F.length+1),u=h.slice(f)}}r.loose||(p?r.loose=!0:/\n *\n *$/.test(l)&&(p=!0));let y=null,R;this.options.gfm&&(y=/^\[[ xX]\] /.exec(o),y&&(R=y[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:l,task:!!y,checked:R,loose:!1,text:o,tokens:[]}),r.raw+=l}r.items[r.items.length-1].raw=l.trimEnd(),r.items[r.items.length-1].text=o.trimEnd(),r.raw=r.raw.trimEnd();for(let c=0;c<r.items.length;c++)if(this.lexer.state.top=!1,r.items[c].tokens=this.lexer.blockTokens(r.items[c].text,[]),!r.loose){const u=r.items[c].tokens.filter(f=>f.type==="space"),h=u.length>0&&u.some(f=>/\n.*\n/.test(f.raw));r.loose=h}if(r.loose)for(let c=0;c<r.items.length;c++)r.items[c].loose=!0;return r}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const n=e[1].toLowerCase().replace(/\s+/g," "),i=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:i,title:r}}}table(t){const e=this.rules.block.table.exec(t);if(!e||!/[:|]/.test(e[2]))return;const n=ae(e[1]),i=e[2].replace(/^\||\| *$/g,"").split("|"),r=e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
15
- `):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const l of i)/^ *-+: *$/.test(l)?s.align.push("right"):/^ *:-+: *$/.test(l)?s.align.push("center"):/^ *:-+ *$/.test(l)?s.align.push("left"):s.align.push(null);for(const l of n)s.header.push({text:l,tokens:this.lexer.inline(l)});for(const l of r)s.rows.push(ae(l,s.header.length).map(o=>({text:o,tokens:this.lexer.inline(o)})));return s}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
16
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:b(e[1])}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const s=L(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{const s=qe(e[2],"()");if(s>-1){const o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let i=e[2],r="";if(this.options.pedantic){const s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);s&&(i=s[1],r=s[3])}else r=e[3]?e[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),ce(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const i=(n[2]||n[1]).replace(/\s+/g," "),r=e[i.toLowerCase()];if(!r){const s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return ce(n,r,n[0],this.lexer)}}emStrong(t,e,n=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const s=[...i[0]].length-1;let l,o,p=s,c=0;const u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+s);(i=u.exec(e))!=null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l)continue;if(o=[...l].length,i[3]||i[4]){p+=o;continue}else if((i[5]||i[6])&&s%3&&!((s+o)%3)){c+=o;continue}if(p-=o,p>0)continue;o=Math.min(o,o+p+c);const h=[...i[0]][0].length,f=t.slice(0,s+i.index+h+o);if(Math.min(s,o)%2){const y=f.slice(1,-1);return{type:"em",raw:f,text:y,tokens:this.lexer.inlineTokens(y)}}const w=f.slice(2,-2);return{type:"strong",raw:f,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(/\n/g," ");const i=/[^ ]/.test(n),r=/^ /.test(n)&&/ $/.test(n);return i&&r&&(n=n.substring(1,n.length-1)),n=b(n,!0),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let n,i;return e[2]==="@"?(n=b(e[1]),i="mailto:"+n):(n=b(e[1]),i=n),{type:"link",raw:e[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let i,r;if(e[2]==="@")i=b(e[0]),r="mailto:"+i;else{let s;do s=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(s!==e[0]);i=b(e[0]),e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){let n;return this.lexer.state.inRawBlock?n=e[0]:n=b(e[0]),{type:"text",raw:e[0],text:n}}}}const Be=/^(?: *(?:\n|$))+/,Me=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Ne=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,E=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Fe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,me=/(?:[*+-]|\d{1,9}[.)])/,we=d(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,me).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),U=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Qe=/^[^\n]+/,X=/(?!\s*\])(?:\\.|[^\[\]\\])+/,He=d(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",X).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Je=d(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,me).getRegex(),M="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",K=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,We=d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",K).replace("tag",M).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),be=d(U).replace("hr",E).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",M).getRegex(),Ge=d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",be).getRegex(),V={blockquote:Ge,code:Me,def:He,fences:Ne,heading:Fe,hr:E,html:We,lheading:we,list:Je,newline:Be,paragraph:be,table:j,text:Qe},he=d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",E).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",M).getRegex(),Ue={...V,table:he,paragraph:d(U).replace("hr",E).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",he).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",M).getRegex()},Xe={...V,html:d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",K).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:j,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:d(U).replace("hr",E).replace("heading",` *#{1,6} *[^
17
- ]`).replace("lheading",we).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ye=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ke=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$e=/^( {2,}|\\)\n(?!\s*$)/,Ve=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,v="\\p{P}\\p{S}",Ye=d(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,v).getRegex(),et=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,tt=d(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,v).getRegex(),nt=d("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,v).getRegex(),st=d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,v).getRegex(),it=d(/\\([punct])/,"gu").replace(/punct/g,v).getRegex(),rt=d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ot=d(K).replace("(?:-->|$)","-->").getRegex(),lt=d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ot).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Z=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,at=d(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Z).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Te=d(/^!?\[(label)\]\[(ref)\]/).replace("label",Z).replace("ref",X).getRegex(),ze=d(/^!?\[(ref)\](?:\[\])?/).replace("ref",X).getRegex(),ct=d("reflink|nolink(?!\\()","g").replace("reflink",Te).replace("nolink",ze).getRegex(),Y={_backpedal:j,anyPunctuation:it,autolink:rt,blockSkip:et,br:$e,code:Ke,del:j,emStrongLDelim:tt,emStrongRDelimAst:nt,emStrongRDelimUnd:st,escape:ye,link:at,nolink:ze,punctuation:Ye,reflink:Te,reflinkSearch:ct,tag:lt,text:Ve,url:j},ht={...Y,link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",Z).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Z).getRegex()},J={...Y,escape:d(ye).replace("])","~|])").getRegex(),url:d(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},pt={...J,br:d($e).replace("{2,}","*").getRegex(),text:d(J.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},D={normal:V,gfm:Ue,pedantic:Xe},A={normal:Y,gfm:J,breaks:pt,pedantic:ht};class T{constructor(t){k(this,"tokens");k(this,"options");k(this,"state");k(this,"tokenizer");k(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||I,this.options.tokenizer=this.options.tokenizer||new q,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const e={block:D.normal,inline:A.normal};this.options.pedantic?(e.block=D.pedantic,e.inline=A.pedantic):this.options.gfm&&(e.block=D.gfm,this.options.breaks?e.inline=A.breaks:e.inline=A.gfm),this.tokenizer.rules=e}static get rules(){return{block:D,inline:A}}static lex(t,e){return new T(e).lex(t)}static lexInline(t,e){return new T(e).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
18
- `),this.blockTokens(t,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const n=this.inlineQueue[e];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,e=[]){this.options.pedantic?t=t.replace(/\t/g," ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(l,o,p)=>o+" ".repeat(p.length));let n,i,r,s;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(n=l.call({lexer:this},t,e))?(t=t.substring(n.raw.length),e.push(n),!0):!1))){if(n=this.tokenizer.space(t)){t=t.substring(n.raw.length),n.raw.length===1&&e.length>0?e[e.length-1].raw+=`
19
- `:e.push(n);continue}if(n=this.tokenizer.code(t)){t=t.substring(n.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
20
- `+n.raw,i.text+=`
21
- `+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(n);continue}if(n=this.tokenizer.fences(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.heading(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.hr(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.blockquote(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.list(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.html(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.def(t)){t=t.substring(n.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
22
- `+n.raw,i.text+=`
23
- `+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.lheading(t)){t=t.substring(n.raw.length),e.push(n);continue}if(r=t,this.options.extensions&&this.options.extensions.startBlock){let l=1/0;const o=t.slice(1);let p;this.options.extensions.startBlock.forEach(c=>{p=c.call({lexer:this},o),typeof p=="number"&&p>=0&&(l=Math.min(l,p))}),l<1/0&&l>=0&&(r=t.substring(0,l+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r))){i=e[e.length-1],s&&i.type==="paragraph"?(i.raw+=`
24
- `+n.raw,i.text+=`
25
- `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(n),s=r.length!==t.length,t=t.substring(n.raw.length);continue}if(n=this.tokenizer.text(t)){t=t.substring(n.raw.length),i=e[e.length-1],i&&i.type==="text"?(i.raw+=`
26
- `+n.raw,i.text+=`
27
- `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(n);continue}if(t){const l="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){let n,i,r,s=t,l,o,p;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,l.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(o||(p=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(n=c.call({lexer:this},t,e))?(t=t.substring(n.raw.length),e.push(n),!0):!1))){if(n=this.tokenizer.escape(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.tag(t)){t=t.substring(n.raw.length),i=e[e.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):e.push(n);continue}if(n=this.tokenizer.link(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(n.raw.length),i=e[e.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):e.push(n);continue}if(n=this.tokenizer.emStrong(t,s,p)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.codespan(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.br(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.del(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.autolink(t)){t=t.substring(n.raw.length),e.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(t))){t=t.substring(n.raw.length),e.push(n);continue}if(r=t,this.options.extensions&&this.options.extensions.startInline){let c=1/0;const u=t.slice(1);let h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(r=t.substring(0,c+1))}if(n=this.tokenizer.inlineText(r)){t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(p=n.raw.slice(-1)),o=!0,i=e[e.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):e.push(n);continue}if(t){const c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return e}}class B{constructor(t){k(this,"options");this.options=t||I}code(t,e,n){var r;const i=(r=(e||"").match(/^\S*/))==null?void 0:r[0];return t=t.replace(/\n$/,"")+`
28
- `,i?'<pre><code class="language-'+b(i)+'">'+(n?t:b(t,!0))+`</code></pre>
29
- `:"<pre><code>"+(n?t:b(t,!0))+`</code></pre>
30
- `}blockquote(t){return`<blockquote>
31
- ${t}</blockquote>
32
- `}html(t,e){return t}heading(t,e,n){return`<h${e}>${t}</h${e}>
14
+ `,n=n.substring(F.length+1),u=h.slice(f)}}r.loose||(p?r.loose=!0:/\n *\n *$/.test(l)&&(p=!0));let y=null,R;this.options.gfm&&(y=/^\[[ xX]\] /.exec(o),y&&(R=y[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:l,task:!!y,checked:R,loose:!1,text:o,tokens:[]}),r.raw+=l}r.items[r.items.length-1].raw=l.trimEnd(),r.items[r.items.length-1].text=o.trimEnd(),r.raw=r.raw.trimEnd();for(let c=0;c<r.items.length;c++)if(this.lexer.state.top=!1,r.items[c].tokens=this.lexer.blockTokens(r.items[c].text,[]),!r.loose){const u=r.items[c].tokens.filter(f=>f.type==="space"),h=u.length>0&&u.some(f=>/\n.*\n/.test(f.raw));r.loose=h}if(r.loose)for(let c=0;c<r.items.length;c++)r.items[c].loose=!0;return r}}html(n){const e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){const e=this.rules.block.def.exec(n);if(e){const t=e[1].toLowerCase().replace(/\s+/g," "),i=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:i,title:r}}}table(n){const e=this.rules.block.table.exec(n);if(!e||!/[:|]/.test(e[2]))return;const t=ae(e[1]),i=e[2].replace(/^\||\| *$/g,"").split("|"),r=e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
15
+ `):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===i.length){for(const l of i)/^ *-+: *$/.test(l)?s.align.push("right"):/^ *:-+: *$/.test(l)?s.align.push("center"):/^ *:-+ *$/.test(l)?s.align.push("left"):s.align.push(null);for(const l of t)s.header.push({text:l,tokens:this.lexer.inline(l)});for(const l of r)s.rows.push(ae(l,s.header.length).map(o=>({text:o,tokens:this.lexer.inline(o)})));return s}}lheading(n){const e=this.rules.block.lheading.exec(n);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(n){const e=this.rules.block.paragraph.exec(n);if(e){const t=e[1].charAt(e[1].length-1)===`
16
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){const e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){const e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:b(e[1])}}tag(n){const e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){const e=this.rules.inline.link.exec(n);if(e){const t=e[2].trim();if(!this.options.pedantic&&/^</.test(t)){if(!/>$/.test(t))return;const s=L(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{const s=qe(e[2],"()");if(s>-1){const o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let i=e[2],r="";if(this.options.pedantic){const s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);s&&(i=s[1],r=s[3])}else r=e[3]?e[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(t)?i=i.slice(1):i=i.slice(1,-1)),ce(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){const i=(t[2]||t[1]).replace(/\s+/g," "),r=e[i.toLowerCase()];if(!r){const s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return ce(t,r,t[0],this.lexer)}}emStrong(n,e,t=""){let i=this.rules.inline.emStrongLDelim.exec(n);if(!i||i[3]&&t.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!t||this.rules.inline.punctuation.exec(t)){const s=[...i[0]].length-1;let l,o,p=s,c=0;const u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*n.length+s);(i=u.exec(e))!=null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l)continue;if(o=[...l].length,i[3]||i[4]){p+=o;continue}else if((i[5]||i[6])&&s%3&&!((s+o)%3)){c+=o;continue}if(p-=o,p>0)continue;o=Math.min(o,o+p+c);const h=[...i[0]][0].length,f=n.slice(0,s+i.index+h+o);if(Math.min(s,o)%2){const y=f.slice(1,-1);return{type:"em",raw:f,text:y,tokens:this.lexer.inlineTokens(y)}}const w=f.slice(2,-2);return{type:"strong",raw:f,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(n){const e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(/\n/g," ");const i=/[^ ]/.test(t),r=/^ /.test(t)&&/ $/.test(t);return i&&r&&(t=t.substring(1,t.length-1)),t=b(t,!0),{type:"codespan",raw:e[0],text:t}}}br(n){const e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n){const e=this.rules.inline.del.exec(n);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){const e=this.rules.inline.autolink.exec(n);if(e){let t,i;return e[2]==="@"?(t=b(e[1]),i="mailto:"+t):(t=b(e[1]),i=t),{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let i,r;if(e[2]==="@")i=b(e[0]),r="mailto:"+i;else{let s;do s=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(s!==e[0]);i=b(e[0]),e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(n){const e=this.rules.inline.text.exec(n);if(e){let t;return this.lexer.state.inRawBlock?t=e[0]:t=b(e[0]),{type:"text",raw:e[0],text:t}}}}const Ze=/^(?: *(?:\n|$))+/,Be=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Me=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,P=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Fe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,me=/(?:[*+-]|\d{1,9}[.)])/,we=d(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,me).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),U=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Qe=/^[^\n]+/,X=/(?!\s*\])(?:\\.|[^\[\]\\])+/,He=d(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",X).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Je=d(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,me).getRegex(),B="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",V=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,We=d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",V).replace("tag",B).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),be=d(U).replace("hr",P).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex(),Ge=d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",be).getRegex(),K={blockquote:Ge,code:Be,def:He,fences:Me,heading:Fe,hr:P,html:We,lheading:we,list:Je,newline:Ze,paragraph:be,table:C,text:Qe},he=d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",P).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex(),Ue={...K,table:he,paragraph:d(U).replace("hr",P).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",he).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex()},Xe={...K,html:d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",V).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:C,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:d(U).replace("hr",P).replace("heading",` *#{1,6} *[^
17
+ ]`).replace("lheading",we).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ye=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ve=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$e=/^( {2,}|\\)\n(?!\s*$)/,Ke=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,v="\\p{P}\\p{S}",Ye=d(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,v).getRegex(),et=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,tt=d(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,v).getRegex(),nt=d("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,v).getRegex(),st=d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,v).getRegex(),it=d(/\\([punct])/,"gu").replace(/punct/g,v).getRegex(),rt=d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ot=d(V).replace("(?:-->|$)","-->").getRegex(),lt=d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ot).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),N=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,at=d(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",N).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Te=d(/^!?\[(label)\]\[(ref)\]/).replace("label",N).replace("ref",X).getRegex(),ze=d(/^!?\[(ref)\](?:\[\])?/).replace("ref",X).getRegex(),ct=d("reflink|nolink(?!\\()","g").replace("reflink",Te).replace("nolink",ze).getRegex(),Y={_backpedal:C,anyPunctuation:it,autolink:rt,blockSkip:et,br:$e,code:Ve,del:C,emStrongLDelim:tt,emStrongRDelimAst:nt,emStrongRDelimUnd:st,escape:ye,link:at,nolink:ze,punctuation:Ye,reflink:Te,reflinkSearch:ct,tag:lt,text:Ke,url:C},ht={...Y,link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",N).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",N).getRegex()},J={...Y,escape:d(ye).replace("])","~|])").getRegex(),url:d(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},pt={...J,br:d($e).replace("{2,}","*").getRegex(),text:d(J.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},D={normal:K,gfm:Ue,pedantic:Xe},I={normal:Y,gfm:J,breaks:pt,pedantic:ht};class T{constructor(n){k(this,"tokens");k(this,"options");k(this,"state");k(this,"tokenizer");k(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||A,this.options.tokenizer=this.options.tokenizer||new q,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const e={block:D.normal,inline:I.normal};this.options.pedantic?(e.block=D.pedantic,e.inline=I.pedantic):this.options.gfm&&(e.block=D.gfm,this.options.breaks?e.inline=I.breaks:e.inline=I.gfm),this.tokenizer.rules=e}static get rules(){return{block:D,inline:I}}static lex(n,e){return new T(e).lex(n)}static lexInline(n,e){return new T(e).inlineTokens(n)}lex(n){n=n.replace(/\r\n|\r/g,`
18
+ `),this.blockTokens(n,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,e=[]){this.options.pedantic?n=n.replace(/\t/g," ").replace(/^ +$/gm,""):n=n.replace(/^( *)(\t+)/gm,(l,o,p)=>o+" ".repeat(p.length));let t,i,r,s;for(;n;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(t=l.call({lexer:this},n,e))?(n=n.substring(t.raw.length),e.push(t),!0):!1))){if(t=this.tokenizer.space(n)){n=n.substring(t.raw.length),t.raw.length===1&&e.length>0?e[e.length-1].raw+=`
19
+ `:e.push(t);continue}if(t=this.tokenizer.code(n)){n=n.substring(t.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
20
+ `+t.raw,i.text+=`
21
+ `+t.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(t);continue}if(t=this.tokenizer.fences(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.heading(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.hr(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.blockquote(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.list(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.html(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.def(n)){n=n.substring(t.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
22
+ `+t.raw,i.text+=`
23
+ `+t.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[t.tag]||(this.tokens.links[t.tag]={href:t.href,title:t.title});continue}if(t=this.tokenizer.table(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.lheading(n)){n=n.substring(t.raw.length),e.push(t);continue}if(r=n,this.options.extensions&&this.options.extensions.startBlock){let l=1/0;const o=n.slice(1);let p;this.options.extensions.startBlock.forEach(c=>{p=c.call({lexer:this},o),typeof p=="number"&&p>=0&&(l=Math.min(l,p))}),l<1/0&&l>=0&&(r=n.substring(0,l+1))}if(this.state.top&&(t=this.tokenizer.paragraph(r))){i=e[e.length-1],s&&i.type==="paragraph"?(i.raw+=`
24
+ `+t.raw,i.text+=`
25
+ `+t.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(t),s=r.length!==n.length,n=n.substring(t.raw.length);continue}if(t=this.tokenizer.text(n)){n=n.substring(t.raw.length),i=e[e.length-1],i&&i.type==="text"?(i.raw+=`
26
+ `+t.raw,i.text+=`
27
+ `+t.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(t);continue}if(n){const l="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,e}inline(n,e=[]){return this.inlineQueue.push({src:n,tokens:e}),e}inlineTokens(n,e=[]){let t,i,r,s=n,l,o,p;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,l.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;n;)if(o||(p=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(t=c.call({lexer:this},n,e))?(n=n.substring(t.raw.length),e.push(t),!0):!1))){if(t=this.tokenizer.escape(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.tag(n)){n=n.substring(t.raw.length),i=e[e.length-1],i&&t.type==="text"&&i.type==="text"?(i.raw+=t.raw,i.text+=t.text):e.push(t);continue}if(t=this.tokenizer.link(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(t.raw.length),i=e[e.length-1],i&&t.type==="text"&&i.type==="text"?(i.raw+=t.raw,i.text+=t.text):e.push(t);continue}if(t=this.tokenizer.emStrong(n,s,p)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.codespan(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.br(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.del(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.autolink(n)){n=n.substring(t.raw.length),e.push(t);continue}if(!this.state.inLink&&(t=this.tokenizer.url(n))){n=n.substring(t.raw.length),e.push(t);continue}if(r=n,this.options.extensions&&this.options.extensions.startInline){let c=1/0;const u=n.slice(1);let h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(r=n.substring(0,c+1))}if(t=this.tokenizer.inlineText(r)){n=n.substring(t.raw.length),t.raw.slice(-1)!=="_"&&(p=t.raw.slice(-1)),o=!0,i=e[e.length-1],i&&i.type==="text"?(i.raw+=t.raw,i.text+=t.text):e.push(t);continue}if(n){const c="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return e}}class Z{constructor(n){k(this,"options");this.options=n||A}code(n,e,t){var r;const i=(r=(e||"").match(/^\S*/))==null?void 0:r[0];return n=n.replace(/\n$/,"")+`
28
+ `,i?'<pre><code class="language-'+b(i)+'">'+(t?n:b(n,!0))+`</code></pre>
29
+ `:"<pre><code>"+(t?n:b(n,!0))+`</code></pre>
30
+ `}blockquote(n){return`<blockquote>
31
+ ${n}</blockquote>
32
+ `}html(n,e){return n}heading(n,e,t){return`<h${e}>${n}</h${e}>
33
33
  `}hr(){return`<hr>
34
- `}list(t,e,n){const i=e?"ol":"ul",r=e&&n!==1?' start="'+n+'"':"";return"<"+i+r+`>
35
- `+t+"</"+i+`>
36
- `}listitem(t,e,n){return`<li>${t}</li>
37
- `}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(t){return`<p>${t}</p>
38
- `}table(t,e){return e&&(e=`<tbody>${e}</tbody>`),`<table>
34
+ `}list(n,e,t){const i=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+i+r+`>
35
+ `+n+"</"+i+`>
36
+ `}listitem(n,e,t){return`<li>${n}</li>
37
+ `}checkbox(n){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(n){return`<p>${n}</p>
38
+ `}table(n,e){return e&&(e=`<tbody>${e}</tbody>`),`<table>
39
39
  <thead>
40
- `+t+`</thead>
40
+ `+n+`</thead>
41
41
  `+e+`</table>
42
- `}tablerow(t){return`<tr>
43
- ${t}</tr>
44
- `}tablecell(t,e){const n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
45
- `}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return"<br>"}del(t){return`<del>${t}</del>`}link(t,e,n){const i=le(t);if(i===null)return n;t=i;let r='<a href="'+t+'"';return e&&(r+=' title="'+e+'"'),r+=">"+n+"</a>",r}image(t,e,n){const i=le(t);if(i===null)return n;t=i;let r=`<img src="${t}" alt="${n}"`;return e&&(r+=` title="${e}"`),r+=">",r}text(t){return t}}class ee{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,e,n){return""+n}image(t,e,n){return""+n}br(){return""}}class z{constructor(t){k(this,"options");k(this,"renderer");k(this,"textRenderer");this.options=t||I,this.options.renderer=this.options.renderer||new B,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ee}static parse(t,e){return new z(e).parse(t)}static parseInline(t,e){return new z(e).parseInline(t)}parse(t,e=!0){let n="";for(let i=0;i<t.length;i++){const r=t[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const s=r,l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){n+=l||"";continue}}switch(r.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{const s=r;n+=this.renderer.heading(this.parseInline(s.tokens),s.depth,Le(this.parseInline(s.tokens,this.textRenderer)));continue}case"code":{const s=r;n+=this.renderer.code(s.text,s.lang,!!s.escaped);continue}case"table":{const s=r;let l="",o="";for(let c=0;c<s.header.length;c++)o+=this.renderer.tablecell(this.parseInline(s.header[c].tokens),{header:!0,align:s.align[c]});l+=this.renderer.tablerow(o);let p="";for(let c=0;c<s.rows.length;c++){const u=s.rows[c];o="";for(let h=0;h<u.length;h++)o+=this.renderer.tablecell(this.parseInline(u[h].tokens),{header:!1,align:s.align[h]});p+=this.renderer.tablerow(o)}n+=this.renderer.table(l,p);continue}case"blockquote":{const s=r,l=this.parse(s.tokens);n+=this.renderer.blockquote(l);continue}case"list":{const s=r,l=s.ordered,o=s.start,p=s.loose;let c="";for(let u=0;u<s.items.length;u++){const h=s.items[u],f=h.checked,w=h.task;let y="";if(h.task){const R=this.renderer.checkbox(!!f);p?h.tokens.length>0&&h.tokens[0].type==="paragraph"?(h.tokens[0].text=R+" "+h.tokens[0].text,h.tokens[0].tokens&&h.tokens[0].tokens.length>0&&h.tokens[0].tokens[0].type==="text"&&(h.tokens[0].tokens[0].text=R+" "+h.tokens[0].tokens[0].text)):h.tokens.unshift({type:"text",text:R+" "}):y+=R+" "}y+=this.parse(h.tokens,p),c+=this.renderer.listitem(y,w,!!f)}n+=this.renderer.list(c,l,o);continue}case"html":{const s=r;n+=this.renderer.html(s.text,s.block);continue}case"paragraph":{const s=r;n+=this.renderer.paragraph(this.parseInline(s.tokens));continue}case"text":{let s=r,l=s.tokens?this.parseInline(s.tokens):s.text;for(;i+1<t.length&&t[i+1].type==="text";)s=t[++i],l+=`
46
- `+(s.tokens?this.parseInline(s.tokens):s.text);n+=e?this.renderer.paragraph(l):l;continue}default:{const s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}parseInline(t,e){e=e||this.renderer;let n="";for(let i=0;i<t.length;i++){const r=t[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const s=this.options.extensions.renderers[r.type].call({parser:this},r);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=s||"";continue}}switch(r.type){case"escape":{const s=r;n+=e.text(s.text);break}case"html":{const s=r;n+=e.html(s.text);break}case"link":{const s=r;n+=e.link(s.href,s.title,this.parseInline(s.tokens,e));break}case"image":{const s=r;n+=e.image(s.href,s.title,s.text);break}case"strong":{const s=r;n+=e.strong(this.parseInline(s.tokens,e));break}case"em":{const s=r;n+=e.em(this.parseInline(s.tokens,e));break}case"codespan":{const s=r;n+=e.codespan(s.text);break}case"br":{n+=e.br();break}case"del":{const s=r;n+=e.del(this.parseInline(s.tokens,e));break}case"text":{const s=r;n+=e.text(s.text);break}default:{const s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}}class P{constructor(t){k(this,"options");this.options=t||I}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}}k(P,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var _,W,Re;class ut{constructor(...t){re(this,_);k(this,"defaults",G());k(this,"options",this.setOptions);k(this,"parse",O(this,_,W).call(this,T.lex,z.parse));k(this,"parseInline",O(this,_,W).call(this,T.lexInline,z.parseInline));k(this,"Parser",z);k(this,"Renderer",B);k(this,"TextRenderer",ee);k(this,"Lexer",T);k(this,"Tokenizer",q);k(this,"Hooks",P);this.use(...t)}walkTokens(t,e){var i,r;let n=[];for(const s of t)switch(n=n.concat(e.call(this,s)),s.type){case"table":{const l=s;for(const o of l.header)n=n.concat(this.walkTokens(o.tokens,e));for(const o of l.rows)for(const p of o)n=n.concat(this.walkTokens(p.tokens,e));break}case"list":{const l=s;n=n.concat(this.walkTokens(l.items,e));break}default:{const l=s;(r=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&r[l.type]?this.defaults.extensions.childTokens[l.type].forEach(o=>{const p=l[o].flat(1/0);n=n.concat(this.walkTokens(p,e))}):l.tokens&&(n=n.concat(this.walkTokens(l.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){const s=e.renderers[r.name];s?e.renderers[r.name]=function(...l){let o=r.renderer.apply(this,l);return o===!1&&(o=s.apply(this,l)),o}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=e[r.level];s?s.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),i.extensions=e),n.renderer){const r=this.defaults.renderer||new B(this.defaults);for(const s in n.renderer){if(!(s in r))throw new Error(`renderer '${s}' does not exist`);if(s==="options")continue;const l=s,o=n.renderer[l],p=r[l];r[l]=(...c)=>{let u=o.apply(r,c);return u===!1&&(u=p.apply(r,c)),u||""}}i.renderer=r}if(n.tokenizer){const r=this.defaults.tokenizer||new q(this.defaults);for(const s in n.tokenizer){if(!(s in r))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const l=s,o=n.tokenizer[l],p=r[l];r[l]=(...c)=>{let u=o.apply(r,c);return u===!1&&(u=p.apply(r,c)),u}}i.tokenizer=r}if(n.hooks){const r=this.defaults.hooks||new P;for(const s in n.hooks){if(!(s in r))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;const l=s,o=n.hooks[l],p=r[l];P.passThroughHooks.has(s)?r[l]=c=>{if(this.defaults.async)return Promise.resolve(o.call(r,c)).then(h=>p.call(r,h));const u=o.call(r,c);return p.call(r,u)}:r[l]=(...c)=>{let u=o.apply(r,c);return u===!1&&(u=p.apply(r,c)),u}}i.hooks=r}if(n.walkTokens){const r=this.defaults.walkTokens,s=n.walkTokens;i.walkTokens=function(l){let o=[];return o.push(s.call(this,l)),r&&(o=o.concat(r.call(this,l))),o}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return T.lex(t,e??this.defaults)}parser(t,e){return z.parse(t,e??this.defaults)}}_=new WeakSet,W=function(t,e){return(n,i)=>{const r={...i},s={...this.defaults,...r};this.defaults.async===!0&&r.async===!1&&(s.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),s.async=!0);const l=O(this,_,Re).call(this,!!s.silent,!!s.async);if(typeof n>"u"||n===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(n):n).then(o=>t(o,s)).then(o=>s.hooks?s.hooks.processAllTokens(o):o).then(o=>s.walkTokens?Promise.all(this.walkTokens(o,s.walkTokens)).then(()=>o):o).then(o=>e(o,s)).then(o=>s.hooks?s.hooks.postprocess(o):o).catch(l);try{s.hooks&&(n=s.hooks.preprocess(n));let o=t(n,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let p=e(o,s);return s.hooks&&(p=s.hooks.postprocess(p)),p}catch(o){return l(o)}}},Re=function(t,e){return n=>{if(n.message+=`
47
- Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An error occurred:</p><pre>"+b(n.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(n);throw n}};const S=new ut;function g(a,t){return S.parse(a,t)}g.options=g.setOptions=function(a){return S.setOptions(a),g.defaults=S.defaults,de(g.defaults),g};g.getDefaults=G;g.defaults=I;g.use=function(...a){return S.use(...a),g.defaults=S.defaults,de(g.defaults),g};g.walkTokens=function(a,t){return S.walkTokens(a,t)};g.parseInline=S.parseInline;g.Parser=z;g.parser=z.parse;g.Renderer=B;g.TextRenderer=ee;g.Lexer=T;g.lexer=T.lex;g.Tokenizer=q;g.Hooks=P;g.parse=g;g.options;g.setOptions;g.use;g.walkTokens;g.parseInline;z.parse;T.lex;function ft(a){const t=a.replace(/^---[\s\S]*?---\n/,"");try{const e=g.lexer(t),n=[],i=[];for(const r of e)if(r.type==="heading"){const s=r,l=s.depth,o=Se(s.tokens),p=gt(o),c={level:l,text:o,id:p,children:[]};for(;i.length>0&&i[i.length-1].level>=l;)i.pop();i.length===0?n.push(c):i[i.length-1].children.push(c),i.push(c)}return n}catch(e){return console.warn("Failed to extract TOC from markdown:",e),[]}}function Se(a){return a.map(t=>{if(t.type==="text")return t.text;if(t.type==="strong"||t.type==="em"){const e=t;if("tokens"in e&&Array.isArray(e.tokens))return Se(e.tokens)}return""}).join("")}function gt(a){return a.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}async function pe(a,t){const e={};for(const[n,i]of Object.entries(a)){const r=x.join(t,`${n}.md`);if(await m.pathExists(r)){const s=await m.readFile(r,"utf-8"),l=ft(s);e[n]=l}}return e}const $=je.createLogger("WSXPress");function dt(a){const{docsRoot:t,api:e,outputDir:n=".wsx-press"}=a;let i,r;return{name:"vite-plugin-wsx-press",enforce:"pre",configResolved(s){const l=o=>o.startsWith("/")||/^[A-Za-z]:/.test(o)||o.startsWith("\\\\");i=l(n)?n:x.resolve(s.root,n),r=l(t)?t:x.resolve(s.root,t)},async buildStart(){try{if(!i||!r){const c=u=>u.startsWith("/")||/^[A-Za-z]:/.test(u)||u.startsWith("\\\\");i=c(n)?n:x.resolve(process.cwd(),n),r=c(t)?t:x.resolve(process.cwd(),t)}await m.ensureDir(i),$.info("Starting documentation generation..."),$.info(`Docs root: ${r}`),$.info(`Output dir: ${i}`);const s=await C(r),l=x.join(i,"docs-meta.json");await m.writeJSON(l,s,{spaces:2}),$.info(`✅ Generated docs-meta.json with ${Object.keys(s).length} documents`);const o=await H(s,r),p=x.join(i,"search-index.json");await m.writeJSON(p,o,{spaces:2}),$.info("✅ Generated search-index.json"),$.info("Generating TOC collection...");try{const c=await pe(s,r),u=x.join(i,"docs-toc.json");await m.writeJSON(u,c,{spaces:2}),$.info(`✅ Generated docs-toc.json with ${Object.keys(c).length} documents`)}catch(c){$.error("❌ Failed to generate TOC collection:",c)}if(e){const c=e.outputDir||x.join(r,"api");await ge({...e,outputDir:x.isAbsolute(c)?c:x.resolve(process.cwd(),c)})}}catch(s){throw $.error("Failed to generate documentation:",s),s}},configureServer(s){s.middlewares.use("/.wsx-press",async(l,o,p)=>{try{const h=new URL(l.url||"/",`http://${l.headers.host}`).pathname.replace(/^\/\.wsx-press\/?/,"").replace(/^\//,"");if(h==="docs-meta.json"||h==="search-index.json"||h==="docs-toc.json"){const f=x.join(i,h);if(await m.pathExists(f)){const w=await m.readFile(f,"utf-8");o.setHeader("Content-Type","application/json"),o.end(w);return}}if(h==="docs-meta.json"){const f=await C(r);await m.ensureDir(i),await m.writeJSON(x.join(i,"docs-meta.json"),f,{spaces:2}),o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(f,null,2));return}if(h==="search-index.json"){const f=await C(r),w=await H(f,r);await m.ensureDir(i),await m.writeJSON(x.join(i,"search-index.json"),w,{spaces:2}),o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(w,null,2));return}if(h==="docs-toc.json"){const f=await C(r),w=await pe(f,r);await m.ensureDir(i),await m.writeJSON(x.join(i,"docs-toc.json"),w,{spaces:2}),o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(w,null,2));return}p()}catch(c){$.error("Middleware error:",c),o.statusCode=500,o.end(JSON.stringify({error:String(c)}))}})}}}exports.addPrevNextLinks=fe;exports.extractFrontmatter=ue;exports.generateApiDocs=ge;exports.generateSearchIndex=H;exports.scanDocsMetadata=C;exports.wsxPress=dt;
42
+ `}tablerow(n){return`<tr>
43
+ ${n}</tr>
44
+ `}tablecell(n,e){const t=e.header?"th":"td";return(e.align?`<${t} align="${e.align}">`:`<${t}>`)+n+`</${t}>
45
+ `}strong(n){return`<strong>${n}</strong>`}em(n){return`<em>${n}</em>`}codespan(n){return`<code>${n}</code>`}br(){return"<br>"}del(n){return`<del>${n}</del>`}link(n,e,t){const i=le(n);if(i===null)return t;n=i;let r='<a href="'+n+'"';return e&&(r+=' title="'+e+'"'),r+=">"+t+"</a>",r}image(n,e,t){const i=le(n);if(i===null)return t;n=i;let r=`<img src="${n}" alt="${t}"`;return e&&(r+=` title="${e}"`),r+=">",r}text(n){return n}}class ee{strong(n){return n}em(n){return n}codespan(n){return n}del(n){return n}html(n){return n}text(n){return n}link(n,e,t){return""+t}image(n,e,t){return""+t}br(){return""}}class z{constructor(n){k(this,"options");k(this,"renderer");k(this,"textRenderer");this.options=n||A,this.options.renderer=this.options.renderer||new Z,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ee}static parse(n,e){return new z(e).parse(n)}static parseInline(n,e){return new z(e).parseInline(n)}parse(n,e=!0){let t="";for(let i=0;i<n.length;i++){const r=n[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const s=r,l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){t+=l||"";continue}}switch(r.type){case"space":continue;case"hr":{t+=this.renderer.hr();continue}case"heading":{const s=r;t+=this.renderer.heading(this.parseInline(s.tokens),s.depth,Le(this.parseInline(s.tokens,this.textRenderer)));continue}case"code":{const s=r;t+=this.renderer.code(s.text,s.lang,!!s.escaped);continue}case"table":{const s=r;let l="",o="";for(let c=0;c<s.header.length;c++)o+=this.renderer.tablecell(this.parseInline(s.header[c].tokens),{header:!0,align:s.align[c]});l+=this.renderer.tablerow(o);let p="";for(let c=0;c<s.rows.length;c++){const u=s.rows[c];o="";for(let h=0;h<u.length;h++)o+=this.renderer.tablecell(this.parseInline(u[h].tokens),{header:!1,align:s.align[h]});p+=this.renderer.tablerow(o)}t+=this.renderer.table(l,p);continue}case"blockquote":{const s=r,l=this.parse(s.tokens);t+=this.renderer.blockquote(l);continue}case"list":{const s=r,l=s.ordered,o=s.start,p=s.loose;let c="";for(let u=0;u<s.items.length;u++){const h=s.items[u],f=h.checked,w=h.task;let y="";if(h.task){const R=this.renderer.checkbox(!!f);p?h.tokens.length>0&&h.tokens[0].type==="paragraph"?(h.tokens[0].text=R+" "+h.tokens[0].text,h.tokens[0].tokens&&h.tokens[0].tokens.length>0&&h.tokens[0].tokens[0].type==="text"&&(h.tokens[0].tokens[0].text=R+" "+h.tokens[0].tokens[0].text)):h.tokens.unshift({type:"text",text:R+" "}):y+=R+" "}y+=this.parse(h.tokens,p),c+=this.renderer.listitem(y,w,!!f)}t+=this.renderer.list(c,l,o);continue}case"html":{const s=r;t+=this.renderer.html(s.text,s.block);continue}case"paragraph":{const s=r;t+=this.renderer.paragraph(this.parseInline(s.tokens));continue}case"text":{let s=r,l=s.tokens?this.parseInline(s.tokens):s.text;for(;i+1<n.length&&n[i+1].type==="text";)s=n[++i],l+=`
46
+ `+(s.tokens?this.parseInline(s.tokens):s.text);t+=e?this.renderer.paragraph(l):l;continue}default:{const s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}parseInline(n,e){e=e||this.renderer;let t="";for(let i=0;i<n.length;i++){const r=n[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const s=this.options.extensions.renderers[r.type].call({parser:this},r);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){t+=s||"";continue}}switch(r.type){case"escape":{const s=r;t+=e.text(s.text);break}case"html":{const s=r;t+=e.html(s.text);break}case"link":{const s=r;t+=e.link(s.href,s.title,this.parseInline(s.tokens,e));break}case"image":{const s=r;t+=e.image(s.href,s.title,s.text);break}case"strong":{const s=r;t+=e.strong(this.parseInline(s.tokens,e));break}case"em":{const s=r;t+=e.em(this.parseInline(s.tokens,e));break}case"codespan":{const s=r;t+=e.codespan(s.text);break}case"br":{t+=e.br();break}case"del":{const s=r;t+=e.del(this.parseInline(s.tokens,e));break}case"text":{const s=r;t+=e.text(s.text);break}default:{const s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}}class j{constructor(n){k(this,"options");this.options=n||A}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}}k(j,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var _,W,Re;class ut{constructor(...n){re(this,_);k(this,"defaults",G());k(this,"options",this.setOptions);k(this,"parse",O(this,_,W).call(this,T.lex,z.parse));k(this,"parseInline",O(this,_,W).call(this,T.lexInline,z.parseInline));k(this,"Parser",z);k(this,"Renderer",Z);k(this,"TextRenderer",ee);k(this,"Lexer",T);k(this,"Tokenizer",q);k(this,"Hooks",j);this.use(...n)}walkTokens(n,e){var i,r;let t=[];for(const s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{const l=s;for(const o of l.header)t=t.concat(this.walkTokens(o.tokens,e));for(const o of l.rows)for(const p of o)t=t.concat(this.walkTokens(p.tokens,e));break}case"list":{const l=s;t=t.concat(this.walkTokens(l.items,e));break}default:{const l=s;(r=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&r[l.type]?this.defaults.extensions.childTokens[l.type].forEach(o=>{const p=l[o].flat(1/0);t=t.concat(this.walkTokens(p,e))}):l.tokens&&(t=t.concat(this.walkTokens(l.tokens,e)))}}return t}use(...n){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{const i={...t};if(i.async=this.defaults.async||i.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){const s=e.renderers[r.name];s?e.renderers[r.name]=function(...l){let o=r.renderer.apply(this,l);return o===!1&&(o=s.apply(this,l)),o}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=e[r.level];s?s.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),i.extensions=e),t.renderer){const r=this.defaults.renderer||new Z(this.defaults);for(const s in t.renderer){if(!(s in r))throw new Error(`renderer '${s}' does not exist`);if(s==="options")continue;const l=s,o=t.renderer[l],p=r[l];r[l]=(...c)=>{let u=o.apply(r,c);return u===!1&&(u=p.apply(r,c)),u||""}}i.renderer=r}if(t.tokenizer){const r=this.defaults.tokenizer||new q(this.defaults);for(const s in t.tokenizer){if(!(s in r))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const l=s,o=t.tokenizer[l],p=r[l];r[l]=(...c)=>{let u=o.apply(r,c);return u===!1&&(u=p.apply(r,c)),u}}i.tokenizer=r}if(t.hooks){const r=this.defaults.hooks||new j;for(const s in t.hooks){if(!(s in r))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;const l=s,o=t.hooks[l],p=r[l];j.passThroughHooks.has(s)?r[l]=c=>{if(this.defaults.async)return Promise.resolve(o.call(r,c)).then(h=>p.call(r,h));const u=o.call(r,c);return p.call(r,u)}:r[l]=(...c)=>{let u=o.apply(r,c);return u===!1&&(u=p.apply(r,c)),u}}i.hooks=r}if(t.walkTokens){const r=this.defaults.walkTokens,s=t.walkTokens;i.walkTokens=function(l){let o=[];return o.push(s.call(this,l)),r&&(o=o.concat(r.call(this,l))),o}}this.defaults={...this.defaults,...i}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return T.lex(n,e??this.defaults)}parser(n,e){return z.parse(n,e??this.defaults)}}_=new WeakSet,W=function(n,e){return(t,i)=>{const r={...i},s={...this.defaults,...r};this.defaults.async===!0&&r.async===!1&&(s.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),s.async=!0);const l=O(this,_,Re).call(this,!!s.silent,!!s.async);if(typeof t>"u"||t===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(t):t).then(o=>n(o,s)).then(o=>s.hooks?s.hooks.processAllTokens(o):o).then(o=>s.walkTokens?Promise.all(this.walkTokens(o,s.walkTokens)).then(()=>o):o).then(o=>e(o,s)).then(o=>s.hooks?s.hooks.postprocess(o):o).catch(l);try{s.hooks&&(t=s.hooks.preprocess(t));let o=n(t,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let p=e(o,s);return s.hooks&&(p=s.hooks.postprocess(p)),p}catch(o){return l(o)}}},Re=function(n,e){return t=>{if(t.message+=`
47
+ Please report this to https://github.com/markedjs/marked.`,n){const i="<p>An error occurred:</p><pre>"+b(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}};const S=new ut;function g(a,n){return S.parse(a,n)}g.options=g.setOptions=function(a){return S.setOptions(a),g.defaults=S.defaults,de(g.defaults),g};g.getDefaults=G;g.defaults=A;g.use=function(...a){return S.use(...a),g.defaults=S.defaults,de(g.defaults),g};g.walkTokens=function(a,n){return S.walkTokens(a,n)};g.parseInline=S.parseInline;g.Parser=z;g.parser=z.parse;g.Renderer=Z;g.TextRenderer=ee;g.Lexer=T;g.lexer=T.lex;g.Tokenizer=q;g.Hooks=j;g.parse=g;g.options;g.setOptions;g.use;g.walkTokens;g.parseInline;z.parse;T.lex;function ft(a){const n=a.replace(/^---[\s\S]*?---\n/,"");try{const e=g.lexer(n),t=[],i=[];for(const r of e)if(r.type==="heading"){const s=r,l=s.depth,o=Se(s.tokens),p=gt(o),c={level:l,text:o,id:p,children:[]};for(;i.length>0&&i[i.length-1].level>=l;)i.pop();i.length===0?t.push(c):i[i.length-1].children.push(c),i.push(c)}return t}catch(e){return console.warn("Failed to extract TOC from markdown:",e),[]}}function Se(a){return a.map(n=>{if(n.type==="text")return n.text;if(n.type==="strong"||n.type==="em"){const e=n;if("tokens"in e&&Array.isArray(e.tokens))return Se(e.tokens)}return""}).join("")}function gt(a){return a.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}async function pe(a,n){const e={};for(const[t,i]of Object.entries(a)){const r=x.join(n,`${t}.md`);if(await m.pathExists(r)){const s=await m.readFile(r,"utf-8"),l=ft(s);e[t]=l}}return e}const $=Ce.createLogger("WSXPress");function dt(a){const{docsRoot:n,api:e,outputDir:t=".wsx-press"}=a;let i,r;return{name:"vite-plugin-wsx-press",enforce:"pre",configResolved(s){const l=o=>o.startsWith("/")||/^[A-Za-z]:/.test(o)||o.startsWith("\\\\");i=l(t)?t:x.resolve(s.root,t),r=l(n)?n:x.resolve(s.root,n)},async buildStart(){try{if(!i||!r){const c=u=>u.startsWith("/")||/^[A-Za-z]:/.test(u)||u.startsWith("\\\\");i=c(t)?t:x.resolve(process.cwd(),t),r=c(n)?n:x.resolve(process.cwd(),n)}await m.ensureDir(i),$.info("Starting documentation generation..."),$.info(`Docs root: ${r}`),$.info(`Output dir: ${i}`);const s=await E(r),l=x.join(i,"docs-meta.json");await m.writeJSON(l,s,{spaces:2}),$.info(`✅ Generated docs-meta.json with ${Object.keys(s).length} documents`);const o=await H(s,r),p=x.join(i,"search-index.json");await m.writeJSON(p,o,{spaces:2}),$.info("✅ Generated search-index.json"),$.info("Generating TOC collection...");try{const c=await pe(s,r),u=x.join(i,"docs-toc.json");await m.writeJSON(u,c,{spaces:2}),$.info(`✅ Generated docs-toc.json with ${Object.keys(c).length} documents`)}catch(c){$.error("❌ Failed to generate TOC collection:",c)}if(e){const c=e.outputDir||x.join(r,"api");await ge({...e,outputDir:x.isAbsolute(c)?c:x.resolve(process.cwd(),c)})}}catch(s){throw $.error("Failed to generate documentation:",s),s}},configureServer(s){s.middlewares.use("/.wsx-press",async(l,o,p)=>{try{const h=new URL(l.url||"/",`http://${l.headers.host}`).pathname.replace(/^\/\.wsx-press\/?/,"").replace(/^\//,"");if(h==="docs-meta.json"||h==="search-index.json"||h==="docs-toc.json"){const f=x.join(i,h);if(await m.pathExists(f)){const w=await m.readFile(f,"utf-8");o.setHeader("Content-Type","application/json"),o.end(w);return}}if(h==="docs-meta.json"){const f=await E(r);await m.ensureDir(i),await m.writeJSON(x.join(i,"docs-meta.json"),f,{spaces:2}),o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(f,null,2));return}if(h==="search-index.json"){const f=await E(r),w=await H(f,r);await m.ensureDir(i),await m.writeJSON(x.join(i,"search-index.json"),w,{spaces:2}),o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(w,null,2));return}if(h==="docs-toc.json"){const f=await E(r),w=await pe(f,r);await m.ensureDir(i),await m.writeJSON(x.join(i,"docs-toc.json"),w,{spaces:2}),o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(w,null,2));return}p()}catch(c){$.error("Middleware error:",c),o.statusCode=500,o.end(JSON.stringify({error:String(c)}))}})}}}exports.addPrevNextLinks=fe;exports.extractFrontmatter=ue;exports.generateApiDocs=ge;exports.generateSearchIndex=H;exports.scanDocsMetadata=E;exports.wsxPress=dt;