%PDF- %PDF-
Direktori : /www/varak.net/nextcloud.varak.net/apps_old/apps/text/js/ |
Current File : //www/varak.net/nextcloud.varak.net/apps_old/apps/text/js/createText-ca0c5216-zBmLklPS.chunk.mjs |
/*! third party licenses: js/vendor.LICENSE.txt */ import{l as wt,an as At,ap as It}from"./mermaid.core-CHhv7cmw.chunk.mjs";const qe=document.createElement("i");function ze(e){const r="&"+e+";";qe.innerHTML=r;const t=qe.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===r?!1:t}function Ct(e,r){const t={}.includeImageAlt;return tt(e,typeof t=="boolean"?t:!0)}function tt(e,r){return Tt(e)&&("value"in e&&e.value||r&&"alt"in e&&e.alt||"children"in e&&Ve(e.children,r))||Array.isArray(e)&&Ve(e,r)||""}function Ve(e,r){const t=[];let n=-1;for(;++n<e.length;)t[n]=tt(e[n],r);return t.join("")}function Tt(e){return!!(e&&typeof e=="object")}function ne(e,r,t,n){const u=e.length;let c=0,i;if(r<0?r=-r>u?0:u+r:r=r>u?u:r,t=t>0?t:0,n.length<1e4)i=Array.from(n),i.unshift(r,t),[].splice.apply(e,i);else for(t&&[].splice.apply(e,[r,t]);c<n.length;)i=n.slice(c,c+1e4),i.unshift(r,0),[].splice.apply(e,i),c+=1e4,r+=1e4}function $(e,r){return e.length>0?(ne(e,e.length,0,r),e):r}const Qe={}.hasOwnProperty;function zt(e){const r={};let t=-1;for(;++t<e.length;)Dt(r,e[t]);return r}function Dt(e,r){let t;for(t in r){const n=(Qe.call(e,t)?e[t]:void 0)||(e[t]={}),u=r[t];let c;for(c in u){Qe.call(n,c)||(n[c]=[]);const i=u[c];Bt(n[c],Array.isArray(i)?i:i?[i]:[])}}}function Bt(e,r){let t=-1;const n=[];for(;++t<r.length;)(r[t].add==="after"?e:n).push(r[t]);ne(e,0,0,n)}const _t=/[!-/:-@[-`{-~\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]/,te=oe(/[A-Za-z]/),we=oe(/\d/),Lt=oe(/[\dA-Fa-f]/),Y=oe(/[\dA-Za-z]/),Ot=oe(/[!-/:-@[-`{-~]/),Ue=oe(/[#-'*+\--9=?A-Z^-~]/);function Ae(e){return e!==null&&(e<32||e===127)}function G(e){return e!==null&&(e<0||e===32)}function w(e){return e!==null&&e<-2}function H(e){return e===-2||e===-1||e===32}const Pt=oe(/\s/),Mt=oe(_t);function oe(e){return r;function r(t){return t!==null&&e.test(String.fromCharCode(t))}}function C(e,r,t,n){const u=n?n-1:Number.POSITIVE_INFINITY;let c=0;return i;function i(a){return H(a)?(e.enter(t),o(a)):r(a)}function o(a){return H(a)&&c++<u?(e.consume(a),o):(e.exit(t),r(a))}}const jt={tokenize:Ht};function Ht(e){const r=e.attempt(this.parser.constructs.contentInitial,n,u);let t;return r;function n(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),C(e,r,"linePrefix")}function u(o){return e.enter("paragraph"),c(o)}function c(o){const a=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=a),t=a,i(o)}function i(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return w(o)?(e.consume(o),e.exit("chunkText"),c):(e.consume(o),i)}}const Rt={tokenize:qt},We={tokenize:Vt};function qt(e){const r=this,t=[];let n=0,u,c,i;return o;function o(v){if(n<t.length){const D=t[n];return r.containerState=D[1],e.attempt(D[0].continuation,a,f)(v)}return f(v)}function a(v){if(n++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,u&&O();const D=r.events.length;let B=D,k;for(;B--;)if(r.events[B][0]==="exit"&&r.events[B][1].type==="chunkFlow"){k=r.events[B][1].end;break}b(n);let L=D;for(;L<r.events.length;)r.events[L][1].end=Object.assign({},k),L++;return ne(r.events,B+1,0,r.events.slice(D)),r.events.length=L,f(v)}return o(v)}function f(v){if(n===t.length){if(!u)return g(v);if(u.currentConstruct&&u.currentConstruct.concrete)return x(v);r.interrupt=!!(u.currentConstruct&&!u._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(We,d,m)(v)}function d(v){return u&&O(),b(n),g(v)}function m(v){return r.parser.lazy[r.now().line]=n!==t.length,i=r.now().offset,x(v)}function g(v){return r.containerState={},e.attempt(We,h,x)(v)}function h(v){return n++,t.push([r.currentConstruct,r.containerState]),g(v)}function x(v){if(v===null){u&&O(),b(0),e.consume(v);return}return u=u||r.parser.flow(r.now()),e.enter("chunkFlow",{contentType:"flow",previous:c,_tokenizer:u}),T(v)}function T(v){if(v===null){_(e.exit("chunkFlow"),!0),b(0),e.consume(v);return}return w(v)?(e.consume(v),_(e.exit("chunkFlow")),n=0,r.interrupt=void 0,o):(e.consume(v),T)}function _(v,D){const B=r.sliceStream(v);if(D&&B.push(null),v.previous=c,c&&(c.next=v),c=v,u.defineSkip(v.start),u.write(B),r.parser.lazy[v.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;const L=r.events.length;let M=L,j,V;for(;M--;)if(r.events[M][0]==="exit"&&r.events[M][1].type==="chunkFlow"){if(j){V=r.events[M][1].end;break}j=!0}for(b(n),k=L;k<r.events.length;)r.events[k][1].end=Object.assign({},V),k++;ne(r.events,M+1,0,r.events.slice(L)),r.events.length=k}}function b(v){let D=t.length;for(;D-- >v;){const B=t[D];r.containerState=B[1],B[0].exit.call(r,e)}t.length=v}function O(){u.write([null]),c=void 0,u=void 0,r.containerState._closeFlow=void 0}}function Vt(e,r,t){return C(e,e.attempt(this.parser.constructs.document,r,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ne(e){if(e===null||G(e)||Pt(e))return 1;if(Mt(e))return 2}function De(e,r,t){const n=[];let u=-1;for(;++u<e.length;){const c=e[u].resolveAll;c&&!n.includes(c)&&(r=c(r,t),n.push(c))}return r}const Ie={name:"attention",tokenize:Ut,resolveAll:Qt};function Qt(e,r){let t=-1,n,u,c,i,o,a,f,d;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(n=t;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&r.sliceSerialize(e[n][1]).charCodeAt(0)===r.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[n][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const m=Object.assign({},e[n][1].end),g=Object.assign({},e[t][1].start);$e(m,-a),$e(g,a),i={type:a>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[n][1].end)},o={type:a>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[t][1].start),end:g},c={type:a>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[t][1].start)},u={type:a>1?"strong":"emphasis",start:Object.assign({},i.start),end:Object.assign({},o.end)},e[n][1].end=Object.assign({},i.start),e[t][1].start=Object.assign({},o.end),f=[],e[n][1].end.offset-e[n][1].start.offset&&(f=$(f,[["enter",e[n][1],r],["exit",e[n][1],r]])),f=$(f,[["enter",u,r],["enter",i,r],["exit",i,r],["enter",c,r]]),f=$(f,De(r.parser.constructs.insideSpan.null,e.slice(n+1,t),r)),f=$(f,[["exit",c,r],["enter",o,r],["exit",o,r],["exit",u,r]]),e[t][1].end.offset-e[t][1].start.offset?(d=2,f=$(f,[["enter",e[t][1],r],["exit",e[t][1],r]])):d=0,ne(e,n-1,t-n+3,f),t=n+f.length-d-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function Ut(e,r){const t=this.parser.constructs.attentionMarkers.null,n=this.previous,u=Ne(n);let c;return i;function i(a){return e.enter("attentionSequence"),c=a,o(a)}function o(a){if(a===c)return e.consume(a),o;const f=e.exit("attentionSequence"),d=Ne(a),m=!d||d===2&&u||t.includes(a),g=!u||u===2&&d||t.includes(n);return f._open=!!(c===42?m:m&&(u||!g)),f._close=!!(c===42?g:g&&(d||!m)),r(a)}}function $e(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const Wt={name:"autolink",tokenize:Nt};function Nt(e,r,t){let n=1;return u;function u(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(x){return te(x)?(e.consume(x),i):Ue(x)?f(x):t(x)}function i(x){return x===43||x===45||x===46||Y(x)?o(x):f(x)}function o(x){return x===58?(e.consume(x),a):(x===43||x===45||x===46||Y(x))&&n++<32?(e.consume(x),o):f(x)}function a(x){return x===62?(e.exit("autolinkProtocol"),h(x)):x===null||x===32||x===60||Ae(x)?t(x):(e.consume(x),a)}function f(x){return x===64?(e.consume(x),n=0,d):Ue(x)?(e.consume(x),f):t(x)}function d(x){return Y(x)?m(x):t(x)}function m(x){return x===46?(e.consume(x),n=0,d):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",h(x)):g(x)}function g(x){return(x===45||Y(x))&&n++<63?(e.consume(x),x===45?g:m):t(x)}function h(x){return e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),r}}const be={tokenize:$t,partial:!0};function $t(e,r,t){return C(e,n,"linePrefix");function n(u){return u===null||w(u)?r(u):t(u)}}const nt={name:"blockQuote",tokenize:Gt,continuation:{tokenize:Jt},exit:Xt};function Gt(e,r,t){const n=this;return u;function u(i){if(i===62){const o=n.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),c}return t(i)}function c(i){return H(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(i))}}function Jt(e,r,t){return C(e,e.attempt(nt,r,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xt(e){e.exit("blockQuote")}const rt={name:"characterEscape",tokenize:Zt};function Zt(e,r,t){return n;function n(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),u}function u(c){return Ot(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):t(c)}}const it={name:"characterReference",tokenize:Yt};function Yt(e,r,t){const n=this;let u=0,c,i;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),a}function a(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),c=31,i=Y,d(m))}function f(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,i=Lt,d):(e.enter("characterReferenceValue"),c=7,i=we,d(m))}function d(m){let g;return m===59&&u?(g=e.exit("characterReferenceValue"),i===Y&&!ze(n.sliceSerialize(g))?t(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)):i(m)&&u++<c?(e.consume(m),d):t(m)}}const Ge={name:"codeFenced",tokenize:Kt,concrete:!0};function Kt(e,r,t){const n=this,u={tokenize:B,partial:!0},c={tokenize:D,partial:!0},i=this.events[this.events.length-1],o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let a=0,f;return d;function d(k){return e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f=k,m(k)}function m(k){return k===f?(e.consume(k),a++,m):(e.exit("codeFencedFenceSequence"),a<3?t(k):C(e,g,"whitespace")(k))}function g(k){return k===null||w(k)?_(k):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(k))}function h(k){return k===null||G(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),C(e,x,"whitespace")(k)):k===96&&k===f?t(k):(e.consume(k),h)}function x(k){return k===null||w(k)?_(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),T(k))}function T(k){return k===null||w(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),_(k)):k===96&&k===f?t(k):(e.consume(k),T)}function _(k){return e.exit("codeFencedFence"),n.interrupt?r(k):b(k)}function b(k){return k===null?v(k):w(k)?e.attempt(c,e.attempt(u,v,o?C(e,b,"linePrefix",o+1):b),v)(k):(e.enter("codeFlowValue"),O(k))}function O(k){return k===null||w(k)?(e.exit("codeFlowValue"),b(k)):(e.consume(k),O)}function v(k){return e.exit("codeFenced"),r(k)}function D(k,L,M){const j=this;return V;function V(S){return k.enter("lineEnding"),k.consume(S),k.exit("lineEnding"),F}function F(S){return j.parser.lazy[j.now().line]?M(S):L(S)}}function B(k,L,M){let j=0;return C(k,V,"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function V(A){return k.enter("codeFencedFence"),k.enter("codeFencedFenceSequence"),F(A)}function F(A){return A===f?(k.consume(A),j++,F):j<a?M(A):(k.exit("codeFencedFenceSequence"),C(k,S,"whitespace")(A))}function S(A){return A===null||w(A)?(k.exit("codeFencedFence"),L(A)):M(A)}}}const Se={name:"codeIndented",tokenize:tn},en={tokenize:nn,partial:!0};function tn(e,r,t){const n=this;return u;function u(f){return e.enter("codeIndented"),C(e,c,"linePrefix",5)(f)}function c(f){const d=n.events[n.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(f):t(f)}function i(f){return f===null?a(f):w(f)?e.attempt(en,i,a)(f):(e.enter("codeFlowValue"),o(f))}function o(f){return f===null||w(f)?(e.exit("codeFlowValue"),i(f)):(e.consume(f),o)}function a(f){return e.exit("codeIndented"),r(f)}}function nn(e,r,t){const n=this;return u;function u(i){return n.parser.lazy[n.now().line]?t(i):w(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),u):C(e,c,"linePrefix",5)(i)}function c(i){const o=n.events[n.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?r(i):w(i)?u(i):t(i)}}const rn={name:"codeText",tokenize:on,resolve:un,previous:cn};function un(e){let r=e.length-4,t=3,n,u;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(n=t;++n<r;)if(e[n][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[r][1].type="codeTextPadding",t+=2,r-=2;break}}for(n=t-1,r++;++n<=r;)u===void 0?n!==r&&e[n][1].type!=="lineEnding"&&(u=n):(n===r||e[n][1].type==="lineEnding")&&(e[u][1].type="codeTextData",n!==u+2&&(e[u][1].end=e[n-1][1].end,e.splice(u+2,n-u-2),r-=n-u-2,n=u+2),u=void 0);return e}function cn(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function on(e,r,t){let n=0,u,c;return i;function i(m){return e.enter("codeText"),e.enter("codeTextSequence"),o(m)}function o(m){return m===96?(e.consume(m),n++,o):(e.exit("codeTextSequence"),a(m))}function a(m){return m===null?t(m):m===96?(c=e.enter("codeTextSequence"),u=0,d(m)):m===32?(e.enter("space"),e.consume(m),e.exit("space"),a):w(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),a):(e.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||w(m)?(e.exit("codeTextData"),a(m)):(e.consume(m),f)}function d(m){return m===96?(e.consume(m),u++,d):u===n?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(c.type="codeTextData",f(m))}}function ut(e){const r={};let t=-1,n,u,c,i,o,a,f;for(;++t<e.length;){for(;t in r;)t=r[t];if(n=e[t],t&&n[1].type==="chunkFlow"&&e[t-1][1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,c=0,c<a.length&&a[c][1].type==="lineEndingBlank"&&(c+=2),c<a.length&&a[c][1].type==="content"))for(;++c<a.length&&a[c][1].type!=="content";)a[c][1].type==="chunkText"&&(a[c][1]._isInFirstContentOfListItem=!0,c++);if(n[0]==="enter")n[1].contentType&&(Object.assign(r,sn(e,t)),t=r[t],f=!0);else if(n[1]._container){for(c=t,u=void 0;c--&&(i=e[c],i[1].type==="lineEnding"||i[1].type==="lineEndingBlank");)i[0]==="enter"&&(u&&(e[u][1].type="lineEndingBlank"),i[1].type="lineEnding",u=c);u&&(n[1].end=Object.assign({},e[u][1].start),o=e.slice(u,t),o.unshift(n),ne(e,u,t-u+1,o))}}return!f}function sn(e,r){const t=e[r][1],n=e[r][2];let u=r-1;const c=[],i=t._tokenizer||n.parser[t.contentType](t.start),o=i.events,a=[],f={};let d,m,g=-1,h=t,x=0,T=0;const _=[T];for(;h;){for(;e[++u][1]!==h;);c.push(u),h._tokenizer||(d=n.sliceStream(h),h.next||d.push(null),m&&i.defineSkip(h.start),h._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),h._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),m=h,h=h.next}for(h=t;++g<o.length;)o[g][0]==="exit"&&o[g-1][0]==="enter"&&o[g][1].type===o[g-1][1].type&&o[g][1].start.line!==o[g][1].end.line&&(T=g+1,_.push(T),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(i.events=[],h?(h._tokenizer=void 0,h.previous=void 0):_.pop(),g=_.length;g--;){const b=o.slice(_[g],_[g+1]),O=c.pop();a.unshift([O,O+b.length-1]),ne(e,O,2,b)}for(g=-1;++g<a.length;)f[x+a[g][0]]=x+a[g][1],x+=a[g][1]-a[g][0]-1;return f}const ln={tokenize:dn,resolve:fn},an={tokenize:pn,partial:!0};function fn(e){return ut(e),e}function dn(e,r){let t;return n;function n(o){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),u(o)}function u(o){return o===null?c(o):w(o)?e.check(an,i,c)(o):(e.consume(o),u)}function c(o){return e.exit("chunkContent"),e.exit("content"),r(o)}function i(o){return e.consume(o),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,u}}function pn(e,r,t){const n=this;return u;function u(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),C(e,c,"linePrefix")}function c(i){if(i===null||w(i))return t(i);const o=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?r(i):e.interrupt(n.parser.constructs.flow,t,r)(i)}}function ct(e,r,t,n,u,c,i,o,a){const f=a||Number.POSITIVE_INFINITY;let d=0;return m;function m(b){return b===60?(e.enter(n),e.enter(u),e.enter(c),e.consume(b),e.exit(c),g):b===null||b===41||Ae(b)?t(b):(e.enter(n),e.enter(i),e.enter(o),e.enter("chunkString",{contentType:"string"}),T(b))}function g(b){return b===62?(e.enter(c),e.consume(b),e.exit(c),e.exit(u),e.exit(n),r):(e.enter(o),e.enter("chunkString",{contentType:"string"}),h(b))}function h(b){return b===62?(e.exit("chunkString"),e.exit(o),g(b)):b===null||b===60||w(b)?t(b):(e.consume(b),b===92?x:h)}function x(b){return b===60||b===62||b===92?(e.consume(b),h):h(b)}function T(b){return b===40?++d>f?t(b):(e.consume(b),T):b===41?d--?(e.consume(b),T):(e.exit("chunkString"),e.exit(o),e.exit(i),e.exit(n),r(b)):b===null||G(b)?d?t(b):(e.exit("chunkString"),e.exit(o),e.exit(i),e.exit(n),r(b)):Ae(b)?t(b):(e.consume(b),b===92?_:T)}function _(b){return b===40||b===41||b===92?(e.consume(b),T):T(b)}}function ot(e,r,t,n,u,c){const i=this;let o=0,a;return f;function f(h){return e.enter(n),e.enter(u),e.consume(h),e.exit(u),e.enter(c),d}function d(h){return h===null||h===91||h===93&&!a||h===94&&!o&&"_hiddenFootnoteSupport"in i.parser.constructs||o>999?t(h):h===93?(e.exit(c),e.enter(u),e.consume(h),e.exit(u),e.exit(n),r):w(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),m(h))}function m(h){return h===null||h===91||h===93||w(h)||o++>999?(e.exit("chunkString"),d(h)):(e.consume(h),a=a||!H(h),h===92?g:m)}function g(h){return h===91||h===92||h===93?(e.consume(h),o++,m):m(h)}}function st(e,r,t,n,u,c){let i;return o;function o(g){return e.enter(n),e.enter(u),e.consume(g),e.exit(u),i=g===40?41:g,a}function a(g){return g===i?(e.enter(u),e.consume(g),e.exit(u),e.exit(n),r):(e.enter(c),f(g))}function f(g){return g===i?(e.exit(c),a(i)):g===null?t(g):w(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),C(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===i||g===null||w(g)?(e.exit("chunkString"),f(g)):(e.consume(g),g===92?m:d)}function m(g){return g===i||g===92?(e.consume(g),d):d(g)}}function xe(e,r){let t;return n;function n(u){return w(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t=!0,n):H(u)?C(e,n,t?"linePrefix":"lineSuffix")(u):r(u)}}function pe(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hn={name:"definition",tokenize:gn},mn={tokenize:xn,partial:!0};function gn(e,r,t){const n=this;let u;return c;function c(a){return e.enter("definition"),ot.call(n,e,i,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(a)}function i(a){return u=pe(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),a===58?(e.enter("definitionMarker"),e.consume(a),e.exit("definitionMarker"),xe(e,ct(e,e.attempt(mn,C(e,o,"whitespace"),C(e,o,"whitespace")),t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString"))):t(a)}function o(a){return a===null||w(a)?(e.exit("definition"),n.parser.defined.includes(u)||n.parser.defined.push(u),r(a)):t(a)}}function xn(e,r,t){return n;function n(i){return G(i)?xe(e,u)(i):t(i)}function u(i){return i===34||i===39||i===40?st(e,C(e,c,"whitespace"),t,"definitionTitle","definitionTitleMarker","definitionTitleString")(i):t(i)}function c(i){return i===null||w(i)?r(i):t(i)}}const kn={name:"hardBreakEscape",tokenize:yn};function yn(e,r,t){return n;function n(c){return e.enter("hardBreakEscape"),e.enter("escapeMarker"),e.consume(c),u}function u(c){return w(c)?(e.exit("escapeMarker"),e.exit("hardBreakEscape"),r(c)):t(c)}}const bn={name:"headingAtx",tokenize:vn,resolve:Fn};function Fn(e,r){let t=e.length-2,n=3,u,c;return e[n][1].type==="whitespace"&&(n+=2),t-2>n&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(n===t-1||t-4>n&&e[t-2][1].type==="whitespace")&&(t-=n+1===t?2:4),t>n&&(u={type:"atxHeadingText",start:e[n][1].start,end:e[t][1].end},c={type:"chunkText",start:e[n][1].start,end:e[t][1].end,contentType:"text"},ne(e,n,t-n+1,[["enter",u,r],["enter",c,r],["exit",c,r],["exit",u,r]])),e}function vn(e,r,t){const n=this;let u=0;return c;function c(d){return e.enter("atxHeading"),e.enter("atxHeadingSequence"),i(d)}function i(d){return d===35&&u++<6?(e.consume(d),i):d===null||G(d)?(e.exit("atxHeadingSequence"),n.interrupt?r(d):o(d)):t(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),a(d)):d===null||w(d)?(e.exit("atxHeading"),r(d)):H(d)?C(e,o,"whitespace")(d):(e.enter("atxHeadingText"),f(d))}function a(d){return d===35?(e.consume(d),a):(e.exit("atxHeadingSequence"),o(d))}function f(d){return d===null||d===35||G(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),f)}}const Sn=["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","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Je=["pre","script","style","textarea"],En={name:"htmlFlow",tokenize:In,resolveTo:An,concrete:!0},wn={tokenize:Cn,partial:!0};function An(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function In(e,r,t){const n=this;let u,c,i,o,a;return f;function f(s){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(s),d}function d(s){return s===33?(e.consume(s),m):s===47?(e.consume(s),x):s===63?(e.consume(s),u=3,n.interrupt?r:W):te(s)?(e.consume(s),i=String.fromCharCode(s),c=!0,T):t(s)}function m(s){return s===45?(e.consume(s),u=2,g):s===91?(e.consume(s),u=5,i="CDATA[",o=0,h):te(s)?(e.consume(s),u=4,n.interrupt?r:W):t(s)}function g(s){return s===45?(e.consume(s),n.interrupt?r:W):t(s)}function h(s){return s===i.charCodeAt(o++)?(e.consume(s),o===i.length?n.interrupt?r:F:h):t(s)}function x(s){return te(s)?(e.consume(s),i=String.fromCharCode(s),T):t(s)}function T(s){return s===null||s===47||s===62||G(s)?s!==47&&c&&Je.includes(i.toLowerCase())?(u=1,n.interrupt?r(s):F(s)):Sn.includes(i.toLowerCase())?(u=6,s===47?(e.consume(s),_):n.interrupt?r(s):F(s)):(u=7,n.interrupt&&!n.parser.lazy[n.now().line]?t(s):c?O(s):b(s)):s===45||Y(s)?(e.consume(s),i+=String.fromCharCode(s),T):t(s)}function _(s){return s===62?(e.consume(s),n.interrupt?r:F):t(s)}function b(s){return H(s)?(e.consume(s),b):j(s)}function O(s){return s===47?(e.consume(s),j):s===58||s===95||te(s)?(e.consume(s),v):H(s)?(e.consume(s),O):j(s)}function v(s){return s===45||s===46||s===58||s===95||Y(s)?(e.consume(s),v):D(s)}function D(s){return s===61?(e.consume(s),B):H(s)?(e.consume(s),D):O(s)}function B(s){return s===null||s===60||s===61||s===62||s===96?t(s):s===34||s===39?(e.consume(s),a=s,k):H(s)?(e.consume(s),B):(a=null,L(s))}function k(s){return s===null||w(s)?t(s):s===a?(e.consume(s),M):(e.consume(s),k)}function L(s){return s===null||s===34||s===39||s===60||s===61||s===62||s===96||G(s)?D(s):(e.consume(s),L)}function M(s){return s===47||s===62||H(s)?O(s):t(s)}function j(s){return s===62?(e.consume(s),V):t(s)}function V(s){return H(s)?(e.consume(s),V):s===null||w(s)?F(s):t(s)}function F(s){return s===45&&u===2?(e.consume(s),J):s===60&&u===1?(e.consume(s),K):s===62&&u===4?(e.consume(s),R):s===63&&u===3?(e.consume(s),W):s===93&&u===5?(e.consume(s),Q):w(s)&&(u===6||u===7)?e.check(wn,R,S)(s):s===null||w(s)?S(s):(e.consume(s),F)}function S(s){return e.exit("htmlFlowData"),A(s)}function A(s){return s===null?l(s):w(s)?e.attempt({tokenize:U,partial:!0},A,l)(s):(e.enter("htmlFlowData"),F(s))}function U(s,le,he){return ae;function ae(Z){return s.enter("lineEnding"),s.consume(Z),s.exit("lineEnding"),q}function q(Z){return n.parser.lazy[n.now().line]?he(Z):le(Z)}}function J(s){return s===45?(e.consume(s),W):F(s)}function K(s){return s===47?(e.consume(s),i="",X):F(s)}function X(s){return s===62&&Je.includes(i.toLowerCase())?(e.consume(s),R):te(s)&&i.length<8?(e.consume(s),i+=String.fromCharCode(s),X):F(s)}function Q(s){return s===93?(e.consume(s),W):F(s)}function W(s){return s===62?(e.consume(s),R):s===45&&u===2?(e.consume(s),W):F(s)}function R(s){return s===null||w(s)?(e.exit("htmlFlowData"),l(s)):(e.consume(s),R)}function l(s){return e.exit("htmlFlow"),r(s)}}function Cn(e,r,t){return n;function n(u){return e.exit("htmlFlowData"),e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),e.attempt(be,r,t)}}const Tn={name:"htmlText",tokenize:zn};function zn(e,r,t){const n=this;let u,c,i,o;return a;function a(l){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(l),f}function f(l){return l===33?(e.consume(l),d):l===47?(e.consume(l),L):l===63?(e.consume(l),B):te(l)?(e.consume(l),V):t(l)}function d(l){return l===45?(e.consume(l),m):l===91?(e.consume(l),c="CDATA[",i=0,_):te(l)?(e.consume(l),D):t(l)}function m(l){return l===45?(e.consume(l),g):t(l)}function g(l){return l===null||l===62?t(l):l===45?(e.consume(l),h):x(l)}function h(l){return l===null||l===62?t(l):x(l)}function x(l){return l===null?t(l):l===45?(e.consume(l),T):w(l)?(o=x,Q(l)):(e.consume(l),x)}function T(l){return l===45?(e.consume(l),R):x(l)}function _(l){return l===c.charCodeAt(i++)?(e.consume(l),i===c.length?b:_):t(l)}function b(l){return l===null?t(l):l===93?(e.consume(l),O):w(l)?(o=b,Q(l)):(e.consume(l),b)}function O(l){return l===93?(e.consume(l),v):b(l)}function v(l){return l===62?R(l):l===93?(e.consume(l),v):b(l)}function D(l){return l===null||l===62?R(l):w(l)?(o=D,Q(l)):(e.consume(l),D)}function B(l){return l===null?t(l):l===63?(e.consume(l),k):w(l)?(o=B,Q(l)):(e.consume(l),B)}function k(l){return l===62?R(l):B(l)}function L(l){return te(l)?(e.consume(l),M):t(l)}function M(l){return l===45||Y(l)?(e.consume(l),M):j(l)}function j(l){return w(l)?(o=j,Q(l)):H(l)?(e.consume(l),j):R(l)}function V(l){return l===45||Y(l)?(e.consume(l),V):l===47||l===62||G(l)?F(l):t(l)}function F(l){return l===47?(e.consume(l),R):l===58||l===95||te(l)?(e.consume(l),S):w(l)?(o=F,Q(l)):H(l)?(e.consume(l),F):R(l)}function S(l){return l===45||l===46||l===58||l===95||Y(l)?(e.consume(l),S):A(l)}function A(l){return l===61?(e.consume(l),U):w(l)?(o=A,Q(l)):H(l)?(e.consume(l),A):F(l)}function U(l){return l===null||l===60||l===61||l===62||l===96?t(l):l===34||l===39?(e.consume(l),u=l,J):w(l)?(o=U,Q(l)):H(l)?(e.consume(l),U):(e.consume(l),u=void 0,X)}function J(l){return l===u?(e.consume(l),K):l===null?t(l):w(l)?(o=J,Q(l)):(e.consume(l),J)}function K(l){return l===62||l===47||G(l)?F(l):t(l)}function X(l){return l===null||l===34||l===39||l===60||l===61||l===96?t(l):l===62||G(l)?F(l):(e.consume(l),X)}function Q(l){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),C(e,W,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function W(l){return e.enter("htmlTextData"),o(l)}function R(l){return l===62?(e.consume(l),e.exit("htmlTextData"),e.exit("htmlText"),r):t(l)}}const Be={name:"labelEnd",tokenize:Pn,resolveTo:On,resolveAll:Ln},Dn={tokenize:Mn},Bn={tokenize:jn},_n={tokenize:Hn};function Ln(e){let r=-1,t;for(;++r<e.length;)t=e[r][1],(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(e.splice(r+1,t.type==="labelImage"?4:2),t.type="data",r++);return e}function On(e,r){let t=e.length,n=0,u,c,i,o;for(;t--;)if(u=e[t][1],c){if(u.type==="link"||u.type==="labelLink"&&u._inactive)break;e[t][0]==="enter"&&u.type==="labelLink"&&(u._inactive=!0)}else if(i){if(e[t][0]==="enter"&&(u.type==="labelImage"||u.type==="labelLink")&&!u._balanced&&(c=t,u.type!=="labelLink")){n=2;break}}else u.type==="labelEnd"&&(i=t);const a={type:e[c][1].type==="labelLink"?"link":"image",start:Object.assign({},e[c][1].start),end:Object.assign({},e[e.length-1][1].end)},f={type:"label",start:Object.assign({},e[c][1].start),end:Object.assign({},e[i][1].end)},d={type:"labelText",start:Object.assign({},e[c+n+2][1].end),end:Object.assign({},e[i-2][1].start)};return o=[["enter",a,r],["enter",f,r]],o=$(o,e.slice(c+1,c+n+3)),o=$(o,[["enter",d,r]]),o=$(o,De(r.parser.constructs.insideSpan.null,e.slice(c+n+4,i-3),r)),o=$(o,[["exit",d,r],e[i-2],e[i-1],["exit",f,r]]),o=$(o,e.slice(i+1)),o=$(o,[["exit",a,r]]),ne(e,c,e.length,o),e}function Pn(e,r,t){const n=this;let u=n.events.length,c,i;for(;u--;)if((n.events[u][1].type==="labelImage"||n.events[u][1].type==="labelLink")&&!n.events[u][1]._balanced){c=n.events[u][1];break}return o;function o(d){return c?c._inactive?f(d):(i=n.parser.defined.includes(pe(n.sliceSerialize({start:c.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelEnd"),a):t(d)}function a(d){return d===40?e.attempt(Dn,r,i?r:f)(d):d===91?e.attempt(Bn,r,i?e.attempt(_n,r,f):f)(d):i?r(d):f(d)}function f(d){return c._balanced=!0,t(d)}}function Mn(e,r,t){return n;function n(a){return e.enter("resource"),e.enter("resourceMarker"),e.consume(a),e.exit("resourceMarker"),xe(e,u)}function u(a){return a===41?o(a):ct(e,c,t,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(a)}function c(a){return G(a)?xe(e,i)(a):o(a)}function i(a){return a===34||a===39||a===40?st(e,xe(e,o),t,"resourceTitle","resourceTitleMarker","resourceTitleString")(a):o(a)}function o(a){return a===41?(e.enter("resourceMarker"),e.consume(a),e.exit("resourceMarker"),e.exit("resource"),r):t(a)}}function jn(e,r,t){const n=this;return u;function u(i){return ot.call(n,e,c,t,"reference","referenceMarker","referenceString")(i)}function c(i){return n.parser.defined.includes(pe(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?r(i):t(i)}}function Hn(e,r,t){return n;function n(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),u}function u(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),r):t(c)}}const Rn={name:"labelStartImage",tokenize:qn,resolveAll:Be.resolveAll};function qn(e,r,t){const n=this;return u;function u(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),c}function c(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),i):t(o)}function i(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?t(o):r(o)}}const Vn={name:"labelStartLink",tokenize:Qn,resolveAll:Be.resolveAll};function Qn(e,r,t){const n=this;return u;function u(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),c}function c(i){return i===94&&"_hiddenFootnoteSupport"in n.parser.constructs?t(i):r(i)}}const Ee={name:"lineEnding",tokenize:Un};function Un(e,r){return t;function t(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),C(e,r,"linePrefix")}}const ke={name:"thematicBreak",tokenize:Wn};function Wn(e,r,t){let n=0,u;return c;function c(a){return e.enter("thematicBreak"),u=a,i(a)}function i(a){return a===u?(e.enter("thematicBreakSequence"),o(a)):H(a)?C(e,i,"whitespace")(a):n<3||a!==null&&!w(a)?t(a):(e.exit("thematicBreak"),r(a))}function o(a){return a===u?(e.consume(a),n++,o):(e.exit("thematicBreakSequence"),i(a))}}const N={name:"list",tokenize:Gn,continuation:{tokenize:Jn},exit:Zn},Nn={tokenize:Yn,partial:!0},$n={tokenize:Xn,partial:!0};function Gn(e,r,t){const n=this,u=n.events[n.events.length-1];let c=u&&u[1].type==="linePrefix"?u[2].sliceSerialize(u[1],!0).length:0,i=0;return o;function o(h){const x=n.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!n.containerState.marker||h===n.containerState.marker:we(h)){if(n.containerState.type||(n.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(ke,t,f)(h):f(h);if(!n.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(h)}return t(h)}function a(h){return we(h)&&++i<10?(e.consume(h),a):(!n.interrupt||i<2)&&(n.containerState.marker?h===n.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),f(h)):t(h)}function f(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||h,e.check(be,n.interrupt?t:d,e.attempt(Nn,g,m))}function d(h){return n.containerState.initialBlankLine=!0,c++,g(h)}function m(h){return H(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),g):t(h)}function g(h){return n.containerState.size=c+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(h)}}function Jn(e,r,t){const n=this;return n.containerState._closeFlow=void 0,e.check(be,u,c);function u(o){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,C(e,r,"listItemIndent",n.containerState.size+1)(o)}function c(o){return n.containerState.furtherBlankLines||!H(o)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,i(o)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt($n,r,i)(o))}function i(o){return n.containerState._closeFlow=!0,n.interrupt=void 0,C(e,e.attempt(N,r,t),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function Xn(e,r,t){const n=this;return C(e,u,"listItemIndent",n.containerState.size+1);function u(c){const i=n.events[n.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===n.containerState.size?r(c):t(c)}}function Zn(e){e.exit(this.containerState.type)}function Yn(e,r,t){const n=this;return C(e,u,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function u(c){const i=n.events[n.events.length-1];return!H(c)&&i&&i[1].type==="listItemPrefixWhitespace"?r(c):t(c)}}const Xe={name:"setextUnderline",tokenize:er,resolveTo:Kn};function Kn(e,r){let t=e.length,n,u,c;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){n=t;break}e[t][1].type==="paragraph"&&(u=t)}else e[t][1].type==="content"&&e.splice(t,1),!c&&e[t][1].type==="definition"&&(c=t);const i={type:"setextHeading",start:Object.assign({},e[u][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[u][1].type="setextHeadingText",c?(e.splice(u,0,["enter",i,r]),e.splice(c+1,0,["exit",e[n][1],r]),e[n][1].end=Object.assign({},e[c][1].end)):e[n][1]=i,e.push(["exit",i,r]),e}function er(e,r,t){const n=this;let u=n.events.length,c,i;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){i=n.events[u][1].type==="paragraph";break}return o;function o(d){return!n.parser.lazy[n.now().line]&&(n.interrupt||i)?(e.enter("setextHeadingLine"),e.enter("setextHeadingLineSequence"),c=d,a(d)):t(d)}function a(d){return d===c?(e.consume(d),a):(e.exit("setextHeadingLineSequence"),C(e,f,"lineSuffix")(d))}function f(d){return d===null||w(d)?(e.exit("setextHeadingLine"),r(d)):t(d)}}const tr={tokenize:nr};function nr(e){const r=this,t=e.attempt(be,n,e.attempt(this.parser.constructs.flowInitial,u,C(e,e.attempt(this.parser.constructs.flow,u,e.attempt(ln,u)),"linePrefix")));return t;function n(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),r.currentConstruct=void 0,t}function u(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),r.currentConstruct=void 0,t}}const rr={resolveAll:at()},ir=lt("string"),ur=lt("text");function lt(e){return{tokenize:r,resolveAll:at(e==="text"?cr:void 0)};function r(t){const n=this,u=this.parser.constructs[e],c=t.attempt(u,i,o);return i;function i(d){return f(d)?c(d):o(d)}function o(d){if(d===null){t.consume(d);return}return t.enter("data"),t.consume(d),a}function a(d){return f(d)?(t.exit("data"),c(d)):(t.consume(d),a)}function f(d){if(d===null)return!0;const m=u[d];let g=-1;if(m)for(;++g<m.length;){const h=m[g];if(!h.previous||h.previous.call(n,n.previous))return!0}return!1}}}function at(e){return r;function r(t,n){let u=-1,c;for(;++u<=t.length;)c===void 0?t[u]&&t[u][1].type==="data"&&(c=u,u++):(!t[u]||t[u][1].type!=="data")&&(u!==c+2&&(t[c][1].end=t[u-1][1].end,t.splice(c+2,u-c-2),u=c+2),c=void 0);return e?e(t,n):t}}function cr(e,r){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){const n=e[t-1][1],u=r.sliceStream(n);let c=u.length,i=-1,o=0,a;for(;c--;){const f=u[c];if(typeof f=="string"){for(i=f.length;f.charCodeAt(i-1)===32;)o++,i--;if(i)break;i=-1}else if(f===-2)a=!0,o++;else if(f!==-1){c++;break}}if(o){const f={type:t===e.length||a||o<2?"lineSuffix":"hardBreakTrailing",start:{line:n.end.line,column:n.end.column-o,offset:n.end.offset-o,_index:n.start._index+c,_bufferIndex:c?i:n.start._bufferIndex+i},end:Object.assign({},n.end)};n.end=Object.assign({},f.start),n.start.offset===n.end.offset?Object.assign(n,f):(e.splice(t,0,["enter",f,r],["exit",f,r]),t+=2)}t++}return e}function or(e,r,t){let n=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const u={},c=[];let i=[],o=[];const a={consume:O,enter:v,exit:D,attempt:L(B),check:L(k),interrupt:L(k,{interrupt:!0})},f={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:h,sliceSerialize:g,now:x,defineSkip:T,write:m};let d=r.tokenize.call(f,a);return r.resolveAll&&c.push(r),f;function m(F){return i=$(i,F),_(),i[i.length-1]!==null?[]:(M(r,0),f.events=De(c,f.events,f),f.events)}function g(F,S){return lr(h(F),S)}function h(F){return sr(i,F)}function x(){return Object.assign({},n)}function T(F){u[F.line]=F.column,V()}function _(){let F;for(;n._index<i.length;){const S=i[n._index];if(typeof S=="string")for(F=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===F&&n._bufferIndex<S.length;)b(S.charCodeAt(n._bufferIndex));else b(S)}}function b(F){d=d(F)}function O(F){w(F)?(n.line++,n.column=1,n.offset+=F===-3?2:1,V()):F!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===i[n._index].length&&(n._bufferIndex=-1,n._index++)),f.previous=F}function v(F,S){const A=S||{};return A.type=F,A.start=x(),f.events.push(["enter",A,f]),o.push(A),A}function D(F){const S=o.pop();return S.end=x(),f.events.push(["exit",S,f]),S}function B(F,S){M(F,S.from)}function k(F,S){S.restore()}function L(F,S){return A;function A(U,J,K){let X,Q,W,R;return Array.isArray(U)?s(U):"tokenize"in U?s([U]):l(U);function l(q){return Z;function Z(ue){const fe=ue!==null&&q[ue],de=ue!==null&&q.null,Fe=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(de)?de:de?[de]:[]];return s(Fe)(ue)}}function s(q){return X=q,Q=0,q.length===0?K:le(q[Q])}function le(q){return Z;function Z(ue){return R=j(),W=q,q.partial||(f.currentConstruct=q),q.name&&f.parser.constructs.disable.null.includes(q.name)?ae():q.tokenize.call(S?Object.assign(Object.create(f),S):f,a,he,ae)(ue)}}function he(q){return F(W,R),J}function ae(q){return R.restore(),++Q<X.length?le(X[Q]):K}}}function M(F,S){F.resolveAll&&!c.includes(F)&&c.push(F),F.resolve&&ne(f.events,S,f.events.length-S,F.resolve(f.events.slice(S),f)),F.resolveTo&&(f.events=F.resolveTo(f.events,f))}function j(){const F=x(),S=f.previous,A=f.currentConstruct,U=f.events.length,J=Array.from(o);return{restore:K,from:U};function K(){n=F,f.previous=S,f.currentConstruct=A,f.events.length=U,o=J,V()}}function V(){n.line in u&&n.column<2&&(n.column=u[n.line],n.offset+=u[n.line]-1)}}function sr(e,r){const t=r.start._index,n=r.start._bufferIndex,u=r.end._index,c=r.end._bufferIndex;let i;return t===u?i=[e[t].slice(n,c)]:(i=e.slice(t,u),n>-1&&(i[0]=i[0].slice(n)),c>0&&i.push(e[u].slice(0,c))),i}function lr(e,r){let t=-1;const n=[];let u;for(;++t<e.length;){const c=e[t];let i;if(typeof c=="string")i=c;else switch(c){case-5:{i="\r";break}case-4:{i="\n";break}case-3:{i="\r\n";break}case-2:{i=r?" ":" ";break}case-1:{if(!r&&u)continue;i=" ";break}default:i=String.fromCharCode(c)}u=c===-2,n.push(i)}return n.join("")}const ar={42:N,43:N,45:N,48:N,49:N,50:N,51:N,52:N,53:N,54:N,55:N,56:N,57:N,62:nt},fr={91:hn},dr={[-2]:Se,[-1]:Se,32:Se},pr={35:bn,42:ke,45:[Xe,ke],60:En,61:Xe,95:ke,96:Ge,126:Ge},hr={38:it,92:rt},mr={[-5]:Ee,[-4]:Ee,[-3]:Ee,33:Rn,38:it,42:Ie,60:[Wt,Tn],91:Vn,92:[kn,rt],93:Be,95:Ie,96:rn},gr={null:[Ie,rr]},xr={null:[42,95]},kr={null:[]},yr=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:xr,contentInitial:fr,disable:kr,document:ar,flow:pr,flowInitial:dr,insideSpan:gr,string:hr,text:mr},Symbol.toStringTag,{value:"Module"}));function br(e={}){const r=zt([yr].concat(e.extensions||[])),t={defined:[],lazy:{},constructs:r,content:n(jt),document:n(Rt),flow:n(tr),string:n(ir),text:n(ur)};return t;function n(u){return c;function c(i){return or(t,u,i)}}}const Ze=/[\0\t\n\r]/g;function Fr(){let e=1,r="",t=!0,n;return u;function u(c,i,o){const a=[];let f,d,m,g,h;for(c=r+c.toString(i),m=0,r="",t&&(c.charCodeAt(0)===65279&&m++,t=void 0);m<c.length;){if(Ze.lastIndex=m,f=Ze.exec(c),g=f&&f.index!==void 0?f.index:c.length,h=c.charCodeAt(g),!f){r=c.slice(m);break}if(h===10&&m===g&&n)a.push(-3),n=void 0;else switch(n&&(a.push(-5),n=void 0),m<g&&(a.push(c.slice(m,g)),e+=g-m),h){case 0:{a.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,a.push(-2);e++<d;)a.push(-1);break}case 10:{a.push(-4),e=1;break}default:n=!0,e=1}m=g+1}return o&&(n&&a.push(-5),r&&a.push(r),a.push(null)),a}}function vr(e){for(;!ut(e););return e}function ft(e,r){const t=Number.parseInt(e,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?"�":String.fromCharCode(t)}const Sr=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Er(e){return e.replace(Sr,wr)}function wr(e,r,t){if(r)return r;if(t.charCodeAt(0)===35){const n=t.charCodeAt(1),u=n===120||n===88;return ft(t.slice(u?2:1),u?16:10)}return ze(t)||e}function ye(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ye(e.position):"start"in e||"end"in e?Ye(e):"line"in e||"column"in e?Ce(e):""}function Ce(e){return Ke(e&&e.line)+":"+Ke(e&&e.column)}function Ye(e){return Ce(e&&e.start)+"-"+Ce(e&&e.end)}function Ke(e){return e&&typeof e=="number"?e:1}const dt={}.hasOwnProperty,pt=function(e,r,t){return typeof r!="string"&&(t=r,r=void 0),Ar(t)(vr(br(t).document().write(Fr()(e,r,!0))))};function Ar(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(He),autolinkProtocol:F,autolinkEmail:F,atxHeading:o(Pe),blockQuote:o(Fe),characterEscape:F,characterReference:F,codeFenced:o(Oe),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(Oe,a),codeText:o(gt,a),codeTextData:F,data:F,codeFlowValue:F,definition:o(xt),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(kt),hardBreakEscape:o(Me),hardBreakTrailing:o(Me),htmlFlow:o(je,a),htmlFlowData:F,htmlText:o(je,a),htmlTextData:F,image:o(yt),label:a,link:o(He),listItem:o(bt),listItemValue:x,listOrdered:o(Re,h),listUnordered:o(Re),paragraph:o(Ft),reference:ae,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Pe),strong:o(vt),thematicBreak:o(Et)},exit:{atxHeading:d(),atxHeadingSequence:L,autolink:d(),autolinkEmail:de,autolinkProtocol:fe,blockQuote:d(),characterEscapeValue:S,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:ue,codeFenced:d(O),codeFencedFence:b,codeFencedFenceInfo:T,codeFencedFenceMeta:_,codeFlowValue:S,codeIndented:d(v),codeText:d(X),codeTextData:S,data:S,definition:d(),definitionDestinationString:k,definitionLabelString:D,definitionTitleString:B,emphasis:d(),hardBreakEscape:d(U),hardBreakTrailing:d(U),htmlFlow:d(J),htmlFlowData:S,htmlText:d(K),htmlTextData:S,image:d(W),label:l,labelText:R,lineEnding:A,link:d(Q),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:q,resourceDestinationString:s,resourceTitleString:le,resource:he,setextHeading:d(V),setextHeadingLineSequence:j,setextHeadingText:M,strong:d(),thematicBreak:d()}};ht(r,(e||{}).mdastExtensions||[]);const t={};return n;function n(p){let y={type:"root",children:[]};const E={stack:[y],tokenStack:[],config:r,enter:f,exit:m,buffer:a,resume:g,setData:c,getData:i},I=[];let z=-1;for(;++z<p.length;)if(p[z][1].type==="listOrdered"||p[z][1].type==="listUnordered")if(p[z][0]==="enter")I.push(z);else{const ee=I.pop();z=u(p,ee,z)}for(z=-1;++z<p.length;){const ee=r[p[z][0]];dt.call(ee,p[z][1].type)&&ee[p[z][1].type].call(Object.assign({sliceSerialize:p[z][2].sliceSerialize},E),p[z][1])}if(E.tokenStack.length>0){const ee=E.tokenStack[E.tokenStack.length-1];(ee[1]||et).call(E,void 0,ee[0])}for(y.position={start:ce(p.length>0?p[0][1].start:{line:1,column:1,offset:0}),end:ce(p.length>0?p[p.length-2][1].end:{line:1,column:1,offset:0})},z=-1;++z<r.transforms.length;)y=r.transforms[z](y)||y;return y}function u(p,y,E){let I=y-1,z=-1,ee=!1,se,re,me,ge;for(;++I<=E;){const P=p[I];if(P[1].type==="listUnordered"||P[1].type==="listOrdered"||P[1].type==="blockQuote"?(P[0]==="enter"?z++:z--,ge=void 0):P[1].type==="lineEndingBlank"?P[0]==="enter"&&(se&&!ge&&!z&&!me&&(me=I),ge=void 0):P[1].type==="linePrefix"||P[1].type==="listItemValue"||P[1].type==="listItemMarker"||P[1].type==="listItemPrefix"||P[1].type==="listItemPrefixWhitespace"||(ge=void 0),!z&&P[0]==="enter"&&P[1].type==="listItemPrefix"||z===-1&&P[0]==="exit"&&(P[1].type==="listUnordered"||P[1].type==="listOrdered")){if(se){let ve=I;for(re=void 0;ve--;){const ie=p[ve];if(ie[1].type==="lineEnding"||ie[1].type==="lineEndingBlank"){if(ie[0]==="exit")continue;re&&(p[re][1].type="lineEndingBlank",ee=!0),ie[1].type="lineEnding",re=ve}else if(!(ie[1].type==="linePrefix"||ie[1].type==="blockQuotePrefix"||ie[1].type==="blockQuotePrefixWhitespace"||ie[1].type==="blockQuoteMarker"||ie[1].type==="listItemIndent"))break}me&&(!re||me<re)&&(se._spread=!0),se.end=Object.assign({},re?p[re][1].start:P[1].end),p.splice(re||I,0,["exit",se,P[2]]),I++,E++}P[1].type==="listItemPrefix"&&(se={type:"listItem",_spread:!1,start:Object.assign({},P[1].start)},p.splice(I,0,["enter",se,P[2]]),I++,E++,me=void 0,ge=!0)}}return p[y][1]._spread=ee,E}function c(p,y){t[p]=y}function i(p){return t[p]}function o(p,y){return E;function E(I){f.call(this,p(I),I),y&&y.call(this,I)}}function a(){this.stack.push({type:"fragment",children:[]})}function f(p,y,E){return this.stack[this.stack.length-1].children.push(p),this.stack.push(p),this.tokenStack.push([y,E]),p.position={start:ce(y.start)},p}function d(p){return y;function y(E){p&&p.call(this,E),m.call(this,E)}}function m(p,y){const E=this.stack.pop(),I=this.tokenStack.pop();if(I)I[0].type!==p.type&&(y?y.call(this,p,I[0]):(I[1]||et).call(this,p,I[0]));else throw new Error("Cannot close `"+p.type+"` ("+ye({start:p.start,end:p.end})+"): it’s not open");return E.position.end=ce(p.end),E}function g(){return Ct(this.stack.pop())}function h(){c("expectingFirstListItemValue",!0)}function x(p){if(i("expectingFirstListItemValue")){const y=this.stack[this.stack.length-2];y.start=Number.parseInt(this.sliceSerialize(p),10),c("expectingFirstListItemValue")}}function T(){const p=this.resume(),y=this.stack[this.stack.length-1];y.lang=p}function _(){const p=this.resume(),y=this.stack[this.stack.length-1];y.meta=p}function b(){i("flowCodeInside")||(this.buffer(),c("flowCodeInside",!0))}function O(){const p=this.resume(),y=this.stack[this.stack.length-1];y.value=p.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),c("flowCodeInside")}function v(){const p=this.resume(),y=this.stack[this.stack.length-1];y.value=p.replace(/(\r?\n|\r)$/g,"")}function D(p){const y=this.resume(),E=this.stack[this.stack.length-1];E.label=y,E.identifier=pe(this.sliceSerialize(p)).toLowerCase()}function B(){const p=this.resume(),y=this.stack[this.stack.length-1];y.title=p}function k(){const p=this.resume(),y=this.stack[this.stack.length-1];y.url=p}function L(p){const y=this.stack[this.stack.length-1];if(!y.depth){const E=this.sliceSerialize(p).length;y.depth=E}}function M(){c("setextHeadingSlurpLineEnding",!0)}function j(p){const y=this.stack[this.stack.length-1];y.depth=this.sliceSerialize(p).charCodeAt(0)===61?1:2}function V(){c("setextHeadingSlurpLineEnding")}function F(p){const y=this.stack[this.stack.length-1];let E=y.children[y.children.length-1];(!E||E.type!=="text")&&(E=St(),E.position={start:ce(p.start)},y.children.push(E)),this.stack.push(E)}function S(p){const y=this.stack.pop();y.value+=this.sliceSerialize(p),y.position.end=ce(p.end)}function A(p){const y=this.stack[this.stack.length-1];if(i("atHardBreak")){const E=y.children[y.children.length-1];E.position.end=ce(p.end),c("atHardBreak");return}!i("setextHeadingSlurpLineEnding")&&r.canContainEols.includes(y.type)&&(F.call(this,p),S.call(this,p))}function U(){c("atHardBreak",!0)}function J(){const p=this.resume(),y=this.stack[this.stack.length-1];y.value=p}function K(){const p=this.resume(),y=this.stack[this.stack.length-1];y.value=p}function X(){const p=this.resume(),y=this.stack[this.stack.length-1];y.value=p}function Q(){const p=this.stack[this.stack.length-1];if(i("inReference")){const y=i("referenceType")||"shortcut";p.type+="Reference",p.referenceType=y,delete p.url,delete p.title}else delete p.identifier,delete p.label;c("referenceType")}function W(){const p=this.stack[this.stack.length-1];if(i("inReference")){const y=i("referenceType")||"shortcut";p.type+="Reference",p.referenceType=y,delete p.url,delete p.title}else delete p.identifier,delete p.label;c("referenceType")}function R(p){const y=this.sliceSerialize(p),E=this.stack[this.stack.length-2];E.label=Er(y),E.identifier=pe(y).toLowerCase()}function l(){const p=this.stack[this.stack.length-1],y=this.resume(),E=this.stack[this.stack.length-1];if(c("inReference",!0),E.type==="link"){const I=p.children;E.children=I}else E.alt=y}function s(){const p=this.resume(),y=this.stack[this.stack.length-1];y.url=p}function le(){const p=this.resume(),y=this.stack[this.stack.length-1];y.title=p}function he(){c("inReference")}function ae(){c("referenceType","collapsed")}function q(p){const y=this.resume(),E=this.stack[this.stack.length-1];E.label=y,E.identifier=pe(this.sliceSerialize(p)).toLowerCase(),c("referenceType","full")}function Z(p){c("characterReferenceType",p.type)}function ue(p){const y=this.sliceSerialize(p),E=i("characterReferenceType");let I;E?(I=ft(y,E==="characterReferenceMarkerNumeric"?10:16),c("characterReferenceType")):I=ze(y);const z=this.stack.pop();z.value+=I,z.position.end=ce(p.end)}function fe(p){S.call(this,p);const y=this.stack[this.stack.length-1];y.url=this.sliceSerialize(p)}function de(p){S.call(this,p);const y=this.stack[this.stack.length-1];y.url="mailto:"+this.sliceSerialize(p)}function Fe(){return{type:"blockquote",children:[]}}function Oe(){return{type:"code",lang:null,meta:null,value:""}}function gt(){return{type:"inlineCode",value:""}}function xt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function kt(){return{type:"emphasis",children:[]}}function Pe(){return{type:"heading",depth:void 0,children:[]}}function Me(){return{type:"break"}}function je(){return{type:"html",value:""}}function yt(){return{type:"image",title:null,url:"",alt:null}}function He(){return{type:"link",title:null,url:"",children:[]}}function Re(p){return{type:"list",ordered:p.type==="listOrdered",start:null,spread:p._spread,children:[]}}function bt(p){return{type:"listItem",spread:p._spread,checked:null,children:[]}}function Ft(){return{type:"paragraph",children:[]}}function vt(){return{type:"strong",children:[]}}function St(){return{type:"text",value:""}}function Et(){return{type:"thematicBreak"}}}function ce(e){return{line:e.line,column:e.column,offset:e.offset}}function ht(e,r){let t=-1;for(;++t<r.length;){const n=r[t];Array.isArray(n)?ht(e,n):Ir(e,n)}}function Ir(e,r){let t;for(t in r)if(dt.call(r,t)){if(t==="canContainEols"){const n=r[t];n&&e[t].push(...n)}else if(t==="transforms"){const n=r[t];n&&e[t].push(...n)}else if(t==="enter"||t==="exit"){const n=r[t];n&&Object.assign(e[t],n)}}}function et(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+ye({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+ye({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+ye({start:r.start,end:r.end})+") is still open")}function Cr(e){const r=e.replace(/\n{2,}/g,"\n");return It(r)}function Tr(e){const r=Cr(e),{children:t}=pt(r),n=[[]];let u=0;function c(i,o="normal"){i.type==="text"?i.value.split("\n").forEach((a,f)=>{f!==0&&(u++,n.push([])),a.split(" ").forEach(d=>{d&&n[u].push({content:d,type:o})})}):(i.type==="strong"||i.type==="emphasis")&&i.children.forEach(a=>{c(a,i.type)})}return t.forEach(i=>{i.type==="paragraph"&&i.children.forEach(o=>{c(o)})}),n}function zr(e){const{children:r}=pt(e);function t(n){return n.type==="text"?n.value.replace(/\n/g,"<br/>"):n.type==="strong"?"<strong>".concat(n.children.map(t).join(""),"</strong>"):n.type==="emphasis"?"<em>".concat(n.children.map(t).join(""),"</em>"):n.type==="paragraph"?"<p>".concat(n.children.map(t).join(""),"</p>"):"Unsupported markdown: ".concat(n.type)}return r.map(t).join("")}function Dr(e){return Intl.Segmenter?[...new Intl.Segmenter().segment(e)].map(r=>r.segment):[...e]}function Br(e,r){const t=Dr(r.content);return mt(e,[],t,r.type)}function mt(e,r,t,n){if(t.length===0)return[{content:r.join(""),type:n},{content:"",type:n}];const[u,...c]=t,i=[...r,u];return e([{content:i.join(""),type:n}])?mt(e,i,c,n):(r.length===0&&u&&(r.push(u),t.shift()),[{content:r.join(""),type:n},{content:t.join(""),type:n}])}function _r(e,r){if(e.some(({content:t})=>t.includes("\n")))throw new Error("splitLineToFitWidth does not support newlines in the line");return Te(e,r)}function Te(e,r,t=[],n=[]){var o;if(e.length===0)return n.length>0&&t.push(n),t.length>0?t:[];let u="";e[0].content===" "&&(u=" ",e.shift());const c=(o=e.shift())!=null?o:{content:" ",type:"normal"},i=[...n];if(u!==""&&i.push({content:u,type:"normal"}),i.push(c),r(i))return Te(e,r,t,i);if(n.length>0)t.push(n),e.unshift(c);else if(c.content){const[a,f]=Br(r,c);t.push([a]),f.content&&e.unshift(f)}return Te(e,r,t)}function Lr(e,r){r&&e.attr("style",r)}function Or(e,r,t,n,u=!1){const c=e.append("foreignObject"),i=c.append("xhtml:div"),o=r.label,a=r.isNode?"nodeLabel":"edgeLabel";i.html('\n <span class="'.concat(a," ").concat(n,'" ')+(r.labelStyle?'style="'+r.labelStyle+'"':"")+">"+o+"</span>"),Lr(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 f=i.node().getBoundingClientRect();return f.width===t&&(i.style("display","table"),i.style("white-space","break-spaces"),i.style("width",t+"px"),f=i.node().getBoundingClientRect()),c.style("width",f.width),c.style("height",f.height),c.node()}function _e(e,r,t){return e.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",r*t-.1+"em").attr("dy",t+"em")}function Pr(e,r,t){const n=e.append("text"),u=_e(n,1,r);Le(u,t);const c=u.node().getComputedTextLength();return n.remove(),c}function Hr(e,r,t){var n;const u=e.append("text"),c=_e(u,1,r);Le(c,[{content:t,type:"normal"}]);const i=(n=c.node())==null?void 0:n.getBoundingClientRect();return i&&u.remove(),i}function Mr(e,r,t,n=!1){const u=r.append("g"),c=u.insert("rect").attr("class","background"),i=u.append("text").attr("y","-10.1");let o=0;for(const a of t){const f=m=>Pr(u,1.1,m)<=e,d=f(a)?[a]:_r(a,f);for(const m of d){const g=_e(i,o,1.1);Le(g,m),o++}}if(n){const a=i.node().getBBox(),f=2;return c.attr("x",-f).attr("y",-f).attr("width",a.width+2*f).attr("height",a.height+2*f),u.node()}else return i.node()}function Le(e,r){e.text(""),r.forEach((t,n)=>{const u=e.append("tspan").attr("font-style",t.type==="emphasis"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",t.type==="strong"?"bold":"normal");n===0?u.text(t.content):u.text(" "+t.content)})}const Rr=(e,r="",{style:t="",isTitle:n=!1,classes:u="",useHtmlLabels:c=!0,isNode:i=!0,width:o=200,addSvgBackground:a=!1}={})=>{if(wt.info("createText",r,t,n,u,c,i,a),c){const f=zr(r),d={isNode:i,label:At(f).replace(/fa[blrs]?:fa-[\w-]+/g,m=>"<i class='".concat(m.replace(":"," "),"'></i>")),labelStyle:t.replace("fill:","color:")};return Or(e,d,o,u,a)}else{const f=Tr(r);return Mr(o,e,f,a)}};export{Hr as a,Rr as c};