@zombie-mermaid/core 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/diagram-type.test.ts +38 -0
- package/src/diagram-type.ts +9 -0
- package/src/style-directives.ts +6 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t){let n=e.match(/^click\s+([\w\p{L}-]+)\s+(.*)$/iu);if(!n)return;let r=n[1],i=n[2].trim(),a={...t.get(r)},o=i.match(/^(?:call|callback)\s+(.+?)\s*$/i);if(o){let e=o[1].match(/^(.*?\))\s+"([^"]*)"\s*$/);e?(a.callback=e[1].trim(),a.tooltip=e[2]):a.callback=o[1].trim(),t.set(r,a);return}i=i.replace(/^href\s+/i,``);let s=[...i.matchAll(/"([^"]*)"/g)].map(e=>e[1]);s.length>0&&(a.href=s[0]),s.length>1&&(a.tooltip=s[1]);let c=i.match(/(_blank|_self|_parent|_top)\s*$/i);c&&(a.target=c[1].toLowerCase()),(a.href!==void 0||a.tooltip!==void 0)&&t.set(r,a)}function t(e){if(!e||/[\x00-\x1F\x7F]/.test(e))return;let t=e.trim();if(/^[./#?]/.test(t))return t;let n=t.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/)?.[1];return n===void 0||/^(https?|mailto)$/i.test(n)?t:void 0}var n=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,r=/^rgba?\(\s*([\d.]+%?)\s*[, ]\s*([\d.]+%?)\s*[, ]\s*([\d.]+%?)\s*(?:[,/]\s*([\d.]+%?)\s*)?\)$/i;function i(e){let t=a(e);return t?[t.r,t.g,t.b]:null}function a(e){let t=n.exec(e.trim());if(!t)return null;let r=t[1];if(r===void 0)return null;let i=r;return(i.length===3||i.length===4)&&(i=i.split(``).map(e=>e+e).join(``)),{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:i.length===8?parseInt(i.slice(6,8),16)/255:1}}function o(e){return e.endsWith(`%`)?Number(e.slice(0,-1))/100*255:Number(e)}function s(e){return e===void 0?1:e.endsWith(`%`)?Number(e.slice(0,-1))/100:Number(e)}function c(e){let t=e.trim();if(t.toLowerCase()===`transparent`)return{r:0,g:0,b:0,a:0};let n=a(t);if(n)return n;let i=r.exec(t);if(i){let[,e,t,n,r]=i;if(e===void 0||t===void 0||n===void 0)return null;let a={r:o(e),g:o(t),b:o(n),a:s(r)};return[a.r,a.g,a.b,a.a].some(e=>Number.isNaN(e))?null:a}return null}function l(e,t,n,r){let i,a;n===void 0&&r===void 0?(i=50,a=50):n===void 0?(a=r??50,i=100-a):r===void 0?(i=n,a=100-i):(i=n,a=r);let o=i+a;if(o===0)return null;let s=o<100?o/100:1;i/=o,a/=o;let c=e.a*i+t.a*a,l=(n,r)=>c===0?0:(n*e.a*i+r*t.a*a)/c;return{r:l(e.r,t.r),g:l(e.g,t.g),b:l(e.b,t.b),a:c*s}}function u(e,t,n){let r=c(e),i=c(t);if(!r||!i)return e;let a=l(r,i,n,100-n);return a?f(a):e}var d=e=>Math.min(255,Math.max(0,Math.round(e)));function f(e){let t=d(e.r),n=d(e.g),r=d(e.b),i=Math.min(1,Math.max(0,e.a));return i>=1?`#`+[t,n,r].map(e=>e.toString(16).padStart(2,`0`)).join(``):`rgba(${t}, ${n}, ${r}, ${Number(i.toFixed(3))})`}var p=/^[&#](?:#?[0-9]+|#?[xX][0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);/,m=new Set([`&`,`#`]);function ee(e){let t=null;for(let n=0;n<e.length;n++){let r=e[n];if(t!==null){r===t&&(t=null);continue}if(r===`"`||r===`'`){t=r;continue}if(m.has(r)){let t=p.exec(e.slice(n));if(t){n+=t[0].length-1;continue}}if(r===`%`&&e[n+1]===`%`)return n}return-1}function h(e){let t=[],n=``,r=null;for(let i=0;i<e.length;i++){let a=e[i];if(r!==null){n+=a,a===r&&(r=null);continue}if(a===`"`||a===`'`){r=a,n+=a;continue}if(m.has(a)){let t=p.exec(e.slice(i));if(t){n+=t[0],i+=t[0].length-1;continue}}if(a===`;`){t.push(n),n=``;continue}n+=a}return t.push(n),t}function g(e){let t=[],n=e.split(`
|
|
2
|
-
`);for(let e=0;e<n.length;e++){let r=n[e].trim(),i=e+1,a=ee(r);if(a!==-1&&(r=r.slice(0,a).trim()),r.length===0)continue;let o=[];for(let e of h(r)){let t=e.trim();t.length!==0&&o.push({text:t,line:i})}o.length>0&&t.push(o)}return t}function _(e){return g(e).flat()}var v=[`flowchart`,`sequence`,`class`,`er`,`xychart`];function te(e){let t=_(e)[0]?.text.toLowerCase()??``;return/^xychart(?:-beta)?(?:\s|$)/.test(t)?`xychart`:/^sequencediagram\s*$/.test(t)?`sequence`:/^classdiagram\s*$/.test(t)?`class`:/^erdiagram\s*$/.test(t)?`er`:`flowchart`}function y(e){return e===`TD`||e===`TB`||e===`LR`||e===`BT`||e===`RL`}function ne(e){let t=e?.toUpperCase();if(t===void 0||!y(t))throw Error(`Invalid direction: "${e}"`);return t}function b(e,t){return t===void 0||!y(t)?e:{...e,direction:t}}var x=new Set([`linear`,`basis`,`natural`,`step`,`stepBefore`,`stepAfter`]),S={theme:"colors come from the caller's bg/fg render options, which are usually CSS variables so a diagram inherits the host page's light/dark. A diagram-supplied theme would hard-code colors that fight it. Mermaid's theme names (default/dark/forest/neutral) also have no equivalent in this renderer's palettes — pass `bg`/`fg`, or a THEMES entry, instead",securitylevel:`this renderer emits static SVG and never executes diagram-supplied script, so there is no sandbox to configure`,defaultrenderer:`ELK is the only layout engine; dagre/elk selection has no effect`,fontfamily:"use the `font` render option instead",htmllabels:`labels are always rendered as SVG text; there is no HTML label mode`,maxtextsize:`no text-size limit is enforced`,startonload:`not a browser auto-render integration`},C=/^\s*%%\{\s*(?:init|initialize)\s*:\s*([\s\S]*?)\}%%/i;function w(e){return C.test(e)}function re(e){let t=``,n=null;for(let r=0;r<e.length;r++){let i=e[r];if(n!==null){if(i===`\\`&&r+1<e.length){let n=e[r+1];t+=n===`'`?`'`:`\\${n}`,r++}else i===n?(n=null,t+=`"`):t+=i===`"`?`\\"`:i;continue}if(i===`"`||i===`'`){n=i,t+=`"`;continue}if(/[A-Za-z_$]/.test(i)){let n=r;for(;n<e.length&&/[\w$-]/.test(e[n]);)n++;let i=e.slice(r,n),a=n;for(;a<e.length&&/\s/.test(e[a]);)a++;if(e[a]===`:`){t+=`"${i}"`,r=n-1;continue}t+=/^(true|false|null)$/i.test(i)?i.toLowerCase():`"${i}"`,r=n-1;continue}t+=i}return t}function T(e){let t=e.match(C);if(!t)return;let n;try{n=JSON.parse(re(t[1]))}catch{return}if(typeof n!=`object`||!n)return;let r={ignored:[]},i={...n};for(let[e,t]of Object.entries(i)){let n=e.toLowerCase();if(n===`theme`&&typeof t==`string`){r.theme=t,r.ignored.push(e);continue}if(n===`flowchart`&&typeof t==`object`&&t){let e={...t};for(let[t,n]of Object.entries(e)){if(t.toLowerCase()===`curve`&&typeof n==`string`){x.has(n)&&(r.curve=n);continue}t.toLowerCase()in S&&r.ignored.push(t)}continue}n in S&&r.ignored.push(e)}return r}function ie(e){let t={ignored:[]};for(let n of e){let e=T(n);e&&(e.theme!==void 0&&(t.theme=e.theme),e.curve!==void 0&&(t.curve=e.curve),t.ignored.push(...e.ignored))}return t}function ae(e,t){return t.curve===void 0||e.curve!==void 0?e:{...e,curve:t.curve}}function oe(e){return[...new Set(e.ignored)].map(e=>`${e}: ${S[e.toLowerCase()]??`not supported`}`)}var E={" ":.521,"!":.533,'"':.863,"#":1.173,$:1.188,"%":1.818,"&":1.193,"'":.555,"(":.675,")":.675,"*":.928,"+":1.225,",":.534,"-":.852,".":.534,"/":.667,0:1.168,1:.753,2:1.129,3:1.144,4:1.196,5:1.099,6:1.148,7:1.048,8:1.146,9:1.148,":":.534,";":.559,"<":1.225,"=":1.225,">":1.225,"?":.947,"@":1.789,A:1.278,B:1.212,C:1.353,D:1.336,E:1.113,F:1.093,G:1.382,H:1.376,I:.497,J:1.057,K:1.244,L:1.047,M:1.673,N:1.395,O:1.416,P:1.183,Q:1.416,R:1.192,S:1.188,T:1.195,U:1.378,V:1.278,W:1.825,X:1.263,Y:1.257,Z:1.165,"[":.675,"\\":.667,"]":.675,"^":.873,_:.845,"`":.598,a:1.04,b:1.134,c:1.058,d:1.134,e:1.08,f:.685,g:1.136,h:1.095,i:.448,j:.448,k:1.016,l:.448,m:1.622,n:1.094,o:1.11,p:1.134,q:1.134,r:.697,s:.977,t:.606,u:1.095,v:1.041,w:1.515,x:1.011,y:1.041,z:1.023,"{":.789,"|":.616,"}":.789,"~":1.225};function se(e){return Object.hasOwn(E,e)}var ce=new Set([`i`,`l`,`t`,`f`,`j`,`I`,`1`,`!`,`|`,`.`,`,`,`:`,`;`,`'`]),le=new Set([`W`,`M`,`w`,`m`,`@`,`%`]),ue=new Set([`W`,`M`]),de=new Set([`(`,`)`,`[`,`]`,`{`,`}`,`/`,`\\`,`-`,`"`,"`"]);function fe(e){return e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071}function D(e){return e>=4352&&e<=4447||e>=11904&&e<=12031||e>=12032&&e<=12255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12544&&e<=12591||e>=12592&&e<=12687||e>=12688&&e<=12799||e>=12800&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072}var pe=/\p{Emoji_Presentation}/u,O=/\p{Extended_Pictographic}/u;function k(e){return e>=9632&&e<=9727}function A(e){return e>=8596&&e<=8601||e===8617||e===8618}function j(e){if(pe.test(e))return!0;let t=e.codePointAt(0);return t!==void 0&&k(t)||t!==void 0&&A(t)?!1:O.test(e)}function M(e){let t=e.codePointAt(0);return t===void 0?!1:D(t)||j(e)}function N(e){let t=e.codePointAt(0);if(t===void 0)return 0;if(Object.hasOwn(E,e)){let t=E[e];if(t!==void 0)return t}if(fe(t))return 0;if(D(t)||j(e))return 2;let n=e.normalize(`NFD`)[0];if(n!==void 0&&n!==e){let e=E[n];if(e!==void 0)return e}return e===` `?.3:ue.has(e)?1.5:le.has(e)?1.2:ce.has(e)?.4:de.has(e)?.5:e===`r`?.8:t>=65&&t<=90?1.2:1}var P=.6,F=!1;function I(e){return/mono|consol|menlo|courier|\bcode\b/i.test(e)}function L(e){F=e}function R(e,t,n){let r=t*.15;if(F){let n=0;for(let t of e)n+=1;return n*t*P+r}let i=n>=600?.6:n>=500?.57:.54,a=0;for(let t of e)a+=N(t);return a*t*i+r}var z=1.3;function B(e,t,n){let r=e.split(`
|
|
2
|
+
`);for(let e=0;e<n.length;e++){let r=n[e].trim(),i=e+1,a=ee(r);if(a!==-1&&(r=r.slice(0,a).trim()),r.length===0)continue;let o=[];for(let e of h(r)){let t=e.trim();t.length!==0&&o.push({text:t,line:i})}o.length>0&&t.push(o)}return t}function _(e){return g(e).flat()}var v=[`flowchart`,`sequence`,`class`,`er`,`xychart`,`architecture`,`c4`];function te(e){let t=_(e)[0]?.text.toLowerCase()??``;return/^xychart(?:-beta)?(?:\s|$)/.test(t)?`xychart`:/^architecture(?:-beta)?\s*$/.test(t)?`architecture`:/^c4(?:context|container|component|dynamic|deployment)\s*$/.test(t)?`c4`:/^sequencediagram\s*$/.test(t)?`sequence`:/^classdiagram\s*$/.test(t)?`class`:/^erdiagram\s*$/.test(t)?`er`:`flowchart`}function y(e){return e===`TD`||e===`TB`||e===`LR`||e===`BT`||e===`RL`}function ne(e){let t=e?.toUpperCase();if(t===void 0||!y(t))throw Error(`Invalid direction: "${e}"`);return t}function b(e,t){return t===void 0||!y(t)?e:{...e,direction:t}}var x=new Set([`linear`,`basis`,`natural`,`step`,`stepBefore`,`stepAfter`]),S={theme:"colors come from the caller's bg/fg render options, which are usually CSS variables so a diagram inherits the host page's light/dark. A diagram-supplied theme would hard-code colors that fight it. Mermaid's theme names (default/dark/forest/neutral) also have no equivalent in this renderer's palettes — pass `bg`/`fg`, or a THEMES entry, instead",securitylevel:`this renderer emits static SVG and never executes diagram-supplied script, so there is no sandbox to configure`,defaultrenderer:`ELK is the only layout engine; dagre/elk selection has no effect`,fontfamily:"use the `font` render option instead",htmllabels:`labels are always rendered as SVG text; there is no HTML label mode`,maxtextsize:`no text-size limit is enforced`,startonload:`not a browser auto-render integration`},C=/^\s*%%\{\s*(?:init|initialize)\s*:\s*([\s\S]*?)\}%%/i;function w(e){return C.test(e)}function re(e){let t=``,n=null;for(let r=0;r<e.length;r++){let i=e[r];if(n!==null){if(i===`\\`&&r+1<e.length){let n=e[r+1];t+=n===`'`?`'`:`\\${n}`,r++}else i===n?(n=null,t+=`"`):t+=i===`"`?`\\"`:i;continue}if(i===`"`||i===`'`){n=i,t+=`"`;continue}if(/[A-Za-z_$]/.test(i)){let n=r;for(;n<e.length&&/[\w$-]/.test(e[n]);)n++;let i=e.slice(r,n),a=n;for(;a<e.length&&/\s/.test(e[a]);)a++;if(e[a]===`:`){t+=`"${i}"`,r=n-1;continue}t+=/^(true|false|null)$/i.test(i)?i.toLowerCase():`"${i}"`,r=n-1;continue}t+=i}return t}function T(e){let t=e.match(C);if(!t)return;let n;try{n=JSON.parse(re(t[1]))}catch{return}if(typeof n!=`object`||!n)return;let r={ignored:[]},i={...n};for(let[e,t]of Object.entries(i)){let n=e.toLowerCase();if(n===`theme`&&typeof t==`string`){r.theme=t,r.ignored.push(e);continue}if(n===`flowchart`&&typeof t==`object`&&t){let e={...t};for(let[t,n]of Object.entries(e)){if(t.toLowerCase()===`curve`&&typeof n==`string`){x.has(n)&&(r.curve=n);continue}t.toLowerCase()in S&&r.ignored.push(t)}continue}n in S&&r.ignored.push(e)}return r}function ie(e){let t={ignored:[]};for(let n of e){let e=T(n);e&&(e.theme!==void 0&&(t.theme=e.theme),e.curve!==void 0&&(t.curve=e.curve),t.ignored.push(...e.ignored))}return t}function ae(e,t){return t.curve===void 0||e.curve!==void 0?e:{...e,curve:t.curve}}function oe(e){return[...new Set(e.ignored)].map(e=>`${e}: ${S[e.toLowerCase()]??`not supported`}`)}var E={" ":.521,"!":.533,'"':.863,"#":1.173,$:1.188,"%":1.818,"&":1.193,"'":.555,"(":.675,")":.675,"*":.928,"+":1.225,",":.534,"-":.852,".":.534,"/":.667,0:1.168,1:.753,2:1.129,3:1.144,4:1.196,5:1.099,6:1.148,7:1.048,8:1.146,9:1.148,":":.534,";":.559,"<":1.225,"=":1.225,">":1.225,"?":.947,"@":1.789,A:1.278,B:1.212,C:1.353,D:1.336,E:1.113,F:1.093,G:1.382,H:1.376,I:.497,J:1.057,K:1.244,L:1.047,M:1.673,N:1.395,O:1.416,P:1.183,Q:1.416,R:1.192,S:1.188,T:1.195,U:1.378,V:1.278,W:1.825,X:1.263,Y:1.257,Z:1.165,"[":.675,"\\":.667,"]":.675,"^":.873,_:.845,"`":.598,a:1.04,b:1.134,c:1.058,d:1.134,e:1.08,f:.685,g:1.136,h:1.095,i:.448,j:.448,k:1.016,l:.448,m:1.622,n:1.094,o:1.11,p:1.134,q:1.134,r:.697,s:.977,t:.606,u:1.095,v:1.041,w:1.515,x:1.011,y:1.041,z:1.023,"{":.789,"|":.616,"}":.789,"~":1.225};function se(e){return Object.hasOwn(E,e)}var ce=new Set([`i`,`l`,`t`,`f`,`j`,`I`,`1`,`!`,`|`,`.`,`,`,`:`,`;`,`'`]),le=new Set([`W`,`M`,`w`,`m`,`@`,`%`]),ue=new Set([`W`,`M`]),de=new Set([`(`,`)`,`[`,`]`,`{`,`}`,`/`,`\\`,`-`,`"`,"`"]);function fe(e){return e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071}function D(e){return e>=4352&&e<=4447||e>=11904&&e<=12031||e>=12032&&e<=12255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12544&&e<=12591||e>=12592&&e<=12687||e>=12688&&e<=12799||e>=12800&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072}var pe=/\p{Emoji_Presentation}/u,O=/\p{Extended_Pictographic}/u;function k(e){return e>=9632&&e<=9727}function A(e){return e>=8596&&e<=8601||e===8617||e===8618}function j(e){if(pe.test(e))return!0;let t=e.codePointAt(0);return t!==void 0&&k(t)||t!==void 0&&A(t)?!1:O.test(e)}function M(e){let t=e.codePointAt(0);return t===void 0?!1:D(t)||j(e)}function N(e){let t=e.codePointAt(0);if(t===void 0)return 0;if(Object.hasOwn(E,e)){let t=E[e];if(t!==void 0)return t}if(fe(t))return 0;if(D(t)||j(e))return 2;let n=e.normalize(`NFD`)[0];if(n!==void 0&&n!==e){let e=E[n];if(e!==void 0)return e}return e===` `?.3:ue.has(e)?1.5:le.has(e)?1.2:ce.has(e)?.4:de.has(e)?.5:e===`r`?.8:t>=65&&t<=90?1.2:1}var P=.6,F=!1;function I(e){return/mono|consol|menlo|courier|\bcode\b/i.test(e)}function L(e){F=e}function R(e,t,n){let r=t*.15;if(F){let n=0;for(let t of e)n+=1;return n*t*P+r}let i=n>=600?.6:n>=500?.57:.54,a=0;for(let t of e)a+=N(t);return a*t*i+r}var z=1.3;function B(e,t,n){let r=e.split(`
|
|
3
3
|
`),i=t*z,a=0;for(let e of r){let r=R(e.replace(/<\/?(?:b|strong|i|em|u|s|del)\s*>/gi,``),t,n);r>a&&(a=r)}return{width:a,height:r.length*i,lines:r,lineHeight:i}}function me(e){return Number.isFinite(e)?Number(e.toFixed(2)):0}function V(e,...t){let n=e[0]??``;for(let r=0;r<t.length;r++){let i=t[r];n+=String(typeof i==`number`?me(i):i),n+=e[r+1]??``}return n}function he(e){let t=e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e;return(t.length>=2&&t.startsWith("`")&&t.endsWith("`")?t.slice(1,-1):t).replace(/<br\s*\/?>/gi,`
|
|
4
4
|
`).replace(/\\n/g,`
|
|
5
5
|
`).replace(/<\/?(?:sub|sup|small|mark)\s*>/gi,``).replace(/\*\*(.+?)\*\*/g,`<b>$1</b>`).replace(/(?<!\*)\*([^\s*](?:[^*]*[^\s*])?)\*(?!\*)/g,`<i>$1</i>`).replace(/~~(.+?)~~/g,`<s>$1</s>`)}function ge(e){return e.replace(/<\/?(?:b|strong|i|em|u|s|del)\s*>/gi,``)}function H(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function U(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}var W=/<(\/)?(?:(b|strong)|(i|em)|(u)|(s|del))\s*>/gi;function _e(e){let t=[],n=!1,r=!1,i=!1,a=!1,o=0;W.lastIndex=0;let s;for(;(s=W.exec(e))!==null;){s.index>o&&t.push({text:e.slice(o,s.index),bold:n,italic:r,underline:i,strikethrough:a}),o=s.index+s[0].length;let c=!!s[1];s[2]?n=!c:s[3]?r=!c:s[4]?i=!c:s[5]&&(a=!c)}return o<e.length&&t.push({text:e.slice(o),bold:n,italic:r,underline:i,strikethrough:a}),t}var ve=/<\/?(?:b|strong|i|em|u|s|del)\s*>/i;function G(e){if(!ve.test(e))return H(e);let t=_e(e);return t.length===0?``:t.every(e=>!e.bold&&!e.italic&&!e.underline&&!e.strikethrough)?t.map(e=>H(e.text)).join(``):t.map(e=>{let t=H(e.text);if(!e.bold&&!e.italic&&!e.underline&&!e.strikethrough)return t;let n=[];e.bold&&n.push(`font-weight="bold"`),e.italic&&n.push(`font-style="italic"`);let r=[];return e.underline&&r.push(`underline`),e.strikethrough&&r.push(`line-through`),r.length&&n.push(`text-decoration="${r.join(` `)}"`),`<tspan ${n.join(` `)}>${t}</tspan>`}).join(``)}function K(e,t,n,r,i,a=.35){let o=e.split(`
|
|
6
|
-
`);if(o.length===1)return V`<text x="${t}" y="${n}" ${i} dy="${r*a}">${G(e)}</text>`;let s=r*z,c=-((o.length-1)/2)*s+r*a;return V`<text x="${t}" y="${n}" ${i}>${o.map((e,n)=>V`<tspan x="${t}" dy="${n===0?c:s}">${G(e)}</tspan>`).join(``)}</text>`}function ye(e,t,n,r,i,a,o,s,c){let l=r+o*2,u=i+o*2;return`${V`<rect x="${t-l/2}" y="${n-u/2}" `+V`width="${l}" height="${u}" ${c} />`}\n${K(e,t,n,a,s)}`}function q(e){let t=e.replace(/;\s*$/,``),n={};for(let e of t.split(`,`)){let t=e.indexOf(`:`);if(t>0){let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();r&&i&&(n[r]=i)}}return n}function be(e,t){let n=e.match(/^classDef\s+([\w,-]+)\s+(.+)$/);if(!n)return!1;let r=q(n[2]);for(let e of n[1].split(`,`)){let n=e.trim();n&&t.classDefs.set(n,r)}return!0}function xe(e,t){let n=e.match(/^class\s+([\w
|
|
6
|
+
`);if(o.length===1)return V`<text x="${t}" y="${n}" ${i} dy="${r*a}">${G(e)}</text>`;let s=r*z,c=-((o.length-1)/2)*s+r*a;return V`<text x="${t}" y="${n}" ${i}>${o.map((e,n)=>V`<tspan x="${t}" dy="${n===0?c:s}">${G(e)}</tspan>`).join(``)}</text>`}function ye(e,t,n,r,i,a,o,s,c){let l=r+o*2,u=i+o*2;return`${V`<rect x="${t-l/2}" y="${n-u/2}" `+V`width="${l}" height="${u}" ${c} />`}\n${K(e,t,n,a,s)}`}function q(e){let t=e.replace(/;\s*$/,``),n={};for(let e of t.split(`,`)){let t=e.indexOf(`:`);if(t>0){let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();r&&i&&(n[r]=i)}}return n}function be(e,t){let n=e.match(/^classDef\s+([\w,-]+)\s+(.+)$/);if(!n)return!1;let r=q(n[2]);for(let e of n[1].split(`,`)){let n=e.trim();n&&t.classDefs.set(n,r)}return!0}function xe(e,t){let n=e.match(/^class\s+([\w-]+(?:\s*,\s*[\w-]+)*)\s+([\w-]+)\s*;?\s*$/);if(!n)return!1;let r=n[2];for(let e of n[1].split(`,`))t.classAssignments.set(e.trim(),r);return!0}function Se(e,t){let n=e.match(/^cssClass\s+"([^"]*)"\s+([\w-]+)\s*;?\s*$/);if(!n)return!1;let r=n[2];for(let e of n[1].split(`,`)){let n=e.trim();n&&t.classAssignments.set(n,r)}return!0}function Ce(e,t){let n=e.match(/^style\s+([\w,-]+)\s+(.+)$/);if(!n)return!1;let r=q(n[2]);for(let e of n[1].split(`,`).map(e=>e.trim()))t.nodeStyles.set(e,{...t.nodeStyles.get(e),...r});return!0}function we(e){let t=e.match(/^(.+?):::([\w][\w-]*)$/);return t?{id:t[1],className:t[2]}:{id:e}}function Te(e,t){let n,r=t.classDefs.get(`default`);r&&(n={...r});let i=t.classAssignments.get(e);if(i){let e=t.classDefs.get(i);e&&(n=n?{...n,...e}:{...e})}let a=t.nodeStyles.get(e);return a&&(n=n?{...n,...a}:{...a}),n}function Ee(e){if(e)return/^-?[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e)?e:void 0}var De=`JetBrains Mono NL`,Oe=`@font-face {
|
|
7
7
|
font-family: 'JetBrains Mono NL';
|
|
8
8
|
font-style: normal;
|
|
9
9
|
font-weight: 400;
|