import{createMemo as I$,createContext as VJ,useContext as XJ}from"solid-js";import i6 from"solid-js/h";var I=32,w=9,H9=13,E=10,a=96,M0=126,W0=91,a0=94,d=62,Y9=35,V$=37,u=45,x0=61,_0=92,O0=42,G0=95,e=60,X$=64,u0=93,S0=33,S$=38,g0=58,g$=70,D9=102,f9=104,F9=119,C9=116,z$=112,E$=115,Z6=160,J6=12,Q6=44,x$=59,i9=63,p0=46,H0=47,k9=39,B9=34,j9=43,N0=124,L9=123,O$=125,n0=40,s0=41,a9=30,H$=31,o=48,r=57,p=65,c=90,Y0=97,q0=122,n9=128,o0=32,IZ={blockQuote:0,breakLine:1,breakThematic:2,codeBlock:3,codeInline:4,footnote:5,footnoteReference:6,frontmatter:7,gfmTask:8,heading:9,htmlBlock:10,htmlComment:11,htmlSelfClosing:12,image:13,link:14,orderedList:15,paragraph:16,ref:17,refCollection:18,table:19,text:20,textFormatted:21,unorderedList:22},v=IZ;import{decodeEntity as PZ}from"markdown-to-jsx/entities";function U6($){if(!X6($,"---"))return null;let J=3;for(;J<$.length&&($[J]===" "||$[J]==="	");)J++;if(J<$.length&&$[J]==="\r"&&J++,J>=$.length||$[J]!==`
`)return null;J++;let Z=!1;for(;J<$.length;){let Q=J;for(;J<$.length&&$[J]!==`
`&&$[J]!=="\r";)J++;if(J>=$.length)break;let V=J;if($[J]==="\r"&&J++,J<$.length&&$[J]===`
`&&J++,X6($,"---",Q))return{endPos:J,hasValidYaml:Z};if(!Z){let X=SZ($,Q,V);if(X<V){let K=$.charCodeAt(X);if(K>=Y0&&K<=q0||K>=p&&K<=c||K>=o&&K<=r||K===G0){for(X++;X<V&&(K=$.charCodeAt(X),K>=Y0&&K<=q0||K>=p&&K<=c||K>=o&&K<=r||K===G0||K===u||K===p0);)X++;X<V&&$.charCodeAt(X)===g0&&(X++,X>=V?Z=!0:(K=$.charCodeAt(X),(K===I||K===w)&&(Z=!0)))}}}}return null}var bZ=/&([a-zA-Z0-9]+|#[0-9]{1,7}|#x[0-9a-fA-F]{1,6});/gi,wZ={class:"className",for:"htmlFor",allowfullscreen:"allowFullScreen",allowtransparency:"allowTransparency",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",classid:"classId",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",crossorigin:"crossOrigin",enctype:"encType",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap",viewbox:"viewBox"};function jJ($){var J={};for(var Z in $){var Q=Z.toLowerCase(),V=wZ[Q];if(V)J[V]=$[Z];else{var X=Z.indexOf(":");X!==-1?J[Z.slice(0,X)+Z[X+1].toUpperCase()+Z.slice(X+2)]=$[Z]:J[Z]=$[Z]}}return J}var F6=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s|^<(div|p|h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|td|th|dl|dt|dd|hr|address|article|aside|details|dialog|figure|figcaption|footer|form|header|main|menu|nav|section|summary|textarea|fieldset|legend|center|dir|hgroup|marquee|search|output|template)\b)/i;function s9($){return $.indexOf("&")===-1?$:$.replace(bZ,(J,Z)=>{var Q=PZ(Z);if(Q)return Q;if(Z[0]==="#"){var V=Z[1]==="x"||Z[1]==="X"?parseInt(Z.slice(2),16):parseInt(Z.slice(1),10);return V===0||V>=55296&&V<=57343||V>1114111?"\uFFFD":V<=65535?String.fromCharCode(V):String.fromCharCode(55296+(V-65536>>10),56320+(V-65536&1023))}return J})}var V6=/(javascript|vbscript|data(?!:image)):/i;function u9($){if(V6.test($))return null;if($.indexOf("%")===-1)return $;try{let J=decodeURIComponent($).replace(/[^A-Za-z0-9/:]/g,"");if(V6.test(J))return null}catch{return null}return $}var E0={},T0,w0;for(T0=[192,193,194,195,196,197,224,225,226,227,228,229,230,198],w0=0;w0<T0.length;w0++)E0[T0[w0]]="a";for(E0[231]=E0[199]="c",E0[240]=E0[208]="d",T0=[200,201,202,203,233,232,234,235],w0=0;w0<T0.length;w0++)E0[T0[w0]]="e";for(T0=[207,239,206,238,205,237,204,236],w0=0;w0<T0.length;w0++)E0[T0[w0]]="i";for(E0[209]=E0[241]="n",T0=[248,216,339,338,213,245,212,244,211,243,210,242],w0=0;w0<T0.length;w0++)E0[T0[w0]]="o";for(T0=[220,252,219,251,218,250,217,249],w0=0;w0<T0.length;w0++)E0[T0[w0]]="u";E0[376]=E0[255]=E0[221]=E0[253]="y";function f0($){for(var J="",Z=-1,Q=$.length,V=0;V<Q;V++){var X=$.charCodeAt(V);if(X>=Y0&&X<=q0||X>=o&&X<=r){Z<0&&(Z=V);continue}if(X>=p&&X<=c){Z>=0&&(J+=$.slice(Z,V),Z=-1),J+=String.fromCharCode(X+o0);continue}if(X===I||X===u){Z>=0&&(J+=$.slice(Z,V),Z=-1),J+="-";continue}Z>=0&&(J+=$.slice(Z,V),Z=-1);var K=E0[X];K&&(J+=K)}return Z>=0&&(J+=$.slice(Z)),J}function X6($,J,Z){return $.startsWith(J,Z)}var Y6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr","circle","ellipse","line","path","polygon","polyline","rect","use","stop","animate","set"]);function p9($){let J=$.toLowerCase();if(Y6.has(J))return!0;let Z=J.indexOf(":");return Z!==-1?(J=J.slice(Z+1),Y6.has(J)):!1}var M9=1,K6=2,m9=4,G6=8,RZ=16,t0=32,A9=64,q6=1,yZ=2,kZ=3,LZ=4,W6=(function(){var $=new Uint8Array(128),J;for($[w]=M9,$[E]=M9|K6,$[J6]=M9,$[H9]=M9|K6,$[I]=M9,J=S0;J<=H0;J++)$[J]=m9;for(J=g0;J<=X$;J++)$[J]=m9;for(J=W0;J<=a;J++)$[J]=m9;for(J=L9;J<=M0;J++)$[J]=m9;for(J=o;J<=r;J++)$[J]=RZ;for(J=p;J<=c;J++)$[J]=G6;for(J=Y0;J<=q0;J++)$[J]=G6;return $})(),MJ=(function(){let $=new Uint8Array(128);return $[_0]=yZ,$[W0]=LZ,$[O0]=$[G0]=$[M0]=$[x0]=kZ,$[a]=$[e]=$[X$]=$[u0]=$[E]=$[I]=$[S0]=q6,$[D9]=$[f9]=$[F9]=q6,$})(),z6=/[\p{P}\p{S}]/u,O6=/\p{Zs}/u,h9=[];function f$($){var J=$.indexOf("\r"),Z=$.indexOf("\0");if(J===-1&&Z===-1)return $;var Q=$.length;h9.length=0;var V=0,X=0;for(J===-1?X=Z:Z===-1?X=J:X=J<Z?J:Z;X<Q;X++){var K=$.charCodeAt(X);K===H9?(V<X&&h9.push($.slice(V,X)),X+1<Q&&$.charCodeAt(X+1)===E&&X++,h9.push(`
`),V=X+1):K===0&&(V<X&&h9.push($.slice(V,X)),h9.push("\uFFFD"),V=X+1)}return V<Q&&h9.push($.slice(V)),h9.join("")}function SZ($,J,Z){let Q=Z??$.length;for(;J<Q&&($[J]===" "||$[J]==="	");)J++;return J}function AJ($){if(!$)return!1;for(var J in $)return!0;return!1}function t9($,J,Z){for(var Q=$,V=J.split("."),X=0;X<V.length&&(Q=Q?.[V[X]],Q!==void 0);)X++;return Q||Z}function H6($){for(var J=!1,Z=0;Z<$.length;Z++){var Q=$.charCodeAt(Z);if(Q<=I||Q===B9||Q===V$||Q===e||Q===d||Q===W0||Q===_0||Q===u0||Q===a0||Q===a||Q>=123){J=!0;break}}if(!J)return $;for(var V="",Z=0;Z<$.length;Z++){var Q=$.charCodeAt(Z);if(Q===V$&&Z+2<$.length){var X=$.charCodeAt(Z+1),K=$.charCodeAt(Z+2);if((X>=o&&X<=r||X>=p&&X<=g$||X>=Y0&&X<=D9)&&(K>=o&&K<=r||K>=p&&K<=g$||K>=Y0&&K<=D9)){V+=$[Z]+$[Z+1]+$[Z+2],Z+=2;continue}}V+=encodeURI($[Z])}return V}function D6(...$){return $.filter(Boolean).join(" ")}function _J($,J){if(!J)return $;let Z=t9(J,$,void 0);return typeof Z=="string"?Z:typeof Z=="object"&&Z.component?Z.component:$}function vJ($,J){if(!J)return{};let Z=t9(J,$,void 0);return typeof Z=="object"&&Z.props?Z.props:{}}var gZ=new Set(["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"]),D$=/<(\/?)(title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)(\s|>|\/)/gi;function C$($){return gZ.has($.toLowerCase())}function NJ($){return D$.lastIndex=0,D$.test($)}function h$($){return D$.lastIndex=0,$.replace(D$,function(J,Z,Q,V){return"&lt;"+Z+Q+V})}var k6=/^<([a-zA-Z][a-zA-Z0-9-]*)\s[^>]*>/,L6=/^<[A-Z]/,m$=["script","pre","style","textarea"],G$=new Set(m$),EZ=/<(?:pre|script|style|textarea)\b/i,j6=/<(?:pre|script|style|textarea)\b/iy,M6=/^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m,A6=/^<([a-z][^ >/\n\r]*) ?([^>]*?)>/im,S6=new Uint8Array(128);(function(){for(var $=[a,O0,G0,M0,x0,W0,S0,e,_0,H$,f9,F9,D9],J=0;J<$.length;J++)S6[$[J]]=1})();var _6=/([a-zA-Z_][a-zA-Z0-9_-]*)=(?:"([^"]*)"|'([^']*)')/g;function g6($){return G$.has($)}function yJ($){return EZ.test($)}function E6($,J,Z){for(var Q=J,V=Z;Q<V&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;if(Q>=V)return!1;$.charCodeAt(Q)===N0&&Q++;for(var X=0;Q<V;){for(;Q<V&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;if(Q>=V)break;if($.charCodeAt(Q)===N0&&X>0){for(var K=Q+1;K<V&&($.charCodeAt(K)===I||$.charCodeAt(K)===w);)K++;if(K>=V)return!0}if($.charCodeAt(Q)===g0&&Q++,Q>=V||$.charCodeAt(Q)!==u)return!1;for(;Q<V&&$.charCodeAt(Q)===u;)Q++;for(Q<V&&$.charCodeAt(Q)===g0&&Q++,X++;Q<V&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;if(Q<V)if($.charCodeAt(Q)===N0)Q++;else return!1}return X>0}function v9($,J){if($.charCodeAt(J)!==e)return null;let Z=J+1,Q=$.length,V=!1;$.charCodeAt(Z)===H0&&(Z++,V=!0);let X=Z,K=$.charCodeAt(Z);if(!(K>=Y0&&K<=q0||K>=p&&K<=c))return null;for(;Z<Q&&($.charCodeAt(Z)>=Y0&&$.charCodeAt(Z)<=q0||$.charCodeAt(Z)>=p&&$.charCodeAt(Z)<=c||$.charCodeAt(Z)>=o&&$.charCodeAt(Z)<=r||$.charCodeAt(Z)===u);)Z++;let G=$.slice(X,Z);if(!G)return null;let Y=Z;for(;Z<Q&&($.charCodeAt(Z)===I||$.charCodeAt(Z)===w||$.charCodeAt(Z)===E);)Z++;let q=$.slice(Y,Z);if(Z===Y&&Z<Q){var U=$.charCodeAt(Z);if(U!==d&&U!==H0)return null}let F=Z,O={},z=!1;for(;Z<Q;){let L=$.charCodeAt(Z);if(L===d){let k=$.slice(F,Z);return{tag:G,attrs:O,selfClosing:!1,end:Z+1,rawAttrs:k,whitespaceBeforeAttrs:q,isClosing:V,hasSpaceBeforeSlash:z}}if(L===I||L===w||L===E){Z++;continue}if(L===H0&&Z+1<Q&&$.charCodeAt(Z+1)===d){let k=$.slice(F,Z);return z=Z>F&&$.charCodeAt(Z-1)===I,{tag:G,attrs:O,selfClosing:!0,end:Z+2,rawAttrs:k,whitespaceBeforeAttrs:q,isClosing:V,hasSpaceBeforeSlash:z}}var j=Z,D=$.charCodeAt(Z);if(!(D>=Y0&&D<=q0||D>=p&&D<=c||D===G0||D===g0))return null;for(Z++;Z<Q;){var W=$.charCodeAt(Z);if(W>=Y0&&W<=q0||W>=p&&W<=c||W>=o&&W<=r||W===G0||W===p0||W===g0||W===u)Z++;else break}for(var B=$.slice(j,Z);Z<Q&&($.charCodeAt(Z)===I||$.charCodeAt(Z)===w);)Z++;if($.charCodeAt(Z)!==x0){O[B]="";continue}for(Z++;Z<Q&&($.charCodeAt(Z)===I||$.charCodeAt(Z)===w);)Z++;var H=$.charCodeAt(Z);if(H===B9||H===k9){Z++;for(var M=Z;Z<Q&&$.charCodeAt(Z)!==H;)Z++;if(Z>=Q)return null;if(O[B]=$.slice(M,Z),Z++,Z<Q){var R=$.charCodeAt(Z);if(R!==I&&R!==w&&R!==E&&R!==d&&R!==H0)return null}}else if(H===L9){var N=1,M=Z;for(Z++;Z<Q&&N>0;){var W=$.charCodeAt(Z);W===L9?N++:W===O$&&N--,Z++}O[B]=$.slice(M,Z)}else{for(var M=Z;Z<Q;){var A=$.charCodeAt(Z);if(A===I||A===w||A===d||A===E||A===B9||A===k9||A===x0||A===e||A===a)break;Z++}if(Z===M)return null;O[B]=$.slice(M,Z)}}return null}function x6($,J,Z){if(!Z.streaming&&!Z.optimizeForStreaming&&$.indexOf("[")===-1)return!1;for(var Q=0,V=$.length,X=!1,K=!1;Q<V;){for(var G=$.indexOf(`
`,Q),Y=G<0?V:G,q=Q,U=0;q<Y&&U<4;)if($.charCodeAt(q)===I)U++,q++;else if($.charCodeAt(q)===w)U+=4,q++;else break;if(q>=Y){X=!1,Q=G<0?V:G+1;continue}if(U<4){var F=$.charCodeAt(q);if(F===a||F===M0){for(var O=F,z=0,j=q;j<Y&&$.charCodeAt(j)===O;)z++,j++;if(z>=3){var D=!0;if(O===a){for(var W=j;W<Y;W++)if($.charCodeAt(W)===a){D=!1;break}}if(D){X=!1;for(var B=G<0?V:G+1;B<V;){for(var H=B,M=0;H<V&&M<4;){var R=$.charCodeAt(H);if(R===I)M++,H++;else if(R===w)M+=4,H++;else break}if(M<4&&H<V&&$.charCodeAt(H)===O){for(var N=0;H<V&&$.charCodeAt(H)===O;)N++,H++;if(N>=z){for(;H<V&&($.charCodeAt(H)===I||$.charCodeAt(H)===w);)H++;if(H>=V||$.charCodeAt(H)===E){Q=H>=V?V:H+1;break}}}for(;B<V&&$.charCodeAt(B)!==E;)B++;B<V&&B++}B>=V&&(Q=V,K=!0);continue}}}}for(var A=q;A<Y&&$.charCodeAt(A)===d;){A++,A<Y&&$.charCodeAt(A)===I&&A++;for(var L=0;A<Y&&L<4;)if($.charCodeAt(A)===I)L++,A++;else if($.charCodeAt(A)===w)L+=4,A++;else break;if(L>=4)break;X=!1}if(!X&&U<4&&A<Y&&$.charCodeAt(A)===W0&&!(A+1<V&&$.charCodeAt(A+1)===a0)){var k=T6($,A,J);if(k){Q=k,X=!1;continue}}var P=$.charCodeAt(q);if(P===Y9&&U<4)X=!1;else if(U<4&&(P===u||P===O0||P===G0)){for(var b=q,y=0;b<Y;){var S=$.charCodeAt(b);if(S===P)y++;else if(S!==I&&S!==w)break;b++}X=!(y>=3&&b>=Y)}else X=!0;Q=G<0?V:G+1}return K}function T6($,J,Z){let Q=$.length;if($.charCodeAt(J)!==W0)return null;let V=J+1<Q&&$.charCodeAt(J+1)===a0,X=J+1;for(;X<Q;){var K=$.charCodeAt(X);if(K===u0){X++;break}if(K===W0)return null;K===_0&&X+1<Q&&X++,X++}if(X>Q||$.charCodeAt(X-1)!==u0)return null;let G=$.slice(J+1,X-1);if(G.length>999)return null;let Y=B$(G);if(!Y||X>=Q||$.charCodeAt(X)!==g0)return null;X++;let q=!1;for(;X<Q;){let T=$.charCodeAt(X);if(T===I||T===w)X++;else if(T===E&&!q)q=!0,X++;else break}if(V){let T=$.indexOf(`
`,X),C=T<0?Q:T,f=$.slice(X,C).trim();return Z[Y]={target:f,title:void 0},T<0?Q:T+1}var U;if(X<Q&&$.charCodeAt(X)===e){X++;for(var F=X;X<Q&&$.charCodeAt(X)!==d&&$.charCodeAt(X)!==E;)$.charCodeAt(X)===_0&&X+1<Q&&X++,X++;if(X>=Q||$.charCodeAt(X)!==d)return null;U=$.slice(F,X),X++;for(var O=$.indexOf(`
`,X),z=O<0?Q:O,j=X;j<z&&($.charCodeAt(j)===I||$.charCodeAt(j)===w);)j++;if(j<z){if(j===X)return null;var D=$.charCodeAt(j);if(D!==B9&&D!==k9&&D!==n0)return null}}else{for(var F=X,W=0;X<Q;){var K=$.charCodeAt(X);if(K===n0)W++;else if(K===s0){if(W===0)break;W--}else{if(K===I||K===w||K===E)break;K===_0&&X+1<Q&&X++}X++}if(U=$.slice(F,X),!U)return null}for(;X<Q&&($.charCodeAt(X)===I||$.charCodeAt(X)===w);)X++;var B=$.indexOf(`
`,X),H=B<0?Q:B,M,R=!1,N=X,A=X;if(X===H&&X<Q)for(A=X+1;A<Q&&($.charCodeAt(A)===I||$.charCodeAt(A)===w);)A++;if(A<Q){var L=$.charCodeAt(A);if(L===B9||L===k9||L===n0){for(var k=L===n0?41:L,P=A+1,b=P;P<Q;){var y=$.charCodeAt(P);if(y===k){for(var S=P+1;S<Q&&($.charCodeAt(S)===I||$.charCodeAt(S)===w);)S++;(S>=Q||$.charCodeAt(S)===E)&&(M=$.slice(b,P),R=!0,N=S<Q?S+1:Q);break}if(y===_0&&P+1<Q){P+=2;continue}if(y===E&&P+1<Q&&$.charCodeAt(P+1)===E)break;P++}if(!R&&A===X)return null}}if(R)return Z[Y]||(Z[Y]={target:$$(U),title:M!==void 0?s9($$(M)):M}),N;for(;X<H&&($.charCodeAt(X)===I||$.charCodeAt(X)===w);)X++;return X<H?null:(Z[Y]||(Z[Y]={target:$$(U),title:M}),B<0?Q:B+1)}var h0=new Uint8Array(W6);for(h0[H$]=M9,h0[Y9]|=t0,h0[d]|=t0,h0[u]|=t0|A9,h0[j9]|=t0,h0[O0]|=t0|A9,h0[G0]|=t0|A9,h0[a]|=t0|A9,h0[M0]|=t0|A9,h0[e]|=t0|A9,h0[W0]|=A9,h0[S0]|=A9,h0[N0]|=t0,Y$=o;Y$<=r;Y$++)h0[Y$]|=t0;var Y$;function v6($){if($.indexOf("[")<0&&$.indexOf("]")<0)return!1;for(var J=0;J<$.length;J++){if($.charCodeAt(J)===_0){J++;continue}if($.charCodeAt(J)===W0||$.charCodeAt(J)===u0)return!0}return!1}function B$($){var J=$.replace(/\s+/g," ").trim();return J.indexOf("\u1E9E")!==-1?J.replace(/\u1E9E/g,"ss").toLowerCase():J.toLowerCase()}function d$($){return $<n9?h0[$]:$===Z6?M9:0}function $$($){return $.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,"$1")}var f6=null,C6=-1,h6=-1;function J0($,J){if(J===C6&&$===f6)return h6;var Z=$.indexOf(`
`,J);return Z<0?$.length:Z}function i($,J){let Z=J0($,J);return Z<$.length?Z+1:Z}function K$($,J,Z){for(;J<Z;){let Q=$.charCodeAt(J);if(Q!==I&&Q!==w)break;J++}return J}function N6($,J){let Z=i($,J);for(;Z<$.length;){let Q=J0($,Z);if(d0($,Z,Q))return Z;Z=i($,Z)}return $.length}function I9($,J,Z,Q){let V=0;for(;J+V<Z&&$.charCodeAt(J+V)===Q;)V++;return V}var $0=0,t=0;function A0($,J,Z){for($0=0,t=0;J+t<Z;){let Q=$.charCodeAt(J+t);if(Q===w)$0+=4-$0%4;else if(Q===I)$0++;else break;t++}}function d0($,J,Z){return K$($,J,Z)>=Z}function m6($,J,Z,Q){let V=J0($,J);if(A0($,J,V),$0>3)return null;let X=J+t;if($.charCodeAt(X)!==Y9)return null;let K=I9($,X,V,35);if(K<1||K>6||(X+=K,X<V&&$.charCodeAt(X)!==I&&$.charCodeAt(X)!==w))return null;X=K$($,X,V);for(var G=V;G>X&&$.charCodeAt(G-1)===I;)G--;for(var Y=G;G>X&&$.charCodeAt(G-1)===Y9;)G--;if(G<Y)if(G===X||$.charCodeAt(G-1)===I)for(;G>X&&$.charCodeAt(G-1)===I;)G--;else G=Y;let q=$.slice(X,G),U=C0(q,0,q.length,Z,Q),O=(Q?.slugify||f0)(q);return{node:{type:v.heading,level:K,children:U,id:O},end:i($,V)}}function xZ($,J,Z){var Q=$.charCodeAt(J);if(Q!==x0&&Q!==u)return!1;for(var V=J;V<Z&&$.charCodeAt(V)===Q;)V++;for(;V<Z&&($.charCodeAt(V)===I||$.charCodeAt(V)===w);)V++;return V>=Z}function E9($,J){let Z=J0($,J);if(A0($,J,Z),$0>3)return null;let Q=J+t,V=$.charCodeAt(Q);if(V!==u&&V!==O0&&V!==G0)return null;let X=0;for(;Q<Z;){let K=$.charCodeAt(Q);if(K===V)X++;else if(K!==I&&K!==w)return null;Q++}return X<3?null:{node:{type:v.breakThematic},end:i($,Z)}}function TZ($,J,Z){let Q=J0($,J);if(A0($,J,Q),$0>3)return null;let V=$0,X=t,K=J+t,G=$.charCodeAt(K);if(G!==a&&G!==M0)return null;let Y=I9($,K,Q,G);if(Y<3)return null;K+=Y;let q=K$($,K,Q),U=Q;if(G===a){for(let P=q;P<Q;P++)if($.charCodeAt(P)===a)return null}for(;U>q&&($.charCodeAt(U-1)===I||$.charCodeAt(U-1)===w);)U--;let F=$.slice(q,U),O="",z="",j=F.indexOf(" ");j===-1?O=F:(O=F.slice(0,j),z=F.slice(j+1).trim()),O=$$(O);var D=void 0;if(z){_6.lastIndex=0;for(var W;(W=_6.exec(z))!==null;)D||(D={}),D[W[1]]=W[2]!==void 0?W[2]:W[3]}let B=i($,Q),H=B,M=$.length;for(;H<$.length;){let P=J0($,H);if(A0($,H,P),$0<4){let b=H+t;var R=I9($,b,P,G);if(R>=Y){let y=b+R;if(d0($,y,P)){M=i($,P);break}}}H=i($,P)}var N;if(V===0)N=H>B&&$.charCodeAt(H-1)===E?$.slice(B,H-1):$.slice(B,H);else{N="";for(var A=B;A<H;){var L=J0($,A);A0($,A,L);var k=Math.min(t,V);N+=$.slice(A+k,L)+`
`,A=i($,L)}N.length>0&&N.charCodeAt(N.length-1)===E&&(N=N.slice(0,-1))}return{node:{type:v.codeBlock,lang:O||void 0,text:N,infoString:z||void 0,attrs:D},end:M}}function fZ($,J){let Z=J0($,J);if(A0($,J,Z),$0<4)return null;let Q="",V=J;for(;V<$.length;){let z=J0($,V);if(A0($,V,z),d0($,V,z)){for(var X=0,K=i($,z);K<$.length;){var G=J0($,K);if(d0($,K,G)){X++,K=i($,G);continue}if(A0($,K,G),$0>=4){for(var Y=0;Y<=X;Y++)Q+=`
`;V=K;break}break}if(V!==K)break;continue}if($0<4)break;let j=0,D=0;var q=0;for(let W=V;W<z&&D<4;W++){if($.charCodeAt(W)===w){var U=4-D%4;D+U>4&&(q=D+U-4),D+=U}else D++;j++}var F="";if(q>0)for(var O=0;O<q;O++)F+=" ";F+=$.slice(V+j,z),Q+=F+`
`,V=i($,z)}for(;Q.length>0&&Q.charCodeAt(Q.length-1)===E;)Q=Q.slice(0,-1);for(;Q.length>0&&Q.charCodeAt(Q.length-1)===E;)Q=Q.slice(0,-1);return Q?{node:{type:v.codeBlock,lang:void 0,text:Q,infoString:void 0,attrs:void 0},end:V}:null}function CZ($,J,Z,Q){let V=J0($,J);if(A0($,J,V),$0>3)return null;let X=J+t;if($.charCodeAt(X)!==d)return null;let K="",G=J,Y,q=!1,U=!1,F=!1;for(;G<$.length;){let g=J0($,G);A0($,G,g);let D0=G+t;if($.charCodeAt(D0)===d){let Q0=D0+1;var O=$0+1,z=!1;if(Q0<g){var j=$.charCodeAt(Q0);j===I?(Q0++,O++,z=!0):j===w&&(z=!0)}for(var D="",W=!1,B=Q0;B<g;B++)if($.charCodeAt(B)===w){W=!0;break}if(W){var H=O;if(z&&Q0<g&&$.charCodeAt(Q0)===w){for(var M=4-H%4,R=0;R<M-1;R++)D+=" ";H+=M,Q0++}for(var N=Q0;N<g;N++)if($.charCodeAt(N)===w){for(var A=4-H%4,L=0;L<A;L++)D+=" ";H+=A}else D+=$[N],H++}else D=$.slice(Q0,g);if(!K&&!Y){let m=D.match(/^\[!([A-Za-z]+)\]\s*$/);if(m){Y=m[1].toUpperCase(),G=i($,g);continue}}K+=D+`
`;var k=D.trimStart();k.startsWith("```")||k.startsWith("~~~")?F=!F:D.startsWith("    ")||D.startsWith("	")?F=!0:k.length>0&&!F&&(F=!1),U=k.length>0,G=i($,g)}else if(K&&!d0($,G,g)&&U){if($0<4){var P=G+t,b=P<g?$.charCodeAt(P):0;if(b===Y9||b===d||b===a||b===M0||b===e||(b===u||b===O0||b===G0)&&E9($,G)||(b===u||b===O0||b===j9)&&P+1<g&&($.charCodeAt(P+1)===I||$.charCodeAt(P+1)===w))break;if(b>=o&&b<=r){for(var y=P;y<g&&$.charCodeAt(y)>=o&&$.charCodeAt(y)<=r;)y++;if(y<g&&($.charCodeAt(y)===p0||$.charCodeAt(y)===s0))break}}if(F)break;K+=$.slice(G,g)+`
`,q=!0,G=i($,g)}else break}if(!K&&!Y)return null;var{inBlockQuote:S,g:T}=Z;Z.inBlockQuote=!0,q&&(Z.g=!0);let C=N9(K||"",Z,Q);return Z.inBlockQuote=S,Z.g=T,{node:{type:v.blockQuote,children:C,alert:Y||void 0},end:G}}function u6($,J,Z){for(var Q=0,V=J;V<Z;V++)$.charCodeAt(V)===w?Q+=4-Q%4:Q++;return Q}function S9($,J,Z){if(A0($,J,Z),$0>3)return null;var Q=J+t;if(Q>=Z)return null;var V=$.charCodeAt(Q),X=$0,K=Q;if(V===u||V===O0||V===j9){if(K=Q+1,K<Z&&$.charCodeAt(K)!==I&&$.charCodeAt(K)!==w&&$.charCodeAt(K)!==E)return null}else if(V>=o&&V<=r){for(var G=Q;G<Z&&G-Q<9;){var Y=$.charCodeAt(G);if(Y<o||Y>r)break;G++}if(G>Q&&G<Z){var q=$.charCodeAt(G);if(q===p0||q===s0){if(K=G+1,K<Z&&$.charCodeAt(K)!==I&&$.charCodeAt(K)!==w&&$.charCodeAt(K)!==E)return null}else return null}else return null}else return null;var U=K,F=u6($,J,K),O=0,z=U,j=F;if(U>=Z)return{ordered:V>=o&&V<=r,marker:V>=o&&V<=r?$[G]:$[Q],start:V>=o&&V<=r?parseInt($.slice(Q,G),10):void 0,contentStart:U,contentCol:F+1,markerCol:X,isEmpty:!0};for(;z<Z&&($.charCodeAt(z)===I||$.charCodeAt(z)===w);){if($.charCodeAt(z)===w){var D=4-j%4;j+=D}else j++;z++,O++}var W=z>=Z,B=j-F;return W||B>4?(j=F+1,z=U+1,O=1):O===0&&(j=F+1,z=U,O=1),{ordered:V>=o&&V<=r,marker:V>=o&&V<=r?$[G]:$[Q],start:V>=o&&V<=r?parseInt($.slice(Q,G),10):void 0,contentStart:z,contentCol:j,markerCol:X,isEmpty:W}}var j$=0;function hZ($,J,Z,Q){var V=0,X=J;for(j$=0;X<Z&&V<Q;){var K=$.charCodeAt(X);if(K===w){var G=4-V%4;if(V+G>Q){j$=V+G-Q,X++,V=Q;break}V+=G}else if(K===I)V++;else break;X++}return X}function I6($,J,Z,Q){var V=J0($,J),X=S9($,J,V);if(!X)return null;var K=[],G=J,Y=X.contentCol,q="",U=X.isEmpty,F=!1,O=!1;if(!X.isEmpty){for(var z=!1,j=X.contentStart;j<V;j++)if($.charCodeAt(j)===w){z=!0;break}if(z){var D="",W=u6($,J,X.contentStart),B=W-X.contentCol;if(B>0)for(var H=0;H<B;H++)D+=" ";for(var M=X.contentStart;M<V;M++)if($.charCodeAt(M)===w){for(var R=4-W%4,N=0;N<R;N++)D+=" ";W+=R}else D+=$[M],W++;q=D+`
`}else q=$.slice(X.contentStart,V)+`
`}for(G=i($,V);G<$.length;){var A=J0($,G);A0($,G,A);var L=$.charCodeAt(G+t);if($0<Y&&(L===u||L===O0||L===G0)&&$0<=3&&E9($,G))break;var k=S9($,G,A);if(k&&k.ordered===X.ordered&&k.marker===X.marker&&k.markerCol<Y){K.push({contentCol:Y,raw:q,hasBlankAfter:F,isEmpty:U}),F&&(O=!0),Y=k.contentCol,U=k.isEmpty,F=!1,q=k.isEmpty?"":$.slice(k.contentStart,A)+`
`,G=i($,A);continue}if(d0($,G,A)){q+=`
`,G=i($,A);for(var P=!1,b=0;b<q.length;b++){var y=q.charCodeAt(b);if(y!==E&&y!==H9&&y!==I&&y!==w){P=!0;break}}if(U&&!P)if(G<$.length){var S=J0($,G),T=S9($,G,S);if(!T||T.ordered!==X.ordered||T.marker!==X.marker)break;F=!0}else break;if(G<$.length){var C=J0($,G);A0($,G,C);var f=$.charCodeAt(G+t);if((f===u||f===O0||f===G0)&&$0<=3&&E9($,G))break;var g=S9($,G,C);if(g&&g.ordered===X.ordered&&g.marker===X.marker&&g.markerCol<Y){F=!0;continue}if(!d0($,G,C)&&$0<Y)break}continue}if($0>=Y){var D0=hZ($,G,A,Y);if(j$>0){for(var Q0="",m=Y,n=0;n<j$;n++)Q0+=" ",m++;for(var y0=D0;y0<A;y0++)if($.charCodeAt(y0)===w){for(var c0=4-m%4,m0=0;m0<c0;m0++)Q0+=" ";m+=c0}else Q0+=$[y0],m++;q+=Q0+`
`}else q+=$.slice(D0,A)+`
`;G=i($,A);continue}for(var z0=!1,h=0;h<q.length;h++){var B0=q.charCodeAt(h);if(B0!==E&&B0!==H9&&B0!==I&&B0!==w){z0=!0;break}}if(!F&&z0&&!U){var Z0=G+t,K0=$.charCodeAt(Z0),K9=K0===Y9||K0===d||K0===e||K0===a||K0===M0||(K0===u||K0===O0||K0===G0||K0===j9)&&(E9($,G)!==null||S9($,G,A)!==null)||K0>=o&&K0<=r&&S9($,G,A)!==null;if(!K9){q+=""+$.slice(Z0,A)+`
`,G=i($,A);continue}}break}if(K.push({contentCol:Y,raw:q,hasBlankAfter:F,isEmpty:U}),K.length===0)return null;var V0=O;if(!V0)for(var j0=0;j0<K.length;j0++){if(K[j0].hasBlankAfter&&j0<K.length-1){V0=!0;break}if(!K[j0].isEmpty){for(var v0=K[j0].raw,s=v0.length,U0=0,_=!1,l=!1,I0=!1,P0=!1,$9=0,k0=0,X0=-1;U0<s;){var x=v0.indexOf(`
`,U0);if(x<0&&(x=s),P0){A0(v0,U0,x);for(var R0=v0.slice(U0+t,x),F0=0;F0<R0.length&&R0.charCodeAt(F0)===$9;)F0++;F0>=k0&&R0.slice(F0).trim()===""&&(P0=!1),U0=x<s?x+1:s;continue}if(d0(v0,U0,x)){X0>=0?I0=!0:_&&(l=!0),U0=x<s?x+1:s;continue}if(A0(v0,U0,x),X0>=0){if($0>=X0){U0=x<s?x+1:s;continue}var G9=S9(v0,U0,x);if(G9&&G9.markerCol<X0&&G9.contentCol<=X0){U0=x<s?x+1:s;continue}if(G9){U0=x<s?x+1:s;continue}X0=-1,I0&&(l=!0,I0=!1)}var c9=v0.slice(U0+t,x),P9=c9.charCodeAt(0);if((P9===a||P9===M0)&&$0<=3){for(var W9=0;W9<c9.length&&c9.charCodeAt(W9)===P9;)W9++;if(W9>=3){if(l&&_){V0=!0;break}P0=!0,$9=P9,k0=W9,_=!0,U0=x<s?x+1:s;continue}}var q9=$0<=3?S9(v0,U0,x):null;if(q9&&_){if(l){V0=!0;break}X0=q9.contentCol,I0=!1,U0=x<s?x+1:s,_=!0;continue}if(l){V0=!0;break}_=!0,U0=x<s?x+1:s}if(V0)break}}for(var z9=[],x9=0;x9<K.length;x9++){for(var Z$=K[x9],O9=Z$.raw,Z9=O9.length;Z9>0&&O9.charCodeAt(Z9-1)===E;)Z9--;var J9=Z9<O9.length?O9.slice(0,Z9):O9,Q9=null;if(J9.length>=3&&J9.charCodeAt(0)===W0){var r0=J9[1];(r0===" "||r0==="x"||r0==="X")&&J9.charCodeAt(2)===u0&&(Q9={type:v.gfmTask,completed:r0==="x"||r0==="X"},J9=J9.slice(3))}var b0;if(Z$.isEmpty&&J9.trim()==="")b0=[];else if(V0){var b9=Z.inList;Z.inList=!0,b0=N9(J9,Z,Q),Z.inList=b9}else{var U9=Z.inList;if(Z.inList=!0,b0=N9(J9,Z,Q),Z.inList=U9,b0.length===1&&b0[0].type===v.paragraph)b0=b0[0].children;else{for(var V9=[],w9=0;w9<b0.length;w9++)if(b0[w9].type===v.paragraph)for(var l9=b0[w9].children,X9=0;X9<l9.length;X9++)V9.push(l9[X9]);else V9.push(b0[w9]);b0=V9}}Q9?z9.push([Q9,{type:v.text,text:" "},...b0]):z9.push(b0)}return{node:{type:X.ordered?v.orderedList:v.unorderedList,start:X.ordered?X.start:void 0,items:z9},end:G}}var M$=new Set(["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]);function _9($,J,Z){let Q={};for(let[K,G]of Object.entries($)){let Y=K,q=K.toLowerCase();if(q==="style"&&typeof G=="string"){let U={},F=[],O=0,z=0;for(let D=0;D<G.length;D++){let W=G.charCodeAt(D);W===n0?O++:W===s0?O--:W===x$&&O===0&&(F.push(G.slice(z,D)),z=D+1)}z<G.length&&F.push(G.slice(z));let j=!1;F.forEach(D=>{let W=D.indexOf(":");if(W===-1)return;let B=D.slice(0,W).trim(),H=D.slice(W+1).trim();if(B&&H){if(/url\s*\(\s*(javascript|vbscript|data:(?!image\/))/i.test(H)){j=!0;return}let M=B.indexOf("-")!==-1?B.replace(/-([a-z])/g,(R,N)=>N.toUpperCase()):B;U[M]=H}}),!j&&Object.keys(U).length>0&&(Q[Y]=U)}else if((q==="href"||q==="src")&&Z?.sanitizer){let U=Z.sanitizer(G,J,q);U!==null&&(Q[Y]=U)}else if(G==="")Q[Y]=!0;else if(G.length>=2&&G.charCodeAt(0)===L9&&G.charCodeAt(G.length-1)===O$){var V=G.slice(1,-1);if(V.length>0){var X=V.charCodeAt(0);if(X===W0||X===L9)try{Q[Y]=JSON.parse(V);continue}catch{}}if(V==="true"){Q[Y]=!0;continue}if(V==="false"){Q[Y]=!1;continue}if(Z?.evalUnserializableExpressions)try{Q[Y]=(0,eval)("("+V+")");continue}catch{}Q[Y]=V}else Q[Y]=G}return Q}function g9($,J,Z){let Q=J.length;if(Q===0)return Z;var V=J.charCodeAt(0),X=V>=p&&V<=c||V>=Y0&&V<=q0;if(!X){for(var K=String.fromCharCode(V),G=$.length-Q,Y=Z;Y<=G;){var q=$.indexOf(K,Y);if(q===-1||q>G)return-1;for(var U=!0,F=1;F<Q;F++){var O=$.charCodeAt(q+F),z=J.charCodeAt(F);if(O>=p&&O<=c&&(O+=o0),z>=p&&z<=c&&(z+=o0),O!==z){U=!1;break}}if(U)return q;Y=q+1}return-1}V>=p&&V<=c&&(V+=o0);for(let D=Z;D<=$.length-Q;D++){var j=$.charCodeAt(D);if(j>=p&&j<=c&&(j+=o0),j!==V)continue;let W=!0;for(let B=1;B<Q;B++){let H=$.charCodeAt(D+B),M=J.charCodeAt(B);if(H>=p&&H<=c&&(H+=o0),M>=p&&M<=c&&(M+=o0),H!==M){W=!1;break}}if(W)return D}return-1}function mZ($,J,Z){let Q=J.length;var V=J.charCodeAt(0);V>=p&&V<=c&&(V+=o0);for(let K=Math.min(Z,$.length-Q);K>=0;K--){var X=$.charCodeAt(K);if(X>=p&&X<=c&&(X+=o0),X!==V)continue;let G=!0;for(let Y=1;Y<Q;Y++){let q=$.charCodeAt(K+Y),U=J.charCodeAt(Y);if(q>=p&&q<=c&&(q+=o0),U>=p&&U<=c&&(U+=o0),q!==U){G=!1;break}}if(G)return K}return-1}var A$=-1;function u$($,J,Z){let Q=Z.toLowerCase(),V="<"+Q,X="</"+Q,K=1,G=J,Y=$.length;for(A$=-1;G<Y&&K>0;){let F=g9($,V,G),O=g9($,X,G);if(O===-1)return-1;if(F!==-1&&F<O){let z=v9($,F);z?(z.tag.toLowerCase()===Q&&!z.isClosing&&!z.selfClosing&&!p9(z.tag)&&K++,G=z.end):G=F+1}else{var q=O+X.length,U=q<Y?$.charCodeAt(q):62;if((U===d||U===I||U===w||U===E)&&(K--,K===0)){A$=O;let z=O+X.length;for(;z<Y&&$.charCodeAt(z)!==d;)z++;return z+1}G=O+1}}return-1}function p6($,J,Z,Q){if(Q.ignoreHTMLBlocks||Q.disableParsingRawHTML)return null;var V=J0($,J);if(A0($,J,V),$0>3&&!Z.inHTML)return null;var X=J+t;if($.charCodeAt(X)!==e)return null;var K=$.indexOf(">",X+1);if(K!==-1&&K<V){var G=$.slice(X+1,K);if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(G)||/^[^\s@]+@[^\s@]+$/.test(G))return null}var Y=uZ($,X);if(Y>=1&&Y<=5){var q=$.length;if(Y===1){for(var U=$.length,F=0;F<m$.length;F++){var O=g9($,"</"+m$[F]+">",X);O>=0&&O<U&&(U=O)}if(U<$.length){var z=$.indexOf(">",U);q=z>=0?i($,z+1):$.length}}else{var j=Y===2?"-->":Y===3?"?>":Y===4?">":"]]>",D=$.indexOf(j,X);D>=0&&(q=i($,D+j.length))}var W=$.slice(X,q);if(Y>=2)return{node:{type:v.htmlComment,text:W,h:!1,raw:!0,endPos:q},end:q};var B="div",H=W.match(/^<\/?([a-zA-Z][a-zA-Z0-9-]*)/);H&&(B=H[1]);var M=v9($,X),R={},N;M&&!M.isClosing&&(R=_9(M.attrs,B,Q),N=M.whitespaceBeforeAttrs+M.rawAttrs);var A=[],L=B.toLowerCase(),k="</"+L,P=g9(W,k,0),b=W,y="";if(M&&M.isClosing)for(b=W.slice(M.end-X);b.length>0&&b.charCodeAt(b.length-1)===E;)b=b.slice(0,-1);else if(M&&!M.isClosing){var S=M.end-X;if(P!==-1)for(b=W.slice(S),b.charCodeAt(0)===E&&(b=b.slice(1));b.length>0&&b.charCodeAt(b.length-1)===E;)b=b.slice(0,-1);else for(b=W;b.length>0&&b.charCodeAt(b.length-1)===E;)b=b.slice(0,-1);if(P!==-1){var T=W.slice(S,P);y=T.trim()}}var C=M?M.isClosing:!1;return{node:{type:v.htmlBlock,tag:B,attrs:R,f:N,children:A,a:b,text:y,d:!0,b:C,endPos:q,e:!0},end:q}}if(Y===6||Y===7){var f=N6($,J),g=f<$.length?f:$.length,D0=$.slice(X,g),Q0=f<$.length?i($,f):$.length,m=v9($,X);if(m){var n=m.tag,y0=n.toLowerCase(),c0=m.isClosing;if(c0){var m0=$.slice(m.end,g);return{node:{type:v.htmlBlock,tag:n,attrs:{},children:[],a:m0,text:m0,d:!0,b:!0,endPos:g,e:Y===6},end:Q0}}if(m.selfClosing||p9(n))return{node:{type:v.htmlBlock,tag:n,attrs:_9(m.attrs,n,Q),f:m.whitespaceBeforeAttrs+m.rawAttrs,children:[],a:"",text:"",d:!1,b:!1,endPos:m.end,e:Y===6},end:m.end<$.length&&$.charCodeAt(m.end)===E?m.end+1:m.end};var z0=Z.c||0,h=$.slice(X,g),B0=-1,Z0=-1;if(z0<10){for(var K0="</"+y0,K9=m.end-X,V0=1,j0=K9;j0<h.length&&V0>0;){var v0=g9(h,"<"+y0,j0),s=g9(h,K0,j0);if(s===-1)break;if(v0!==-1&&v0<s){var U0=v0+y0.length+1;if(U0<h.length){var _=h.charCodeAt(U0);(_===I||_===w||_===E||_===d||_===H0)&&V0++}j0=v0+1}else{var l=s+K0.length;if(l<h.length){var I0=h.charCodeAt(l);if((I0===d||I0===I||I0===w||I0===E)&&(V0--,V0===0)){B0=s;for(var P0=l;P0<h.length&&h.charCodeAt(P0)!==d;)P0++;Z0=P0+1;break}}else if(V0--,V0===0){B0=s,Z0=h.length;break}j0=s+1}}var $9=!1;if(B0===-1&&Y===6&&!m.isClosing){var k0=u$($,m.end,y0);if(k0!==-1){for(var X0=A$,x=m.end,R0=!1,F0=!1,G9=!1,c9=0,P9=!1,W9=!1,q9=x;q9<X0;){var z9=$.charCodeAt(q9);if(z9===E)W9&&(R0=!0),P9||c9++,W9=!0,q9++;else if(z9===I||z9===w)q9++;else{if(!P9&&(P9=!0,c9>=2&&z9===e)){G9=!0;break}if(W9=!1,z9===e){var x9=$.charCodeAt(q9+1)|32;if((x9===z$||x9===E$||x9===C9)&&(j6.lastIndex=q9,j6.test($))){F0=!0;break}}q9++}}if(R0&&!G9&&!F0){var Z$=J0($,k0);g=Z$,Q0=i($,Z$),h=$.slice(X,g),D0=$.slice(X,g),B0=X0-X,Z0=k0-X,$9=!0}}}}var O9=m.rawAttrs.indexOf(`
`)!==-1||m.whitespaceBeforeAttrs.indexOf(`
`)!==-1,Z9=!1;if(B0!==-1){var J9=h.slice(Z0).trim();Z9=J9.length===0}var Q9=!1,r0=g,b0=Q0;if(B0!==-1){var b9=X+Z0,U9=J0($,b9-1);if(b9<U9){for(var V9=b9;V9<U9&&($.charCodeAt(V9)===I||$.charCodeAt(V9)===w);)V9++;if(V9<U9&&$.charCodeAt(V9)===e){var w9=v9($,V9);w9&&!w9.isClosing&&(Q9=!0,r0=b9,b0=b9,Z9=!0)}}if(!Q9){var l9=i($,U9);if(l9<g){for(var X9=l9;X9<g&&($.charCodeAt(X9)===I||$.charCodeAt(X9)===w);)X9++;if(X9<g&&$.charCodeAt(X9)===e){var s6=v9($,X9);s6&&(Q9=!0,r0=U9,b0=l9,Z9=!0)}}}if(!Q9&&Z.inHTML){Q9=!0,r0=U9,b0=i($,U9);var t6=$.slice(b9,U9).trim();Z9=t6.length===0}}var o9=[],i0="";if(B0!==-1){i0=h.slice(m.end-X,B0);var R9=i0.trim();if(R9){var{inline:e6,inHTML:$Z,c:ZZ}=Z;Z.inHTML=!0,Z.c=z0+1;var JZ=y0==="p";if(JZ)Z.inline=!0,o9=C0(R9,0,R9.length,Z,Q);else{var l$=i0.indexOf(`

`)!==-1,o$=M6.test(R9),P$=A6.test(R9),QZ=l$||o$||Z.inHTML&&P$,VZ=i0.length>=2&&i0.charCodeAt(0)===E&&i0.charCodeAt(i0.length-1)===E&&!l$;VZ&&!o$&&!P$?o9=[{type:v.text,text:R9}]:QZ||P$?(Z.inline=!1,o9=N9(i0,Z,Q)):(Z.inline=!0,o9=C0(R9,0,R9.length,Z,Q))}Z.inline=e6,Z.inHTML=$Z,Z.c=ZZ}}var r$=!1;if(Y===6&&B0!==-1&&!Z.inHTML&&!O9){var b$=i0,XZ=/<[a-zA-Z][^>]*>/.test(b$),YZ=/\n\n/.test(b$)||/^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m.test(b$);XZ&&!YZ&&(r$=!0)}var KZ=!$9&&(Z.inHTML||Y===7||O9||!Z9||r$);if(KZ){var l0,i$=!1;if(B0!==-1&&Q9){var a$=!1;if(Z.inHTML&&Z0<h.length){for(var q$=Z0;q$<h.length&&h.charCodeAt(q$)!==E;)q$++;var w$=h.slice(Z0,q$).trim();a$=w$.length>1&&w$.charCodeAt(0)===e&&w$.charCodeAt(1)!==H0}l0=a$?h.slice(m.end-X):i0,i$=!0}else(Y===7||Z.inHTML)&&B0!==-1?(l0=h.slice(m.end-X),l0.charCodeAt(0)===E&&(l0=l0.slice(1))):Q9?l0=$.slice(X,r0):O9?l0=D0:(l0=h.slice(m.end-X),l0.charCodeAt(0)===E&&(l0=l0.slice(1)));var n$={type:v.htmlBlock,tag:n,attrs:_9(m.attrs,n,Q),f:m.whitespaceBeforeAttrs+m.rawAttrs,children:o9,a:l0,text:l0,d:!0,b:!1,endPos:r0,e:Y===6};return i$&&(n$.k=!0),{node:n$,end:b0}}return{node:{type:v.htmlBlock,tag:n,attrs:_9(m.attrs,n,Q),f:m.whitespaceBeforeAttrs+m.rawAttrs,children:o9,a:$9?"":i0,text:i0,d:!1,b:!1,endPos:r0,e:Y===6},end:b0}}var U$=D0.match(/^<(\/?)([a-zA-Z][a-zA-Z0-9-]*)/),GZ=U$?U$[2]:"div",s$=U$?U$[1]==="/":!1,R$=D0;if(s$){var t$=D0.indexOf(">");t$!==-1&&(R$=D0.slice(t$+1))}return{node:{type:v.htmlBlock,tag:GZ,attrs:{},children:[],a:R$,text:R$,d:!0,b:s$,endPos:g,e:Y===6},end:Q0}}var L0=v9($,X);if(!L0)return null;var y9=L0.tag,y$=y9.toLowerCase(),e$=y9.charCodeAt(0),F$=e$>=p&&e$<=c;if(!F$&&!M$.has(y$)&&!G$.has(y$)&&!y$.includes("-"))return null;if(L0.isClosing)return{node:{type:v.htmlSelfClosing,tag:y9,attrs:{},a:$.slice(X,L0.end),b:!0,endPos:L0.end},end:L0.end};var OJ=!0,T9=u$($,L0.end,y9),J$=[];if(T9!==-1){var qZ=A$,W$=$.slice(L0.end,qZ),Q$=W$.trim();if(Q$){var UZ=W$.indexOf(`

`)!==-1,FZ=M6.test(Q$),WZ=A6.test(Q$),zZ=Z.inline,OZ=Z.inHTML,HZ=Z.c;Z.inHTML=!0,Z.c=(Z.c||0)+1,UZ||FZ||WZ?(Z.inline=!1,J$=N9(W$,Z,Q)):(Z.inline=!0,J$=C0(Q$,0,Q$.length,Z,Q)),Z.inline=zZ,Z.inHTML=OZ,Z.c=HZ}var DZ=J0($,T9),BZ=$.slice(T9,DZ).trim(),k$=BZ?T9:i($,T9),$6=F$?$.slice(X,T9):$.slice(X,k$),jZ=F$?T9:k$;return{node:{type:v.htmlBlock,tag:y9,attrs:_9(L0.attrs,y9,Q),f:L0.whitespaceBeforeAttrs+L0.rawAttrs,children:J$,a:$6,text:F$?W$:$6,d:!0,b:!1,endPos:jZ,e:!1},end:k$}}var r9=N6($,L0.end),MZ=r9<$.length?i($,r9):r9,L$=$.slice(L0.end,r9);if(L$.trim()){var{inline:AZ,inHTML:_Z,c:vZ}=Z;Z.inline=!1,Z.inHTML=!0,Z.c=(Z.c||0)+1,J$=N9(L$,Z,Q),Z.inline=AZ,Z.inHTML=_Z,Z.c=vZ}var NZ=$.slice(L0.end,r9);return{node:{type:v.htmlBlock,tag:y9,attrs:_9(L0.attrs,y9,Q),f:L0.whitespaceBeforeAttrs+L0.rawAttrs,children:J$,a:NZ,text:L$,d:!0,b:!1,endPos:r9,e:!1},end:MZ}}function uZ($,J){if($.charCodeAt(J)!==e)return 0;var Z=J+1,Q=$.length;if($.charCodeAt(Z)===S0&&$.charCodeAt(Z+1)===u&&$.charCodeAt(Z+2)===u)return 2;if($.charCodeAt(Z)===i9)return 3;if($.charCodeAt(Z)===S0){var V=$.charCodeAt(Z+1);if(V>=p&&V<=c)return 4;if($.slice(Z+1,Z+8)==="[CDATA[")return 5}for(var X=$.charCodeAt(Z)===H0,K=X?Z+1:Z,G=K;G<Q;){var Y=$.charCodeAt(G);if(Y>=p&&Y<=c||Y>=Y0&&Y<=q0||Y>=o&&Y<=r||Y===u)G++;else break}if(G===K)return 0;var q=$.slice(K,G);if(G$.has(q.toLowerCase())){if(X)return 0;var U=$.charCodeAt(G);return U===I||U===w||U===d||U===E||G>=Q?1:0}if(M$.has(q.toLowerCase())){if(X){for(var F=G;F<Q&&($.charCodeAt(F)===I||$.charCodeAt(F)===w);)F++;return F<Q&&$.charCodeAt(F)===d?6:0}var O=G<Q?$.charCodeAt(G):-1;return O===I||O===w||O===d||O===E||O===H0||O===-1?6:0}if(X){for(var W=G;W<Q&&($.charCodeAt(W)===I||$.charCodeAt(W)===w);)W++;if(W<Q&&$.charCodeAt(W)===d){var B=J0($,J),H=$.slice(W+1,B).trim();if(H==="")return 7}}else{var z=J0($,J),j=v9($,J);if(j&&j.end<=z){var D=$.slice(j.end,z).trim();if(D==="")return 7}}return 0}function P6($,J,Z){for(var Q=0,V=$.length;Q<V&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;for(;V>Q&&($.charCodeAt(V-1)===I||$.charCodeAt(V-1)===w);)V--;Q<V&&$.charCodeAt(Q)===N0&&Q++,V>Q&&$.charCodeAt(V-1)===N0&&(V-2<Q||$.charCodeAt(V-2)!==_0)&&V--;for(var X=[],K=Q,G=!1,Y=[],q=Q;q<V;){var U=$.charCodeAt(q);if(U===_0&&q+1<V){$.charCodeAt(q+1)===N0?(G||(G=!0,Y=[]),Y.push($.slice(K,q)),Y.push("|"),q+=2,K=q):q+=2;continue}if(U===a){for(var F=0;q<V&&$.charCodeAt(q)===a;)F++,q++;for(var O=!1;q<V&&!O;){for(var z=0;q<V&&$.charCodeAt(q)===a;)z++,q++;z===F?O=!0:z===0&&q++}continue}if(U===N0){var j=G?(Y.push($.slice(K,q)),Y.join("")):$.slice(K,q);X.push(j.trim()),q++,K=q,G=!1,Y=[];continue}q++}var D=G?(Y.push($.slice(K,V)),Y.join("")):$.slice(K,V);return X.push(D.trim()),X.map(function(W){var B=W.indexOf("\\|")!==-1?W.replace(/\\\|/g,"|"):W;return C0(B,0,B.length,J,Z)})}function b6($,J,Z,Q){let V=J0($,J);var X=$.indexOf("|",J);if(X<0||X>=V)return null;let K=i($,V);if(K>=$.length)return null;let G=J0($,K);if(!E6($,K,G))return null;let Y=$.slice(J,V),q=$.slice(K,G);for(var U=[],F=0,O=q.length;F<O&&(q.charCodeAt(F)===I||q.charCodeAt(F)===w);)F++;for(F<O&&q.charCodeAt(F)===N0&&F++;F<O;){for(;F<O&&(q.charCodeAt(F)===I||q.charCodeAt(F)===w);)F++;if(F>=O||q.charCodeAt(F)===N0)break;var z=q.charCodeAt(F)===g0;for(z&&F++;F<O&&q.charCodeAt(F)===u;)F++;var j=F<O&&q.charCodeAt(F)===g0;for(j&&F++,U.push(z&&j?"center":j?"right":z?"left":null);F<O&&(q.charCodeAt(F)===I||q.charCodeAt(F)===w);)F++;F<O&&q.charCodeAt(F)===N0&&F++}let D=P6(Y,Z,Q);if(U.length!==D.length)return null;let W=[],B=i($,G);for(;B<$.length;){let L=J0($,B),k=$.slice(B,L);if(d0($,B,L))break;if(A0($,B,L),$0<4){var H=$.charCodeAt(B+t);if(H===d||H===Y9||(H===u||H===O0||H===G0)&&E9($,B))break;if(H===a||H===M0){for(var M=B+t,R=0;M<L&&$.charCodeAt(M)===H;)R++,M++;if(R>=3)break}}W.push(P6(k,Z,Q)),B=i($,L)}if((Q.streaming||Q.optimizeForStreaming)&&W.length===0)return null;for(var N=D.length,A=0;A<W.length;A++)if(W[A].length<N)for(;W[A].length<N;)W[A].push([]);else W[A].length>N&&(W[A].length=N);return{node:{type:v.table,header:D,cells:W,align:U},end:B}}function pZ($,J,Z){var Q=J0($,J);if(A0($,J,Q),$0>3)return null;var V=J+t;if($.charCodeAt(V)!==W0)return null;if(V+1<$.length&&$.charCodeAt(V+1)===a0){var X=dZ($,V,Z);return X||null}Z.refs||(Z.refs={});var K=T6($,V,Z.refs);return K===null?null:{node:{type:v.refCollection},end:K}}function dZ($,J,Z){var Q=$.length;if($.charCodeAt(J)!==W0||J+1>=Q||$.charCodeAt(J+1)!==a0)return null;for(var V=J+2,X=V;V<Q&&$.charCodeAt(V)!==u0;){if($.charCodeAt(V)===E)return null;V++}if(V>=Q)return null;var K=("^"+$.slice(X,V)).toLowerCase();if(V++,V>=Q||$.charCodeAt(V)!==g0)return null;for(V++;V<Q&&($.charCodeAt(V)===I||$.charCodeAt(V)===w);)V++;if(V<Q&&$.charCodeAt(V)===E)for(V++;V<Q&&($.charCodeAt(V)===I||$.charCodeAt(V)===w);)V++;var G=$.indexOf(`
`,V);G<0&&(G=Q);for(var Y=$.slice(V,G).trim(),q=G<Q?G+1:Q;q<Q;){var U=J0($,q);if(A0($,q,U),$0>=2&&!d0($,q,U))Y+=`
`+$.slice(q,U),q=i($,U);else if(d0($,q,U)){var F=i($,U);if(F<Q){var O=J0($,F);if(A0($,F,O),$0>=2){Y+=`
`,q=i($,U);continue}}break}else break}return Z.refs[K]||(Z.refs[K]={target:Y,title:void 0}),{node:{type:v.footnote},end:q}}function cZ($,J,Z,Q){let V=J,X=0,K=0,G=-1;for(;V<$.length;){let y=G>=0?G:J0($,V);if(G=-1,d0($,V,y))break;if(A0($,V,y),$0<4&&K>0&&!Z.g){let T=$.charCodeAt(V+t);if(T===x0||T===u){let C=V+t;for(;C<y&&$.charCodeAt(C)===T;)C++;for(;C<y&&($.charCodeAt(C)===I||$.charCodeAt(C)===w);)C++;if(C>=y){X=T===x0?1:2,V=i($,y);break}}}K=y;let S=i($,y);if(S<$.length){if($.charCodeAt(S)===a9){var Y=J0($,S);V=i($,Y),K=Y;continue}let T=J0($,S);if(G=T,A0($,S,T),$0<4){let C=$.charCodeAt(S+t);if(C===d){V=S;break}if(C===Y9&&m6($,S,Z,Q)){V=S;break}if(C===a||C===M0){for(var q=S+t,U=0;q<T&&$.charCodeAt(q)===C;)U++,q++;if(U>=3){V=S;break}}if(C===e){var F=S+t+1,O=F<T?$.charCodeAt(F):0,z=O===S0||O===i9;if(!z&&O===H0){for(var j=F+1,D=j;D<T&&($.charCodeAt(D)>=p&&$.charCodeAt(D)<=c||$.charCodeAt(D)>=Y0&&$.charCodeAt(D)<=q0||$.charCodeAt(D)>=o&&$.charCodeAt(D)<=r||$.charCodeAt(D)===u);)D++;D>j&&(z=M$.has($.slice(j,D).toLowerCase()))}else if(!z){for(var W=F;W<T&&($.charCodeAt(W)>=p&&$.charCodeAt(W)<=c||$.charCodeAt(W)>=Y0&&$.charCodeAt(W)<=q0||$.charCodeAt(W)>=o&&$.charCodeAt(W)<=r||$.charCodeAt(W)===u);)W++;if(W>F){var B=$.slice(F,W).toLowerCase();z=M$.has(B)||G$.has(B)}}if(z&&p6($,S,Z,Q)){V=S;break}}if(C===u||C===O0||C===j9){let f=S+t+1;if(f<T&&($.charCodeAt(f)===I||$.charCodeAt(f)===w)){var H=K$($,f,T);if(H<T&&!E9($,S)){V=S;break}}}if(C>=o&&C<=r){let f=S+t;for(;f<T&&$.charCodeAt(f)>=o&&$.charCodeAt(f)<=r;)f++;if(f<T&&($.charCodeAt(f)===p0||$.charCodeAt(f)===s0)&&f-(S+t)===1&&$.charCodeAt(S+t)===49){var M=f+1;if(M<T&&($.charCodeAt(M)===I||$.charCodeAt(M)===w)){var R=K$($,M,T);if(R<T){V=S;break}}}}if(C===N0){let f=i($,T);if(f<$.length){let g=J0($,f);if(E6($,f,g)){V=S;break}}}if((C===u||C===O0||C===G0)&&E9($,S)){if(C!==u){V=S;break}let f=0,g=S+t;for(;g<T&&$.charCodeAt(g)===u;)f++,g++;for(;g<T&&($.charCodeAt(g)===I||$.charCodeAt(g)===w);)g++;if(g<T){V=S;break}}}}V=i($,y)}for(var N=X?K:V;N>J&&($.charCodeAt(N-1)===E||$.charCodeAt(N-1)===H9||$.charCodeAt(N-1)===I||$.charCodeAt(N-1)===w);)N--;for(var A=J;A<N&&($.charCodeAt(A)===I||$.charCodeAt(A)===w);)A++;if(A>=N)return null;for(var L=!1,k=A;k<N;k++)if($.charCodeAt(k)===a9){L=!0;break}var P=L?$.slice(A,N).replace(/\u001E/g,""):$.slice(A,N);if(!P)return null;let b=lZ(P,0,P.length,Z,Q);if(X){let S=(Q?.slugify||f0)(P);return{node:{type:v.heading,level:X,children:b,id:S},end:V}}return{node:{type:v.paragraph,children:b},end:V}}function lZ($,J,Z,Q,V){var X=$.indexOf(`
`,J);if(X<0||X>=Z)return C0($,J,Z,Q,V);for(var K="",G=J,Y=J;Y<Z;){var q=$.charCodeAt(Y);if(q===a){var U=v$($,Y,Z);if(U>Y){for(var F=!1,O=Y;O<U;O++)if($.charCodeAt(O)===E){F=!0;break}F&&(K+=$.slice(G,Y),K+=$.slice(Y,U).replace(/\n/g," "),G=U),Y=U;continue}}if(q===e){var z=d6($,Y,Z);if(z>Y){Y=z;continue}}if(q===E){var j=!1,D=0;if(Y>J&&$.charCodeAt(Y-1)===_0)j=!0,D=1;else{for(var W=0,B=Y-1;B>=J&&$.charCodeAt(B)===I;)W++,B--;W>=2&&(j=!0,D=W)}if(j)K+=$.slice(G,Y-D),K+="";else{for(var H=Y;H>G&&$.charCodeAt(H-1)===I;)H--;K+=$.slice(G,H)+`
`}for(Y++;Y<Z&&$.charCodeAt(Y)===I;)Y++;G=Y;continue}Y++}return G<Z&&(K+=$.slice(G,Z)),C0(K,0,K.length,Q,V)}function oZ($,J,Z){if($.charCodeAt(J)!==a)return null;let Q=I9($,J,Z,96),V=J+Q;for(;V<Z;){let X=$.indexOf("`",V);if(X<0||X>=Z)return null;let K=I9($,X,Z,96);if(K===Q){let G=$.slice(J+Q,X);return G=G.replace(/\n/g," "),G.length>0&&G[0]===" "&&G[G.length-1]===" "&&G.trim().length>0&&(G=G.slice(1,-1)),{node:{type:v.codeInline,text:G},end:X+K}}V=X+K}return null}function v$($,J,Z){if($.charCodeAt(J)!==a)return J;let Q=I9($,J,Z,96),V=J+Q;for(;V<Z;){let X=$.indexOf("`",V);if(X<0||X>=Z)return J;let K=I9($,X,Z,96);if(K===Q)return X+K;V=X+K}return J}function d6($,J,Z){if($.charCodeAt(J)!==e)return J;if(J+1<Z&&$.charCodeAt(J+1)===H0){let q=J+2;for(;q<Z&&$.charCodeAt(q)!==d;)q++;return q<Z?q+1:J}if(J+3<Z&&$.charCodeAt(J+1)===S0&&$.charCodeAt(J+2)===u&&$.charCodeAt(J+3)===u){let q=$.indexOf("-->",J+4);return q>=0?q+3:J}let Q=J+1,V=Q;for(;Q<Z;){let q=$.charCodeAt(Q);if(q>=p&&q<=c||q>=Y0&&q<=q0||q>=o&&q<=r||q===u)Q++;else break}if(Q===V)return J;let X=$.slice(V,Q).toLowerCase(),K=!1;for(;Q<Z;){let q=$.charCodeAt(Q);if(q===d){Q++;break}if(q===H0&&Q+1<Z&&$.charCodeAt(Q+1)===d){Q+=2,K=!0;break}if(q===B9||q===k9){var G=q;for(Q++;Q<Z&&$.charCodeAt(Q)!==G;)Q++;Q<Z&&Q++;continue}if(q===E)return J;Q++}if(K||p9(X))return Q;let Y=1;for(;Q<Z&&Y>0;)if($.charCodeAt(Q)===e)if(Q+1<Z&&$.charCodeAt(Q+1)===H0){let q=Q+2,U=q;for(;U<Z&&($.charCodeAt(U)>=p&&$.charCodeAt(U)<=c||$.charCodeAt(U)>=Y0&&$.charCodeAt(U)<=q0);)U++;if($.slice(q,U).toLowerCase()===X){for(;U<Z&&$.charCodeAt(U)!==d;)U++;if(U<Z&&U++,Y--,Y===0)return U}Q=U}else{let q=Q+1,U=q;for(;U<Z&&($.charCodeAt(U)>=p&&$.charCodeAt(U)<=c||$.charCodeAt(U)>=Y0&&$.charCodeAt(U)<=q0);)U++;$.slice(q,U).toLowerCase()===X&&Y++,Q++}else Q++;return Q}function rZ($,J,Z,Q,V){if($.charCodeAt(J)!==M0||J+1>=Z||$.charCodeAt(J+1)!==M0)return null;let X=J+2;for(;X+1<Z;){let K=$.charCodeAt(X);if(K===a){let G=v$($,X,Z);if(G>X){X=G;continue}}if(K===M0&&$.charCodeAt(X+1)===M0){let G=$.slice(J+2,X),Y=C0(G,0,G.length,Q,V);return{node:{type:v.textFormatted,tag:"del",children:Y},end:X+2}}K===_0&&X+1<Z&&X++,X++}return null}function iZ($,J,Z,Q,V){if($.charCodeAt(J)!==x0||J+1>=Z||$.charCodeAt(J+1)!==x0)return null;let X=J+2;for(;X+1<Z;){let K=$.charCodeAt(X);if(K===a){let G=v$($,X,Z);if(G>X){X=G;continue}}if(K===x0&&$.charCodeAt(X+1)===x0&&X>J+2){let G=$.slice(J+2,X),Y=C0(G,0,G.length,Q,V);return{node:{type:v.textFormatted,tag:"mark",children:Y},end:X+2}}K===_0&&X+1<Z&&X++,X++}return null}function w6($,J,Z){return $<n9?!!(d$($)&m9):z6.test(J[Z])}function R6($,J,Z){return $<n9?!!(d$($)&M9):O6.test(J[Z])}function aZ($,J,Z){var Q=$.charCodeAt(J);if(Q!==O0&&Q!==G0)return null;var V=I9($,J,Z,Q);if(V===0)return null;var X=J>0?$.charCodeAt(J-1):32,K=J+V<Z?$.charCodeAt(J+V):32,G=R6(X,$,J-1),Y=R6(K,$,J+V),q=J>0?w6(X,$,J-1):!1,U=J+V<Z?w6(K,$,J+V):!1,F=!Y&&(!U||G||q),O=!G&&(!q||Y||U),z,j;return Q===O0?(z=F,j=O):(z=F&&(!O||q),j=O&&(!F||U)),{len:V,canOpen:z,canClose:j}}function nZ($,J,Z,Q){if(J.length!==0){for(var V=[],X=0;X<12;X++)V[X]=-1;for(var K=0;K<J.length;){var G=J[K];if(!G.active||!G.canClose){K++;continue}for(var Y=G.ch===O0?0:1,q=Y*6+G.len%3*2+(G.canOpen?1:0),U=V[q]!==void 0?V[q]:-1,F=-1,O=K-1;O>U;O--){var z=J[O];if(!(!z.active||z.ch!==G.ch||!z.canOpen)&&!((G.canOpen||z.canClose)&&(z.len+G.len)%3===0&&z.len%3!==0)){F=O;break}}if(F<0){V[q]=K-1,!G.canOpen&&(G.active=!1),K++;continue}var j=J[F],D=j.len>=2&&G.len>=2,W=D?2:1;j.len-=W,G.len-=W;var B=$[j.idx],H=$[G.idx];B.text=B.text.slice(0,B.text.length-W),H.text=H.text.slice(W);var M=j.idx+1,R=G.idx,N=$.slice(M,R),A={type:v.textFormatted,tag:D?"strong":"em",children:N};$.splice(M,R-M,A);for(var L=R-M-1,k=0;k<J.length;k++)J[k].idx>j.idx&&(J[k].idx-=L);for(var P=F+1;P<K;P++)J[P].active=!1;if(j.len===0&&(j.active=!1,B.text==="")){$.splice(j.idx,1);for(var b=0;b<J.length;b++)J[b].idx>j.idx?J[b].idx--:J[b].idx===j.idx&&(J[b].idx=-1)}if(G.len===0){G.active=!1;var y=G.idx;if(H.text===""){$.splice(y,1);for(var S=0;S<J.length;S++)J[S].idx>y?J[S].idx--:J[S].idx===y&&(J[S].idx=-1)}}else continue;K++}for(var T=0,C=0;C<$.length;C++){var f=$[C];if(f.type===v.text){var g=f;if(g.text==="")continue;if(T>0&&$[T-1].type===v.text){$[T-1].text+=g.text;continue}}$[T++]=f}$.length=T}}function y6($,J,Z,Q,V){let X=$.charCodeAt(J)===S0,K=X?J+1:J;if($.charCodeAt(K)!==W0)return null;var G=$.indexOf("]",K+1);if(G<0||G>=Z)return null;for(var Y=K+1,q=-1,U=1;Y<Z&&U>0;){var F=$.charCodeAt(Y);if(F===_0&&Y+1<Z){Y+=2;continue}if(F===a){var O=v$($,Y,Z);if(O>Y){Y=O;continue}}if(F===e){var z=c6($,Y,Z);if(z){Y=z.end;continue}var j=d6($,Y,Z);if(j>Y){Y=j;continue}}F===W0?U++:F===u0&&U--,Y++}if(U!==0)return null;var D=Y-1,W=$.slice(K+1,D),B=Y<Z?$.charCodeAt(Y):0,H=!1;if(B===n0){var M=!0;for(Y++;Y<Z&&($.charCodeAt(Y)===I||$.charCodeAt(Y)===E);)Y++;var R="",N=Y;if(Y<Z&&$.charCodeAt(Y)===e){for(Y++,N=Y;N<Z&&$.charCodeAt(N)!==d;){if($.charCodeAt(N)===_0&&N+1<Z){N+=2;continue}if($.charCodeAt(N)===E){M=!1;break}N++}M&&(N>=Z||$.charCodeAt(N)!==d)&&(M=!1),M&&(R=$.slice(Y,N),N++)}else if(M){for(var A=0;N<Z;){var L=$.charCodeAt(N);if(L===_0&&N+1<Z){N+=2;continue}if(L===n0)A++;else if(L===s0){if(A===0)break;A--}else if(L===I||L===E)break;N++}R=$.slice(Y,N)}if(M){for(Y=N;Y<Z&&($.charCodeAt(Y)===I||$.charCodeAt(Y)===E);)Y++;var k;if(Y<Z){var P=$.charCodeAt(Y);if(P===B9||P===k9||P===n0){var b=P===n0?41:P;Y++;for(var y=Y;Y<Z&&$.charCodeAt(Y)!==b;)$.charCodeAt(Y)===_0&&Y+1<Z&&Y++,Y++;Y>=Z?M=!1:(k=$.slice(y,Y),Y++)}}if(M){for(;Y<Z&&($.charCodeAt(Y)===I||$.charCodeAt(Y)===E);)Y++;(Y>=Z||$.charCodeAt(Y)!==s0)&&(M=!1)}}if(M){Y++,R=$$(R),k!==void 0&&(k=s9($$(k)));var S=V?.sanitizer||u9,T=S(R,X?"img":"a",X?"src":"href"),C=T===null?null:R;if(X){var f=C0(W,0,W.length,Q,V),g=_$(f);return{node:{type:v.image,target:C,alt:g,title:k},end:Y}}else{var D0=Q.inAnchor;Q.inAnchor=!0;var Q0=D0?[{type:v.text,text:W}]:C0(W,0,W.length,Q,V);return Q.inAnchor=D0,!Q.inAnchor&&p$(Q0)?null:{node:{type:v.link,target:C,title:k,children:Q0},end:Y}}}else Y=D+1,H=!0}var m="",n=Y;if(!H&&B===W0){var y0=Y+1;n=y0;for(var c0=!1;n<Z&&$.charCodeAt(n)!==u0;){if($.charCodeAt(n)===_0&&n+1<Z){n+=2;continue}if($.charCodeAt(n)===W0){c0=!0;break}n++}if(c0||n>=Z)return null;var m0=$.slice(y0,n);if(m0.trim())m=B$(m0);else{if(v6(W))return null;m=B$(W)}n=n+1}else{if(v6(W))return null;m=B$(W)}var z0=Q.refs[m];if(!z0)return null;if(X)return{node:{type:v.image,target:z0.target,alt:_$(C0(W,0,W.length,Q,V)),title:z0.title},end:n};var h=Q.inAnchor;Q.inAnchor=!0;var Q0=h?[{type:v.text,text:W}]:C0(W,0,W.length,Q,V);return Q.inAnchor=h,!Q.inAnchor&&p$(Q0)?null:{node:{type:v.link,target:z0.target,title:z0.title,children:Q0},end:n}}function c6($,J,Z){if($.charCodeAt(J)!==e)return null;for(var Q=J+1;Q<Z;){var V=$.charCodeAt(Q);if(V===d)break;if(V===I||V===E||V===H9||V===e)return null;Q++}if(Q>=Z||$.charCodeAt(Q)!==d)return null;var X=$.slice(J+1,Q),K=X.match(/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^\x00-\x20]*)$/);return K?{node:{type:v.link,target:X,title:void 0,children:[{type:v.text,text:X}]},end:Q+1}:X.indexOf("@")!==-1&&/^[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])?)*$/.test(X)?{node:{type:v.link,target:"mailto:"+X,title:void 0,children:[{type:v.text,text:X}]},end:Q+1}:null}function sZ($,J,Z,Q){if($.charCodeAt(J)!==W0||J+1>=Z||$.charCodeAt(J+1)!==a0)return null;let V=J+2;for(;V<Z&&$.charCodeAt(V)!==u0&&$.charCodeAt(V)!==E;)V++;if(V>=Z||$.charCodeAt(V)!==u0)return null;let X=$.slice(J+2,V);return X?{node:{type:v.footnoteReference,target:"#"+f0(X),text:X},end:V+1}:null}function tZ($,J,Z,Q){if(Q.disableBareUrls)return null;var V="",X=!1,K=$.charCodeAt(J);if(K===f9||K===72?J+8<=Z&&$.charCodeAt(J+1)===C9&&$.charCodeAt(J+2)===C9&&$.charCodeAt(J+3)===z$&&($.charCodeAt(J+4)===E$&&$.charCodeAt(J+5)===g0&&$.charCodeAt(J+6)===H0&&$.charCodeAt(J+7)===H0?V="https://":$.charCodeAt(J+4)===g0&&$.charCodeAt(J+5)===H0&&$.charCodeAt(J+6)===H0&&(V="http://")):K===D9||K===70?J+6<=Z&&$.charCodeAt(J+1)===C9&&$.charCodeAt(J+2)===z$&&$.charCodeAt(J+3)===g0&&$.charCodeAt(J+4)===H0&&$.charCodeAt(J+5)===H0&&(V="ftp://"):(K===F9||K===87)&&J+4<=Z&&$.charCodeAt(J+1)===F9&&$.charCodeAt(J+2)===F9&&$.charCodeAt(J+3)===p0&&(V="www.",X=!0),!V)return null;let G=J+V.length;for(;G<Z;){let A=$.charCodeAt(G);if(A===I||A===E||A===w||A===H9||A===e||A===d)break;G++}for(var Y=0,q=0,U=J;U<G;U++){var F=$.charCodeAt(U);F===n0?Y++:F===s0&&q++}let O=G;for(;O>J+V.length;){let A=$.charCodeAt(O-1);if(A===p0||A===Q6||A===g0||A===S0||A===i9||A===s0||A===O0||A===G0||A===M0){if(A===s0){if(Y>=q)break;q--}O--}else if(A===x$){for(var z=O-2;z>J&&($.charCodeAt(z)>=p&&$.charCodeAt(z)<=c||$.charCodeAt(z)>=Y0&&$.charCodeAt(z)<=q0||$.charCodeAt(z)>=o&&$.charCodeAt(z)<=r);)z--;z>=J&&$.charCodeAt(z)===S$?O=z:O--}else break}if(O<=J+V.length)return null;var j=J+(X?4:V.length),D=$.indexOf("/",j);if((D<0||D>O)&&(D=O),X&&$.indexOf(".",j)===-1)return null;for(var W=-1,B=-1,H=D-1;H>=j;H--)if($.charCodeAt(H)===p0)if(W<0)W=H;else{B=H;break}for(var M=B>=0?B+1:j,H=M;H<D;H++)if($.charCodeAt(H)===G0)return null;var R=$.slice(J,O),N=X?"http://"+R:R;return{node:{type:v.link,target:N,title:void 0,children:[{type:v.text,text:R}]},end:O}}function eZ($,J,Z,Q){if(Q.disableBareUrls)return null;for(var V=J,X=V;V<Z;){var K=$.charCodeAt(V);if(K>=p&&K<=c||K>=Y0&&K<=q0||K>=o&&K<=r||K===p0||K===S0||K===Y9||K===36||K===V$||K===S$||K===k9||K===O0||K===j9||K===H0||K===x0||K===i9||K===a0||K===G0||K===a||K===L9||K===N0||K===O$||K===M0||K===u)V++;else break}if(V===X||V>=Z||$.charCodeAt(V)!==X$)return null;V++;for(var G=V,Y=-1,q=V;V<Z;){var K=$.charCodeAt(V);if(K>=p&&K<=c||K>=Y0&&K<=q0||K>=o&&K<=r)V++;else if((K===u||K===G0)&&V>G)V++;else if(K===p0){if(V===G)break;var U=$.charCodeAt(V-1);if(U===u||U===G0||V-q>63)break;if(V+1<Z){var F=$.charCodeAt(V+1);if(F>=p&&F<=c||F>=Y0&&F<=q0||F>=o&&F<=r)Y=V,q=V+1,V++;else break}else break}else break}if(V-q>63||Y<0)return null;var O=$.charCodeAt(V-1);if(!(O>=p&&O<=c||O>=Y0&&O<=q0||O>=o&&O<=r)||V<=Y+1)return null;for(var z=-1,j=Y-1;j>=G;j--)if($.charCodeAt(j)===p0){z=j;break}for(var D=z>=0?z+1:G,j=D;j<V;j++)if($.charCodeAt(j)===G0)return null;var W=$.slice(J,V);return{node:{type:v.link,target:"mailto:"+W,title:void 0,children:[{type:v.text,text:W}]},end:V}}function p$($){for(var J=0;J<$.length;J++)if($[J].type===v.link||"children"in $[J]&&Array.isArray($[J].children)&&p$($[J].children))return!0;return!1}function _$($){for(var J="",Z=0;Z<$.length;Z++){var Q=$[Z];Q.type===v.text?J+=Q.text:Q.type===v.breakLine?J+=" ":Q.type===v.codeInline?J+=Q.text:"children"in Q&&Array.isArray(Q.children)?J+=_$(Q.children):Q.type===v.image?J+=Q.alt||"":Q.type===v.link&&(J+=_$(Q.children))}return J}function d9($){let J=$.includes("&")?s9($):$;return{type:v.text,text:J}}function $J($,J,Z,Q,V){if($.charCodeAt(J)!==e)return null;var X=J+1;if(X>=Z)return null;var K=$.charCodeAt(X);if(K===S0&&X+1<Z&&$.charCodeAt(X+1)===u&&X+2<Z&&$.charCodeAt(X+2)===u){var G=X+3;if(G<Z&&$.charCodeAt(G)===d)return{node:{type:v.htmlComment,text:"",h:!0},end:G+1};if(G+1<Z&&$.charCodeAt(G)===u&&$.charCodeAt(G+1)===d)return{node:{type:v.htmlComment,text:"-",h:!0},end:G+2};var Y=$.indexOf("-->",G);return Y!==-1&&Y<=Z-3?{node:{type:v.htmlComment,text:$.slice(J+4,Y),h:!1},end:Y+3}:null}if(K===i9){var q=$.indexOf("?>",X+1);return q!==-1&&q<Z?{node:{type:v.htmlSelfClosing,tag:"?",attrs:{},a:$.slice(J,q+2),b:!1},end:q+2}:null}if(K===S0&&X+1<Z){var U=$.charCodeAt(X+1);if(U===W0&&$.slice(X+1,X+8)==="[CDATA["){var F=$.indexOf("]]>",X+8);return F!==-1&&F<Z?{node:{type:v.htmlSelfClosing,tag:"![CDATA[",attrs:{},a:$.slice(J,F+3),b:!1},end:F+3}:null}if(U>=p&&U<=c){var O=$.indexOf(">",X+2);return O!==-1&&O<Z?{node:{type:v.htmlSelfClosing,tag:"!"+$.slice(X+1,O),attrs:{},a:$.slice(J,O+1),b:!1},end:O+1}:null}}if(K===H0){var z=X+1;if(z>=Z)return null;var j=$.charCodeAt(z);if(!(j>=p&&j<=c||j>=Y0&&j<=q0))return null;for(z++;z<Z;){var D=$.charCodeAt(z);if(D>=p&&D<=c||D>=Y0&&D<=q0||D>=o&&D<=r||D===u)z++;else break}for(;z<Z&&($.charCodeAt(z)===I||$.charCodeAt(z)===w||$.charCodeAt(z)===E);)z++;if(z<Z&&$.charCodeAt(z)===d){var W=$.slice(X+1,z).trim();return{node:{type:v.htmlSelfClosing,tag:W,attrs:{},a:$.slice(J,z+1),b:!0},end:z+1}}return null}if(!(K>=p&&K<=c||K>=Y0&&K<=q0))return null;var B=v9($,J);if(!B)return null;var H=B.tag,M=H.toLowerCase(),R=B.selfClosing;if(R||p9(H))return{node:{type:v.htmlSelfClosing,tag:H,attrs:_9(B.attrs,H,V),a:$.slice(J,B.end),b:!1},end:B.end};var N=G$.has(M),A=u$($.slice(0,Z),B.end,H);if(A===-1)return{node:{type:v.htmlSelfClosing,tag:H,attrs:_9(B.attrs,H,V),a:$.slice(J,B.end),b:!1},end:B.end};var L=mZ($,"</"+M,A),k=$.slice(B.end,L),P=[];if(N)k.trim()&&(P=[{type:v.text,text:k}]);else{var b=k.trim();if(b){var{inAnchor:y,inline:S}=Q;M==="a"&&(Q.inAnchor=!0);var T=b.indexOf(`

`)!==-1||/^#{1,6}\s/.test(b);T?(Q.inline=!1,P=N9(b,Q,V)):P=C0(b,0,b.length,Q,V),Q.inAnchor=y,Q.inline=S}}return{node:{type:v.htmlBlock,tag:H,attrs:_9(B.attrs,H,V),f:B.rawAttrs,children:P,a:void 0,text:k,d:!1,b:!1,endPos:A,e:!1},end:A}}var ZJ=200,e9=0;function C0($,J,Z,Q,V){if(e9++,e9>ZJ)return e9--,[{type:v.text,text:$.slice(J,Z)}];let X=Q;if(V.streaming||V.optimizeForStreaming){let $9=function(X0,x){for(var R0=1,F0=x+1;F0<X0.length;F0++){var G9=X0.charCodeAt(F0);if(G9===W0)R0++;else if(G9===u0&&(R0--,R0===0))return F0}return-1},_=$.slice(J,Z),l=_;for(var K=0,G=0,Y=0,q=0,U=0,F=-1,O=-1,z=-1,j=-1,D=-1,W=0;W<_.length;W++){var B=_.charCodeAt(W);B===O0?W+1<_.length&&_.charCodeAt(W+1)===O0?(K++,F=W,W++):(G++,O=W):B===G0?W+1<_.length&&_.charCodeAt(W+1)===G0?(Y++,z=W,W++):(q++,j=W):B===M0&&W+1<_.length&&_.charCodeAt(W+1)===M0&&(U++,D=W,W++)}var H=[];U%2===1&&D>=0&&H.push([D,2]),Y%2===1&&z>=0&&H.push([z,2]),q%2===1&&j>=0&&H.push([j,1]),K%2===1&&F>=0&&H.push([F,2]),G%2===1&&O>=0&&H.push([O,1]),H.sort(function(X0,x){return x[0]-X0[0]});for(var M=0;M<H.length;M++){var R=H[M][0],N=H[M][1];_=_.slice(0,R)+_.slice(R+N)}let I0=0,P0=-1;for(let X0=0;X0<_.length;X0++)_.charCodeAt(X0)===a&&(I0++,P0=X0);if(I0%2===1&&P0!==-1){let X0=!1,x=-1,R0=0;for(;R0<_.length;)_.charCodeAt(R0)===a&&(X0?(X0=!1,x=-1):(x=R0,X0=!0)),R0++;X0&&x!==-1&&(_=_.slice(0,x))}for(var A=!0;A;){A=!1;for(var L=-1,k=-1,P=-1,b=!1,y=0;y<_.length;y++){var S=_.charCodeAt(y);if(S===W0&&(y===0||_.charCodeAt(y-1)!==_0)){var T=y>0&&_.charCodeAt(y-1)===S0,C=T?y-1:y,f=$9(_,y);if(f===-1)L=C,b=T,k=y+1,P=_.length;else{var g=f+1;if(g>=_.length)L=C,b=T,k=y+1,P=f;else if(_.charCodeAt(g)===n0){var D0=_.indexOf(")",g+1);D0===-1?(L=C,b=T,k=y+1,P=f,y=_.length):y=D0}else if(_.charCodeAt(g)===W0){var Q0=_.indexOf("]",g+1);Q0===-1?(L=C,b=T,k=y+1,P=f,y=_.length):y=Q0}else y=f}}}if(L>=0){var m=b?"":_.slice(k,P);_=_.slice(0,L)+m,A=!0}}let k0=_.match(/<([A-Z][A-Za-z0-9]*)(?:\s[^>]*)?>([^<]*)$/);if(k0&&k0.index!==void 0){var n=k0[0].length-k0[2].length,y0=n>=2&&k0[0].charCodeAt(n-2)===H0;if(!y0){for(var c0=!1,m0=0,z0=0;z0<k0.index;z0++)_.charCodeAt(z0)===a&&m0++;if(c0=m0%2===1,!c0){let X0=k0[1];g9(_,"</"+X0,0)===-1&&(_=_.replace(/<[A-Z][A-Za-z0-9]*(?:\s[^>]*)?>([^<]*)$/,"$1"))}}}_!==l&&($=$.slice(0,J)+_,Z=J+_.length)}let h=[];var B0=[];let Z0=J;var K0=V.disableAutoLink||V.disableBareUrls||X.inAnchor?-1:$.indexOf("@",J);for(K0>=Z&&(K0=-1);J<Z;){let _=$.charCodeAt(J),l=null;if(_===a){if(l=oZ($,J,Z),!l){var K9=I9($,J,Z,a);J+=K9-1}}else if(_===O0||_===G0){var V0=aZ($,J,Z);if(V0){if(V0.canOpen||V0.canClose){J>Z0&&h.push(d9($.slice(Z0,J)));var j0=$.slice(J,J+V0.len),v0=d9(j0);B0.push({idx:h.length,ch:_,len:V0.len,canOpen:V0.canOpen,canClose:V0.canClose,active:!0}),h.push(v0),J+=V0.len,Z0=J;continue}J+=V0.len-1}}else if(_===M0)l=rZ($,J,Z,X,V);else if(_===x0)l=iZ($,J,Z,X,V);else if(_===W0)J+1<Z&&$.charCodeAt(J+1)===a0&&(l=sZ($,J,Z,X)),l||(l=y6($,J,Z,X,V));else if(_===S0&&J+1<Z&&$.charCodeAt(J+1)===W0)l=y6($,J,Z,X,V);else if(_===e)l=c6($,J,Z),!l&&!V.disableParsingRawHTML&&!V.ignoreHTMLBlocks&&(l=$J($,J,Z,X,V));else if((_===f9||_===F9||_===D9)&&!X.inAnchor&&!V.disableAutoLink&&(J===0||$.charCodeAt(J-1)!==e)){var s=J+1<Z?$.charCodeAt(J+1):0;(_===f9&&s===C9||_===D9&&s===C9||_===F9&&s===F9)&&(l=tZ($,J,Z,V))}if(!l&&K0>=0&&K0-J<=64&&!X.inAnchor&&!V.disableAutoLink&&!V.disableBareUrls&&(_>=p&&_<=c||_>=Y0&&_<=q0||_>=o&&_<=r)&&(l=eZ($,J,Z,V),!l&&J>=K0&&(K0=$.indexOf("@",J+1),K0>=Z&&(K0=-1))),_===H$){J>Z0&&h.push(d9($.slice(Z0,J))),h.push({type:v.breakLine}),J++,Z0=J;continue}if(l)J>Z0&&h.push(d9($.slice(Z0,J))),h.push(l.node),J=l.end,Z0=J;else{if(_===_0&&J+1<Z){let I0=$.charCodeAt(J+1);if(d$(I0)&m9){J>Z0&&h.push(d9($.slice(Z0,J))),h.push(d9($[J+1])),J+=2,Z0=J;continue}}if(J++,K0<0||K0-J>64)for(;J<Z;){var U0=$.charCodeAt(J);if(U0<n9&&!S6[U0])J++;else break}}}if(Z>Z0){let _=$.slice(Z0,Z);_&&h.push(d9(_))}return B0.length>0&&nZ(h,B0,Q,V),e9--,h}var JJ=500;function N9($,J,Z){var Q=J.i||0;if(Q>JJ)return[{type:v.text,text:$}];J.i=Q+1;let V=J;if((Z.streaming||Z.optimizeForStreaming)&&!J.j){var X=$.length;X>0&&$.charCodeAt(X-1)===E&&X--;for(var K=X;K>0&&$.charCodeAt(K-1)!==E;)K--;if(K>0&&$.charCodeAt(K)===N0){for(var G=!0,Y=K;Y<X;Y++){var q=$.charCodeAt(Y);if(q!==I&&q!==w&&q!==u&&q!==g0&&q!==N0){G=!1;break}}if(G){for(var U=K-1;U>0&&$.charCodeAt(U-1)!==E;)U--;$.charCodeAt(U)===N0&&($=$.slice(0,U).trimEnd())}}var F=$.trim(),O=F.lastIndexOf(`
`),z=O===-1?F:F.slice(O+1);if(z.length>0&&z.charCodeAt(0)===N0){for(var j=!1,D=!1,W=1;W<z.length;W++){var B=z.charCodeAt(W);B===N0&&(j=!0),B===u&&(D=!0)}j&&D&&($=O===-1?"":$.slice(0,$.lastIndexOf(z)).trimEnd())}for(var H=-1,M=-1,R=-1,N=$.length-1;N>=0;N--)if($.charCodeAt(N)===e){var A=N+1<$.length?$.charCodeAt(N+1):0;if(A>=p&&A<=c||A>=Y0&&A<=q0){for(var L=N+2;L<$.length;){var k=$.charCodeAt(L);if(k>=p&&k<=c||k>=Y0&&k<=q0||k>=o&&k<=r)L++;else break}for(var P=L;P<$.length&&$.charCodeAt(P)!==d;)P++;if(P<$.length&&$.charCodeAt(P-1)!==H0){for(var b=!1,y=P+1;y<$.length;y++)if($.charCodeAt(y)===e){b=!0;break}b||(H=N,M=L,R=P+1)}}break}if(H>=0){for(var S=0,T=0;T<H;T++)$.charCodeAt(T)===a&&S++;if(S%2===0){var C=$.slice(H+1,M);g9($,"</"+C,0)===-1&&($=$.slice(0,H)+$.slice(R))}}for(var f=$.length;f>0&&$.charCodeAt(f-1)===E;)f--;if(f>0){for(var g=f;g>0&&$.charCodeAt(g-1)!==E;)g--;for(var D0=g,Q0=0;D0<f&&$.charCodeAt(D0)===I&&Q0<3;)D0++,Q0++;if(g>0&&D0<f&&xZ($,D0,f)){for(var m=g-1,n=m;n>0&&$.charCodeAt(n-1)!==E;)n--;d0($,n,m)||($=$.slice(0,g).trimEnd())}}var y0=$.length;if(y0>0){for(var c0=$.lastIndexOf(`
`),m0=c0===-1?0:c0+1,z0=y0,h=m0,B0=0;h<z0&&$.charCodeAt(h)===I&&B0<3;)h++,B0++;if(h<z0){var Z0=$.charCodeAt(h),K0=!1;if(Z0===O0||Z0===u||Z0===j9){var K9=h+1;if(K9>=z0||$.charCodeAt(K9)===I||$.charCodeAt(K9)===w){for(var V0=K9;V0<z0&&($.charCodeAt(V0)===I||$.charCodeAt(V0)===w);)V0++;V0>=z0&&(K0=!0)}}else if(Z0>=o&&Z0<=r){for(var j0=h;j0<z0&&$.charCodeAt(j0)>=o&&$.charCodeAt(j0)<=r;)j0++;if(j0<z0&&($.charCodeAt(j0)===p0||$.charCodeAt(j0)===s0)){var v0=j0+1;if(v0>=z0||$.charCodeAt(v0)===I||$.charCodeAt(v0)===w){for(var s=v0;s<z0&&($.charCodeAt(s)===I||$.charCodeAt(s)===w);)s++;s>=z0&&(K0=!0)}}}K0&&($=$.slice(0,m0).trimEnd())}}}if(J.inline)return C0($,0,$.length,J,Z);let U0=[],_=0,l=$.length;if(_===0&&!Z.disableFrontmatter&&$.startsWith("---")){let x=U6($);if(x&&x.hasValidYaml){if(Z.preserveFrontmatter!==!1){let R0=$.slice(0,x.endPos).trimEnd();U0.push({type:v.frontmatter,text:R0})}_=x.endPos}}for(;_<l;){for(var I0=$.indexOf(`
`,_),P0=I0<0?l:I0;_<l&&d0($,_,P0);)_=P0<l?P0+1:P0,_<l&&(I0=$.indexOf(`
`,_),P0=I0<0?l:I0);if(_>=l)break;$.charCodeAt(_),A0($,_,P0);let x=null;if(f6=$,C6=_,h6=P0,$.charCodeAt(_)!==a9&&$0>=4&&!J.inHTML)x=fZ($,_);else if($.charCodeAt(_)!==a9){let R0=_+t,F0=$.charCodeAt(R0);F0===Y9?x=m6($,_,J,Z):F0===d?x=CZ($,_,J,Z):F0===a||F0===M0?x=TZ($,_,J):F0===u||F0===O0||F0===G0?(x=E9($,_),!x&&(x=I6($,_,J,Z))):F0===j9||F0>=o&&F0<=r?x=I6($,_,J,Z):F0===e?x=p6($,_,J,Z):F0===N0?x=b6($,_,J,Z):F0===W0&&(x=pZ($,_,J))}if(!x){for(var $9=!1,k0=_;k0<P0;k0++)if($.charCodeAt(k0)===N0){$9=!0;break}$9&&(x=b6($,_,J,Z))}if(x||(x=cZ($,_,J,Z)),x)x.node.type!==v.refCollection&&U0.push(x.node),_=x.end;else{var X0=$.indexOf(`
`,_);_=X0<0?l:X0+1}}return J.i=Q,U0}function c$($,J){e9=0,$.charCodeAt(0)===65279&&($=$.slice(1)),$=f$($);let Z={inline:!1,inAnchor:!1,inHTML:!1,inList:!1,inBlockQuote:!1,refs:{}},Q={...J,slugify:J?.slugify?X=>J.slugify(X,f0):f0,sanitizer:J?.sanitizer||u9,tagfilter:J?.tagfilter!==!1};Z.j=x6($,Z.refs,Q);let V=N9($,Z,Q);return Z.refs&&Object.keys(Z.refs).length>0?[{type:v.refCollection,refs:Z.refs},...V]:V}function l6($,J,Z,Q){var V=v9($,J);return V?{tagName:V.tag,tagLower:V.tag.toLowerCase(),attrs:V.rawAttrs,whitespaceBeforeAttrs:V.whitespaceBeforeAttrs,isSelfClosing:V.selfClosing,hasSpaceBeforeSlash:V.hasSpaceBeforeSlash,isClosing:V.isClosing,hasNewline:V.whitespaceBeforeAttrs.includes(`
`)||V.rawAttrs.includes(`
`),endPos:V.end}:null}function N$($,J,Z){e9=0,$=f$($),!J.refs&&(J.refs={}),J.j=x6($,J.refs,Z);let Q=N9($,J,Z);return J.refs&&Object.keys(J.refs).length>0?[{type:v.refCollection,refs:J.refs},...Q]:Q}var YJ=/^\n+/,KJ=typeof document<"u",e0=$=>Array.isArray($)?$:[$],o6=$=>typeof $=="function"||typeof $=="object"&&$!==null&&"render"in $;function r6($){if(!$)return"";let J="";for(let[Z,Q]of Object.entries($))Q===!0?J+=` ${Z}`:Q!=null&&Q!==!1&&(J+=` ${Z}="${String(Q)}"`);return J}function GJ($,J,Z,Q,V,X,K,G){switch($.type){case v.blockQuote:{let Y={},q=$.children;return $.alert&&(Y.class="markdown-alert-"+X($.alert.toLowerCase(),f0),q=[{attrs:{},children:[{type:v.text,text:$.alert}],d:!0,type:v.htmlBlock,tag:"header"},...q]),Q("blockquote",Y,...e0(J(q,Z)))}case v.breakLine:return Q("br",{});case v.breakThematic:return Q("hr",{});case v.frontmatter:return G.preserveFrontmatter?Q("pre",{},$.text):null;case v.codeBlock:{let Y=$.lang?s9($.lang):"",q={...$.attrs||{},class:Y?`language-${Y} lang-${Y}`:""};return Q("pre",{},Q("code",q,$.text))}case v.codeInline:return Q("code",{},$.text);case v.footnoteReference:return Q("a",{href:V($.target,"a","href")},Q("sup",{},$.text));case v.gfmTask:return Q("input",{checked:$.completed,readOnly:!0,type:"checkbox"});case v.heading:return Q(`h${$.level}`,{id:$.id},...e0(J($.children,Z)));case v.htmlBlock:{let Y=$;if(G.tagfilter&&C$(Y.tag)){let q=typeof Y.a=="string"?Y.a:`<${Y.tag}${r6(Y.attrs)}>`;return Q("span",{},q)}if(Y.a&&Y.d){let z=function(M){if((M.type===v.htmlSelfClosing||M.type===v.htmlBlock)&&M.b)return[];if(M.type===v.paragraph){let R=M.children;return R?R.flatMap(z):[]}return M.type===v.text?M.text?.trim()?[M]:[]:M.type===v.htmlBlock&&M.children?[{...M,children:M.children?.flatMap(z)}]:[M]},q=Y.tag.toLowerCase(),U=g6(q),F=/<[a-z][^>]{0,100}>/i.test(Y.a);if(U){let M=Y.a.replace(new RegExp("\\s*</"+q+">\\s*$","i"),"");return G.tagfilter&&(M=h$(M)),F?Q($.tag,{...$.attrs,innerHTML:M}):Q($.tag,{...$.attrs},M)}if(/<\/?pre\b/i.test(Y.a)){let M=G.tagfilter?h$(Y.a):Y.a;return Q($.tag,{...$.attrs,innerHTML:M})}if(Y.children&&Y.children.length>0)return Q($.tag,{...$.attrs},J(Y.children.flatMap(z),Z));let j={slugify:M=>X(M,f0),sanitizer:V,tagfilter:!0},D=Y.a.replace(/>\s+</g,"><").replace(/\n+/g," ").trim();if(new RegExp(`^<${Y.tag}(\\s[^>]*)?>(\\s*</${Y.tag}>)?$`,"i").test(D))return Q($.tag,{...$.attrs});let B=N$(D,{inline:!1,refs:K,inHTML:!1},j),H=J(B.flatMap(z),Z);return Q($.tag,{...$.attrs},...e0(H))}return p9($.tag)?Q($.tag,{...$.attrs}):Q($.tag,{...$.attrs},...$.children?e0(J($.children,Z)):[])}case v.htmlSelfClosing:{let Y=$;if(G.tagfilter&&C$(Y.tag)){let q=typeof Y.a=="string"?Y.a:`<${Y.tag}${r6(Y.attrs)} />`;return Q("span",{},q)}return Q(Y.tag,{...Y.attrs})}case v.image:return Q("img",{alt:$.alt&&$.alt.length>0?$.alt:void 0,title:$.title||void 0,src:V($.target,"img","src")});case v.link:{let Y={};return $.target!=null&&(Y.href=H6($.target)),$.title&&(Y.title=$.title),Q("a",Y,...e0(J($.children,Z)))}case v.table:{let Y=$;return Q("table",{},Q("thead",{},Q("tr",{},...Y.header.map(function(U,F){return Q("th",{style:Y.align[F]==null?{}:{textAlign:Y.align[F]}},...e0(J(U,Z)))}))),Y.cells.length>0?Q("tbody",{},...Y.cells.map(function(U,F){return Q("tr",{},...U.map(function(z,j){return Q("td",{style:Y.align[j]==null?{}:{textAlign:Y.align[j]}},...e0(J(z,Z)))}))})):null)}case v.text:return $.text;case v.textFormatted:return Q($.tag,{},...e0(J($.children,Z)));case v.orderedList:case v.unorderedList:{let Y=$.type===v.orderedList?"ol":"ul";return Q(Y,{start:$.type===v.orderedList?$.start:void 0},...$.items.map(function(U,F){return Q("li",{},...e0(J(U,Z)))}))}case v.paragraph:return Q("p",{},...e0(J($.children,Z)));case v.ref:return null;default:return null}}var qJ=($,J,Z,Q,V,X)=>{let K=(q,U,F)=>{let O=()=>GJ(q,z=>U(e0(z)),F,J,Z,Q,V,X);return $?$(O,q,U,F):O()},G=q=>q.map(U=>"text"in U?U.text:""),Y=(q,U={})=>{let F=(U.renderDepth||0)+1;if(F>2500)return G(q);let O=[],z=!1;for(let j=0;j<q.length;j++){let D=K(q[j],Y,{...U,renderDepth:F}),W=typeof D=="string";if(W&&z)O[O.length-1]+=D;else if(D!==null)if(Array.isArray(D))for(let B=0;B<D.length;B++)O.push(D[B]);else O.push(D);z=W}return O};return Y},UJ=($,J)=>{let Z=t9(J,$,void 0);if(!Z)return $;if(o6(Z))return Z;let Q=t9(J,`${$}.component`,$);return o6(Q),Q};function a6($,J){let Z={...J||{}};Z.overrides=Z.overrides||{};let Q=Z.slugify||f0,V=Z.sanitizer||u9,X=W=>FJ(W,{...Z,wrapper:null});function K(W,B,...H){if(!KJ){let R=H.length===0?void 0:H.length===1?H[0]:H,N=R===void 0?B:{...B,children:R};return typeof W=="function"?W(N):{t:W,p:N}}let M=i6(W,B,...H);return typeof M=="function"?M():M}function G(W,B,...H){let M=t9(Z.overrides,`${W}.props`,{}),R=B||{};for(let k in R){let P=R[k];if(typeof P=="string"&&P.length>0&&P[0]==="<"&&(k6.test(P)||L6.test(P)||l6(P,0))){let b=X(P.trim());R[k]=k==="innerHTML"&&Array.isArray(b)?b[0]:b}}let N=UJ(W,Z.overrides),A=D6(R?.class,M.class||void 0)||void 0,L={...R,...M};return A&&(L.class=A),R.innerHTML&&M.innerHTML===void 0&&(L.innerHTML=R.innerHTML,delete R.innerHTML),K(N,L,...H)}let Y=Z.createElement||((W,B,...H)=>K(W,B||{},...H)),q={slugify:W=>Q(W,f0),sanitizer:V,tagfilter:Z.tagfilter!==!1,disableAutoLink:Z.disableAutoLink,disableParsingRawHTML:Z.disableParsingRawHTML,enforceAtxHeadings:Z.enforceAtxHeadings,forceBlock:Z.forceBlock,forceInline:Z.forceInline,preserveFrontmatter:Z.preserveFrontmatter},U=$[0]&&$[0].type===v.refCollection?$[0].refs:{},F=qJ(Z.renderRule,G,V,Q,U,Z),O=F($,{inline:Z.forceInline,refs:U}),z=[];for(let W in U)W.charCodeAt(0)===a0&&z.push({identifier:W,footnote:U[W].target});if(z.length&&O.push(G("footer",{},...z.map(function(B){let H=B.identifier.slice(1),M=N$(B.footnote,{inline:!0,refs:U},q),R=F(M,{inline:!0,refs:U});return G("div",{id:Q(H,f0)},H+": ",...e0(R))}))),Z.wrapper===null)return O.length===0?null:O.length===1?O[0]:O;let j=Z.wrapper||(Z.forceInline?"span":"div"),D;if(O.length>1||Z.forceWrapper)D=O;else return O.length===1?O[0]:null;return Y(j,{...Z.wrapperProps},D)}function FJ($="",J={}){let Z={...J||{}};Z.overrides=Z.overrides||{};let Q=Z.slugify||f0,V=Z.sanitizer||u9;function X(Y){let q=Z.forceInline||!Z.forceBlock&&!F6.test(Y),U={slugify:z=>Q(z,f0),sanitizer:V,tagfilter:Z.tagfilter!==!1,disableAutoLink:Z.disableAutoLink,disableParsingRawHTML:Z.disableParsingRawHTML,enforceAtxHeadings:Z.enforceAtxHeadings,forceBlock:Z.forceBlock,forceInline:q,preserveFrontmatter:Z.preserveFrontmatter},F=Y;if(!q){let z=F.length;for(;z>0&&(F[z-1]===`
`||F[z-1]==="\r");)z--;F=F.slice(0,z),F=`${F.replace(YJ,"")}

`}let O=N$(q?Y:F,{inline:q,refs:K},U);return a6(O,{...Z,forceInline:q})}let K={};return X($)}var n6=VJ(void 0);function WJ($,J,...Z){if(typeof document>"u"){let V=Z.length===0?void 0:Z.length===1?Z[0]:Z,X=V===void 0?J:{...J,children:V};return typeof $=="function"?$(X):{t:$,p:X}}let Q=i6($,J,...Z);return typeof Q=="function"?Q():Q}var hJ=$=>{let J={value:$.options};return WJ(n6.Provider,J,$.children)},zJ=$=>{let J=XJ(n6),Z=I$(()=>({...J,...$.options})),Q=I$(()=>{let K=typeof $.children=="function"?$.children():$.children;return K??""}),V=I$(()=>c$(Q(),Z()));return I$(()=>a6(V(),{...Z(),wrapperProps:{...Z()?.wrapperProps,...Object.fromEntries(Object.entries($).filter(([K])=>K!=="children"&&K!=="options"))}}))()},cJ=zJ;export{f0 as slugify,u9 as sanitizer,c$ as parser,cJ as default,FJ as compiler,a6 as astToJSX,v as RuleType,hJ as MarkdownProvider,n6 as MarkdownContext,zJ as Markdown};
