import{O as nt,aY as At,be as zt}from"./state.f87e7922.js";const It={};function Tt(n,r){const t=r||It,e=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return tt(n,e,i)}function tt(n,r,t){if(Bt(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 i=-1;for(;++ii?0:i+r:r=r>i?i:r,t=t>0?t:0,e.length<1e4)u=Array.from(e),u.unshift(r,t),[].splice.apply(n,u);else for(t&&[].splice.apply(n,[r,t]);l0?(en(n,n.length,0,r),n):r}const Hn={}.hasOwnProperty;function Lt(n){const r={};let t=-1;for(;++tu))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 D=t[O];r.containerState=D[1],D[0].exit.call(r,n)}t.length=F}function _(){i.write([null]),l=void 0,i=void 0,r.containerState._closeFlow=void 0}}function Qt(n,r,t){return B(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||Z(n)||Rt(n))return 1;if(jt(n))return 2}function Bn(n,r,t){const e=[];let i=-1;for(;++i1&&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),u={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)},i={type:c>1?"strong":"emphasis",start:Object.assign({},u.start),end:Object.assign({},a.end)},n[e][1].end=Object.assign({},u.start),n[t][1].start=Object.assign({},a.end),p=[],n[e][1].end.offset-n[e][1].start.offset&&(p=Y(p,[["enter",n[e][1],r],["exit",n[e][1],r]])),p=Y(p,[["enter",i,r],["enter",u,r],["exit",u,r],["enter",l,r]]),p=Y(p,Bn(r.parser.constructs.insideSpan.null,n.slice(e+1,t),r)),p=Y(p,[["exit",l,r],["enter",a,r],["exit",a,r],["exit",i,r]]),n[t][1].end.offset-n[t][1].start.offset?(h=2,p=Y(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?u(p):t(p)}function u(p){return p===null?c(p):C(p)?n.attempt(te,u,c)(p):(n.enter("codeFlowValue"),a(p))}function a(p){return p===null||C(p)?(n.exit("codeFlowValue"),u(p)):(n.consume(p),a)}function c(p){return n.exit("codeIndented"),r(p)}}function re(n,r,t){const e=this;return i;function i(u){return e.parser.lazy[e.now().line]?t(u):C(u)?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),i):B(n,l,"linePrefix",4+1)(u)}function l(u){const a=e.events[e.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?r(u):C(u)?i(u):t(u)}}const ie={name:"codeText",tokenize:ae,resolve:ue,previous:le};function ue(n){let r=n.length-4,t=3,e,i;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(u):n.interrupt(e.parser.constructs.flow,t,r)(u)}}function lt(n,r,t,e,i,l,u,a,c){const p=c||Number.POSITIVE_INFINITY;let h=0;return x;function x(y){return y===60?(n.enter(e),n.enter(i),n.enter(l),n.consume(y),n.exit(l),g):y===null||y===41||zn(y)?t(y):(n.enter(e),n.enter(u),n.enter(a),n.enter("chunkString",{contentType:"string"}),A(y))}function g(y){return y===62?(n.enter(l),n.consume(y),n.exit(l),n.exit(i),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 A(y){return y===40?++h>p?t(y):(n.consume(y),A):y===41?h--?(n.consume(y),A):(n.exit("chunkString"),n.exit(a),n.exit(u),n.exit(e),r(y)):y===null||Z(y)?h?t(y):(n.exit("chunkString"),n.exit(a),n.exit(u),n.exit(e),r(y)):zn(y)?t(y):(n.consume(y),y===92?L:A)}function L(y){return y===40||y===41||y===92?(n.consume(y),A):A(y)}}function at(n,r,t,e,i,l){const u=this;let a=0,c;return p;function p(f){return n.enter(e),n.enter(i),n.consume(f),n.exit(i),n.enter(l),h}function h(f){return f===null||f===91||f===93&&!c||f===94&&!a&&"_hiddenFootnoteSupport"in u.parser.constructs||a>999?t(f):f===93?(n.exit(l),n.enter(i),n.consume(f),n.exit(i),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,i,l){let u;return a;function a(g){return n.enter(e),n.enter(i),n.consume(g),n.exit(i),u=g===40?41:g,c}function c(g){return g===u?(n.enter(i),n.consume(g),n.exit(i),n.exit(e),r):(n.enter(l),p(g))}function p(g){return g===u?(n.exit(l),c(u)):g===null?t(g):C(g)?(n.enter("lineEnding"),n.consume(g),n.exit("lineEnding"),B(n,p,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===u||g===null||C(g)?(n.exit("chunkString"),p(g)):(n.consume(g),g===92?x:h)}function x(g){return g===u||g===92?(n.consume(g),h):h(g)}}function dn(n,r){let t;return e;function e(i){return C(i)?(n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),t=!0,e):q(i)?B(n,e,t?"linePrefix":"lineSuffix")(i):r(i)}}function fn(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const fe={name:"definition",tokenize:ge},xe={tokenize:ke,partial:!0};function ge(n,r,t){const e=this;let i;return l;function l(c){return n.enter("definition"),at.call(e,n,u,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(c)}function u(c){return i=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(xe,B(n,a,"whitespace"),B(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(i)||e.parser.defined.push(i),r(c)):t(c)}}function ke(n,r,t){return e;function e(u){return Z(u)?dn(n,i)(u):t(u)}function i(u){return u===34||u===39||u===40?ot(n,B(n,l,"whitespace"),t,"definitionTitle","definitionTitleMarker","definitionTitleString")(u):t(u)}function l(u){return u===null||C(u)?r(u):t(u)}}const de={name:"hardBreakEscape",tokenize:be};function be(n,r,t){return e;function e(l){return n.enter("hardBreakEscape"),n.enter("escapeMarker"),n.consume(l),i}function i(l){return C(l)?(n.exit("escapeMarker"),n.exit("hardBreakEscape"),r(l)):t(l)}}const ye={name:"headingAtx",tokenize:Fe,resolve:Se};function Se(n,r){let t=n.length-2,e=3,i,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&&(i={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",i,r],["enter",l,r],["exit",l,r],["exit",i,r]])),n}function Fe(n,r,t){const e=this;let i=0;return l;function l(h){return n.enter("atxHeading"),n.enter("atxHeadingSequence"),u(h)}function u(h){return h===35&&i++<6?(n.consume(h),u):h===null||Z(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)?B(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||Z(h)?(n.exit("atxHeadingText"),a(h)):(n.consume(h),p)}}const we=["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"],Yn=["pre","script","style","textarea"],Ee={name:"htmlFlow",tokenize:ze,resolveTo:Ae,concrete:!0},Ce={tokenize:Ie,partial:!0};function Ae(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 ze(n,r,t){const e=this;let i,l,u,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),i=3,e.interrupt?r:W):tn(o)?(n.consume(o),u=String.fromCharCode(o),l=!0,A):t(o)}function x(o){return o===45?(n.consume(o),i=2,g):o===91?(n.consume(o),i=5,u="CDATA[",a=0,f):tn(o)?(n.consume(o),i=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===u.charCodeAt(a++)?(n.consume(o),a===u.length?e.interrupt?r:S:f):t(o)}function k(o){return tn(o)?(n.consume(o),u=String.fromCharCode(o),A):t(o)}function A(o){return o===null||o===47||o===62||Z(o)?o!==47&&l&&Yn.includes(u.toLowerCase())?(i=1,e.interrupt?r(o):S(o)):we.includes(u.toLowerCase())?(i=6,o===47?(n.consume(o),L):e.interrupt?r(o):S(o)):(i=7,e.interrupt&&!e.parser.lazy[e.now().line]?t(o):l?_(o):y(o)):o===45||v(o)?(n.consume(o),u+=String.fromCharCode(o),A):t(o)}function L(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):O(o)}function O(o){return o===61?(n.consume(o),D):q(o)?(n.consume(o),O):_(o)}function D(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),D):(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||Z(o)?O(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&&i===2?(n.consume(o),G):o===60&&i===1?(n.consume(o),nn):o===62&&i===4?(n.consume(o),H):o===63&&i===3?(n.consume(o),W):o===93&&i===5?(n.consume(o),Q):C(o)&&(i===6||i===7)?n.check(Ce,H,w)(o):o===null||C(o)?w(o):(n.consume(o),S)}function w(o){return n.exit("htmlFlowData"),z(o)}function z(o){return o===null?s(o):C(o)?n.attempt({tokenize:U,partial:!0},z,s)(o):(n.enter("htmlFlowData"),S(o))}function U(o,cn,xn){return hn;function hn(K){return o.enter("lineEnding"),o.consume(K),o.exit("lineEnding"),V}function V(K){return e.parser.lazy[e.now().line]?xn(K):cn(K)}}function G(o){return o===45?(n.consume(o),W):S(o)}function nn(o){return o===47?(n.consume(o),u="",J):S(o)}function J(o){return o===62&&Yn.includes(u.toLowerCase())?(n.consume(o),H):tn(o)&&u.length<8?(n.consume(o),u+=String.fromCharCode(o),J):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&&i===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 Ie(n,r,t){return e;function e(i){return n.exit("htmlFlowData"),n.enter("lineEndingBlank"),n.consume(i),n.exit("lineEndingBlank"),n.attempt(Sn,r,t)}}const Te={name:"htmlText",tokenize:Be};function Be(n,r,t){const e=this;let i,l,u,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),D):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[",u=0,L):tn(s)?(n.consume(s),O):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),A):C(s)?(a=k,Q(s)):(n.consume(s),k)}function A(s){return s===45?(n.consume(s),H):k(s)}function L(s){return s===l.charCodeAt(u++)?(n.consume(s),u===l.length?y:L):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 O(s){return s===null||s===62?H(s):C(s)?(a=O,Q(s)):(n.consume(s),O)}function D(s){return s===null?t(s):s===63?(n.consume(s),d):C(s)?(a=D,Q(s)):(n.consume(s),D)}function d(s){return s===62?H(s):D(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||Z(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):z(s)}function z(s){return s===61?(n.consume(s),U):C(s)?(a=z,Q(s)):q(s)?(n.consume(s),z):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),i=s,G):C(s)?(a=U,Q(s)):q(s)?(n.consume(s),U):(n.consume(s),i=void 0,J)}function G(s){return s===i?(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||Z(s)?S(s):t(s)}function J(s){return s===null||s===34||s===39||s===60||s===61||s===96?t(s):s===62||Z(s)?S(s):(n.consume(s),J)}function Q(s){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(s),n.exit("lineEnding"),B(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:Me,resolveTo:_e,resolveAll:Pe},Le={tokenize:Re},Oe={tokenize:je},De={tokenize:qe};function Pe(n){let r=-1,t;for(;++r-1&&(u[0]=u[0].slice(e)),l>0&&u.push(n[i].slice(0,l))),u}function sr(n,r){let t=-1;const e=[];let i;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 wr=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Er(n){return n.replace(wr,Cr)}function Cr(n,r,t){if(r)return r;if(t.charCodeAt(0)===35){const i=t.charCodeAt(1),l=i===120||i===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?Jn(n.position):"start"in n||"end"in n?Jn(n):"line"in n||"column"in n?Tn(n):""}function Tn(n){return Kn(n&&n.line)+":"+Kn(n&&n.column)}function Jn(n){return Tn(n&&n.start)+"-"+Tn(n&&n.end)}function Kn(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),Ar(t)(Fr(yr(t).document().write(Sr()(n,r,!0))))};function Ar(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(kt,c),codeTextData:S,data:S,codeFlowValue:S,definition:a(dt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:a(bt),hardBreakEscape:a(_n),hardBreakTrailing:a(_n),htmlFlow:a(Mn,c),htmlFlowData:S,htmlText:a(Mn,c),htmlTextData:S,image:a(yt),label:c,link:a(Rn),listItem:a(St),listItemValue:k,listOrdered:a(jn,f),listUnordered:a(jn),paragraph:a(Ft),reference:hn,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:a(Pn),strong:a(wt),thematicBreak:a(Ct)},exit:{atxHeading:h(),atxHeadingSequence:P,autolink:h(),autolinkEmail:mn,autolinkProtocol:pn,blockQuote:h(),characterEscapeValue:w,characterReferenceMarkerHexadecimal:K,characterReferenceMarkerNumeric:K,characterReferenceValue:ln,codeFenced:h(_),codeFencedFence:y,codeFencedFenceInfo:A,codeFencedFenceMeta:L,codeFlowValue:w,codeIndented:h(F),codeText:h(J),codeTextData:w,data:w,definition:h(),definitionDestinationString:d,definitionLabelString:O,definitionTitleString:D,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:z,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:u},I=[];let T=-1;for(;++T0){const X=E.tokenStack[E.tokenStack.length-1];(X[1]||Xn).call(E,void 0,X[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})},T=-1;++T{h!==0&&(i++,e.push([])),p.split(" ").forEach(x=>{x&&e[i].push({content:x,type:a})})}):(u.type==="strong"||u.type==="emphasis")&&u.children.forEach(c=>{l(c,u.type)})}return t.forEach(u=>{u.type==="paragraph"&&u.children.forEach(a=>{l(a)})}),e}function Br(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 Lr(n,r){r&&n.attr("style",r)}function Or(n,r,t,e,i=!1){const l=n.append("foreignObject"),u=l.append("xhtml:div"),a=r.label,c=r.isNode?"nodeLabel":"edgeLabel";u.html(` "+a+""),Lr(u,r.labelStyle),u.style("display","table-cell"),u.style("white-space","nowrap"),u.style("max-width",t+"px"),u.attr("xmlns","http://www.w3.org/1999/xhtml"),i&&u.attr("class","labelBkg");let p=u.node().getBoundingClientRect();return p.width===t&&(u.style("display","table"),u.style("white-space","break-spaces"),u.style("width",t+"px"),p=u.node().getBoundingClientRect()),l.style("width",p.width),l.style("height",p.height),l.node()}function xt(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 vn(n,r,t){const e=n.append("text"),i=xt(e,1,r);gt(i,[{content:t,type:"normal"}]);const l=i.node().getComputedTextLength();return e.remove(),l}function Dr(n,r,t,e=!1){const l=r.append("g");let u=l.insert("rect").attr("class","background");const a=l.append("text").attr("y","-10.1");let c=0;if(t.forEach(p=>{let h=p.map(A=>A.content).join(" "),x="",g=[],f=0;if(vn(l,1.1,h)<=n)g.push(h);else{for(let A=0;A<=h.length;A++)if(x=h.slice(f,A),nt.info(x,f,A),vn(l,1.1,x)>n){const y=h.slice(f,A).lastIndexOf(" ");y>-1&&(A=f+y+1),g.push(h.slice(f,A).trim()),f=A,x=null}x!=null&&g.push(x)}const k=g.map(A=>({content:A,type:p.type}));for(const A of k){let L=xt(a,c,1.1);gt(L,[A]),c++}}),e){const p=a.node().getBBox(),h=2;return u.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 gt(n,r){n.text(""),r.forEach((t,e)=>{const i=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?i.text(t.content):i.text(" "+t.content)})}const _r=(n,r="",{style:t="",isTitle:e=!1,classes:i="",useHtmlLabels:l=!0,isNode:u=!0,width:a,addSvgBackground:c=!1}={})=>{if(nt.info("createText",r,t,e,i,l,u,c),l){const p=Br(r),h={isNode:u,label:At(p).replace(/fa[blrs]?:fa-[\w-]+/g,g=>``),labelStyle:t.replace("fill:","color:")};return Or(n,h,a,i,c)}else{const p=Tr(r);return Dr(a,n,p,c)}};export{_r as c};