import{O as Et,aX as Ct,bd as At}from"./state.a4b22a68.js";const zt={};function It(n,r){const t=r||zt,e=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,u=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return tt(n,e,u)}function tt(n,r,t){if(Tt(n)){if("value"in n)return n.type==="html"&&!t?"":n.value;if(r&&"alt"in n&&n.alt)return n.alt;if("children"in n)return qn(n.children,r,t)}return Array.isArray(n)?qn(n,r,t):""}function qn(n,r,t){const e=[];let u=-1;for(;++uu?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]);l0?(en(n,n.length,0,r),n):r}const Hn={}.hasOwnProperty;function Bt(n){const r={};let t=-1;for(;++ti))return;const P=r.events.length;let R=P,j,N;for(;R--;)if(r.events[R][0]==="exit"&&r.events[R][1].type==="chunkFlow"){if(j){N=r.events[R][1].end;break}j=!0}for(y(e),d=P;dF;){const O=t[L];r.containerState=O[1],O[0].exit.call(r,n)}t.length=F}function _(){u.write([null]),l=void 0,u=void 0,r.containerState._closeFlow=void 0}}function Nt(n,r,t){return T(n,n.attempt(this.parser.constructs.document,r,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qn(n){if(n===null||Y(n)||Mt(n))return 1;if(Rt(n))return 2}function Bn(n,r,t){const e=[];let u=-1;for(;++u1&&n[t][1].end.offset-n[t][1].start.offset>1?2:1;const x=Object.assign({},n[e][1].end),g=Object.assign({},n[t][1].start);Un(x,-c),Un(g,c),i={type:c>1?"strongSequence":"emphasisSequence",start:x,end:Object.assign({},n[e][1].end)},a={type:c>1?"strongSequence":"emphasisSequence",start:Object.assign({},n[t][1].start),end:g},l={type:c>1?"strongText":"emphasisText",start:Object.assign({},n[e][1].end),end:Object.assign({},n[t][1].start)},u={type:c>1?"strong":"emphasis",start:Object.assign({},i.start),end:Object.assign({},a.end)},n[e][1].end=Object.assign({},i.start),n[t][1].start=Object.assign({},a.end),p=[],n[e][1].end.offset-n[e][1].start.offset&&(p=Z(p,[["enter",n[e][1],r],["exit",n[e][1],r]])),p=Z(p,[["enter",u,r],["enter",i,r],["exit",i,r],["enter",l,r]]),p=Z(p,Bn(r.parser.constructs.insideSpan.null,n.slice(e+1,t),r)),p=Z(p,[["exit",l,r],["enter",a,r],["exit",a,r],["exit",u,r]]),n[t][1].end.offset-n[t][1].start.offset?(h=2,p=Z(p,[["enter",n[t][1],r],["exit",n[t][1],r]])):h=0,en(n,e-1,t-e+3,p),t=e+p.length-h-2;break}}for(t=-1;++t=4?i(p):t(p)}function i(p){return p===null?c(p):C(p)?n.attempt(ne,i,c)(p):(n.enter("codeFlowValue"),a(p))}function a(p){return p===null||C(p)?(n.exit("codeFlowValue"),i(p)):(n.consume(p),a)}function c(p){return n.exit("codeIndented"),r(p)}}function ee(n,r,t){const e=this;return u;function u(i){return e.parser.lazy[e.now().line]?t(i):C(i)?(n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),u):T(n,l,"linePrefix",4+1)(i)}function l(i){const a=e.events[e.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?r(i):C(i)?u(i):t(i)}}const re={name:"codeText",tokenize:le,resolve:ie,previous:ue};function ie(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=4?r(i):n.interrupt(e.parser.constructs.flow,t,r)(i)}}function lt(n,r,t,e,u,l,i,a,c){const p=c||Number.POSITIVE_INFINITY;let h=0;return x;function x(y){return y===60?(n.enter(e),n.enter(u),n.enter(l),n.consume(y),n.exit(l),g):y===null||y===41||zn(y)?t(y):(n.enter(e),n.enter(i),n.enter(a),n.enter("chunkString",{contentType:"string"}),B(y))}function g(y){return y===62?(n.enter(l),n.consume(y),n.exit(l),n.exit(u),n.exit(e),r):(n.enter(a),n.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(n.exit("chunkString"),n.exit(a),g(y)):y===null||y===60||C(y)?t(y):(n.consume(y),y===92?k:f)}function k(y){return y===60||y===62||y===92?(n.consume(y),f):f(y)}function B(y){return y===40?++h>p?t(y):(n.consume(y),B):y===41?h--?(n.consume(y),B):(n.exit("chunkString"),n.exit(a),n.exit(i),n.exit(e),r(y)):y===null||Y(y)?h?t(y):(n.exit("chunkString"),n.exit(a),n.exit(i),n.exit(e),r(y)):zn(y)?t(y):(n.consume(y),y===92?D:B)}function D(y){return y===40||y===41||y===92?(n.consume(y),B):B(y)}}function at(n,r,t,e,u,l){const i=this;let a=0,c;return p;function p(f){return n.enter(e),n.enter(u),n.consume(f),n.exit(u),n.enter(l),h}function h(f){return f===null||f===91||f===93&&!c||f===94&&!a&&"_hiddenFootnoteSupport"in i.parser.constructs||a>999?t(f):f===93?(n.exit(l),n.enter(u),n.consume(f),n.exit(u),n.exit(e),r):C(f)?(n.enter("lineEnding"),n.consume(f),n.exit("lineEnding"),h):(n.enter("chunkString",{contentType:"string"}),x(f))}function x(f){return f===null||f===91||f===93||C(f)||a++>999?(n.exit("chunkString"),h(f)):(n.consume(f),c=c||!q(f),f===92?g:x)}function g(f){return f===91||f===92||f===93?(n.consume(f),a++,x):x(f)}}function ot(n,r,t,e,u,l){let i;return a;function a(g){return n.enter(e),n.enter(u),n.consume(g),n.exit(u),i=g===40?41:g,c}function c(g){return g===i?(n.enter(u),n.consume(g),n.exit(u),n.exit(e),r):(n.enter(l),p(g))}function p(g){return g===i?(n.exit(l),c(i)):g===null?t(g):C(g)?(n.enter("lineEnding"),n.consume(g),n.exit("lineEnding"),T(n,p,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===i||g===null||C(g)?(n.exit("chunkString"),p(g)):(n.consume(g),g===92?x:h)}function x(g){return g===i||g===92?(n.consume(g),h):h(g)}}function dn(n,r){let t;return e;function e(u){return C(u)?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),t=!0,e):q(u)?T(n,e,t?"linePrefix":"lineSuffix")(u):r(u)}}function fn(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const me={name:"definition",tokenize:xe},fe={tokenize:ge,partial:!0};function xe(n,r,t){const e=this;let u;return l;function l(c){return n.enter("definition"),at.call(e,n,i,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(c)}function i(c){return u=fn(e.sliceSerialize(e.events[e.events.length-1][1]).slice(1,-1)),c===58?(n.enter("definitionMarker"),n.consume(c),n.exit("definitionMarker"),dn(n,lt(n,n.attempt(fe,T(n,a,"whitespace"),T(n,a,"whitespace")),t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString"))):t(c)}function a(c){return c===null||C(c)?(n.exit("definition"),e.parser.defined.includes(u)||e.parser.defined.push(u),r(c)):t(c)}}function ge(n,r,t){return e;function e(i){return Y(i)?dn(n,u)(i):t(i)}function u(i){return i===34||i===39||i===40?ot(n,T(n,l,"whitespace"),t,"definitionTitle","definitionTitleMarker","definitionTitleString")(i):t(i)}function l(i){return i===null||C(i)?r(i):t(i)}}const ke={name:"hardBreakEscape",tokenize:de};function de(n,r,t){return e;function e(l){return n.enter("hardBreakEscape"),n.enter("escapeMarker"),n.consume(l),u}function u(l){return C(l)?(n.exit("escapeMarker"),n.exit("hardBreakEscape"),r(l)):t(l)}}const be={name:"headingAtx",tokenize:Se,resolve:ye};function ye(n,r){let t=n.length-2,e=3,u,l;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},l={type:"chunkText",start:n[e][1].start,end:n[t][1].end,contentType:"text"},en(n,e,t-e+1,[["enter",u,r],["enter",l,r],["exit",l,r],["exit",u,r]])),n}function Se(n,r,t){const e=this;let u=0;return l;function l(h){return n.enter("atxHeading"),n.enter("atxHeadingSequence"),i(h)}function i(h){return h===35&&u++<6?(n.consume(h),i):h===null||Y(h)?(n.exit("atxHeadingSequence"),e.interrupt?r(h):a(h)):t(h)}function a(h){return h===35?(n.enter("atxHeadingSequence"),c(h)):h===null||C(h)?(n.exit("atxHeading"),r(h)):q(h)?T(n,a,"whitespace")(h):(n.enter("atxHeadingText"),p(h))}function c(h){return h===35?(n.consume(h),c):(n.exit("atxHeadingSequence"),a(h))}function p(h){return h===null||h===35||Y(h)?(n.exit("atxHeadingText"),a(h)):(n.consume(h),p)}}const Fe=["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"],Zn=["pre","script","style","textarea"],we={name:"htmlFlow",tokenize:Ae,resolveTo:Ce,concrete:!0},Ee={tokenize:ze,partial:!0};function Ce(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 Ae(n,r,t){const e=this;let u,l,i,a,c;return p;function p(o){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(o),h}function h(o){return o===33?(n.consume(o),x):o===47?(n.consume(o),k):o===63?(n.consume(o),u=3,e.interrupt?r:W):tn(o)?(n.consume(o),i=String.fromCharCode(o),l=!0,B):t(o)}function x(o){return o===45?(n.consume(o),u=2,g):o===91?(n.consume(o),u=5,i="CDATA[",a=0,f):tn(o)?(n.consume(o),u=4,e.interrupt?r:W):t(o)}function g(o){return o===45?(n.consume(o),e.interrupt?r:W):t(o)}function f(o){return o===i.charCodeAt(a++)?(n.consume(o),a===i.length?e.interrupt?r:S:f):t(o)}function k(o){return tn(o)?(n.consume(o),i=String.fromCharCode(o),B):t(o)}function B(o){return o===null||o===47||o===62||Y(o)?o!==47&&l&&Zn.includes(i.toLowerCase())?(u=1,e.interrupt?r(o):S(o)):Fe.includes(i.toLowerCase())?(u=6,o===47?(n.consume(o),D):e.interrupt?r(o):S(o)):(u=7,e.interrupt&&!e.parser.lazy[e.now().line]?t(o):l?_(o):y(o)):o===45||v(o)?(n.consume(o),i+=String.fromCharCode(o),B):t(o)}function D(o){return o===62?(n.consume(o),e.interrupt?r:S):t(o)}function y(o){return q(o)?(n.consume(o),y):j(o)}function _(o){return o===47?(n.consume(o),j):o===58||o===95||tn(o)?(n.consume(o),F):q(o)?(n.consume(o),_):j(o)}function F(o){return o===45||o===46||o===58||o===95||v(o)?(n.consume(o),F):L(o)}function L(o){return o===61?(n.consume(o),O):q(o)?(n.consume(o),L):_(o)}function O(o){return o===null||o===60||o===61||o===62||o===96?t(o):o===34||o===39?(n.consume(o),c=o,d):q(o)?(n.consume(o),O):(c=null,P(o))}function d(o){return o===null||C(o)?t(o):o===c?(n.consume(o),R):(n.consume(o),d)}function P(o){return o===null||o===34||o===39||o===60||o===61||o===62||o===96||Y(o)?L(o):(n.consume(o),P)}function R(o){return o===47||o===62||q(o)?_(o):t(o)}function j(o){return o===62?(n.consume(o),N):t(o)}function N(o){return q(o)?(n.consume(o),N):o===null||C(o)?S(o):t(o)}function S(o){return o===45&&u===2?(n.consume(o),G):o===60&&u===1?(n.consume(o),nn):o===62&&u===4?(n.consume(o),H):o===63&&u===3?(n.consume(o),W):o===93&&u===5?(n.consume(o),Q):C(o)&&(u===6||u===7)?n.check(Ee,H,w)(o):o===null||C(o)?w(o):(n.consume(o),S)}function w(o){return n.exit("htmlFlowData"),A(o)}function A(o){return o===null?s(o):C(o)?n.attempt({tokenize:U,partial:!0},A,s)(o):(n.enter("htmlFlowData"),S(o))}function U(o,cn,xn){return hn;function hn(J){return o.enter("lineEnding"),o.consume(J),o.exit("lineEnding"),V}function V(J){return e.parser.lazy[e.now().line]?xn(J):cn(J)}}function G(o){return o===45?(n.consume(o),W):S(o)}function nn(o){return o===47?(n.consume(o),i="",X):S(o)}function X(o){return o===62&&Zn.includes(i.toLowerCase())?(n.consume(o),H):tn(o)&&i.length<8?(n.consume(o),i+=String.fromCharCode(o),X):S(o)}function Q(o){return o===93?(n.consume(o),W):S(o)}function W(o){return o===62?(n.consume(o),H):o===45&&u===2?(n.consume(o),W):S(o)}function H(o){return o===null||C(o)?(n.exit("htmlFlowData"),s(o)):(n.consume(o),H)}function s(o){return n.exit("htmlFlow"),r(o)}}function ze(n,r,t){return e;function e(u){return n.exit("htmlFlowData"),n.enter("lineEndingBlank"),n.consume(u),n.exit("lineEndingBlank"),n.attempt(Sn,r,t)}}const Ie={name:"htmlText",tokenize:Te};function Te(n,r,t){const e=this;let u,l,i,a;return c;function c(s){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(s),p}function p(s){return s===33?(n.consume(s),h):s===47?(n.consume(s),P):s===63?(n.consume(s),O):tn(s)?(n.consume(s),N):t(s)}function h(s){return s===45?(n.consume(s),x):s===91?(n.consume(s),l="CDATA[",i=0,D):tn(s)?(n.consume(s),L):t(s)}function x(s){return s===45?(n.consume(s),g):t(s)}function g(s){return s===null||s===62?t(s):s===45?(n.consume(s),f):k(s)}function f(s){return s===null||s===62?t(s):k(s)}function k(s){return s===null?t(s):s===45?(n.consume(s),B):C(s)?(a=k,Q(s)):(n.consume(s),k)}function B(s){return s===45?(n.consume(s),H):k(s)}function D(s){return s===l.charCodeAt(i++)?(n.consume(s),i===l.length?y:D):t(s)}function y(s){return s===null?t(s):s===93?(n.consume(s),_):C(s)?(a=y,Q(s)):(n.consume(s),y)}function _(s){return s===93?(n.consume(s),F):y(s)}function F(s){return s===62?H(s):s===93?(n.consume(s),F):y(s)}function L(s){return s===null||s===62?H(s):C(s)?(a=L,Q(s)):(n.consume(s),L)}function O(s){return s===null?t(s):s===63?(n.consume(s),d):C(s)?(a=O,Q(s)):(n.consume(s),O)}function d(s){return s===62?H(s):O(s)}function P(s){return tn(s)?(n.consume(s),R):t(s)}function R(s){return s===45||v(s)?(n.consume(s),R):j(s)}function j(s){return C(s)?(a=j,Q(s)):q(s)?(n.consume(s),j):H(s)}function N(s){return s===45||v(s)?(n.consume(s),N):s===47||s===62||Y(s)?S(s):t(s)}function S(s){return s===47?(n.consume(s),H):s===58||s===95||tn(s)?(n.consume(s),w):C(s)?(a=S,Q(s)):q(s)?(n.consume(s),S):H(s)}function w(s){return s===45||s===46||s===58||s===95||v(s)?(n.consume(s),w):A(s)}function A(s){return s===61?(n.consume(s),U):C(s)?(a=A,Q(s)):q(s)?(n.consume(s),A):S(s)}function U(s){return s===null||s===60||s===61||s===62||s===96?t(s):s===34||s===39?(n.consume(s),u=s,G):C(s)?(a=U,Q(s)):q(s)?(n.consume(s),U):(n.consume(s),u=void 0,X)}function G(s){return s===u?(n.consume(s),nn):s===null?t(s):C(s)?(a=G,Q(s)):(n.consume(s),G)}function nn(s){return s===62||s===47||Y(s)?S(s):t(s)}function X(s){return s===null||s===34||s===39||s===60||s===61||s===96?t(s):s===62||Y(s)?S(s):(n.consume(s),X)}function Q(s){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(s),n.exit("lineEnding"),T(n,W,"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function W(s){return n.enter("htmlTextData"),a(s)}function H(s){return s===62?(n.consume(s),n.exit("htmlTextData"),n.exit("htmlText"),r):t(s)}}const On={name:"labelEnd",tokenize:_e,resolveTo:Pe,resolveAll:De},Be={tokenize:Me},Le={tokenize:Re},Oe={tokenize:je};function De(n){let r=-1,t;for(;++r-1&&(i[0]=i[0].slice(e)),l>0&&i.push(n[u].slice(0,l))),i}function or(n,r){let t=-1;const e=[];let u;for(;++t13&&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 Fr=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function wr(n){return n.replace(Fr,Er)}function Er(n,r,t){if(r)return r;if(t.charCodeAt(0)===35){const u=t.charCodeAt(1),l=u===120||u===88;return ht(t.slice(l?2:1),l?16:10)}return Ln(t)||n}function yn(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?Xn(n.position):"start"in n||"end"in n?Xn(n):"line"in n||"column"in n?Tn(n):""}function Tn(n){return Jn(n&&n.line)+":"+Jn(n&&n.column)}function Xn(n){return Tn(n&&n.start)+"-"+Tn(n&&n.end)}function Jn(n){return n&&typeof n=="number"?n:1}const pt={}.hasOwnProperty,mt=function(n,r,t){return typeof r!="string"&&(t=r,r=void 0),Cr(t)(Sr(br(t).document().write(yr()(n,r,!0))))};function Cr(n){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Rn),autolinkProtocol:S,autolinkEmail:S,atxHeading:a(Pn),blockQuote:a(Fn),characterEscape:S,characterReference:S,codeFenced:a(Dn),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:a(Dn,c),codeText:a(xt,c),codeTextData:S,data:S,codeFlowValue:S,definition:a(gt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:a(kt),hardBreakEscape:a(_n),hardBreakTrailing:a(_n),htmlFlow:a(Mn,c),htmlFlowData:S,htmlText:a(Mn,c),htmlTextData:S,image:a(dt),label:c,link:a(Rn),listItem:a(bt),listItemValue:k,listOrdered:a(jn,f),listUnordered:a(jn),paragraph:a(yt),reference:hn,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:a(Pn),strong:a(St),thematicBreak:a(wt)},exit:{atxHeading:h(),atxHeadingSequence:P,autolink:h(),autolinkEmail:mn,autolinkProtocol:pn,blockQuote:h(),characterEscapeValue:w,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:ln,codeFenced:h(_),codeFencedFence:y,codeFencedFenceInfo:B,codeFencedFenceMeta:D,codeFlowValue:w,codeIndented:h(F),codeText:h(X),codeTextData:w,data:w,definition:h(),definitionDestinationString:d,definitionLabelString:L,definitionTitleString:O,emphasis:h(),hardBreakEscape:h(U),hardBreakTrailing:h(U),htmlFlow:h(G),htmlFlowData:w,htmlText:h(nn),htmlTextData:w,image:h(W),label:s,labelText:H,lineEnding:A,link:h(Q),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:V,resourceDestinationString:o,resourceTitleString:cn,resource:xn,setextHeading:h(N),setextHeadingLineSequence:j,setextHeadingText:R,strong:h(),thematicBreak:h()}};ft(r,(n||{}).mdastExtensions||[]);const t={};return e;function e(m){let b={type:"root",children:[]};const E={stack:[b],tokenStack:[],config:r,enter:p,exit:x,buffer:c,resume:g,setData:l,getData:i},z=[];let I=-1;for(;++I0){const K=E.tokenStack[E.tokenStack.length-1];(K[1]||Kn).call(E,void 0,K[0])}for(b.position={start:on(m.length>0?m[0][1].start:{line:1,column:1,offset:0}),end:on(m.length>0?m[m.length-2][1].end:{line:1,column:1,offset:0})},I=-1;++I{h!==0&&(u++,e.push([])),p.split(" ").forEach(x=>{x&&e[u].push({content:x,type:a})})}):(i.type==="strong"||i.type==="emphasis")&&i.children.forEach(c=>{l(c,i.type)})}return t.forEach(i=>{i.type==="paragraph"&&i.children.forEach(a=>{l(a)})}),e}function Tr(n){const{children:r}=mt(n);function t(e){return e.type==="text"?e.value.replace(/\n/g,"
"):e.type==="strong"?`${e.children.map(t).join("")}`:e.type==="emphasis"?`${e.children.map(t).join("")}`:e.type==="paragraph"?`

${e.children.map(t).join("")}

`:`Unsupported markdown: ${e.type}`}return r.map(t).join("")}function Br(n,r){r&&n.attr("style",r)}function Lr(n,r,t,e,u=!1){const l=n.append("foreignObject"),i=l.append("xhtml:div"),a=r.label,c=r.isNode?"nodeLabel":"edgeLabel";i.html(` "+a+""),Br(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 p=i.node().getBoundingClientRect();return p.width===t&&(i.style("display","table"),i.style("white-space","break-spaces"),i.style("width",t+"px"),p=i.node().getBoundingClientRect()),l.style("width",p.width),l.style("height",p.height),l.node()}function vn(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 Or(n,r,t,e=!1){const l=r.append("g");let i=l.insert("rect").attr("class","background");const a=l.append("text").attr("y","-10.1");let c=-1;if(t.forEach(p=>{c++;let h=vn(a,c,1.1),x=[...p].reverse(),g,f=[];for(;x.length;)g=x.pop(),f.push(g),nt(h,f),h.node().getComputedTextLength()>n&&(f.pop(),x.push(g),nt(h,f),f=[],c++,h=vn(a,c,1.1))}),e){const p=a.node().getBBox(),h=2;return i.attr("x",-h).attr("y",-h).attr("width",p.width+2*h).attr("height",p.height+2*h),l.node()}else return a.node()}function nt(n,r){n.text(""),r.forEach((t,e)=>{const u=n.append("tspan").attr("font-style",t.type==="em"?"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)})}const Pr=(n,r="",{style:t="",isTitle:e=!1,classes:u="",useHtmlLabels:l=!0,isNode:i=!0,width:a,addSvgBackground:c=!1}={})=>{if(Et.info("createText",r,t,e,u,l,i,c),l){const p=Tr(r),h={isNode:i,label:Ct(p).replace(/fa[blrs]?:fa-[\w-]+/g,g=>``),labelStyle:t.replace("fill:","color:")};return Lr(n,h,a,u,c)}else{const p=Ir(r);return Or(a,n,p,c)}};export{Pr as c};