mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-10 09:03:02 +08:00
7 lines
57 KiB
JavaScript
7 lines
57 KiB
JavaScript
import{a as yn}from"./chunk-BZUL2CAN.js";import{Ga as xt,a as ft,bb as gt}from"./chunk-VNKGKUEF.js";import{g as ie}from"./chunk-3NXJ7VWC.js";function dt(n,r){var{includeImageAlt:t=!0}=r||{};return yt(n,t)}function yt(n,r){return n&&typeof n=="object"&&(n.value||(r?n.alt:"")||"children"in n&&kt(n.children,r)||Array.isArray(n)&&kt(n,r))||""}function kt(n,r){for(var t=[],e=-1;++e<n.length;)t[e]=yt(n[e],r);return t.join("")}function Z(n,r,t,e){let u=n.length,a=0,i;if(r<0?r=-r>u?0:u+r:r=r>u?u:r,t=t>0?t:0,e.length<1e4)i=Array.from(e),i.unshift(r,t),[].splice.apply(n,i);else for(t&&[].splice.apply(n,[r,t]);a<e.length;)i=e.slice(a,a+1e4),i.unshift(r,0),[].splice.apply(n,i),a+=1e4,r+=1e4}function J(n,r){return n.length>0?(Z(n,n.length,0,r),n):r}var bt={}.hasOwnProperty;function St(n){let r={},t=-1;for(;++t<n.length;)ue(r,n[t]);return r}function ue(n,r){let t;for(t in r){let u=(bt.call(n,t)?n[t]:void 0)||(n[t]={}),a=r[t],i;for(i in a){bt.call(u,i)||(u[i]=[]);let o=a[i];ae(u[i],Array.isArray(o)?o:o?[o]:[])}}}function ae(n,r){let t=-1,e=[];for(;++t<r.length;)(r[t].add==="after"?n:e).push(r[t]);Z(n,0,0,e)}var Et=/[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var v=sn(/[A-Za-z]/),An=sn(/\d/),wt=sn(/[\dA-Fa-f]/),K=sn(/[\dA-Za-z]/),Ft=sn(/[!-/:-@[-`{-~]/),Un=sn(/[#-'*+\--9=?A-Z^-~]/);function zn(n){return n!==null&&(n<32||n===127)}function V(n){return n!==null&&(n<0||n===32)}function S(n){return n!==null&&n<-2}function I(n){return n===-2||n===-1||n===32}var Ct=sn(/\s/),At=sn(Et);function sn(n){return r;function r(t){return t!==null&&n.test(String.fromCharCode(t))}}function C(n,r,t,e){let u=e?e-1:Number.POSITIVE_INFINITY,a=0;return i;function i(p){return I(p)?(n.enter(t),o(p)):r(p)}function o(p){return I(p)&&a++<u?(n.consume(p),o):(n.exit(t),r(p))}}var zt={tokenize:oe};function oe(n){let r=n.attempt(this.parser.constructs.contentInitial,e,u),t;return r;function e(o){if(o===null){n.consume(o);return}return n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),C(n,r,"linePrefix")}function u(o){return n.enter("paragraph"),a(o)}function a(o){let p=n.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=p),t=p,i(o)}function i(o){if(o===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(o);return}return S(o)?(n.consume(o),n.exit("chunkText"),a):(n.consume(o),i)}}var Tt={tokenize:le},It={tokenize:se};function le(n){let r=this,t=[],e=0,u,a,i;return o;function o(w){if(e<t.length){let P=t[e];return r.containerState=P[1],n.attempt(P[0].continuation,p,m)(w)}return m(w)}function p(w){if(e++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,u&&R();let P=r.events.length,_=P,k;for(;_--;)if(r.events[_][0]==="exit"&&r.events[_][1].type==="chunkFlow"){k=r.events[_][1].end;break}b(e);let j=P;for(;j<r.events.length;)r.events[j][1].end=Object.assign({},k),j++;return Z(r.events,_+1,0,r.events.slice(P)),r.events.length=j,m(w)}return o(w)}function m(w){if(e===t.length){if(!u)return h(w);if(u.currentConstruct&&u.currentConstruct.concrete)return g(w);r.interrupt=!!(u.currentConstruct&&!u._gfmTableDynamicInterruptHack)}return r.containerState={},n.check(It,c,y)(w)}function c(w){return u&&R(),b(e),h(w)}function y(w){return r.parser.lazy[r.now().line]=e!==t.length,i=r.now().offset,g(w)}function h(w){return r.containerState={},n.attempt(It,x,g)(w)}function x(w){return e++,t.push([r.currentConstruct,r.containerState]),h(w)}function g(w){if(w===null){u&&R(),b(0),n.consume(w);return}return u=u||r.parser.flow(r.now()),n.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:u}),L(w)}function L(w){if(w===null){O(n.exit("chunkFlow"),!0),b(0),n.consume(w);return}return S(w)?(n.consume(w),O(n.exit("chunkFlow")),e=0,r.interrupt=void 0,o):(n.consume(w),L)}function O(w,P){let _=r.sliceStream(w);if(P&&_.push(null),w.previous=a,a&&(a.next=w),a=w,u.defineSkip(w.start),u.write(_),r.parser.lazy[w.start.line]){let k=u.events.length;for(;k--;)if(u.events[k][1].start.offset<i&&(!u.events[k][1].end||u.events[k][1].end.offset>i))return;let j=r.events.length,H=j,M,Q;for(;H--;)if(r.events[H][0]==="exit"&&r.events[H][1].type==="chunkFlow"){if(M){Q=r.events[H][1].end;break}M=!0}for(b(e),k=j;k<r.events.length;)r.events[k][1].end=Object.assign({},Q),k++;Z(r.events,H+1,0,r.events.slice(j)),r.events.length=k}}function b(w){let P=t.length;for(;P-- >w;){let _=t[P];r.containerState=_[1],_[0].exit.call(r,n)}t.length=w}function R(){u.write([null]),a=void 0,u=void 0,r.containerState._closeFlow=void 0}}function se(n,r,t){return C(n,n.attempt(this.parser.constructs.document,r,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $n(n){if(n===null||V(n)||Ct(n))return 1;if(At(n))return 2}function bn(n,r,t){let e=[],u=-1;for(;++u<n.length;){let a=n[u].resolveAll;a&&!e.includes(a)&&(r=a(r,t),e.push(a))}return r}var In={name:"attention",tokenize:pe,resolveAll:ce};function ce(n,r){let t=-1,e,u,a,i,o,p,m,c;for(;++t<n.length;)if(n[t][0]==="enter"&&n[t][1].type==="attentionSequence"&&n[t][1]._close){for(e=t;e--;)if(n[e][0]==="exit"&&n[e][1].type==="attentionSequence"&&n[e][1]._open&&r.sliceSerialize(n[e][1]).charCodeAt(0)===r.sliceSerialize(n[t][1]).charCodeAt(0)){if((n[e][1]._close||n[t][1]._open)&&(n[t][1].end.offset-n[t][1].start.offset)%3&&!((n[e][1].end.offset-n[e][1].start.offset+n[t][1].end.offset-n[t][1].start.offset)%3))continue;p=n[e][1].end.offset-n[e][1].start.offset>1&&n[t][1].end.offset-n[t][1].start.offset>1?2:1;let y=Object.assign({},n[e][1].end),h=Object.assign({},n[t][1].start);Lt(y,-p),Lt(h,p),i={type:p>1?"strongSequence":"emphasisSequence",start:y,end:Object.assign({},n[e][1].end)},o={type:p>1?"strongSequence":"emphasisSequence",start:Object.assign({},n[t][1].start),end:h},a={type:p>1?"strongText":"emphasisText",start:Object.assign({},n[e][1].end),end:Object.assign({},n[t][1].start)},u={type:p>1?"strong":"emphasis",start:Object.assign({},i.start),end:Object.assign({},o.end)},n[e][1].end=Object.assign({},i.start),n[t][1].start=Object.assign({},o.end),m=[],n[e][1].end.offset-n[e][1].start.offset&&(m=J(m,[["enter",n[e][1],r],["exit",n[e][1],r]])),m=J(m,[["enter",u,r],["enter",i,r],["exit",i,r],["enter",a,r]]),m=J(m,bn(r.parser.constructs.insideSpan.null,n.slice(e+1,t),r)),m=J(m,[["exit",a,r],["enter",o,r],["exit",o,r],["exit",u,r]]),n[t][1].end.offset-n[t][1].start.offset?(c=2,m=J(m,[["enter",n[t][1],r],["exit",n[t][1],r]])):c=0,Z(n,e-1,t-e+3,m),t=e+m.length-c-2;break}}for(t=-1;++t<n.length;)n[t][1].type==="attentionSequence"&&(n[t][1].type="data");return n}function pe(n,r){let t=this.parser.constructs.attentionMarkers.null,e=this.previous,u=$n(e),a;return i;function i(p){return n.enter("attentionSequence"),a=p,o(p)}function o(p){if(p===a)return n.consume(p),o;let m=n.exit("attentionSequence"),c=$n(p),y=!c||c===2&&u||t.includes(p),h=!u||u===2&&c||t.includes(e);return m._open=!!(a===42?y:y&&(u||!h)),m._close=!!(a===42?h:h&&(c||!y)),r(p)}}function Lt(n,r){n.column+=r,n.offset+=r,n._bufferIndex+=r}var Zn={name:"autolink",tokenize:me};function me(n,r,t){let e=1;return u;function u(g){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(g),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),a}function a(g){return v(g)?(n.consume(g),i):Un(g)?m(g):t(g)}function i(g){return g===43||g===45||g===46||K(g)?o(g):m(g)}function o(g){return g===58?(n.consume(g),p):(g===43||g===45||g===46||K(g))&&e++<32?(n.consume(g),o):m(g)}function p(g){return g===62?(n.exit("autolinkProtocol"),x(g)):g===null||g===32||g===60||zn(g)?t(g):(n.consume(g),p)}function m(g){return g===64?(n.consume(g),e=0,c):Un(g)?(n.consume(g),m):t(g)}function c(g){return K(g)?y(g):t(g)}function y(g){return g===46?(n.consume(g),e=0,c):g===62?(n.exit("autolinkProtocol").type="autolinkEmail",x(g)):h(g)}function h(g){return(g===45||K(g))&&e++<63?(n.consume(g),g===45?h:y):t(g)}function x(g){return n.enter("autolinkMarker"),n.consume(g),n.exit("autolinkMarker"),n.exit("autolink"),r}}var cn={tokenize:he,partial:!0};function he(n,r,t){return C(n,e,"linePrefix");function e(u){return u===null||S(u)?r(u):t(u)}}var On={name:"blockQuote",tokenize:fe,continuation:{tokenize:xe},exit:ge};function fe(n,r,t){let e=this;return u;function u(i){if(i===62){let o=e.containerState;return o.open||(n.enter("blockQuote",{_container:!0}),o.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(i),n.exit("blockQuoteMarker"),a}return t(i)}function a(i){return I(i)?(n.enter("blockQuotePrefixWhitespace"),n.consume(i),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),r):(n.exit("blockQuotePrefix"),r(i))}}function xe(n,r,t){return C(n,n.attempt(On,r,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ge(n){n.exit("blockQuote")}var Dn={name:"characterEscape",tokenize:ke};function ke(n,r,t){return e;function e(a){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(a),n.exit("escapeMarker"),u}function u(a){return Ft(a)?(n.enter("characterEscapeValue"),n.consume(a),n.exit("characterEscapeValue"),n.exit("characterEscape"),r):t(a)}}var Pn={name:"characterReference",tokenize:de};function de(n,r,t){let e=this,u=0,a,i;return o;function o(y){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(y),n.exit("characterReferenceMarker"),p}function p(y){return y===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(y),n.exit("characterReferenceMarkerNumeric"),m):(n.enter("characterReferenceValue"),a=31,i=K,c(y))}function m(y){return y===88||y===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(y),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),a=6,i=wt,c):(n.enter("characterReferenceValue"),a=7,i=An,c(y))}function c(y){let h;return y===59&&u?(h=n.exit("characterReferenceValue"),i===K&&!yn(e.sliceSerialize(h))?t(y):(n.enter("characterReferenceMarker"),n.consume(y),n.exit("characterReferenceMarker"),n.exit("characterReference"),r)):i(y)&&u++<a?(n.consume(y),c):t(y)}}var _n={name:"codeFenced",tokenize:ye,concrete:!0};function ye(n,r,t){let e=this,u={tokenize:_,partial:!0},a={tokenize:P,partial:!0},i=this.events[this.events.length-1],o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,p=0,m;return c;function c(k){return n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),m=k,y(k)}function y(k){return k===m?(n.consume(k),p++,y):(n.exit("codeFencedFenceSequence"),p<3?t(k):C(n,h,"whitespace")(k))}function h(k){return k===null||S(k)?O(k):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===null||V(k)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),C(n,g,"whitespace")(k)):k===96&&k===m?t(k):(n.consume(k),x)}function g(k){return k===null||S(k)?O(k):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),L(k))}function L(k){return k===null||S(k)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),O(k)):k===96&&k===m?t(k):(n.consume(k),L)}function O(k){return n.exit("codeFencedFence"),e.interrupt?r(k):b(k)}function b(k){return k===null?w(k):S(k)?n.attempt(a,n.attempt(u,w,o?C(n,b,"linePrefix",o+1):b),w)(k):(n.enter("codeFlowValue"),R(k))}function R(k){return k===null||S(k)?(n.exit("codeFlowValue"),b(k)):(n.consume(k),R)}function w(k){return n.exit("codeFenced"),r(k)}function P(k,j,H){let M=this;return Q;function Q(D){return k.enter("lineEnding"),k.consume(D),k.exit("lineEnding"),A}function A(D){return M.parser.lazy[M.now().line]?H(D):j(D)}}function _(k,j,H){let M=0;return C(k,Q,"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function Q(E){return k.enter("codeFencedFence"),k.enter("codeFencedFenceSequence"),A(E)}function A(E){return E===m?(k.consume(E),M++,A):M<p?H(E):(k.exit("codeFencedFenceSequence"),C(k,D,"whitespace")(E))}function D(E){return E===null||S(E)?(k.exit("codeFencedFence"),j(E)):H(E)}}}var Tn={name:"codeIndented",tokenize:Se},be={tokenize:Ee,partial:!0};function Se(n,r,t){let e=this;return u;function u(m){return n.enter("codeIndented"),C(n,a,"linePrefix",5)(m)}function a(m){let c=e.events[e.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?i(m):t(m)}function i(m){return m===null?p(m):S(m)?n.attempt(be,i,p)(m):(n.enter("codeFlowValue"),o(m))}function o(m){return m===null||S(m)?(n.exit("codeFlowValue"),i(m)):(n.consume(m),o)}function p(m){return n.exit("codeIndented"),r(m)}}function Ee(n,r,t){let e=this;return u;function u(i){return e.parser.lazy[e.now().line]?t(i):S(i)?(n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),u):C(n,a,"linePrefix",5)(i)}function a(i){let o=e.events[e.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?r(i):S(i)?u(i):t(i)}}var Yn={name:"codeText",tokenize:Ce,resolve:we,previous:Fe};function we(n){let r=n.length-4,t=3,e,u;if((n[t][1].type==="lineEnding"||n[t][1].type==="space")&&(n[r][1].type==="lineEnding"||n[r][1].type==="space")){for(e=t;++e<r;)if(n[e][1].type==="codeTextData"){n[t][1].type="codeTextPadding",n[r][1].type="codeTextPadding",t+=2,r-=2;break}}for(e=t-1,r++;++e<=r;)u===void 0?e!==r&&n[e][1].type!=="lineEnding"&&(u=e):(e===r||n[e][1].type==="lineEnding")&&(n[u][1].type="codeTextData",e!==u+2&&(n[u][1].end=n[e-1][1].end,n.splice(u+2,e-u-2),r-=e-u-2,e=u+2),u=void 0);return n}function Fe(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Ce(n,r,t){let e=this,u=0,a,i;return o;function o(h){return n.enter("codeText"),n.enter("codeTextSequence"),p(h)}function p(h){return h===96?(n.consume(h),u++,p):(n.exit("codeTextSequence"),m(h))}function m(h){return h===null?t(h):h===96?(i=n.enter("codeTextSequence"),a=0,y(h)):h===32?(n.enter("space"),n.consume(h),n.exit("space"),m):S(h)?(n.enter("lineEnding"),n.consume(h),n.exit("lineEnding"),m):(n.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||S(h)?(n.exit("codeTextData"),m(h)):(n.consume(h),c)}function y(h){return h===96?(n.consume(h),a++,y):a===u?(n.exit("codeTextSequence"),n.exit("codeText"),r(h)):(i.type="codeTextData",c(h))}}function Mn(n){let r={},t=-1,e,u,a,i,o,p,m;for(;++t<n.length;){for(;t in r;)t=r[t];if(e=n[t],t&&e[1].type==="chunkFlow"&&n[t-1][1].type==="listItemPrefix"&&(p=e[1]._tokenizer.events,a=0,a<p.length&&p[a][1].type==="lineEndingBlank"&&(a+=2),a<p.length&&p[a][1].type==="content"))for(;++a<p.length&&p[a][1].type!=="content";)p[a][1].type==="chunkText"&&(p[a][1]._isInFirstContentOfListItem=!0,a++);if(e[0]==="enter")e[1].contentType&&(Object.assign(r,Ae(n,t)),t=r[t],m=!0);else if(e[1]._container){for(a=t,u=void 0;a--&&(i=n[a],i[1].type==="lineEnding"||i[1].type==="lineEndingBlank");)i[0]==="enter"&&(u&&(n[u][1].type="lineEndingBlank"),i[1].type="lineEnding",u=a);u&&(e[1].end=Object.assign({},n[u][1].start),o=n.slice(u,t),o.unshift(e),Z(n,u,t-u+1,o))}}return!m}function Ae(n,r){let t=n[r][1],e=n[r][2],u=r-1,a=[],i=t._tokenizer||e.parser[t.contentType](t.start),o=i.events,p=[],m={},c,y,h=-1,x=t,g=0,L=0,O=[L];for(;x;){for(;n[++u][1]!==x;);a.push(u),x._tokenizer||(c=e.sliceStream(x),x.next||c.push(null),y&&i.defineSkip(x.start),x._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(c),x._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),y=x,x=x.next}for(x=t;++h<o.length;)o[h][0]==="exit"&&o[h-1][0]==="enter"&&o[h][1].type===o[h-1][1].type&&o[h][1].start.line!==o[h][1].end.line&&(L=h+1,O.push(L),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(i.events=[],x?(x._tokenizer=void 0,x.previous=void 0):O.pop(),h=O.length;h--;){let b=o.slice(O[h],O[h+1]),R=a.pop();p.unshift([R,R+b.length-1]),Z(n,R,2,b)}for(h=-1;++h<p.length;)m[g+p[h][0]]=g+p[h][1],g+=p[h][1]-p[h][0]-1;return m}var Gn={tokenize:Te,resolve:Ie},ze={tokenize:Le,partial:!0};function Ie(n){return Mn(n),n}function Te(n,r){let t;return e;function e(o){return n.enter("content"),t=n.enter("chunkContent",{contentType:"content"}),u(o)}function u(o){return o===null?a(o):S(o)?n.check(ze,i,a)(o):(n.consume(o),u)}function a(o){return n.exit("chunkContent"),n.exit("content"),r(o)}function i(o){return n.consume(o),n.exit("chunkContent"),t.next=n.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,u}}function Le(n,r,t){let e=this;return u;function u(i){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),C(n,a,"linePrefix")}function a(i){if(i===null||S(i))return t(i);let o=e.events[e.events.length-1];return!e.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?r(i):n.interrupt(e.parser.constructs.flow,t,r)(i)}}function Rn(n,r,t,e,u,a,i,o,p){let m=p||Number.POSITIVE_INFINITY,c=0;return y;function y(b){return b===60?(n.enter(e),n.enter(u),n.enter(a),n.consume(b),n.exit(a),h):b===null||b===41||zn(b)?t(b):(n.enter(e),n.enter(i),n.enter(o),n.enter("chunkString",{contentType:"string"}),L(b))}function h(b){return b===62?(n.enter(a),n.consume(b),n.exit(a),n.exit(u),n.exit(e),r):(n.enter(o),n.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===62?(n.exit("chunkString"),n.exit(o),h(b)):b===null||b===60||S(b)?t(b):(n.consume(b),b===92?g:x)}function g(b){return b===60||b===62||b===92?(n.consume(b),x):x(b)}function L(b){return b===40?++c>m?t(b):(n.consume(b),L):b===41?c--?(n.consume(b),L):(n.exit("chunkString"),n.exit(o),n.exit(i),n.exit(e),r(b)):b===null||V(b)?c?t(b):(n.exit("chunkString"),n.exit(o),n.exit(i),n.exit(e),r(b)):zn(b)?t(b):(n.consume(b),b===92?O:L)}function O(b){return b===40||b===41||b===92?(n.consume(b),L):L(b)}}function jn(n,r,t,e,u,a){let i=this,o=0,p;return m;function m(x){return n.enter(e),n.enter(u),n.consume(x),n.exit(u),n.enter(a),c}function c(x){return x===null||x===91||x===93&&!p||x===94&&!o&&"_hiddenFootnoteSupport"in i.parser.constructs||o>999?t(x):x===93?(n.exit(a),n.enter(u),n.consume(x),n.exit(u),n.exit(e),r):S(x)?(n.enter("lineEnding"),n.consume(x),n.exit("lineEnding"),c):(n.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===null||x===91||x===93||S(x)||o++>999?(n.exit("chunkString"),c(x)):(n.consume(x),p=p||!I(x),x===92?h:y)}function h(x){return x===91||x===92||x===93?(n.consume(x),o++,y):y(x)}}function qn(n,r,t,e,u,a){let i;return o;function o(h){return n.enter(e),n.enter(u),n.consume(h),n.exit(u),i=h===40?41:h,p}function p(h){return h===i?(n.enter(u),n.consume(h),n.exit(u),n.exit(e),r):(n.enter(a),m(h))}function m(h){return h===i?(n.exit(a),p(i)):h===null?t(h):S(h)?(n.enter("lineEnding"),n.consume(h),n.exit("lineEnding"),C(n,m,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===i||h===null||S(h)?(n.exit("chunkString"),m(h)):(n.consume(h),h===92?y:c)}function y(h){return h===i||h===92?(n.consume(h),c):c(h)}}function fn(n,r){let t;return e;function e(u){return S(u)?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),t=!0,e):I(u)?C(n,e,t?"linePrefix":"lineSuffix")(u):r(u)}}function on(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Jn={name:"definition",tokenize:Oe},Be={tokenize:De,partial:!0};function Oe(n,r,t){let e=this,u;return a;function a(p){return n.enter("definition"),jn.call(e,n,i,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function i(p){return u=on(e.sliceSerialize(e.events[e.events.length-1][1]).slice(1,-1)),p===58?(n.enter("definitionMarker"),n.consume(p),n.exit("definitionMarker"),fn(n,Rn(n,n.attempt(Be,C(n,o,"whitespace"),C(n,o,"whitespace")),t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString"))):t(p)}function o(p){return p===null||S(p)?(n.exit("definition"),e.parser.defined.includes(u)||e.parser.defined.push(u),r(p)):t(p)}}function De(n,r,t){return e;function e(i){return V(i)?fn(n,u)(i):t(i)}function u(i){return i===34||i===39||i===40?qn(n,C(n,a,"whitespace"),t,"definitionTitle","definitionTitleMarker","definitionTitleString")(i):t(i)}function a(i){return i===null||S(i)?r(i):t(i)}}var Kn={name:"hardBreakEscape",tokenize:Pe};function Pe(n,r,t){return e;function e(a){return n.enter("hardBreakEscape"),n.enter("escapeMarker"),n.consume(a),u}function u(a){return S(a)?(n.exit("escapeMarker"),n.exit("hardBreakEscape"),r(a)):t(a)}}var Xn={name:"headingAtx",tokenize:Me,resolve:_e};function _e(n,r){let t=n.length-2,e=3,u,a;return n[e][1].type==="whitespace"&&(e+=2),t-2>e&&n[t][1].type==="whitespace"&&(t-=2),n[t][1].type==="atxHeadingSequence"&&(e===t-1||t-4>e&&n[t-2][1].type==="whitespace")&&(t-=e+1===t?2:4),t>e&&(u={type:"atxHeadingText",start:n[e][1].start,end:n[t][1].end},a={type:"chunkText",start:n[e][1].start,end:n[t][1].end,contentType:"text"},Z(n,e,t-e+1,[["enter",u,r],["enter",a,r],["exit",a,r],["exit",u,r]])),n}function Me(n,r,t){let e=this,u=0;return a;function a(c){return n.enter("atxHeading"),n.enter("atxHeadingSequence"),i(c)}function i(c){return c===35&&u++<6?(n.consume(c),i):c===null||V(c)?(n.exit("atxHeadingSequence"),e.interrupt?r(c):o(c)):t(c)}function o(c){return c===35?(n.enter("atxHeadingSequence"),p(c)):c===null||S(c)?(n.exit("atxHeading"),r(c)):I(c)?C(n,o,"whitespace")(c):(n.enter("atxHeadingText"),m(c))}function p(c){return c===35?(n.consume(c),p):(n.exit("atxHeadingSequence"),o(c))}function m(c){return c===null||c===35||V(c)?(n.exit("atxHeadingText"),o(c)):(n.consume(c),m)}}var Bt=["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","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],vn=["pre","script","style","textarea"];var nt={name:"htmlFlow",tokenize:qe,resolveTo:je,concrete:!0},Re={tokenize:He,partial:!0};function je(n){let r=n.length;for(;r--&&!(n[r][0]==="enter"&&n[r][1].type==="htmlFlow"););return r>1&&n[r-2][1].type==="linePrefix"&&(n[r][1].start=n[r-2][1].start,n[r+1][1].start=n[r-2][1].start,n.splice(r-2,2)),n}function qe(n,r,t){let e=this,u,a,i,o,p;return m;function m(l){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(l),c}function c(l){return l===33?(n.consume(l),y):l===47?(n.consume(l),g):l===63?(n.consume(l),u=3,e.interrupt?r:G):v(l)?(n.consume(l),i=String.fromCharCode(l),a=!0,L):t(l)}function y(l){return l===45?(n.consume(l),u=2,h):l===91?(n.consume(l),u=5,i="CDATA[",o=0,x):v(l)?(n.consume(l),u=4,e.interrupt?r:G):t(l)}function h(l){return l===45?(n.consume(l),e.interrupt?r:G):t(l)}function x(l){return l===i.charCodeAt(o++)?(n.consume(l),o===i.length?e.interrupt?r:A:x):t(l)}function g(l){return v(l)?(n.consume(l),i=String.fromCharCode(l),L):t(l)}function L(l){return l===null||l===47||l===62||V(l)?l!==47&&a&&vn.includes(i.toLowerCase())?(u=1,e.interrupt?r(l):A(l)):Bt.includes(i.toLowerCase())?(u=6,l===47?(n.consume(l),O):e.interrupt?r(l):A(l)):(u=7,e.interrupt&&!e.parser.lazy[e.now().line]?t(l):a?R(l):b(l)):l===45||K(l)?(n.consume(l),i+=String.fromCharCode(l),L):t(l)}function O(l){return l===62?(n.consume(l),e.interrupt?r:A):t(l)}function b(l){return I(l)?(n.consume(l),b):M(l)}function R(l){return l===47?(n.consume(l),M):l===58||l===95||v(l)?(n.consume(l),w):I(l)?(n.consume(l),R):M(l)}function w(l){return l===45||l===46||l===58||l===95||K(l)?(n.consume(l),w):P(l)}function P(l){return l===61?(n.consume(l),_):I(l)?(n.consume(l),P):R(l)}function _(l){return l===null||l===60||l===61||l===62||l===96?t(l):l===34||l===39?(n.consume(l),p=l,k):I(l)?(n.consume(l),_):(p=null,j(l))}function k(l){return l===null||S(l)?t(l):l===p?(n.consume(l),H):(n.consume(l),k)}function j(l){return l===null||l===34||l===39||l===60||l===61||l===62||l===96||V(l)?P(l):(n.consume(l),j)}function H(l){return l===47||l===62||I(l)?R(l):t(l)}function M(l){return l===62?(n.consume(l),Q):t(l)}function Q(l){return I(l)?(n.consume(l),Q):l===null||S(l)?A(l):t(l)}function A(l){return l===45&&u===2?(n.consume(l),U):l===60&&u===1?(n.consume(l),X):l===62&&u===4?(n.consume(l),N):l===63&&u===3?(n.consume(l),G):l===93&&u===5?(n.consume(l),W):S(l)&&(u===6||u===7)?n.check(Re,N,D)(l):l===null||S(l)?D(l):(n.consume(l),A)}function D(l){return n.exit("htmlFlowData"),E(l)}function E(l){return l===null?s(l):S(l)?n.attempt({tokenize:z,partial:!0},E,s)(l):(n.enter("htmlFlowData"),A(l))}function z(l,Sn,mn){return kn;function kn(en){return l.enter("lineEnding"),l.consume(en),l.exit("lineEnding"),En}function En(en){return e.parser.lazy[e.now().line]?mn(en):Sn(en)}}function U(l){return l===45?(n.consume(l),G):A(l)}function X(l){return l===47?(n.consume(l),i="",nn):A(l)}function nn(l){return l===62&&vn.includes(i.toLowerCase())?(n.consume(l),N):v(l)&&i.length<8?(n.consume(l),i+=String.fromCharCode(l),nn):A(l)}function W(l){return l===93?(n.consume(l),G):A(l)}function G(l){return l===62?(n.consume(l),N):l===45&&u===2?(n.consume(l),G):A(l)}function N(l){return l===null||S(l)?(n.exit("htmlFlowData"),s(l)):(n.consume(l),N)}function s(l){return n.exit("htmlFlow"),r(l)}}function He(n,r,t){return e;function e(u){return n.exit("htmlFlowData"),n.enter("lineEndingBlank"),n.consume(u),n.exit("lineEndingBlank"),n.attempt(cn,r,t)}}var tt={name:"htmlText",tokenize:Ne};function Ne(n,r,t){let e=this,u,a,i,o;return p;function p(s){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(s),m}function m(s){return s===33?(n.consume(s),c):s===47?(n.consume(s),j):s===63?(n.consume(s),_):v(s)?(n.consume(s),Q):t(s)}function c(s){return s===45?(n.consume(s),y):s===91?(n.consume(s),a="CDATA[",i=0,O):v(s)?(n.consume(s),P):t(s)}function y(s){return s===45?(n.consume(s),h):t(s)}function h(s){return s===null||s===62?t(s):s===45?(n.consume(s),x):g(s)}function x(s){return s===null||s===62?t(s):g(s)}function g(s){return s===null?t(s):s===45?(n.consume(s),L):S(s)?(o=g,W(s)):(n.consume(s),g)}function L(s){return s===45?(n.consume(s),N):g(s)}function O(s){return s===a.charCodeAt(i++)?(n.consume(s),i===a.length?b:O):t(s)}function b(s){return s===null?t(s):s===93?(n.consume(s),R):S(s)?(o=b,W(s)):(n.consume(s),b)}function R(s){return s===93?(n.consume(s),w):b(s)}function w(s){return s===62?N(s):s===93?(n.consume(s),w):b(s)}function P(s){return s===null||s===62?N(s):S(s)?(o=P,W(s)):(n.consume(s),P)}function _(s){return s===null?t(s):s===63?(n.consume(s),k):S(s)?(o=_,W(s)):(n.consume(s),_)}function k(s){return s===62?N(s):_(s)}function j(s){return v(s)?(n.consume(s),H):t(s)}function H(s){return s===45||K(s)?(n.consume(s),H):M(s)}function M(s){return S(s)?(o=M,W(s)):I(s)?(n.consume(s),M):N(s)}function Q(s){return s===45||K(s)?(n.consume(s),Q):s===47||s===62||V(s)?A(s):t(s)}function A(s){return s===47?(n.consume(s),N):s===58||s===95||v(s)?(n.consume(s),D):S(s)?(o=A,W(s)):I(s)?(n.consume(s),A):N(s)}function D(s){return s===45||s===46||s===58||s===95||K(s)?(n.consume(s),D):E(s)}function E(s){return s===61?(n.consume(s),z):S(s)?(o=E,W(s)):I(s)?(n.consume(s),E):A(s)}function z(s){return s===null||s===60||s===61||s===62||s===96?t(s):s===34||s===39?(n.consume(s),u=s,U):S(s)?(o=z,W(s)):I(s)?(n.consume(s),z):(n.consume(s),u=void 0,nn)}function U(s){return s===u?(n.consume(s),X):s===null?t(s):S(s)?(o=U,W(s)):(n.consume(s),U)}function X(s){return s===62||s===47||V(s)?A(s):t(s)}function nn(s){return s===null||s===34||s===39||s===60||s===61||s===96?t(s):s===62||V(s)?A(s):(n.consume(s),nn)}function W(s){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(s),n.exit("lineEnding"),C(n,G,"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function G(s){return n.enter("htmlTextData"),o(s)}function N(s){return s===62?(n.consume(s),n.exit("htmlTextData"),n.exit("htmlText"),r):t(s)}}var xn={name:"labelEnd",tokenize:Ze,resolveTo:$e,resolveAll:Ue},Ve={tokenize:Ye},We={tokenize:Ge},Qe={tokenize:Je};function Ue(n){let r=-1,t;for(;++r<n.length;)t=n[r][1],(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(n.splice(r+1,t.type==="labelImage"?4:2),t.type="data",r++);return n}function $e(n,r){let t=n.length,e=0,u,a,i,o;for(;t--;)if(u=n[t][1],a){if(u.type==="link"||u.type==="labelLink"&&u._inactive)break;n[t][0]==="enter"&&u.type==="labelLink"&&(u._inactive=!0)}else if(i){if(n[t][0]==="enter"&&(u.type==="labelImage"||u.type==="labelLink")&&!u._balanced&&(a=t,u.type!=="labelLink")){e=2;break}}else u.type==="labelEnd"&&(i=t);let p={type:n[a][1].type==="labelLink"?"link":"image",start:Object.assign({},n[a][1].start),end:Object.assign({},n[n.length-1][1].end)},m={type:"label",start:Object.assign({},n[a][1].start),end:Object.assign({},n[i][1].end)},c={type:"labelText",start:Object.assign({},n[a+e+2][1].end),end:Object.assign({},n[i-2][1].start)};return o=[["enter",p,r],["enter",m,r]],o=J(o,n.slice(a+1,a+e+3)),o=J(o,[["enter",c,r]]),o=J(o,bn(r.parser.constructs.insideSpan.null,n.slice(a+e+4,i-3),r)),o=J(o,[["exit",c,r],n[i-2],n[i-1],["exit",m,r]]),o=J(o,n.slice(i+1)),o=J(o,[["exit",p,r]]),Z(n,a,n.length,o),n}function Ze(n,r,t){let e=this,u=e.events.length,a,i;for(;u--;)if((e.events[u][1].type==="labelImage"||e.events[u][1].type==="labelLink")&&!e.events[u][1]._balanced){a=e.events[u][1];break}return o;function o(c){return a?a._inactive?m(c):(i=e.parser.defined.includes(on(e.sliceSerialize({start:a.end,end:e.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(c),n.exit("labelMarker"),n.exit("labelEnd"),p):t(c)}function p(c){return c===40?n.attempt(Ve,r,i?r:m)(c):c===91?n.attempt(We,r,i?n.attempt(Qe,r,m):m)(c):i?r(c):m(c)}function m(c){return a._balanced=!0,t(c)}}function Ye(n,r,t){return e;function e(p){return n.enter("resource"),n.enter("resourceMarker"),n.consume(p),n.exit("resourceMarker"),fn(n,u)}function u(p){return p===41?o(p):Rn(n,a,t,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function a(p){return V(p)?fn(n,i)(p):o(p)}function i(p){return p===34||p===39||p===40?qn(n,fn(n,o),t,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):o(p)}function o(p){return p===41?(n.enter("resourceMarker"),n.consume(p),n.exit("resourceMarker"),n.exit("resource"),r):t(p)}}function Ge(n,r,t){let e=this;return u;function u(i){return jn.call(e,n,a,t,"reference","referenceMarker","referenceString")(i)}function a(i){return e.parser.defined.includes(on(e.sliceSerialize(e.events[e.events.length-1][1]).slice(1,-1)))?r(i):t(i)}}function Je(n,r,t){return e;function e(a){return n.enter("reference"),n.enter("referenceMarker"),n.consume(a),n.exit("referenceMarker"),u}function u(a){return a===93?(n.enter("referenceMarker"),n.consume(a),n.exit("referenceMarker"),n.exit("reference"),r):t(a)}}var et={name:"labelStartImage",tokenize:Ke,resolveAll:xn.resolveAll};function Ke(n,r,t){let e=this;return u;function u(o){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(o),n.exit("labelImageMarker"),a}function a(o){return o===91?(n.enter("labelMarker"),n.consume(o),n.exit("labelMarker"),n.exit("labelImage"),i):t(o)}function i(o){return o===94&&"_hiddenFootnoteSupport"in e.parser.constructs?t(o):r(o)}}var rt={name:"labelStartLink",tokenize:Xe,resolveAll:xn.resolveAll};function Xe(n,r,t){let e=this;return u;function u(i){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(i),n.exit("labelMarker"),n.exit("labelLink"),a}function a(i){return i===94&&"_hiddenFootnoteSupport"in e.parser.constructs?t(i):r(i)}}var Ln={name:"lineEnding",tokenize:ve};function ve(n,r){return t;function t(e){return n.enter("lineEnding"),n.consume(e),n.exit("lineEnding"),C(n,r,"linePrefix")}}var gn={name:"thematicBreak",tokenize:nr};function nr(n,r,t){let e=0,u;return a;function a(p){return n.enter("thematicBreak"),u=p,i(p)}function i(p){return p===u?(n.enter("thematicBreakSequence"),o(p)):I(p)?C(n,i,"whitespace")(p):e<3||p!==null&&!S(p)?t(p):(n.exit("thematicBreak"),r(p))}function o(p){return p===u?(n.consume(p),e++,o):(n.exit("thematicBreakSequence"),i(p))}}var Y={name:"list",tokenize:rr,continuation:{tokenize:ir},exit:ar},tr={tokenize:or,partial:!0},er={tokenize:ur,partial:!0};function rr(n,r,t){let e=this,u=e.events[e.events.length-1],a=u&&u[1].type==="linePrefix"?u[2].sliceSerialize(u[1],!0).length:0,i=0;return o;function o(x){let g=e.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!e.containerState.marker||x===e.containerState.marker:An(x)){if(e.containerState.type||(e.containerState.type=g,n.enter(g,{_container:!0})),g==="listUnordered")return n.enter("listItemPrefix"),x===42||x===45?n.check(gn,t,m)(x):m(x);if(!e.interrupt||x===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),p(x)}return t(x)}function p(x){return An(x)&&++i<10?(n.consume(x),p):(!e.interrupt||i<2)&&(e.containerState.marker?x===e.containerState.marker:x===41||x===46)?(n.exit("listItemValue"),m(x)):t(x)}function m(x){return n.enter("listItemMarker"),n.consume(x),n.exit("listItemMarker"),e.containerState.marker=e.containerState.marker||x,n.check(cn,e.interrupt?t:c,n.attempt(tr,h,y))}function c(x){return e.containerState.initialBlankLine=!0,a++,h(x)}function y(x){return I(x)?(n.enter("listItemPrefixWhitespace"),n.consume(x),n.exit("listItemPrefixWhitespace"),h):t(x)}function h(x){return e.containerState.size=a+e.sliceSerialize(n.exit("listItemPrefix"),!0).length,r(x)}}function ir(n,r,t){let e=this;return e.containerState._closeFlow=void 0,n.check(cn,u,a);function u(o){return e.containerState.furtherBlankLines=e.containerState.furtherBlankLines||e.containerState.initialBlankLine,C(n,r,"listItemIndent",e.containerState.size+1)(o)}function a(o){return e.containerState.furtherBlankLines||!I(o)?(e.containerState.furtherBlankLines=void 0,e.containerState.initialBlankLine=void 0,i(o)):(e.containerState.furtherBlankLines=void 0,e.containerState.initialBlankLine=void 0,n.attempt(er,r,i)(o))}function i(o){return e.containerState._closeFlow=!0,e.interrupt=void 0,C(n,n.attempt(Y,r,t),"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function ur(n,r,t){let e=this;return C(n,u,"listItemIndent",e.containerState.size+1);function u(a){let i=e.events[e.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===e.containerState.size?r(a):t(a)}}function ar(n){n.exit(this.containerState.type)}function or(n,r,t){let e=this;return C(n,u,"listItemPrefixWhitespace",e.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function u(a){let i=e.events[e.events.length-1];return!I(a)&&i&&i[1].type==="listItemPrefixWhitespace"?r(a):t(a)}}var Hn={name:"setextUnderline",tokenize:sr,resolveTo:lr};function lr(n,r){let t=n.length,e,u,a;for(;t--;)if(n[t][0]==="enter"){if(n[t][1].type==="content"){e=t;break}n[t][1].type==="paragraph"&&(u=t)}else n[t][1].type==="content"&&n.splice(t,1),!a&&n[t][1].type==="definition"&&(a=t);let i={type:"setextHeading",start:Object.assign({},n[u][1].start),end:Object.assign({},n[n.length-1][1].end)};return n[u][1].type="setextHeadingText",a?(n.splice(u,0,["enter",i,r]),n.splice(a+1,0,["exit",n[e][1],r]),n[e][1].end=Object.assign({},n[a][1].end)):n[e][1]=i,n.push(["exit",i,r]),n}function sr(n,r,t){let e=this,u=e.events.length,a,i;for(;u--;)if(e.events[u][1].type!=="lineEnding"&&e.events[u][1].type!=="linePrefix"&&e.events[u][1].type!=="content"){i=e.events[u][1].type==="paragraph";break}return o;function o(c){return!e.parser.lazy[e.now().line]&&(e.interrupt||i)?(n.enter("setextHeadingLine"),n.enter("setextHeadingLineSequence"),a=c,p(c)):t(c)}function p(c){return c===a?(n.consume(c),p):(n.exit("setextHeadingLineSequence"),C(n,m,"lineSuffix")(c))}function m(c){return c===null||S(c)?(n.exit("setextHeadingLine"),r(c)):t(c)}}var Ot={tokenize:cr};function cr(n){let r=this,t=n.attempt(cn,e,n.attempt(this.parser.constructs.flowInitial,u,C(n,n.attempt(this.parser.constructs.flow,u,n.attempt(Gn,u)),"linePrefix")));return t;function e(a){if(a===null){n.consume(a);return}return n.enter("lineEndingBlank"),n.consume(a),n.exit("lineEndingBlank"),r.currentConstruct=void 0,t}function u(a){if(a===null){n.consume(a);return}return n.enter("lineEnding"),n.consume(a),n.exit("lineEnding"),r.currentConstruct=void 0,t}}var Dt={resolveAll:Rt()},Pt=Mt("string"),_t=Mt("text");function Mt(n){return{tokenize:r,resolveAll:Rt(n==="text"?pr:void 0)};function r(t){let e=this,u=this.parser.constructs[n],a=t.attempt(u,i,o);return i;function i(c){return m(c)?a(c):o(c)}function o(c){if(c===null){t.consume(c);return}return t.enter("data"),t.consume(c),p}function p(c){return m(c)?(t.exit("data"),a(c)):(t.consume(c),p)}function m(c){if(c===null)return!0;let y=u[c],h=-1;if(y)for(;++h<y.length;){let x=y[h];if(!x.previous||x.previous.call(e,e.previous))return!0}return!1}}}function Rt(n){return r;function r(t,e){let u=-1,a;for(;++u<=t.length;)a===void 0?t[u]&&t[u][1].type==="data"&&(a=u,u++):(!t[u]||t[u][1].type!=="data")&&(u!==a+2&&(t[a][1].end=t[u-1][1].end,t.splice(a+2,u-a-2),u=a+2),a=void 0);return n?n(t,e):t}}function pr(n,r){let t=0;for(;++t<=n.length;)if((t===n.length||n[t][1].type==="lineEnding")&&n[t-1][1].type==="data"){let e=n[t-1][1],u=r.sliceStream(e),a=u.length,i=-1,o=0,p;for(;a--;){let m=u[a];if(typeof m=="string"){for(i=m.length;m.charCodeAt(i-1)===32;)o++,i--;if(i)break;i=-1}else if(m===-2)p=!0,o++;else if(m!==-1){a++;break}}if(o){let m={type:t===n.length||p||o<2?"lineSuffix":"hardBreakTrailing",start:{line:e.end.line,column:e.end.column-o,offset:e.end.offset-o,_index:e.start._index+a,_bufferIndex:a?i:e.start._bufferIndex+i},end:Object.assign({},e.end)};e.end=Object.assign({},m.start),e.start.offset===e.end.offset?Object.assign(e,m):(n.splice(t,0,["enter",m,r],["exit",m,r]),t+=2)}t++}return n}function jt(n,r,t){let e=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),u={},a=[],i=[],o=[],p=!0,m={consume:P,enter:_,exit:k,attempt:M(j),check:M(H),interrupt:M(H,{interrupt:!0})},c={previous:null,code:null,containerState:{},events:[],parser:n,sliceStream:L,sliceSerialize:g,now:O,defineSkip:b,write:x},y=r.tokenize.call(c,m),h;return r.resolveAll&&a.push(r),c;function x(E){return i=J(i,E),R(),i[i.length-1]!==null?[]:(Q(r,0),c.events=bn(a,c.events,c),c.events)}function g(E,z){return hr(L(E),z)}function L(E){return mr(i,E)}function O(){return Object.assign({},e)}function b(E){u[E.line]=E.column,D()}function R(){let E;for(;e._index<i.length;){let z=i[e._index];if(typeof z=="string")for(E=e._index,e._bufferIndex<0&&(e._bufferIndex=0);e._index===E&&e._bufferIndex<z.length;)w(z.charCodeAt(e._bufferIndex));else w(z)}}function w(E){p=void 0,h=E,y=y(E)}function P(E){S(E)?(e.line++,e.column=1,e.offset+=E===-3?2:1,D()):E!==-1&&(e.column++,e.offset++),e._bufferIndex<0?e._index++:(e._bufferIndex++,e._bufferIndex===i[e._index].length&&(e._bufferIndex=-1,e._index++)),c.previous=E,p=!0}function _(E,z){let U=z||{};return U.type=E,U.start=O(),c.events.push(["enter",U,c]),o.push(U),U}function k(E){let z=o.pop();return z.end=O(),c.events.push(["exit",z,c]),z}function j(E,z){Q(E,z.from)}function H(E,z){z.restore()}function M(E,z){return U;function U(X,nn,W){let G,N,s,l;return Array.isArray(X)?mn(X):"tokenize"in X?mn([X]):Sn(X);function Sn($){return wn;function wn(rn){let dn=rn!==null&&$[rn],hn=rn!==null&&$.null,Wn=[...Array.isArray(dn)?dn:dn?[dn]:[],...Array.isArray(hn)?hn:hn?[hn]:[]];return mn(Wn)(rn)}}function mn($){return G=$,N=0,$.length===0?W:kn($[N])}function kn($){return wn;function wn(rn){return l=A(),s=$,$.partial||(c.currentConstruct=$),$.name&&c.parser.constructs.disable.null.includes($.name)?en(rn):$.tokenize.call(z?Object.assign(Object.create(c),z):c,m,En,en)(rn)}}function En($){return p=!0,E(s,l),nn}function en($){return p=!0,l.restore(),++N<G.length?kn(G[N]):W}}}function Q(E,z){E.resolveAll&&!a.includes(E)&&a.push(E),E.resolve&&Z(c.events,z,c.events.length-z,E.resolve(c.events.slice(z),c)),E.resolveTo&&(c.events=E.resolveTo(c.events,c))}function A(){let E=O(),z=c.previous,U=c.currentConstruct,X=c.events.length,nn=Array.from(o);return{restore:W,from:X};function W(){e=E,c.previous=z,c.currentConstruct=U,c.events.length=X,o=nn,D()}}function D(){e.line in u&&e.column<2&&(e.column=u[e.line],e.offset+=u[e.line]-1)}}function mr(n,r){let t=r.start._index,e=r.start._bufferIndex,u=r.end._index,a=r.end._bufferIndex,i;return t===u?i=[n[t].slice(e,a)]:(i=n.slice(t,u),e>-1&&(i[0]=i[0].slice(e)),a>0&&i.push(n[u].slice(0,a))),i}function hr(n,r){let t=-1,e=[],u;for(;++t<n.length;){let a=n[t],i;if(typeof a=="string")i=a;else switch(a){case-5:{i="\r";break}case-4:{i=`
|
|
`;break}case-3:{i=`\r
|
|
`;break}case-2:{i=r?" ":" ";break}case-1:{if(!r&&u)continue;i=" ";break}default:i=String.fromCharCode(a)}u=a===-2,e.push(i)}return e.join("")}var it={};ie(it,{attentionMarkers:()=>Sr,contentInitial:()=>xr,disable:()=>Er,document:()=>fr,flow:()=>kr,flowInitial:()=>gr,insideSpan:()=>br,string:()=>dr,text:()=>yr});var fr={42:Y,43:Y,45:Y,48:Y,49:Y,50:Y,51:Y,52:Y,53:Y,54:Y,55:Y,56:Y,57:Y,62:On},xr={91:Jn},gr={[-2]:Tn,[-1]:Tn,32:Tn},kr={35:Xn,42:gn,45:[Hn,gn],60:nt,61:Hn,95:gn,96:_n,126:_n},dr={38:Pn,92:Dn},yr={[-5]:Ln,[-4]:Ln,[-3]:Ln,33:et,38:Pn,42:In,60:[Zn,tt],91:rt,92:[Kn,Dn],93:xn,95:In,96:Yn},br={null:[In,Dt]},Sr={null:[42,95]},Er={null:[]};function qt(n={}){let r=St([it].concat(n.extensions||[])),t={defined:[],lazy:{},constructs:r,content:e(zt),document:e(Tt),flow:e(Ot),string:e(Pt),text:e(_t)};return t;function e(u){return a;function a(i){return jt(t,u,i)}}}var Ht=/[\0\t\n\r]/g;function Nt(){let n=1,r="",t=!0,e;return u;function u(a,i,o){let p=[],m,c,y,h,x;for(a=r+a.toString(i),y=0,r="",t&&(a.charCodeAt(0)===65279&&y++,t=void 0);y<a.length;){if(Ht.lastIndex=y,m=Ht.exec(a),h=m&&m.index!==void 0?m.index:a.length,x=a.charCodeAt(h),!m){r=a.slice(y);break}if(x===10&&y===h&&e)p.push(-3),e=void 0;else switch(e&&(p.push(-5),e=void 0),y<h&&(p.push(a.slice(y,h)),n+=h-y),x){case 0:{p.push(65533),n++;break}case 9:{for(c=Math.ceil(n/4)*4,p.push(-2);n++<c;)p.push(-1);break}case 10:{p.push(-4),n=1;break}default:e=!0,n=1}y=h+1}return o&&(e&&p.push(-5),r&&p.push(r),p.push(null)),p}}function Vt(n){for(;!Mn(n););return n}function Nn(n,r){let t=Number.parseInt(n,r);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"\uFFFD":String.fromCharCode(t)}var wr=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Wt(n){return n.replace(wr,Fr)}function Fr(n,r,t){if(r)return r;if(t.charCodeAt(0)===35){let u=t.charCodeAt(1),a=u===120||u===88;return Nn(t.slice(a?2:1),a?16:10)}return yn(t)||n}function Bn(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?Qt(n.position):"start"in n||"end"in n?Qt(n):"line"in n||"column"in n?ut(n):""}function ut(n){return Ut(n&&n.line)+":"+Ut(n&&n.column)}function Qt(n){return ut(n&&n.start)+"-"+ut(n&&n.end)}function Ut(n){return n&&typeof n=="number"?n:1}var Zt={}.hasOwnProperty,Vn=function(n,r,t){return typeof r!="string"&&(t=r,r=void 0),Cr(t)(Vt(qt(t).document().write(Nt()(n,r,!0))))};function Cr(n){let r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(mt),autolinkProtocol:A,autolinkEmail:A,atxHeading:o(st),blockQuote:o(dn),characterEscape:A,characterReference:A,codeFenced:o(hn),codeFencedFenceInfo:p,codeFencedFenceMeta:p,codeIndented:o(hn,p),codeText:o(Wn,p),codeTextData:A,data:A,codeFlowValue:A,definition:o(Jt),definitionDestinationString:p,definitionLabelString:p,definitionTitleString:p,emphasis:o(Kt),hardBreakEscape:o(ct),hardBreakTrailing:o(ct),htmlFlow:o(pt,p),htmlFlowData:A,htmlText:o(pt,p),htmlTextData:A,image:o(Xt),label:p,link:o(mt),listItem:o(vt),listItemValue:g,listOrdered:o(ht,x),listUnordered:o(ht),paragraph:o(ne),reference:kn,referenceString:p,resourceDestinationString:p,resourceTitleString:p,setextHeading:o(st),strong:o(te),thematicBreak:o(re)},exit:{atxHeading:c(),atxHeadingSequence:j,autolink:c(),autolinkEmail:rn,autolinkProtocol:wn,blockQuote:c(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:en,characterReferenceMarkerNumeric:en,characterReferenceValue:$,codeFenced:c(R),codeFencedFence:b,codeFencedFenceInfo:L,codeFencedFenceMeta:O,codeFlowValue:D,codeIndented:c(w),codeText:c(nn),codeTextData:D,data:D,definition:c(),definitionDestinationString:k,definitionLabelString:P,definitionTitleString:_,emphasis:c(),hardBreakEscape:c(z),hardBreakTrailing:c(z),htmlFlow:c(U),htmlFlowData:D,htmlText:c(X),htmlTextData:D,image:c(G),label:s,labelText:N,lineEnding:E,link:c(W),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:En,resourceDestinationString:l,resourceTitleString:Sn,resource:mn,setextHeading:c(Q),setextHeadingLineSequence:M,setextHeadingText:H,strong:c(),thematicBreak:c()}};Yt(r,(n||{}).mdastExtensions||[]);let t={};return e;function e(f){let d={type:"root",children:[]},F={stack:[d],tokenStack:[],config:r,enter:m,exit:y,buffer:p,resume:h,setData:a,getData:i},T=[],B=-1;for(;++B<f.length;)if(f[B][1].type==="listOrdered"||f[B][1].type==="listUnordered")if(f[B][0]==="enter")T.push(B);else{let tn=T.pop();B=u(f,tn,B)}for(B=-1;++B<f.length;){let tn=r[f[B][0]];Zt.call(tn,f[B][1].type)&&tn[f[B][1].type].call(Object.assign({sliceSerialize:f[B][2].sliceSerialize},F),f[B][1])}if(F.tokenStack.length>0){let tn=F.tokenStack[F.tokenStack.length-1];(tn[1]||$t).call(F,void 0,tn[0])}for(d.position={start:pn(f.length>0?f[0][1].start:{line:1,column:1,offset:0}),end:pn(f.length>0?f[f.length-2][1].end:{line:1,column:1,offset:0})},B=-1;++B<r.transforms.length;)d=r.transforms[B](d)||d;return d}function u(f,d,F){let T=d-1,B=-1,tn=!1,ln,un,Fn,Cn;for(;++T<=F;){let q=f[T];if(q[1].type==="listUnordered"||q[1].type==="listOrdered"||q[1].type==="blockQuote"?(q[0]==="enter"?B++:B--,Cn=void 0):q[1].type==="lineEndingBlank"?q[0]==="enter"&&(ln&&!Cn&&!B&&!Fn&&(Fn=T),Cn=void 0):q[1].type==="linePrefix"||q[1].type==="listItemValue"||q[1].type==="listItemMarker"||q[1].type==="listItemPrefix"||q[1].type==="listItemPrefixWhitespace"||(Cn=void 0),!B&&q[0]==="enter"&&q[1].type==="listItemPrefix"||B===-1&&q[0]==="exit"&&(q[1].type==="listUnordered"||q[1].type==="listOrdered")){if(ln){let Qn=T;for(un=void 0;Qn--;){let an=f[Qn];if(an[1].type==="lineEnding"||an[1].type==="lineEndingBlank"){if(an[0]==="exit")continue;un&&(f[un][1].type="lineEndingBlank",tn=!0),an[1].type="lineEnding",un=Qn}else if(!(an[1].type==="linePrefix"||an[1].type==="blockQuotePrefix"||an[1].type==="blockQuotePrefixWhitespace"||an[1].type==="blockQuoteMarker"||an[1].type==="listItemIndent"))break}Fn&&(!un||Fn<un)&&(ln._spread=!0),ln.end=Object.assign({},un?f[un][1].start:q[1].end),f.splice(un||T,0,["exit",ln,q[2]]),T++,F++}q[1].type==="listItemPrefix"&&(ln={type:"listItem",_spread:!1,start:Object.assign({},q[1].start)},f.splice(T,0,["enter",ln,q[2]]),T++,F++,Fn=void 0,Cn=!0)}}return f[d][1]._spread=tn,F}function a(f,d){t[f]=d}function i(f){return t[f]}function o(f,d){return F;function F(T){m.call(this,f(T),T),d&&d.call(this,T)}}function p(){this.stack.push({type:"fragment",children:[]})}function m(f,d,F){return this.stack[this.stack.length-1].children.push(f),this.stack.push(f),this.tokenStack.push([d,F]),f.position={start:pn(d.start)},f}function c(f){return d;function d(F){f&&f.call(this,F),y.call(this,F)}}function y(f,d){let F=this.stack.pop(),T=this.tokenStack.pop();if(T)T[0].type!==f.type&&(d?d.call(this,f,T[0]):(T[1]||$t).call(this,f,T[0]));else throw new Error("Cannot close `"+f.type+"` ("+Bn({start:f.start,end:f.end})+"): it\u2019s not open");return F.position.end=pn(f.end),F}function h(){return dt(this.stack.pop())}function x(){a("expectingFirstListItemValue",!0)}function g(f){if(i("expectingFirstListItemValue")){let d=this.stack[this.stack.length-2];d.start=Number.parseInt(this.sliceSerialize(f),10),a("expectingFirstListItemValue")}}function L(){let f=this.resume(),d=this.stack[this.stack.length-1];d.lang=f}function O(){let f=this.resume(),d=this.stack[this.stack.length-1];d.meta=f}function b(){i("flowCodeInside")||(this.buffer(),a("flowCodeInside",!0))}function R(){let f=this.resume(),d=this.stack[this.stack.length-1];d.value=f.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),a("flowCodeInside")}function w(){let f=this.resume(),d=this.stack[this.stack.length-1];d.value=f.replace(/(\r?\n|\r)$/g,"")}function P(f){let d=this.resume(),F=this.stack[this.stack.length-1];F.label=d,F.identifier=on(this.sliceSerialize(f)).toLowerCase()}function _(){let f=this.resume(),d=this.stack[this.stack.length-1];d.title=f}function k(){let f=this.resume(),d=this.stack[this.stack.length-1];d.url=f}function j(f){let d=this.stack[this.stack.length-1];if(!d.depth){let F=this.sliceSerialize(f).length;d.depth=F}}function H(){a("setextHeadingSlurpLineEnding",!0)}function M(f){let d=this.stack[this.stack.length-1];d.depth=this.sliceSerialize(f).charCodeAt(0)===61?1:2}function Q(){a("setextHeadingSlurpLineEnding")}function A(f){let d=this.stack[this.stack.length-1],F=d.children[d.children.length-1];(!F||F.type!=="text")&&(F=ee(),F.position={start:pn(f.start)},d.children.push(F)),this.stack.push(F)}function D(f){let d=this.stack.pop();d.value+=this.sliceSerialize(f),d.position.end=pn(f.end)}function E(f){let d=this.stack[this.stack.length-1];if(i("atHardBreak")){let F=d.children[d.children.length-1];F.position.end=pn(f.end),a("atHardBreak");return}!i("setextHeadingSlurpLineEnding")&&r.canContainEols.includes(d.type)&&(A.call(this,f),D.call(this,f))}function z(){a("atHardBreak",!0)}function U(){let f=this.resume(),d=this.stack[this.stack.length-1];d.value=f}function X(){let f=this.resume(),d=this.stack[this.stack.length-1];d.value=f}function nn(){let f=this.resume(),d=this.stack[this.stack.length-1];d.value=f}function W(){let f=this.stack[this.stack.length-1];if(i("inReference")){let d=i("referenceType")||"shortcut";f.type+="Reference",f.referenceType=d,delete f.url,delete f.title}else delete f.identifier,delete f.label;a("referenceType")}function G(){let f=this.stack[this.stack.length-1];if(i("inReference")){let d=i("referenceType")||"shortcut";f.type+="Reference",f.referenceType=d,delete f.url,delete f.title}else delete f.identifier,delete f.label;a("referenceType")}function N(f){let d=this.sliceSerialize(f),F=this.stack[this.stack.length-2];F.label=Wt(d),F.identifier=on(d).toLowerCase()}function s(){let f=this.stack[this.stack.length-1],d=this.resume(),F=this.stack[this.stack.length-1];if(a("inReference",!0),F.type==="link"){let T=f.children;F.children=T}else F.alt=d}function l(){let f=this.resume(),d=this.stack[this.stack.length-1];d.url=f}function Sn(){let f=this.resume(),d=this.stack[this.stack.length-1];d.title=f}function mn(){a("inReference")}function kn(){a("referenceType","collapsed")}function En(f){let d=this.resume(),F=this.stack[this.stack.length-1];F.label=d,F.identifier=on(this.sliceSerialize(f)).toLowerCase(),a("referenceType","full")}function en(f){a("characterReferenceType",f.type)}function $(f){let d=this.sliceSerialize(f),F=i("characterReferenceType"),T;F?(T=Nn(d,F==="characterReferenceMarkerNumeric"?10:16),a("characterReferenceType")):T=yn(d);let B=this.stack.pop();B.value+=T,B.position.end=pn(f.end)}function wn(f){D.call(this,f);let d=this.stack[this.stack.length-1];d.url=this.sliceSerialize(f)}function rn(f){D.call(this,f);let d=this.stack[this.stack.length-1];d.url="mailto:"+this.sliceSerialize(f)}function dn(){return{type:"blockquote",children:[]}}function hn(){return{type:"code",lang:null,meta:null,value:""}}function Wn(){return{type:"inlineCode",value:""}}function Jt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Kt(){return{type:"emphasis",children:[]}}function st(){return{type:"heading",depth:void 0,children:[]}}function ct(){return{type:"break"}}function pt(){return{type:"html",value:""}}function Xt(){return{type:"image",title:null,url:"",alt:null}}function mt(){return{type:"link",title:null,url:"",children:[]}}function ht(f){return{type:"list",ordered:f.type==="listOrdered",start:null,spread:f._spread,children:[]}}function vt(f){return{type:"listItem",spread:f._spread,checked:null,children:[]}}function ne(){return{type:"paragraph",children:[]}}function te(){return{type:"strong",children:[]}}function ee(){return{type:"text",value:""}}function re(){return{type:"thematicBreak"}}}function pn(n){return{line:n.line,column:n.column,offset:n.offset}}function Yt(n,r){let t=-1;for(;++t<r.length;){let e=r[t];Array.isArray(e)?Yt(n,e):Ar(n,e)}}function Ar(n,r){let t;for(t in r)if(Zt.call(r,t)){if(t==="canContainEols"){let e=r[t];e&&n[t].push(...e)}else if(t==="transforms"){let e=r[t];e&&n[t].push(...e)}else if(t==="enter"||t==="exit"){let e=r[t];e&&Object.assign(n[t],e)}}}function $t(n,r){throw n?new Error("Cannot close `"+n.type+"` ("+Bn({start:n.start,end:n.end})+"): a different token (`"+r.type+"`, "+Bn({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Bn({start:r.start,end:r.end})+") is still open")}function zr(n){let r=n.replace(/\n{2,}/g,`
|
|
`);return ft(r)}function Ir(n){let r=zr(n),{children:t}=Vn(r),e=[[]],u=0;function a(i,o="normal"){i.type==="text"?i.value.split(`
|
|
`).forEach((m,c)=>{c!==0&&(u++,e.push([])),m.split(" ").forEach(y=>{y&&e[u].push({content:y,type:o})})}):(i.type==="strong"||i.type==="emphasis")&&i.children.forEach(p=>{a(p,i.type)})}return t.forEach(i=>{i.type==="paragraph"&&i.children.forEach(o=>{a(o)})}),e}function Tr(n){let{children:r}=Vn(n);function t(e){return e.type==="text"?e.value.replace(/\n/g,"<br/>"):e.type==="strong"?`<strong>${e.children.map(t).join("")}</strong>`:e.type==="emphasis"?`<em>${e.children.map(t).join("")}</em>`:e.type==="paragraph"?`<p>${e.children.map(t).join("")}</p>`:`Unsupported markdown: ${e.type}`}return r.map(t).join("")}function Lr(n){return Intl.Segmenter?[...new Intl.Segmenter().segment(n)].map(r=>r.segment):[...n]}function Br(n,r){let t=Lr(r.content);return Gt(n,[],t,r.type)}function Gt(n,r,t,e){if(t.length===0)return[{content:r.join(""),type:e},{content:"",type:e}];let[u,...a]=t,i=[...r,u];return n([{content:i.join(""),type:e}])?Gt(n,i,a,e):(r.length===0&&u&&(r.push(u),t.shift()),[{content:r.join(""),type:e},{content:t.join(""),type:e}])}function Or(n,r){if(n.some(({content:t})=>t.includes(`
|
|
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return at(n,r)}function at(n,r,t=[],e=[]){var o;if(n.length===0)return e.length>0&&t.push(e),t.length>0?t:[];let u="";n[0].content===" "&&(u=" ",n.shift());let a=(o=n.shift())!=null?o:{content:" ",type:"normal"},i=[...e];if(u!==""&&i.push({content:u,type:"normal"}),i.push(a),r(i))return at(n,r,t,i);if(e.length>0)t.push(e),n.unshift(a);else if(a.content){let[p,m]=Br(r,a);t.push([p]),m.content&&n.unshift(m)}return at(n,r,t)}function Dr(n,r){r&&n.attr("style",r)}function Pr(n,r,t,e,u=!1){let a=n.append("foreignObject"),i=a.append("xhtml:div"),o=r.label,p=r.isNode?"nodeLabel":"edgeLabel";i.html(`
|
|
<span class="${p} ${e}" `+(r.labelStyle?'style="'+r.labelStyle+'"':"")+">"+o+"</span>"),Dr(i,r.labelStyle),i.style("display","table-cell"),i.style("white-space","nowrap"),i.style("max-width",t+"px"),i.attr("xmlns","http://www.w3.org/1999/xhtml"),u&&i.attr("class","labelBkg");let m=i.node().getBoundingClientRect();return m.width===t&&(i.style("display","table"),i.style("white-space","break-spaces"),i.style("width",t+"px"),m=i.node().getBoundingClientRect()),a.style("width",m.width),a.style("height",m.height),a.node()}function ot(n,r,t){return n.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",r*t-.1+"em").attr("dy",t+"em")}function _r(n,r,t){let e=n.append("text"),u=ot(e,1,r);lt(u,t);let a=u.node().getComputedTextLength();return e.remove(),a}function Za(n,r,t){var e;let u=n.append("text"),a=ot(u,1,r);lt(a,[{content:t,type:"normal"}]);let i=(e=a.node())==null?void 0:e.getBoundingClientRect();return i&&u.remove(),i}function Mr(n,r,t,e=!1){let a=r.append("g"),i=a.insert("rect").attr("class","background"),o=a.append("text").attr("y","-10.1"),p=0;for(let m of t){let c=h=>_r(a,1.1,h)<=n,y=c(m)?[m]:Or(m,c);for(let h of y){let x=ot(o,p,1.1);lt(x,h),p++}}if(e){let m=o.node().getBBox(),c=2;return i.attr("x",-c).attr("y",-c).attr("width",m.width+2*c).attr("height",m.height+2*c),a.node()}else return o.node()}function lt(n,r){n.text(""),r.forEach((t,e)=>{let u=n.append("tspan").attr("font-style",t.type==="emphasis"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",t.type==="strong"?"bold":"normal");e===0?u.text(t.content):u.text(" "+t.content)})}var Ya=(n,r="",{style:t="",isTitle:e=!1,classes:u="",useHtmlLabels:a=!0,isNode:i=!0,width:o=200,addSvgBackground:p=!1}={})=>{if(xt.info("createText",r,t,e,u,a,i,p),a){let m=Tr(r),c={isNode:i,label:gt(m).replace(/fa[blrs]?:fa-[\w-]+/g,h=>`<i class='${h.replace(":"," ")}'></i>`),labelStyle:t.replace("fill:","color:")};return Pr(n,c,o,u,p)}else{let m=Ir(r);return Mr(o,n,m,p)}};export{Za as a,Ya as b};
|