UNPKG

@wcj/markdown-to-html

Version:
2 lines 1.28 MB
/*! @wcj/markdown-to-html v3.0.5 | MIT © 2025 kenny wang <wowohoo@qq.com> (https://github.com/jaywcjlove) https://github.com/jaywcjlove/markdown-to-html */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).markdown={})}(this,function(e){"use strict";function t(e){return e&&"object"==typeof e?"position"in e||"type"in e?r(e.position):"start"in e||"end"in e?r(e):"line"in e||"column"in e?n(e):"":""}function n(e){return a(e&&e.line)+":"+a(e&&e.column)}function r(e){return n(e&&e.start)+"-"+n(e&&e.end)}function a(e){return e&&"number"==typeof e?e:1}class i extends Error{constructor(e,n,r){super(),"string"==typeof n&&(r=n,n=void 0);let a="",i={},o=!1;if(n&&(i="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),"string"==typeof e?a=e:!i.cause&&e&&(o=!0,a=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof r){const e=r.indexOf(":");-1===e?i.ruleId=r:(i.source=r.slice(0,e),i.ruleId=r.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=s?s.line:void 0,this.name=t(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}i.prototype.file="",i.prototype.name="",i.prototype.reason="",i.prototype.message="",i.prototype.stack="",i.prototype.column=void 0,i.prototype.line=void 0,i.prototype.ancestors=void 0,i.prototype.cause=void 0,i.prototype.fatal=void 0,i.prototype.place=void 0,i.prototype.ruleId=void 0,i.prototype.source=void 0;const o={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');s(e);let n,r=0,a=-1,i=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;i--;)if(47===e.codePointAt(i)){if(n){r=i+1;break}}else a<0&&(n=!0,a=i+1);return a<0?"":e.slice(r,a)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(47===e.codePointAt(i)){if(n){r=i+1;break}}else o<0&&(n=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(a=i):(l=-1,a=o));r===a?a=o:a<0&&(a=e.length);return e.slice(r,a)},dirname:function(e){if(s(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){s(e);let t,n=e.length,r=-1,a=0,i=-1,o=0;for(;n--;){const s=e.codePointAt(n);if(47!==s)r<0&&(t=!0,r=n+1),46===s?i<0?i=n:1!==o&&(o=1):i>-1&&(o=-1);else if(t){a=n+1;break}}if(i<0||r<0||0===o||1===o&&i===r-1&&i===a+1)return"";return e.slice(i,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)s(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){s(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,a="",i=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else{if(47===n)break;n=47}if(47===n){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(a.length<2||2!==i||46!==a.codePointAt(a.length-1)||46!==a.codePointAt(a.length-2))if(a.length>2){if(r=a.lastIndexOf("/"),r!==a.length-1){r<0?(a="",i=0):(a=a.slice(0,r),i=a.length-1-a.lastIndexOf("/")),o=l,s=0;continue}}else if(a.length>0){a="",i=0,o=l,s=0;continue}t&&(a=a.length>0?a+"/..":"..",i=2)}else a.length>0?a+="/"+e.slice(o+1,l):a=e.slice(o+1,l),i=l-o-1;o=l,s=0}else 46===n&&s>-1?s++:s=-1}return a}(e,!t);0!==n.length||t||(n=".");n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/");return t?"/"+n:n}(t)},sep:"/"};function s(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const l={cwd:function(){return"/"}};function c(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function u(e){if("string"==typeof e)e=new URL(e);else if(!c(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const d=["history","path","basename","stem","extname","dirname"];class p{constructor(e){let t;t=e?c(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":l.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,r=-1;for(;++r<d.length;){const e=d[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)d.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?o.basename(this.path):void 0}set basename(e){h(e,"basename"),m(e,"basename"),this.path=o.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?o.dirname(this.path):void 0}set dirname(e){g(this.basename,"dirname"),this.path=o.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?o.extname(this.path):void 0}set extname(e){if(m(e,"extname"),g(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=o.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){c(e)&&(e=u(e)),h(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?o.basename(this.path,this.extname):void 0}set stem(e){h(e,"stem"),m(e,"stem"),this.path=o.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new i(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){if(void 0===this.value)return"";if("string"==typeof this.value)return this.value;return new TextDecoder(e||void 0).decode(this.value)}}function m(e,t){if(e&&e.includes(o.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+o.sep+"`")}function h(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function g(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function f(e){if(e)throw e}function b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var E,T;var y=function(){if(T)return E;T=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},i=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,a=e.call(n,"constructor"),i=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!a&&!i)return!1;for(r in n);return void 0===r||e.call(n,r)},o=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},s=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return E=function e(){var t,n,r,l,c,u,d=arguments[0],p=1,m=arguments.length,h=!1;for("boolean"==typeof d&&(h=d,d=arguments[1]||{},p=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});p<m;++p)if(null!=(t=arguments[p]))for(n in t)r=s(d,n),d!==(l=s(t,n))&&(h&&l&&(i(l)||(c=a(l)))?(c?(c=!1,u=r&&a(r)?r:[]):u=r&&i(r)?r:{},o(d,{name:n,newValue:e(h,u,l)})):void 0!==l&&o(d,{name:n,newValue:l}));return d},E}(),S=b(y);function A(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function _(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function a(i,...o){const s=e[++n];let l=-1;if(i)r(i);else{for(;++l<t.length;)null!==o[l]&&void 0!==o[l]||(o[l]=t[l]);t=o,s?function(e,t){let n;return r;function r(...t){const r=e.length>t.length;let o;r&&t.push(a);try{o=e.apply(this,t)}catch(e){if(r&&n)throw e;return a(e)}r||(o&&o.then&&"function"==typeof o.then?o.then(i,a):o instanceof Error?a(o):i(o))}function a(e,...r){n||(n=!0,t(e,...r))}function i(e){a(null,e)}}(s,a)(...o):r(null,...o)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}const k=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},v={}.hasOwnProperty;class N extends k{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=_()}copy(){const e=new N;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(S(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(C("data",this.frozen),this.namespace[e]=t,this):v.call(this.namespace,e)&&this.namespace[e]||void 0:e?(C("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=D(e),n=this.parser||this.Parser;return w("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),w("process",this.parser||this.Parser),R("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,a){const i=D(e),o=n.parse(i);function s(e,n){e||!n?a(e):r?r(n):t(void 0,n)}n.run(o,i,function(e,t,r){if(e||!t||!r)return s(e);const a=t,i=n.stringify(a,r);var o;"string"==typeof(o=i)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(o)?r.value=i:r.result=i,s(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),w("processSync",this.parser||this.Parser),R("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,f(e),t=r}),x("processSync","process",n),t}run(e,t,n){O(e),this.freeze();const r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?a(void 0,n):new Promise(a);function a(a,i){const o=D(t);r.run(e,o,function(t,r,o){const s=r||e;t?i(t):a?a(s):n(void 0,s,o)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){f(e),n=t,r=!0}),x("runSync","run",r),n}stringify(e,t){this.freeze();const n=D(t),r=this.compiler||this.Compiler;return R("stringify",r),O(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(C("use",this.frozen),null==e);else if("function"==typeof e)s(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?o(e):i(e)}return this;function a(e){if("function"==typeof e)s(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;s(t,n)}else i(e)}}function i(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=S(!0,r.settings,e.settings))}function o(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){a(e[t])}}}function s(e,t){let r=-1,a=-1;for(;++r<n.length;)if(n[r][0]===e){a=r;break}if(-1===a)n.push([e,...t]);else if(t.length>0){let[r,...i]=t;const o=n[a][1];A(o)&&A(r)&&(r=S(!0,o,r)),n[a]=[e,r,...i]}}}}const I=(new N).freeze();function w(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function R(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function C(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function O(e){if(!A(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function x(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function D(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new p(e)}function L(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;-1!==a;)r++,a=n.indexOf(t,a+t.length);return r}const M=W(/[A-Za-z]/),P=W(/[\dA-Za-z]/),F=W(/[#-'*+\--9=?A-Z^-~]/);function B(e){return null!==e&&(e<32||127===e)}const U=W(/\d/),H=W(/[\dA-Fa-f]/),G=W(/[!-/:-@[-`{-~]/);function z(e){return null!==e&&e<-2}function $(e){return null!==e&&(e<0||32===e)}function q(e){return-2===e||-1===e||32===e}const V=W(/\p{P}|\p{S}/u),Y=W(/\s/);function W(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}const j=function(e){if(null==e)return X;if("function"==typeof e)return K(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=j(e[n]);return K(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return K(n);function n(n){const r=n;let a;for(a in e)if(r[a]!==t[a])return!1;return!0}}(e);if("string"==typeof e)return function(e){return K(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function K(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function X(){return!0}const Z=[],Q=!0,J=!1,ee="skip";function te(e,t,n,r){let a;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):a=t;const i=j(a),o=r?-1:1;!function e(a,s,l){const c=a&&"object"==typeof a?a:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+a.type+(e?"<"+e+">":"")+")"})}return u;function u(){let c,u,d,p=Z;if((!t||i(a,s,l[l.length-1]||void 0))&&(p=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[Q,e];return null==e?Z:[e]}(n(a,l)),p[0]===J))return p;if("children"in a&&a.children){const t=a;if(t.children&&p[0]!==ee)for(u=(r?t.children.length:-1)+o,d=l.concat(t);u>-1&&u<t.children.length;){const n=t.children[u];if(c=e(n,u,d)(),c[0]===J)return c;u="number"==typeof c[1]?c[1]:u+o}}return p}}(e,void 0,[])()}function ne(e,t,n){const r=j((n||{}).ignore||[]),a=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([re(e[0]),ae(e[1])])}return t}(t);let i=-1;for(;++i<a.length;)te(e,"text",o);function o(e,t){let n,o=-1;for(;++o<t.length;){const e=t[o],a=n?n.children:void 0;if(r(e,a?a.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=a[i][0],o=a[i][1];let s=0;const l=n.children,c=l.indexOf(e);let u=!1,d=[];r.lastIndex=0;let p=r.exec(e.value);for(;p;){const n=p.index,a={index:p.index,input:p.input,stack:[...t,e]};let i=o(...p,a);if("string"==typeof i&&(i=i.length>0?{type:"text",value:i}:void 0),!1===i?r.lastIndex=n+1:(s!==n&&d.push({type:"text",value:e.value.slice(s,n)}),Array.isArray(i)?d.push(...i):i&&d.push(i),s=n+p[0].length,u=!0),!r.global)break;p=r.exec(e.value)}u?(s<e.value.length&&d.push({type:"text",value:e.value.slice(s)}),n.children.splice(c,1,...d)):d=[e];return c+d.length}(e,t)}}function re(e){return"string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function ae(e){return"function"==typeof e?e:function(){return e}}const ie="phrasing",oe=["autolink","link","image","label"];function se(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function le(e){this.config.enter.autolinkProtocol.call(this,e)}function ce(e){this.config.exit.autolinkProtocol.call(this,e)}function ue(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function de(e){this.config.exit.autolinkEmail.call(this,e)}function pe(e){this.exit(e)}function me(e){ne(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,he],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,ge]],{ignore:["link","linkReference"]})}function he(e,t,n,r,a){let i="";if(!fe(a))return!1;if(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!function(e){const t=e.split(".");if(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))return!1;return!0}(n))return!1;const o=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=L(e,"(");let i=L(e,")");for(;-1!==r&&a>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}(n+r);if(!o[0])return!1;const s={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[s,{type:"text",value:o[1]}]:s}function ge(e,t,n,r){return!(!fe(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function fe(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||Y(n)||V(n))&&(!t||47!==n)}function be(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function Ee(){this.buffer()}function Te(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ye(){this.buffer()}function Se(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Ae(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=be(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _e(e){this.exit(e)}function ke(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=be(this.sliceSerialize(e)).toLowerCase(),n.label=t}function ve(e){this.exit(e)}function Ne(e,t,n,r){const a=n.createTracker(r);let i=a.move("[^");const o=n.enter("footnoteReference"),s=n.enter("reference");return i+=a.move(n.safe(n.associationId(e),{after:"]",before:i})),s(),o(),i+=a.move("]"),i}function Ie(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,n,r,a){const i=r.createTracker(a);let o=i.move("[^");const s=r.enter("footnoteDefinition"),l=r.enter("label");o+=i.move(r.safe(r.associationId(e),{before:o,after:"]"})),l(),o+=i.move("]:"),e.children&&e.children.length>0&&(i.shift(4),o+=i.move((t?"\n":" ")+r.indentLines(r.containerFlow(e,i.current()),t?Re:we)));return s(),o},footnoteReference:Ne},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function we(e,t,n){return 0===t?e:Re(e,t,n)}function Re(e,t,n){return(n?"":" ")+e}Ne.peek=function(){return"["};const Ce=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function Oe(e){this.enter({type:"delete",children:[]},e)}function xe(e){this.exit(e)}function De(e,t,n,r){const a=n.createTracker(r),i=n.enter("strikethrough");let o=a.move("~~");return o+=n.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),i(),o}function Le(e){return e.length}function Me(e){return null==e?"":String(e)}function Pe(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}De.peek=function(){return"~"};const Fe={}.hasOwnProperty;function Be(e,t){const n=t||{};function r(t,...n){let a=r.invalid;const i=r.handlers;if(t&&Fe.call(t,e)){const n=String(t[e]);a=Fe.call(i,n)?i[n]:r.unknown}if(a)return a.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function Ue(e,t,n){return">"+(n?"":" ")+e}function He(e,t){return Ge(e,t.inConstruct,!0)&&!Ge(e,t.notInConstruct,!1)}function Ge(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function ze(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if("\n"===n.unsafe[a].character&&He(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function $e(e,t,n){return(n?"":" ")+e}function qe(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Ve(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ye(e){return null===e||$(e)||Y(e)?1:V(e)?2:void 0}function We(e,t,n){const r=Ye(e),a=Ye(t);return void 0===r?void 0===a?"_"===n?{inside:!0,outside:!0}:{inside:!1,outside:!1}:1===a?{inside:!0,outside:!0}:{inside:!1,outside:!0}:1===r?void 0===a?{inside:!1,outside:!1}:1===a?{inside:!0,outside:!0}:{inside:!1,outside:!1}:void 0===a?{inside:!1,outside:!1}:1===a?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function je(e,t,n,r){const a=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),i=n.enter("emphasis"),o=n.createTracker(r),s=o.move(a);let l=o.move(n.containerPhrasing(e,{after:a,before:s,...o.current()}));const c=l.charCodeAt(0),u=We(r.before.charCodeAt(r.before.length-1),c,a);u.inside&&(l=Ve(c)+l.slice(1));const d=l.charCodeAt(l.length-1),p=We(r.after.charCodeAt(0),d,a);p.inside&&(l=l.slice(0,-1)+Ve(d));const m=o.move(a);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},s+l+m}function Ke(e,t,n,r){let a,i,o;"function"==typeof t&&"function"!=typeof n?(i=void 0,o=t,a=n):(i=t,o=n,a=r),te(e,i,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},a)}je.peek=function(e,t,n){return n.options.emphasis||"*"};const Xe={};function Ze(e,t){return Qe(e,"boolean"!=typeof Xe.includeImageAlt||Xe.includeImageAlt,"boolean"!=typeof Xe.includeHtml||Xe.includeHtml)}function Qe(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Je(e.children,t,n)}return Array.isArray(e)?Je(e,t,n):""}function Je(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Qe(e[a],t,n);return r.join("")}function et(e){return e.value||""}function tt(e,t,n,r){const a=qe(n),i='"'===a?"Quote":"Apostrophe",o=n.enter("image");let s=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(s=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),s(),e.title&&(s=n.enter(`title${i}`),c+=l.move(" "+a),c+=l.move(n.safe(e.title,{before:c,after:a,...l.current()})),c+=l.move(a),s()),c+=l.move(")"),o(),c}function nt(e,t,n,r){const a=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const s=n.createTracker(r);let l=s.move("![");const c=n.safe(e.alt,{before:l,after:"]",...s.current()});l+=s.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return o(),n.stack=u,i(),"full"!==a&&c&&c===d?"shortcut"===a?l=l.slice(0,-1):l+=s.move("]"):l+=s.move(d+"]"),l}function rt(e,t,n){let r=e.value||"",a="`",i=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const e=n.unsafe[i],t=n.compilePattern(e);let a;if(e.atBreak)for(;a=t.exec(r);){let e=a.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(a.index+1)}}return a+r+a}function at(e,t){const n=Ze(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function it(e,t,n,r){const a=qe(n),i='"'===a?"Quote":"Apostrophe",o=n.createTracker(r);let s,l;if(at(e,n)){const t=n.stack;n.stack=[],s=n.enter("autolink");let r=o.move("<");return r+=o.move(n.containerPhrasing(e,{before:r,after:">",...o.current()})),r+=o.move(">"),s(),n.stack=t,r}s=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=o.move(" "+a),c+=o.move(n.safe(e.title,{before:c,after:a,...o.current()})),c+=o.move(a),l()),c+=o.move(")"),s(),c}function ot(e,t,n,r){const a=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const s=n.createTracker(r);let l=s.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...s.current()});l+=s.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return o(),n.stack=u,i(),"full"!==a&&c&&c===d?"shortcut"===a?l=l.slice(0,-1):l+=s.move("]"):l+=s.move(d+"]"),l}function st(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function lt(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}et.peek=function(){return"<"},tt.peek=function(){return"!"},nt.peek=function(){return"!"},rt.peek=function(){return"`"},it.peek=function(e,t,n){return at(e,n)?"<":"["},ot.peek=function(){return"["};const ct=j(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ut(e,t,n,r){const a=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),i=n.enter("strong"),o=n.createTracker(r),s=o.move(a+a);let l=o.move(n.containerPhrasing(e,{after:a,before:s,...o.current()}));const c=l.charCodeAt(0),u=We(r.before.charCodeAt(r.before.length-1),c,a);u.inside&&(l=Ve(c)+l.slice(1));const d=l.charCodeAt(l.length-1),p=We(r.after.charCodeAt(0),d,a);p.inside&&(l=l.slice(0,-1)+Ve(d));const m=o.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},s+l+m}ut.peek=function(e,t,n){return n.options.strong||"*"};const dt={blockquote:function(e,t,n,r){const a=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),Ue);return a(),o},break:ze,code:function(e,t,n,r){const a=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),i=e.value||"",o="`"===a?"GraveAccent":"Tilde";if(function(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(i,$e);return e(),t}const s=n.createTracker(r),l=a.repeat(Math.max(function(e,t){const n=String(e);let r=n.indexOf(t),a=r,i=0,o=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===a?++i>o&&(o=i):i=1,a=r+t.length,r=n.indexOf(t,a);return o}(i,a)+1,3)),c=n.enter("codeFenced");let u=s.move(l);if(e.lang){const t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${o}`);u+=s.move(" "),u+=s.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...s.current()})),t()}return u+=s.move("\n"),i&&(u+=s.move(i+"\n")),u+=s.move(l),c(),u},definition:function(e,t,n,r){const a=qe(n),i='"'===a?"Quote":"Apostrophe",o=n.enter("definition");let s=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(s=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),s(),e.title&&(s=n.enter(`title${i}`),c+=l.move(" "+a),c+=l.move(n.safe(e.title,{before:c,after:a,...l.current()})),c+=l.move(a),s()),o(),c},emphasis:je,hardBreak:ze,heading:function(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(function(e,t){let n=!1;return Ke(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,J}),Boolean((!e.depth||e.depth<3)&&Ze(e)&&(t.options.setext||n))}(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),o=n.containerPhrasing(e,{...i.current(),before:"\n",after:"\n"});return r(),t(),o+"\n"+(1===a?"=":"-").repeat(o.length-(Math.max(o.lastIndexOf("\r"),o.lastIndexOf("\n"))+1))}const o="#".repeat(a),s=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...i.current()});return/^[\t ]/.test(c)&&(c=Ve(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),s(),c},html:et,image:tt,imageReference:nt,inlineCode:rt,link:it,linkReference:ot,list:function(e,t,n,r){const a=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):st(n);const s=e.ordered?"."===o?")":".":function(e){const t=st(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let l=!(!t||!n.bulletLastUsed)&&o===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==o&&"-"!==o||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(l=!0),lt(n)===o&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){l=!0;break}}}}l&&(o=s),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,a(),c},listItem:function(e,t,n,r){const a=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let i=n.bulletCurrent||st(n);t&&"list"===t.type&&t.ordered&&(i=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+i);let o=i.length+1;("tab"===a||"mixed"===a&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));const s=n.createTracker(r);s.move(i+" ".repeat(o-i.length)),s.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,s.current()),function(e,t,n){if(t)return(n?"":" ".repeat(o))+e;return(n?i:i+" ".repeat(o-i.length))+e});return l(),c},paragraph:function(e,t,n,r){const a=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),a(),o},root:function(e,t,n,r){const a=e.children.some(function(e){return ct(e)});return(a?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:ut,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(lt(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}},pt=document.createElement("i");function mt(e){const t="&"+e+";";pt.innerHTML=t;const n=pt.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&(n!==t&&n)}function ht(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}const gt=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ft(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return ht(n.slice(t?2:1),t?16:10)}return mt(n)||e}function bt(e){const t=e._align;this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function Et(e){this.exit(e),this.data.inTable=void 0}function Tt(e){this.enter({type:"tableRow",children:[]},e)}function yt(e){this.exit(e)}function St(e){this.enter({type:"tableCell",children:[]},e)}function At(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,_t));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function _t(e,t){return"|"===t?t:e}function kt(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=dt.inlineCode(e,t,n);n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&"));return r},table:function(e,t,n,r){return s(function(e,t,n){const r=e.children;let a=-1;const i=[],o=t.enter("table");for(;++a<r.length;)i[a]=l(r[a],t,n);return o(),i}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){const a=l(e,n,r),i=s([a]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,n,r){const a=n.enter("tableCell"),o=n.enter("phrasing"),s=n.containerPhrasing(e,{...r,before:i,after:i});return o(),a(),s}function s(e,t){return function(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||Le,i=[],o=[],s=[],l=[];let c=0,u=-1;for(;++u<e.length;){const t=[],r=[];let i=-1;for(e[u].length>c&&(c=e[u].length);++i<e[u].length;){const o=Me(e[u][i]);if(!1!==n.alignDelimiters){const e=a(o);r[i]=e,(void 0===l[i]||e>l[i])&&(l[i]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if("object"==typeof r&&"length"in r)for(;++d<c;)i[d]=Pe(r[d]);else{const e=Pe(r);for(;++d<c;)i[d]=e}d=-1;const p=[],m=[];for(;++d<c;){const e=i[d];let t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let a=!1===n.alignDelimiters?1:Math.max(1,l[d]-t.length-r.length);const o=t+"-".repeat(a)+r;!1!==n.alignDelimiters&&(a=t.length+a+r.length,a>l[d]&&(l[d]=a),m[d]=a),p[d]=o}o.splice(1,0,p),s.splice(1,0,m),u=-1;const h=[];for(;++u<o.length;){const e=o[u],t=s[u];d=-1;const r=[];for(;++d<c;){const a=e[d]||"";let o="",s="";if(!1!==n.alignDelimiters){const e=l[d]-(t[d]||0),n=i[d];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):(o=" ".repeat(e/2),s=o):s=" ".repeat(e)}!1===n.delimiterStart||d||r.push("|"),!1===n.padding||!1===n.alignDelimiters&&""===a||!1===n.delimiterStart&&!d||r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(a),!1!==n.alignDelimiters&&r.push(s),!1!==n.padding&&r.push(" "),!1===n.delimiterEnd&&d===c-1||r.push("|")}h.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return h.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:a})}function l(e,t,n){const r=e.children;let a=-1;const i=[],s=t.enter("tableRow");for(;++a<r.length;)i[a]=o(r[a],0,t,n);return s(),i}}function vt(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function Nt(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let a,i=-1;for(;++i<r.length;){const e=r[i];if("paragraph"===e.type){a=e;break}}a===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function It(e,t,n,r){const a=e.children[0],i="boolean"==typeof e.checked&&a&&"paragraph"===a.type,o="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);i&&s.move(o);let l=dt.listItem(e,t,n,{...r,...s.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}function wt(e,t,n,r){const a=e.length;let i,o=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)i=r.slice(o,o+1e4),i.unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function Rt(e,t){return e.length>0?(wt(e,e.length,0,t),e):t}const Ct={}.hasOwnProperty;function Ot(e){const t={};let n=-1;for(;++n<e.length;)xt(t,e[n]);return t}function xt(e,t){let n;for(n in t){const r=(Ct.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let i;if(a)for(i in a){Ct.call(r,i)||(r[i]=[]);const e=a[i];Dt(r[i],Array.isArray(e)?e:e?[e]:[])}}}function Dt(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);wt(e,0,0,r)}const Lt={tokenize:function(e,t,n){let r=0;return function t(i){if((87===i||119===i)&&r<3)return r++,e.consume(i),t;if(46===i&&3===r)return e.consume(i),a;return n(i)};function a(e){return null===e?n(e):t(e)}},partial:!0},Mt={tokenize:function(e,t,n){let r,a,i;return o;function o(t){return 46===t||95===t?e.check(Ft,l,s)(t):null===t||$(t)||Y(t)||45!==t&&V(t)?l(t):(i=!0,e.consume(t),o)}function s(t){return 95===t?r=!0:(a=r,r=void 0),e.consume(t),o}function l(e){return a||r||!i?n(e):t(e)}},partial:!0},Pt={tokenize:function(e,t){let n=0,r=0;return a;function a(o){return 40===o?(n++,e.consume(o),a):41===o&&r<n?i(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(Ft,t,i)(o):null===o||$(o)||Y(o)?t(o):(e.consume(o),a)}function i(t){return 41===t&&r++,e.consume(t),a}},partial:!0},Ft={tokenize:function(e,t,n){return r;function r(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),r):38===o?(e.consume(o),i):93===o?(e.consume(o),a):60===o||null===o||$(o)||Y(o)?t(o):n(o)}function a(e){return null===e||40===e||91===e||$(e)||Y(e)?t(e):r(e)}function i(e){return M(e)?o(e):n(e)}function o(t){return 59===t?(e.consume(t),r):M(t)?(e.consume(t),o):n(t)}},partial:!0},Bt={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return P(e)?n(e):t(e)}},partial:!0},Ut={name:"wwwAutolink",tokenize:function(e,t,n){const r=this;return function(t){if(87!==t&&119!==t||!qt.call(r,r.previous)||jt(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Lt,e.attempt(Mt,e.attempt(Pt,a),n),n)(t)};function a(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:qt},Ht={name:"protocolAutolink",tokenize:function(e,t,n){const r=this;let a="",i=!1;return function(t){if((72===t||104===t)&&Vt.call(r,r.previous)&&!jt(r.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(t),e.consume(t),o;return n(t)};function o(t){if(M(t)&&a.length<5)return a+=String.fromCodePoint(t),e.consume(t),o;if(58===t){const n=a.toLowerCase();if("http"===n||"https"===n)return e.consume(t),s}return n(t)}function s(t){return 47===t?(e.consume(t),i?l:(i=!0,s)):n(t)}function l(t){return null===t||B(t)||$(t)||Y(t)||V(t)?n(t):e.attempt(Mt,e.attempt(Pt,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:Vt},Gt={name:"emailAutolink",tokenize:function(e,t,n){const r=this;let a,i;return function(t){if(!Wt(t)||!Yt.call(r,r.previous)||jt(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(t)};function o(t){return Wt(t)?(e.consume(t),o):64===t?(e.consume(t),s):n(t)}function s(t){return 46===t?e.check(Bt,c,l)(t):45===t||95===t||P(t)?(i=!0,e.consume(t),s):c(t)}function l(t){return e.consume(t),a=!0,s}function c(o){return i&&a&&M(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:Yt},zt={};let $t=48;for(;$t<123;)zt[$t]=Gt,$t++,58===$t?$t=65:91===$t&&($t=97);function qt(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||$(e)}function Vt(e){return!M(e)}function Yt(e){return!(47===e||Wt(e))}function Wt(e){return 43===e||45===e||46===e||95===e||P(e)}function jt(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function Kt(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(37===i&&P(e.charCodeAt(n+1))&&P(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const t=e.charCodeAt(n+1);i<56320&&t>56319&&t<57344?(o=String.fromCharCode(i,t),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Xt(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}zt[43]=Gt,zt[45]=Gt,zt[46]=Gt,zt[95]=Gt,zt[72]=[Gt,Ht],zt[104]=[Gt,Ht],zt[87]=[Gt,Ut],zt[119]=[Gt,Ut];const Zt={name:"attention",resolveAll:function(e,t){let n,r,a,i,o,s,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close)for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const d={...e[n][1].end},p={...e[u][1].start};Qt(d,-s),Qt(p,s),i={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:p},a={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:s>1?"strong":"emphasis",start:{...i.start},end:{...o.end}},e[n][1].end={...i.start},e[u][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=Rt(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=Rt(l,[["enter",r,t],["enter",i,t],["exit",i,t],["enter",a,t]]),l=Rt(l,Xt(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=Rt(l,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=Rt(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,wt(e,n-1,u-n+3,l),u=n+l.length-c-2;break}u=-1;for(;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Ye(r);let i;return function(t){return i=t,e.enter("attentionSequence"),o(t)};function o(s){if(s===i)return e.consume(s),o;const l=e.exit("attentionSequence"),c=Ye(s),u=!c||2===c&&a||n.includes(s),d=!a||2===a&&c||n.includes(r);return l._open=Boolean(42===i?u:u&&(a||!d)),l._close=Boolean(42===i?d:d&&(c||!u)),t(s)}}};function Qt(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Jt={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a};function a(t){return M(t)?(e.consume(t),i):64===t?n(t):l(t)}function i(e){return 43===e||45===e||46===e||P(e)?(r=1,o(e)):l(e)}function o(t){return 58===t?(e.consume(t),r=0,s):(43===t||45===t||46===t||P(t))&&r++<32?(e.consume(t),o):(r=0,l(t))}function s(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||B(r)?n(r):(e.consume(r),s)}function l(t){return 64===t?(e.consume(t),c):F(t)?(e.consume(t),l):n(t)}function c(e){return P(e)?u(e):n(e)}function u(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):d(n)}function d(t){if((45===t||P(t))&&r++<63){const n=45===t?d:u;return e.consume(t),n}return n(t)}}};function en(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return function(r){if(q(r))return e.enter(n),o(r);return t(r)};function o(r){return q(r)&&i++<a?(e.consume(r),o):(e.exit(n),t(r))}}const tn={partial:!0,tokenize:function(e,t,n){return function(t){return q(t)?en(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||z(e)?t(e):n(e)}}};const nn={continuation:{tokenize:function(e,t,n){const r=this;return function(t){if(q(t))return en(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t);return a(t)};function a(r){return e.attempt(nn,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),a}return n(t)};function a(n){return q(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};const rn={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return G(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const an={name:"characterReference",tokenize:function(e,t,n){const r=this;let a,i,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),a=31,i=P,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,i=H,c):(e.enter("characterReferenceValue"),a=7,i=U,c(t))}function c(s){if(59===s&&o){const a=e.exit("characterReferenceValue");return i!==P||mt(r.sliceSerialize(a))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(s)}return i(s)&&o++<a?(e.consume(s),c):n(s)}}};const on={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(null===t)return n(t);return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a};function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},sn={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const r=this,a={partial:!0,tokenize:function(e,t,n){let a=0;return o;function o(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l}function l(t){return e.enter("codeFencedFence"),q(t)?en(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):c(t)}function c(t){return t===i?(e.enter("codeFencedFenceSequence"),u(t)):n(t)}function u(t){return t===i?(a++,e.consume(t),u):a>=s?(e.exit("codeFencedFenceSequence"),q(t)?en(e,d,"whitespace")(t):d(t)):n(t)}function d(r){return null===r||z(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let i,o=0,s=0;return function(t){return function(t){const n=r.events[r.events.length-1];return o=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,i=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSeq