2026-08-12 16:54:48 +08:00

2 lines
42 KiB
JavaScript

!function(t,e){"use strict";const n=Math.random().toString(36).slice(2,8);let i=0;function r(){}function a(t,e){const n=(t,i)=>e(t,()=>{var e;return null==(e=t.children)?void 0:e.map(e=>n(e,t))},i);return n(t)}function o(){const t={};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t}function l(t){return t.replace(/<[^>]*>/g,"").replace(/&#x([0-9a-fA-F]+);/g,(t,e)=>String.fromCodePoint(parseInt(e,16))).replace(/&#(\d+);/g,(t,e)=>String.fromCodePoint(Number(e))).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").trim()}
/*! @gera2ld/jsx-dom v2.2.2 | ISC License */const s="http://www.w3.org/1999/xlink",c={show:s,actuate:s,href:s};function h(t,e,...n){return function(t,e){let n;if("string"==typeof t)n=1;else{if("function"!=typeof t)throw new Error("Invalid VNode type");n=2}return{vtype:n,type:t,props:e}}(t,e=Object.assign({},e,{children:1===n.length?n[0]:n}))}function d(t){return t.children}const u={isSvg:!1};function p(t,e){Array.isArray(e)||(e=[e]),(e=e.filter(Boolean)).length&&t.append(...e)}const g={className:"class",labelFor:"for"};function f(t,e,n,i){if(e=g[e]||e,!0===n)t.setAttribute(e,"");else if(!1===n)t.removeAttribute(e);else{const r=i?c[e]:void 0;void 0!==r?t.setAttributeNS(r,e,n):t.setAttribute(e,n)}}function m(t,e){return Array.isArray(t)?t.map(t=>m(t,e)).reduce((t,e)=>t.concat(e),[]):y(t,e)}function y(t,e=u){if(null==t||"boolean"==typeof t)return null;if(t instanceof Node)return t;if(2===(null==(n=t)?void 0:n.vtype)){const{type:n,props:i}=t;if(n===d){const t=document.createDocumentFragment();if(i.children){p(t,m(i.children,e))}return t}return y(n(i),e)}var n;if((t=>"string"==typeof t||"number"==typeof t)(t))return document.createTextNode(`${t}`);if((t=>1===(null==t?void 0:t.vtype))(t)){let n;const{type:i,props:r}=t;if(e.isSvg||"svg"!==i||(e=Object.assign({},e,{isSvg:!0})),n=e.isSvg?document.createElementNS("http://www.w3.org/2000/svg",i):document.createElement(i),function(t,e,n){for(const i in e)if("key"!==i&&"children"!==i&&"ref"!==i)if("dangerouslySetInnerHTML"===i)t.innerHTML=e[i].__html;else if("innerHTML"===i||"textContent"===i||"innerText"===i||"value"===i&&["textarea","select"].includes(t.tagName)){const n=e[i];null!=n&&(t[i]=n)}else i.startsWith("on")?t[i.toLowerCase()]=e[i]:f(t,i,e[i],n.isSvg)}(n,r,e),r.children){let t=e;e.isSvg&&"foreignObject"===i&&(t=Object.assign({},t,{isSvg:!1}));const a=m(r.children,t);null!=a&&p(n,a)}const{ref:a}=r;return"function"==typeof a&&a(n),n}throw new Error("mount: Invalid Vnode!")}function v(...t){return y(h(...t))}const x=function(t){const e={};return function(...n){const i=`${n[0]}`;let r=e[i];return r||(r={value:t(...n)},e[i]=r),r.value}}(t=>{document.head.append(v("link",{rel:"preload",as:"script",href:t}))}),k={},b={};async function w(t,e){var n;const i="script"===t.type&&(null==(n=t.data)?void 0:n.src)||"";if(t.loaded||(t.loaded=k[i]),!t.loaded){const n=o();if(t.loaded=n.promise,"script"===t.type&&(document.head.append(v("script",{...t.data,onLoad:()=>n.resolve(),onError:n.reject})),i?k[i]=t.loaded:n.resolve()),"iife"===t.type){const{fn:i,getParams:r}=t.data;i(...(null==r?void 0:r(e))||[]),n.resolve()}}await t.loaded}const S="undefined"!=typeof navigator&&navigator.userAgent.includes("Macintosh"),z=e.scaleOrdinal(e.schemeCategory10),C=(t=1,e=3,n=2)=>i=>t+e/n**i.state.depth,E={autoFit:!1,direction:"right",duration:500,embedGlobalCSS:!0,fitRatio:.95,maxInitialScale:2,scrollForPan:S,initialExpandLevel:-1,zoom:!0,pan:!0,toggleRecursively:!1,color:t=>{var e;return z(`${(null==(e=t.state)?void 0:e.path)||""}`)},lineWidth:C(),maxWidth:0,nodeMinHeight:16,paddingX:8,spacingHorizontal:80,spacingVertical:5,theme:void 0};function $(t,n){const i=e.color(t);if(!i)return t;const r=e.rgb(i);return r.r=r.r+(255-r.r)*n,r.g=r.g+(255-r.g)*n,r.b=r.b+(255-r.b)*n,r.formatHex()}function X(t){const n=e.color(t);if(!n)return!1;const{r:i,g:r,b:a}=e.rgb(n);return(.299*i+.587*r+.114*a)/255<.75}function A(t,e){return X(t)?{stroke:"#fff",fillOpen:"rgba(255,255,255,0.5)",fillClosed:"#fff"}:{stroke:e,fillOpen:"#fff",fillClosed:e}}const _=t=>({stroke:t,fillOpen:"#fff",fillClosed:t});function P(t){const n=(t,n)=>"lighten"===n.fn?$(t,n.amount):function(t,n){const i=e.color(t);if(!i)return t;const r=e.rgb(i);return r.r=r.r*(1-n),r.g=r.g*(1-n),r.b=r.b*(1-n),r.formatHex()}(t,n.amount);return(e,i)=>{if(1===e)return{background:{fill:i,rx:t.rootRx??"capsule",ry:t.rootRx??"capsule",paddingX:10,paddingY:6,borderWidth:1.5,borderColor:n(i,t.borderAdjust[0])},font:{size:20,weight:700,color:X(i)?"#fff":"#333"},circle:A(i,i),line:null,filter:"url(#mm-shadow)"};if(2===e){const e=$(i,t.bgLighten[0]);return{background:{fill:e,rx:6,ry:6,paddingX:5,paddingY:3,borderWidth:1,borderColor:n(i,t.borderAdjust[1])},font:{size:16,weight:600,color:X(e)?"#fff":""},circle:A(e,i),line:null,filter:null}}if(3===e){const e=$(i,t.bgLighten[1]);return{background:{fill:e,rx:4,ry:4,paddingX:4,paddingY:2,borderWidth:.5,borderColor:n(i,t.borderAdjust[2])},font:{size:14,weight:400,color:X(e)?"#eee":""},circle:A(e,i),line:null,filter:null}}return{background:null,font:{size:13,weight:400,color:t.leafFontColor||""},circle:t.leafCircle?t.leafCircle(i):_(i),line:{color:i},filter:null}}}const j={classic:{name:"classic",colors:[],nodeStyle:(t,e)=>({background:null,font:{size:16,weight:300,color:""},circle:_(e),line:{color:e},filter:null}),linkStyle:"classic",hoverDim:!1},soft:{name:"soft",colors:["#5ba4cf","#8cc152","#f6a623","#b07cd8","#f5a563","#4fc1a6","#eb6f92","#6fa3d9","#a8d86e","#f0c75e"],spacingVertical:8,nodeStyle:P({bgLighten:[.82,.91],borderAdjust:[{fn:"darken",amount:.15},{fn:"lighten",amount:.45},{fn:"lighten",amount:.65}]}),linkStyle:.85,hoverDim:!0,lineWidth:[1.5,5,2]},dark:{name:"dark",colors:["#61afef","#98c379","#e5c07b","#c678dd","#e06c75","#56b6c2","#d19a66","#be5046","#abb2bf","#528bff"],spacingVertical:8,canvasColor:"#1e1e2e",nodeStyle:P({bgLighten:[.25,.15],borderAdjust:[{fn:"lighten",amount:.3},{fn:"lighten",amount:.4},{fn:"lighten",amount:.3}],leafFontColor:"#ddd",leafCircle:t=>({stroke:$(t,.3),fillOpen:"#2a2a3e",fillClosed:$(t,.3)})}),linkStyle:.85,hoverDim:!0,lineWidth:[1.5,5,2]},forest:{name:"forest",colors:["#2d6a4f","#40916c","#52b788","#74c69d","#95d5b2","#3a7d5e","#479f76","#5ebd96"],spacingVertical:8,nodeStyle:P({bgLighten:[.78,.88],borderAdjust:[{fn:"darken",amount:.2},{fn:"lighten",amount:.35},{fn:"lighten",amount:.55}]}),linkStyle:.85,hoverDim:!0,lineWidth:[1.5,5,2]},monochrome:{name:"monochrome",colors:["#374151","#4b5563","#6b7280","#9ca3af"],spacingVertical:8,linkColor:"#999",nodeStyle:P({bgLighten:[.83,.91],borderAdjust:[{fn:"darken",amount:.2},{fn:"lighten",amount:.45},{fn:"lighten",amount:.65}]}),linkStyle:.3,hoverDim:!1},minimal:{name:"minimal",colors:["#4a5568","#718096","#a0aec0","#636e7c","#8895a7"],spacingVertical:6,linkColor:"#cbd5e0",nodeStyle:(t,e)=>({background:null,font:{1:{size:22,weight:700,color:"#2d3748"},2:{size:16,weight:600,color:"#4a5568"},3:{size:14,weight:400,color:"#718096"}}[t]||{size:13,weight:400,color:"#a0aec0"},circle:{stroke:e,fillOpen:"#fff",fillClosed:e},line:1===t?null:{color:"#e2e8f0"},filter:null}),linkStyle:.4,hoverDim:!0,lineWidth:[1,2.5,2]}};function O(t){return j[t]}function R(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return(e>>>0).toString(36)}function T(t){if("string"==typeof t){const e=t;t=t=>t.matches(e)}const e=t;return function(){let t=Array.from(this.childNodes);return e&&(t=t.filter(t=>e(t))),t}}function M(t){var e=0,n=t.children,i=n&&n.length;if(i)for(;--i>=0;)e+=n[i].value;else e=1;t.value=e}function D(t,e){var n,i,r,a,o,l=new B(t),s=+t.value&&(l.value=t.value),c=[l];for(null==e&&(e=H);n=c.pop();)if(s&&(n.value=+n.data.value),(r=e(n.data))&&(o=r.length))for(n.children=new Array(o),a=o-1;a>=0;--a)c.push(i=n.children[a]=new B(r[a])),i.parent=n,i.depth=n.depth+1;return l.eachBefore(L)}function H(t){return t.children}function W(t){t.data=t.data.data}function L(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function B(t){this.data=t,this.depth=this.height=0,this.parent=null}B.prototype=D.prototype={constructor:B,count:function(){return this.eachAfter(M)},each:function(t){var e,n,i,r,a=this,o=[a];do{for(e=o.reverse(),o=[];a=e.pop();)if(t(a),n=a.children)for(i=0,r=n.length;i<r;++i)o.push(n[i])}while(o.length);return this},eachAfter:function(t){for(var e,n,i,r=this,a=[r],o=[];r=a.pop();)if(o.push(r),e=r.children)for(n=0,i=e.length;n<i;++n)a.push(e[n]);for(;r=o.pop();)t(r);return this},eachBefore:function(t){for(var e,n,i=this,r=[i];i=r.pop();)if(t(i),e=i.children)for(n=e.length-1;n>=0;--n)r.push(e[n]);return this},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;t=n.pop(),e=i.pop();for(;t===e;)r=t,t=n.pop(),e=i.pop();return r}(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return D(this).eachBefore(W)}};const V={version:"2.1.2"},{version:Y}=V,N=Object.freeze({children:t=>t.children,nodeSize:t=>t.data.size,spacing:0});function F(t){const e=Object.assign({},N,t);function n(t){const n=e[t];return"function"==typeof n?n:()=>n}function i(t){const e=a(function(){const t=r(),e=n("nodeSize"),i=n("spacing");return class extends t{constructor(t){super(t),Object.assign(this,{x:0,y:0,relX:0,prelim:0,shift:0,change:0,lExt:this,lExtRelX:0,lThr:null,rExt:this,rExtRelX:0,rThr:null})}get size(){return e(this.data)}spacing(t){return i(this.data,t.data)}get x(){return this.data.x}set x(t){this.data.x=t}get y(){return this.data.y}set y(t){this.data.y=t}update(){return I(this),Z(this),this}}}(),t,t=>t.children);return e.update(),e.data}function r(){const t=n("nodeSize"),e=n("spacing");return class n extends D.prototype.constructor{constructor(t){super(t)}copy(){const t=a(this.constructor,this,t=>t.children);return t.each(t=>t.data=t.data.data),t}get size(){return t(this)}spacing(t){return e(this,t)}get nodes(){return this.descendants()}get xSize(){return this.size[0]}get ySize(){return this.size[1]}get top(){return this.y}get bottom(){return this.y+this.ySize}get left(){return this.x-this.xSize/2}get right(){return this.x+this.xSize/2}get root(){const t=this.ancestors();return t[t.length-1]}get numChildren(){return this.hasChildren?this.children.length:0}get hasChildren(){return!this.noChildren}get noChildren(){return null===this.children}get firstChild(){return this.hasChildren?this.children[0]:null}get lastChild(){return this.hasChildren?this.children[this.numChildren-1]:null}get extents(){return(this.children||[]).reduce((t,e)=>n.maxExtents(t,e.extents),this.nodeExtents)}get nodeExtents(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}static maxExtents(t,e){return{top:Math.min(t.top,e.top),bottom:Math.max(t.bottom,e.bottom),left:Math.min(t.left,e.left),right:Math.max(t.right,e.right)}}}}function a(t,e,n){const i=(e,r)=>{const a=new t(e);Object.assign(a,{parent:r,depth:null===r?0:r.depth+1,height:0,length:1});const o=n(e)||[];return a.children=0===o.length?null:o.map(t=>i(t,a)),a.children&&Object.assign(a,a.children.reduce((t,e)=>({height:Math.max(t.height,e.height+1),length:t.length+e.length}),a)),a};return i(e,null)}return Object.assign(i,{nodeSize(t){return arguments.length?(e.nodeSize=t,i):e.nodeSize},spacing(t){return arguments.length?(e.spacing=t,i):e.spacing},children(t){return arguments.length?(e.children=t,i):e.children},hierarchy(t,n){const i=void 0===n?e.children:n;return a(r(),t,i)},dump(t){const e=n("nodeSize"),i=t=>n=>{const r=t+" ",a=t+" ",{x:o,y:l}=n,s=e(n),c=n.children||[],h=0===c.length?" ":`,${r}children: [${a}${c.map(i(a)).join(a)}${r}],${t}`;return`{ size: [${s.join(", ")}],${r}x: ${o}, y: ${l}${h}},`};return i("\n")(t)}}),i}F.version=Y;const I=(t,e=0)=>(t.y=e,(t.children||[]).reduce((e,n)=>{const[i,r]=e;I(n,t.y+t.ySize);const a=(0===i?n.lExt:n.rExt).bottom;0!==i&&q(t,i,r);return[i+1,it(a,i,r)]},[0,null]),K(t),nt(t),t),Z=(t,e,n)=>{void 0===e&&(e=-t.relX-t.prelim,n=0);const i=e+t.relX;return t.relX=i+t.prelim-n,t.prelim=0,t.x=n+t.relX,(t.children||[]).forEach(e=>Z(e,i,t.x)),t},K=t=>{(t.children||[]).reduce((t,e)=>{const[n,i]=t,r=n+e.shift,a=i+r+e.change;return e.relX+=a,[r,a]},[0,0])},q=(t,e,n)=>{const i=t.children[e-1],r=t.children[e];let a=i,o=i.relX,l=r,s=r.relX,c=!0;for(;a&&l;){a.bottom>n.lowY&&(n=n.next);const i=o+a.prelim-(s+l.prelim)+a.xSize/2+l.xSize/2+a.spacing(l);(i>0||i<0&&c)&&(s+=i,G(r,i),J(t,e,n.index,i)),c=!1;const h=a.bottom,d=l.bottom;h<=d&&(a=U(a),a&&(o+=a.relX)),h>=d&&(l=Q(l),l&&(s+=l.relX))}!a&&l?tt(t,e,l,s):a&&!l&&et(t,e,a,o)},G=(t,e)=>{t.relX+=e,t.lExtRelX+=e,t.rExtRelX+=e},J=(t,e,n,i)=>{const r=t.children[e],a=e-n;if(a>1){const e=i/a;t.children[n+1].shift+=e,r.shift-=e,r.change-=i-e}},Q=t=>t.hasChildren?t.firstChild:t.lThr,U=t=>t.hasChildren?t.lastChild:t.rThr,tt=(t,e,n,i)=>{const r=t.firstChild,a=r.lExt,o=t.children[e];a.lThr=n;const l=i-n.relX-r.lExtRelX;a.relX+=l,a.prelim-=l,r.lExt=o.lExt,r.lExtRelX=o.lExtRelX},et=(t,e,n,i)=>{const r=t.children[e],a=r.rExt,o=t.children[e-1];a.rThr=n;const l=i-n.relX-r.rExtRelX;a.relX+=l,a.prelim-=l,r.rExt=o.rExt,r.rExtRelX=o.rExtRelX},nt=t=>{if(t.hasChildren){const e=t.firstChild,n=t.lastChild,i=(e.prelim+e.relX-e.xSize/2+n.relX+n.prelim+n.xSize/2)/2;Object.assign(t,{prelim:i,lExt:e.lExt,lExtRelX:e.lExtRelX,rExt:n.rExt,rExtRelX:n.rExtRelX})}},it=(t,e,n)=>{for(;null!==n&&t>=n.lowY;)n=n.next;return{lowY:t,index:e,next:n}},rt={isHorizontal:!0,nodeSize:(t,e,n,i)=>[e,t+(t?2*n:0)+i],mapRect:(t,e,n,i,r)=>({x:e,y:t-n/2,width:i-r,height:n}),linkShape:e.linkHorizontal(),linkSourcePoint:(t,e)=>[t.x+t.width,t.y+t.height+e/2],linkTargetPoint:(t,e)=>[t.x,t.y+t.height+e/2],animationOrigin:t=>({x:t.x+t.width,y:t.y+t.height}),animationEnterTranslate:(t,e)=>({x:t.x+t.width-e.width,y:t.y+t.height-e.height}),animationExitTranslate:(t,e)=>({x:t.x+t.width-e.width,y:t.y+t.height-e.height}),linePosition:(t,e,n)=>({x1:-1,y1:e+n/2,x2:t+2,y2:e+n/2}),lineEnterPosition:t=>({x1:t,y1:0,x2:t,y2:0}),circlePosition:(t,e,n)=>({cx:t,cy:e+n/2}),foreignObjectPosition:t=>({x:t,y:0}),getSpacingDepth:t=>t,getSpacingBreadth:(t,e)=>e},at={isHorizontal:!0,nodeSize:(t,e,n,i)=>[e,t+(t?2*n:0)+i],mapRect:(t,e,n,i,r)=>({x:-(e+i-r),y:t-n/2,width:i-r,height:n}),linkShape:e.linkHorizontal(),linkSourcePoint:(t,e)=>[t.x,t.y+t.height+e/2],linkTargetPoint:(t,e)=>[t.x+t.width,t.y+t.height+e/2],animationOrigin:t=>({x:t.x,y:t.y+t.height}),animationEnterTranslate:(t,e)=>({x:t.x,y:t.y+t.height-e.height}),animationExitTranslate:(t,e)=>({x:t.x,y:t.y+t.height-e.height}),linePosition:(t,e,n)=>({x1:-1,y1:e+n/2,x2:t+2,y2:e+n/2}),lineEnterPosition:()=>({x1:0,y1:0,x2:0,y2:0}),circlePosition:(t,e,n)=>({cx:0,cy:e+n/2}),foreignObjectPosition:t=>({x:t,y:0}),getSpacingDepth:t=>t,getSpacingBreadth:(t,e)=>e},ot={isHorizontal:!1,nodeSize:(t,e,n,i)=>[t+(t?2*n:0),e+i],mapRect:(t,e,n,i,r)=>({x:t-n/2,y:e,width:n,height:i-r}),linkShape:e.linkVertical(),linkSourcePoint:(t,e)=>[t.x+t.width/2,t.y+t.height+e/2],linkTargetPoint:t=>[t.x+t.width/2,t.y],animationOrigin:t=>({x:t.x+t.width/2,y:t.y+t.height}),animationEnterTranslate:(t,e)=>({x:t.x+t.width/2-e.width/2,y:t.y+t.height}),animationExitTranslate:(t,e)=>({x:t.x+t.width/2-e.width/2,y:t.y+t.height}),linePosition:(t,e,n)=>({x1:-1,y1:e+n/2,x2:t+2,y2:e+n/2}),lineEnterPosition:t=>({x1:t/2,y1:0,x2:t/2,y2:0}),circlePosition:(t,e,n)=>({cx:t/2,cy:e+n/2}),foreignObjectPosition:t=>({x:t,y:0}),getSpacingDepth:t=>t,getSpacingBreadth:(t,e)=>e},lt={right:rt,left:at,down:ot,balanced:rt};function st(t,e,n,i,r,a=.85){if(t[0]===e[0]&&t[1]===e[1])return`M${t[0]},${t[1]}Z`;const o=n/2,l=i*(1-a)/2,s=.5-.15*a,c=.5+.25*a;if(r){const[n,i]=t,[r,a]=e,h=r-n,d=n+h*s,u=n+h*c;return[`M${n},${i-o}`,`C${d},${i-o} ${u},${a-l} ${r},${a-l}`,`L${r},${a+l}`,`C${u},${a+l} ${d},${i+o} ${n},${i+o}`,"Z"].join(" ")}const[h,d]=t,[u,p]=e,g=p-d,f=d+g*s,m=d+g*c;return[`M${h-o},${d}`,`C${h-o},${f} ${u-l},${m} ${u-l},${p}`,`L${u+l},${p}`,`C${u+l},${m} ${h+o},${f} ${h+o},${d}`,"Z"].join(" ")}const ct=".markmap {\n --markmap-max-width: 9999px;\n --markmap-a-color: #0097e6;\n --markmap-a-hover-color: #00a8ff;\n --markmap-code-bg: #f0f0f0;\n --markmap-code-color: #555;\n --markmap-highlight-bg: #ffeaa7;\n --markmap-table-border: 1px solid currentColor;\n --markmap-font: 300 16px/20px sans-serif;\n --markmap-circle-open-bg: #fff;\n --markmap-text-color: #333;\n --markmap-highlight-node-bg: #ff02;\n\n font: var(--markmap-font);\n color: var(--markmap-text-color);\n}\n\n .markmap-link {\n fill: none;\n }\n\n .markmap-node > circle {\n cursor: pointer;\n }\n\n .markmap-foreign {\n display: inline-block;\n }\n\n .markmap-foreign p {\n margin: 0;\n }\n\n .markmap-foreign a {\n color: var(--markmap-a-color);\n }\n\n .markmap-foreign a:hover {\n color: var(--markmap-a-hover-color);\n }\n\n .markmap-foreign code {\n padding: 0.25em;\n font-size: calc(1em - 2px);\n color: var(--markmap-code-color);\n background-color: var(--markmap-code-bg);\n border-radius: 2px;\n }\n\n .markmap-foreign pre {\n margin: 0;\n }\n\n .markmap-foreign pre > code {\n display: block;\n }\n\n .markmap-foreign del {\n text-decoration: line-through;\n }\n\n .markmap-foreign em {\n font-style: italic;\n }\n\n .markmap-foreign strong {\n font-weight: bold;\n }\n\n .markmap-foreign mark {\n background: var(--markmap-highlight-bg);\n }\n\n .markmap-foreign table,\n .markmap-foreign th,\n .markmap-foreign td {\n border-collapse: collapse;\n border: var(--markmap-table-border);\n }\n\n .markmap-foreign img {\n display: inline-block;\n }\n\n .markmap-foreign svg {\n fill: currentColor;\n }\n\n .markmap-foreign > div {\n width: var(--markmap-max-width);\n text-align: left;\n }\n\n .markmap-foreign > div > div {\n display: inline-block;\n }\n\n .markmap-highlight rect {\n fill: var(--markmap-highlight-node-bg);\n }\n\n.markmap-dark .markmap {\n --markmap-code-bg: #1a1b26;\n --markmap-code-color: #ddd;\n --markmap-circle-open-bg: #444;\n --markmap-text-color: #eee;\n}\n\n.markmap-node-bg {\n pointer-events: none;\n}\n\n.markmap-hover-active .markmap-node,\n.markmap-hover-active .markmap-link {\n opacity: 0.3;\n transition: opacity 0.2s ease;\n}\n\n.markmap-hover-active .markmap-node.markmap-hover-target,\n.markmap-hover-active .markmap-link.markmap-hover-target {\n opacity: 1;\n transition: opacity 0.2s ease;\n}\n\n.markmap-boundary rect {\n fill: rgba(100, 149, 237, 0.08);\n stroke: rgba(100, 149, 237, 0.3);\n stroke-width: 1.5;\n stroke-dasharray: 6 3;\n pointer-events: none;\n}\n\n.markmap-boundary text {\n font-size: 12px;\n font-weight: 600;\n fill: rgba(100, 149, 237, 0.7);\n}\n\n.markmap-icon {\n fill: initial;\n}\n\n.markmap-relation path {\n fill: none;\n stroke: #f59e0b;\n stroke-width: 1.5;\n stroke-dasharray: 5 3;\n pointer-events: none;\n}\n\n.markmap-relation-label-bg {\n fill: #fffbeb;\n stroke: none;\n}\n\n.markmap-relation text {\n font-size: 11px;\n fill: #b45309;\n text-anchor: middle;\n}\n",ht=ct,dt="g.markmap-node",ut="path.markmap-link";function pt(t,n){return t[e.minIndex(t,n)]}function gt(t){t.stopPropagation()}const ft=new class{constructor(){this.listeners=[]}tap(t){return this.listeners.push(t),()=>this.revoke(t)}revoke(t){const e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}revokeAll(){this.listeners.splice(0)}call(...t){for(const e of this.listeners)e(...t)}};class mt{constructor(t,r){this.options={...E},this._nodeDirectionMap={},this._relations=[],this._disposeList=[],this.handleZoom=t=>{const{transform:e}=t;this.g.attr("transform",e)},this.handlePan=t=>{t.preventDefault();const n=e.zoomTransform(this.svg.node()),i=n.translate(-t.deltaX/n.k,-t.deltaY/n.k);this.svg.call(this.zoom.transform,i)},this.handleClick=(t,e)=>{let n=this.options.toggleRecursively;(S?t.metaKey:t.ctrlKey)&&(n=!n),this.toggleNode(e,n)},this.ensureView=this.ensureVisible,this.svg=t.datum?t:e.select(t),this.styleNode=this.svg.append("style"),this.zoom=e.zoom().filter(t=>this.options.scrollForPan&&"wheel"===t.type?t.ctrlKey&&!t.button:!(t.ctrlKey&&"wheel"!==t.type||t.button)).on("zoom",this.handleZoom),this.setOptions(r),this.state={id:this.options.id||this.svg.attr("id")||(i+=1,`mm-${n}-${i}`),rect:{x1:0,y1:0,x2:0,y2:0}},this.g=this.svg.append("g"),this.g.append("g").attr("class","markmap-highlight"),this._observer=new ResizeObserver(function(t,e){const n={timer:0};function i(){n.timer&&(window.clearTimeout(n.timer),n.timer=0)}function r(){i(),n.args&&(n.result=t(...n.args))}return function(...t){return i(),n.args=t,n.timer=window.setTimeout(r,e),n.result}}(()=>{this.renderData()},100)),this._disposeList.push(ft.tap(()=>{this.setData()}),()=>this._observer.disconnect())}getStyleContent(){const{style:t}=this.options,{id:e}=this.state,n="function"==typeof t?t(e):"";return[this.options.embedGlobalCSS&&ct,n].filter(Boolean).join("\n")}updateStyle(){this.svg.attr("class",function(t,...e){const n=(t||"").split(" ").filter(Boolean);return e.forEach(t=>{t&&n.indexOf(t)<0&&n.push(t)}),n.join(" ")}(this.svg.attr("class"),"markmap",this.state.id));const t=this.getStyleContent();this.styleNode.text(t)}async toggleNode(t,e=!1){var n,i;const r=(null==(n=t.payload)?void 0:n.fold)?0:1;e?a(t,(t,e)=>{t.payload={...t.payload,fold:r},e()}):t.payload={...t.payload,fold:(null==(i=t.payload)?void 0:i.fold)?0:1},await this.renderData(t)}async _toggleBalancedSide(t,e){var n;const i="left"===e?"foldLeft":"foldRight";t.payload={...t.payload,[i]:(null==(n=t.payload)?void 0:n[i])?0:1},await this.renderData(t)}_initializeData(t){let e=0;const{color:n,initialExpandLevel:i}=this.options;let r=0,o=0;return a(t,(t,a,l)=>{var s,c,h,d;o+=1,t.children=null==(s=t.children)?void 0:s.map(t=>({...t})),e+=1,t.state={...t.state,depth:o,id:e,rect:{x:0,y:0,width:0,height:0},size:[0,0]},t.state.key=[null==(c=null==l?void 0:l.state)?void 0:c.id,t.state.id].filter(Boolean).join(".")+R(t.content),t.state.path=[null==(h=null==l?void 0:l.state)?void 0:h.path,t.state.id].filter(Boolean).join("."),n(t);const u=2===(null==(d=t.payload)?void 0:d.fold);u?r+=1:(r||i>=0&&t.state.depth>=i)&&(t.payload={...t.payload,fold:1}),a(),u&&(r-=1),o-=1}),t}_measureSizes(){this.g.selectAll(T(dt)).selectAll(T("foreignObject")).each(function(t){var e;const n=null==(e=this.firstChild)?void 0:e.firstChild,i=[n.scrollWidth,n.scrollHeight];t.state.size=i})}_layoutTree(t,e){const{lineWidth:n,paddingX:i,spacingHorizontal:r,spacingVertical:a,theme:o}=this.options,l=(null==o?void 0:o.spacingVertical)??a,s=(null==o?void 0:o.spacingHorizontal)??r,c=e.getSpacingDepth(s,l),h=e.getSpacingBreadth(s,l),d=F({}).children(t=>{var e;if(!(null==(e=t.payload)?void 0:e.fold))return t.children}).nodeSize(t=>{const[n,r]=t.data.state.size;return e.nodeSize(n,r,i,c)}).spacing((t,e)=>(t.parent===e.parent?h:2*h)+n(t.data)),u=d.hierarchy(t);d(u);const p=u.descendants();return p.forEach(t=>{t.data.state.rect=e.mapRect(t.x,t.y,t.xSize,t.ySize,c)}),p}_updateStateRect(t){this.state.rect={x1:e.min(t,t=>t.state.rect.x)||0,y1:e.min(t,t=>t.state.rect.y)||0,x2:e.max(t,t=>t.state.rect.x+t.state.rect.width)||0,y2:e.max(t,t=>t.state.rect.y+t.state.rect.height)||0}}_relayout(){if(!this.state.data)return;if(this._measureSizes(),this._nodeDirectionMap={},"balanced"===this.options.direction)return void this._relayoutBalanced();const t=this._dirHelper,e=this._layoutTree(this.state.data,t);this._updateStateRect(e.map(t=>t.data))}_relayoutBalanced(){var t,e,n,i,r;const o=this.state.data,l=(null==(t=o.payload)?void 0:t.fold)?[]:o.children||[],s=Math.ceil(l.length/2),c=(null==(e=o.payload)?void 0:e.foldRight)?[]:l.slice(0,s),h=(null==(n=o.payload)?void 0:n.foldLeft)?[]:l.slice(s),d={...o,children:c},u=this._layoutTree(d,rt),p={...d.state.rect},g=u.map(t=>t.data);for(const t of g)this._nodeDirectionMap[t.state.id]=rt;if(h.length>0){const t={...o,children:h},e=this._layoutTree(t,at).map(t=>t.data);for(const t of e)t.state.id!==o.state.id&&(this._nodeDirectionMap[t.state.id]=at)}o.state.rect=p,this._nodeDirectionMap[o.state.id]=rt;const f=new Set;(null==(i=o.payload)?void 0:i.foldRight)&&l.slice(0,s).forEach(t=>f.add(t.state.id)),(null==(r=o.payload)?void 0:r.foldLeft)&&l.slice(s).forEach(t=>f.add(t.state.id));const m=[];a(o,(t,e)=>{var n;f.has(t.state.id)||(m.push(t),(null==(n=t.payload)?void 0:n.fold)||e())}),this._updateStateRect(m)}setOptions(t){this.options={...this.options,...t},this._dirHelper=function(t="right"){return lt[t]||lt.right}(this.options.direction),this.options.zoom?this.svg.call(this.zoom):this.svg.on(".zoom",null),this.options.pan?this.svg.on("wheel",this.handlePan):this.svg.on("wheel",null)}async setData(t,e,n){e&&this.setOptions(e),n&&(this._relations=n),t&&(this.state.data=this._initializeData(t)),this.state.data&&(this.updateStyle(),this._updateDefs(),this._updateCanvas(),await this.renderData())}_updateCanvas(){var t;const e=null==(t=this.options.theme)?void 0:t.canvasColor;this.svg.style("background",e||null)}_updateDefs(){this.svg.select("defs.markmap-defs").remove();const{theme:t}=this.options;if(!t)return;this.svg.append("defs").attr("class","markmap-defs").append("filter").attr("id","mm-shadow").attr("x","-20%").attr("y","-20%").attr("width","140%").attr("height","140%").append("feDropShadow").attr("dx","0").attr("dy","2").attr("stdDeviation","3").attr("flood-opacity","0.15").attr("flood-color","#000")}async setHighlight(t){this.state.highlight=t||void 0,await this.renderData()}_getHighlightRect(t){const n=this.svg.node(),i=4/e.zoomTransform(n).k,r={...t.state.rect};return r.x-=i,r.y-=i,r.width+=2*i,r.height+=2*i,r}async renderData(t){var n,i,r;const{paddingX:o,autoFit:s,color:c,maxWidth:h,lineWidth:d,theme:u}=this.options,p=this._dirHelper,g=this._nodeDirectionMap,f=t=>g[t.state.id]||p,m=this.state.data;if(!m)return;const y={},v=t=>{if(!u)return null;if(y[t.state.id])return y[t.state.id];const e=u.nodeStyle(t.state.depth,c(t));return y[t.state.id]=e,e},x="balanced"===this.options.direction,k=(t,e)=>{const n=v(t);if(null==n?void 0:n.background){const{rect:i}=t.state,r=n.background;if(e.isHorizontal){const n=e.linkSourcePoint(i,d(t)),a=i.x+i.width/2;return n[0]+=n[0]>a?r.paddingX:-r.paddingX,n[1]=i.y+i.height/2,n}return[i.x+i.width/2,i.y+i.height+r.paddingY]}return e.linkSourcePoint(t.state.rect,d(t))},b=(t,e)=>{const n=v(t);if(null==n?void 0:n.background){const{rect:i}=t.state,r=n.background;if(e.isHorizontal){const n=e.linkTargetPoint(i,d(t)),a=i.x+i.width/2;return n[0]+=n[0]<a?-r.paddingX:r.paddingX,n[1]=i.y+i.height/2,n}return[i.x+i.width/2,i.y-r.paddingY]}return e.linkTargetPoint(t.state.rect,d(t))};let w=null,S=null;if(x&&(null==(n=m.children)?void 0:n.length)){const t=Math.ceil(m.children.length/2);(null==(i=m.payload)?void 0:i.foldRight)&&(S=new Set(m.children.slice(0,t).map(t=>t.state.id))),(null==(r=m.payload)?void 0:r.foldLeft)&&(w=new Set(m.children.slice(t).map(t=>t.state.id)))}const z={},C={},E=[];a(m,(t,e,n)=>{var i;(null==S?void 0:S.has(t.state.id))||(null==w?void 0:w.has(t.state.id))||((null==(i=t.payload)?void 0:i.fold)||e(),z[t.state.id]=t,n&&(C[t.state.id]=n.state.id),E.push(t))});const $={},X={},A=t=>{t&&!$[t.state.id]&&a(t,(e,n)=>{$[e.state.id]=t.state.id,n()})},_=t=>X[$[t.state.id]]||m.state.rect,P=t=>(z[$[t.state.id]]||m).state.rect;X[m.state.id]=m.state.rect,t&&A(t);let{highlight:j}=this.state;j&&!z[j.state.id]&&(j=void 0);let O=this.g.selectAll(T("g.markmap-highlight")).selectAll(T("rect")).data(j?[this._getHighlightRect(j)]:[]).join("rect").attr("x",t=>t.x).attr("y",t=>t.y).attr("width",t=>t.width).attr("height",t=>t.height);const R=this.g.selectAll(T(dt)).each(t=>{X[t.state.id]=t.state.rect}).data(E,t=>t.state.key),M=R.enter().append("g").attr("data-depth",t=>t.state.depth).attr("data-path",t=>t.state.path).each(t=>{A(z[C[t.state.id]])}),D=R.exit().each(t=>{A(z[C[t.state.id]])}),H=R.merge(M).attr("class",t=>{var e;return["markmap-node",(null==(e=t.payload)?void 0:e.fold)&&"markmap-fold"].filter(Boolean).join(" ")}),W=H.selectAll(T("rect.markmap-node-bg")).data(t=>{var e;return(null==(e=v(t))?void 0:e.background)?[t]:[]},t=>t.state.key),L=W.enter().insert("rect",":first-child").attr("class","markmap-node-bg").attr("opacity",0);W.exit().remove();const B=L.merge(W),V=H.selectAll(T("line")).data(t=>[t],t=>t.state.key),Y=V.enter().append("line").attr("stroke",t=>c(t)).attr("stroke-width",0),N=V.merge(Y),F=t=>"left"===t.side?at:f(t.node),I=H.selectAll(T("circle")).data(t=>{var e;return(null==(e=t.children)?void 0:e.length)?x&&1===t.state.depth?[{node:t,side:"right",key:t.state.key+"-R"},{node:t,side:"left",key:t.state.key+"-L"}]:[{node:t,key:t.state.key}]:[]},t=>t.key);I.exit().remove();const Z=I.enter().append("circle").attr("stroke-width",0).attr("r",0).on("click",(t,e)=>{e.side?this._toggleBalancedSide(e.node,e.side):this.handleClick(t,e.node)}).on("mousedown",gt).merge(I).attr("stroke",t=>{const e=v(t.node);return e?e.circle.stroke:c(t.node)}).attr("fill",t=>{const e=v(t.node),n=(t=>{var e,n,i;const{node:r}=t;return"left"===t.side?!!(null==(e=r.payload)?void 0:e.foldLeft):"right"===t.side?!!(null==(n=r.payload)?void 0:n.foldRight):!!(null==(i=r.payload)?void 0:i.fold)})(t)&&t.node.children;return e?n?e.circle.fillClosed:e.circle.fillOpen:n?c(t.node):"var(--markmap-circle-open-bg)"}),K=this._observer,q=H.selectAll(T("foreignObject")).data(t=>[t],t=>t.state.key),G=p.foreignObjectPosition(o),J=q.enter().append("foreignObject").attr("class","markmap-foreign").attr("x",G.x).attr("y",G.y).style("opacity",0).on("mousedown",gt).on("dblclick",gt);J.append("xhtml:div").append("xhtml:div").html(t=>t.content).attr("xmlns","http://www.w3.org/1999/xhtml"),J.each(function(){var t;const e=null==(t=this.firstChild)?void 0:t.firstChild;K.observe(e)});const Q=D.selectAll(T("foreignObject"));Q.each(function(){var t;const e=null==(t=this.firstChild)?void 0:t.firstChild;K.unobserve(e)});const U=J.merge(q);u&&U.each(function(t){var e;const n=v(t),i=null==(e=this.firstChild)?void 0:e.firstChild;i&&n&&(i.style.fontSize=`${n.font.size}px`,i.style.fontWeight=`${n.font.weight}`,i.style.color=n.font.color||"")});const tt=E.flatMap(t=>{var e;return(null==(e=t.payload)?void 0:e.fold)?[]:t.children.filter(t=>z[t.state.id]).map(e=>({source:t,target:e}))}),et=this.g.selectAll(T(ut)).data(tt,t=>t.target.state.key),nt=et.exit(),it=et.enter().insert("path","g").attr("class","markmap-link").attr("data-depth",t=>t.target.state.depth).attr("data-path",t=>t.target.state.path).attr("d",t=>{const e=f(t.target),n=_(t.target),i=e.animationOrigin(n),r=[i.x,i.y];return"number"==typeof(null==u?void 0:u.linkStyle)&&u.linkStyle>0?st(r,r,0,0,e.isHorizontal,u.linkStyle):e.linkShape({source:r,target:r})}).attr("stroke-width",0).style("fill-opacity",0).merge(et);this.svg.style("--markmap-max-width",h?`${h}px`:null),await new Promise(requestAnimationFrame),this._relayout(),O=O.data(j?[this._getHighlightRect(j)]:[]).join("rect"),this.transition(O).attr("x",t=>t.x).attr("y",t=>t.y).attr("width",t=>t.width).attr("height",t=>t.height),B.each(function(t){const n=v(t);if(!(null==n?void 0:n.background))return;const i=n.background,r=t.state.rect.width+2*i.paddingX,a=t.state.rect.height+2*i.paddingY,o="capsule"===i.rx?a/2:i.rx,l="capsule"===i.ry?a/2:i.ry;e.select(this).attr("x",-i.paddingX).attr("y",-i.paddingY).attr("width",r).attr("height",a).attr("rx",o).attr("ry",l).attr("fill",i.fill).attr("filter",n.filter||null).attr("stroke",i.borderWidth?i.borderColor:"none").attr("stroke-width",i.borderWidth)}),this.transition(B).attr("opacity",1),M.attr("transform",t=>{const e=_(t),n=f(t).animationEnterTranslate(e,t.state.rect);return`translate(${n.x},${n.y})`}),this.transition(D).attr("transform",t=>{const e=P(t),n=f(t).animationExitTranslate(e,t.state.rect);return`translate(${n.x},${n.y})`}).remove(),this.transition(H).attr("transform",t=>`translate(${t.state.rect.x},${t.state.rect.y})`);const rt=D.selectAll(T("line"));this.transition(rt).attr("x1",t=>f(t).lineEnterPosition(t.state.rect.width,t.state.rect.height).x1).attr("x2",t=>f(t).lineEnterPosition(t.state.rect.width,t.state.rect.height).x2).attr("stroke-width",0),Y.each(function(t){const n=f(t).lineEnterPosition(t.state.rect.width,t.state.rect.height);e.select(this).attr("x1",n.x1).attr("x2",n.x2).attr("y1",n.y1).attr("y2",n.y2)}),N.each(function(t){const n=f(t).linePosition(t.state.rect.width,t.state.rect.height,d(t));e.select(this).attr("y1",n.y1).attr("y2",n.y2)}),this.transition(N).attr("x1",t=>f(t).linePosition(t.state.rect.width,t.state.rect.height,d(t)).x1).attr("x2",t=>f(t).linePosition(t.state.rect.width,t.state.rect.height,d(t)).x2).attr("stroke",t=>{var e;const n=v(t);return(null==(e=null==n?void 0:n.line)?void 0:e.color)||c(t)}).attr("stroke-width",t=>{const e=v(t);return e&&!e.line?0:d(t)});const ot=D.selectAll(T("circle"));this.transition(ot).attr("r",0).attr("stroke-width",0),Z.attr("cx",t=>{var e;const n=F(t),{width:i,height:r}=t.node.state.rect;let a=n.circlePosition(i,r,d(t.node)).cx;const o=null==(e=v(t.node))?void 0:e.background;return o&&n.isHorizontal&&(a+=a>i/2?o.paddingX:-o.paddingX),a}).attr("cy",t=>{var e;const n=F(t),{width:i,height:r}=t.node.state.rect,a=n.circlePosition(i,r,d(t.node)),o=null==(e=v(t.node))?void 0:e.background;return o?n.isHorizontal?r/2:r+o.paddingY:a.cy}),this.transition(Z).attr("r",6).attr("stroke-width","1.5"),this.transition(Q).style("opacity",0),U.attr("width",t=>Math.max(0,t.state.rect.width-2*o)).attr("height",t=>t.state.rect.height),this.transition(U).style("opacity",1);const lt="number"==typeof(null==u?void 0:u.linkStyle)?u.linkStyle:0,ct=lt>0,ht=t=>{const e=null==u?void 0:u.linkColor;return e&&"target"!==e?"source"===e?c(t.source):e:c(t.target)};this.transition(nt).attr("d",t=>{const e=f(t.target),n=P(t.target),i=e.animationOrigin(n),r=[i.x,i.y];return ct?st(r,r,0,0,e.isHorizontal,lt):e.linkShape({source:r,target:r})}).attr("stroke-width",0).style("fill-opacity",0).remove(),ct?(it.style("fill",t=>ht(t)).style("stroke","none").attr("stroke-width",0).attr("d",t=>{const e=f(t.target);return st(k(t.source,e),b(t.target,e),d(t.source),d(t.target),e.isHorizontal,lt)}),this.transition(it).style("fill-opacity",.7)):this.transition(it).style("fill","none").style("stroke",null).attr("stroke",t=>ht(t)).attr("stroke-width",t=>d(t.target)).attr("d",t=>{const e=f(t.target),n=k(t.source,e),i=b(t.target,e);return e.linkShape({source:n,target:i})}),(null==u?void 0:u.hoverDim)?H.on("mouseenter.theme",(t,e)=>{this.g.classed("markmap-hover-active",!0);const n=e.state.path;this.g.selectAll(dt).classed("markmap-hover-target",t=>t.state.path.startsWith(n)||n.startsWith(t.state.path)),this.g.selectAll(ut).classed("markmap-hover-target",t=>t.target.state.path.startsWith(n)||n.startsWith(t.target.state.path))}).on("mouseleave.theme",()=>{this.g.classed("markmap-hover-active",!1),this.g.selectAll(".markmap-hover-target").classed("markmap-hover-target",!1)}):H.on("mouseenter.theme",null).on("mouseleave.theme",null);const pt=E.filter(t=>{var e;return null==(e=t.payload)?void 0:e.boundary}),ft=this.g.selectAll("g.markmap-boundary").data(pt,t=>t.state.key);ft.exit().remove();const mt=ft.enter().insert("g","g.markmap-node").attr("class","markmap-boundary");mt.append("rect"),mt.append("text");mt.merge(ft).each(function(t){var n;const i=null==(n=t.payload)?void 0:n.boundary;if(!i)return;const r=[];if(a(t,(t,e)=>{var n;z[t.state.id]&&(r.push(t),(null==(n=t.payload)?void 0:n.fold)||e())}),!r.length)return;const o=12,l=!!i.title,s=l?16:0,c=e.min(r,t=>{var e,n;return t.state.rect.x-((null==(n=null==(e=v(t))?void 0:e.background)?void 0:n.paddingX)||0)})||0,h=e.min(r,t=>{var e,n;return t.state.rect.y-((null==(n=null==(e=v(t))?void 0:e.background)?void 0:n.paddingY)||0)})||0,d=e.max(r,t=>{var e,n;return t.state.rect.x+t.state.rect.width+((null==(n=null==(e=v(t))?void 0:e.background)?void 0:n.paddingX)||0)})||0,u=e.max(r,t=>{var e,n;return t.state.rect.y+t.state.rect.height+((null==(n=null==(e=v(t))?void 0:e.background)?void 0:n.paddingY)||0)})||0,p=e.select(this).select("rect");p.attr("x",c-o).attr("y",h-o-s).attr("width",d-c+24).attr("height",u-h+24+s).attr("rx",8).attr("ry",8),i.color?p.style("fill",i.color).style("fill-opacity",.1).style("stroke",i.color).style("stroke-opacity",.4):p.style("fill",null).style("fill-opacity",null).style("stroke",null).style("stroke-opacity",null);const g=e.select(this).select("text");l?g.attr("x",c-o+8).attr("y",h-o-2).text(i.title).style("fill",i.color||null).style("display",null):g.style("display","none")});const yt={};for(const t of E){const e=l(t.content);e&&!yt[e]&&(yt[e]=t)}const vt=[];this._relations.forEach((t,e)=>{const n=yt[t.sourceContent],i=yt[t.targetContent];n&&i&&vt.push({source:n,target:i,label:t.label,key:`rel-${e}`})});const xt=this.g.selectAll("g.markmap-relation").data(vt,t=>t.key);xt.exit().remove();const kt=xt.enter().append("g").attr("class","markmap-relation");kt.append("path"),kt.append("rect").attr("class","markmap-relation-label-bg"),kt.append("text");const bt=kt.merge(xt),wt=E.map(t=>{var e;const n=t.state.rect,i=null==(e=v(t))?void 0:e.background,r=(null==i?void 0:i.paddingX)||0,a=(null==i?void 0:i.paddingY)||0;return{x1:n.x-r,y1:n.y-a,x2:n.x+n.width+r,y2:n.y+n.height+a}}),St=(t,e,n,i)=>{const r=1-i;return[r*r*t[0]+2*r*i*e[0]+i*i*n[0],r*r*t[1]+2*r*i*e[1]+i*i*n[1]]},zt=(t,e,n,i,r)=>{let a=0;for(let o=1;o<=8;o++){const[l,s]=St(t,e,n,o/9);for(let t=0;t<wt.length;t++){const e=E[t];if(e.state.id===i||e.state.id===r)continue;const n=wt[t];if(l>=n.x1&&l<=n.x2&&s>=n.y1&&s<=n.y2){a++;break}}}return a};bt.each(function(t){const n=t.source.state.rect,i=t.target.state.rect,r=t=>[[t.x+t.width/2,t.y],[t.x+t.width,t.y+t.height/2],[t.x+t.width/2,t.y+t.height],[t.x,t.y+t.height/2]];let a=1/0,o=[0,0],l=[0,0];for(const t of r(n))for(const e of r(i)){const n=(t[0]-e[0])**2+(t[1]-e[1])**2;n<a&&(a=n,o=t,l=e)}const s=l[0]-o[0],c=l[1]-o[1],h=Math.sqrt(s*s+c*c)||1,d=-c/h,u=s/h,p=Math.max(20,.25*h),g=[(o[0]+l[0])/2,(o[1]+l[1])/2],f=[g[0]+d*p,g[1]+u*p],m=[g[0]-d*p,g[1]-u*p],y=zt(o,f,l,t.source.state.id,t.target.state.id)<=zt(o,m,l,t.source.state.id,t.target.state.id)?f:m;e.select(this).select("path").attr("d",`M${o[0]},${o[1]} Q${y[0]},${y[1]} ${l[0]},${l[1]}`);const v=(o[0]+2*y[0]+l[0])/4,x=(o[1]+2*y[1]+l[1])/4,k=e.select(this).select("text"),b=e.select(this).select("rect.markmap-relation-label-bg");if(t.label){k.attr("x",v).attr("y",x).attr("dy","0.35em").text(t.label);const e=k.node().getBBox();b.attr("x",e.x-3).attr("y",e.y-1).attr("width",e.width+6).attr("height",e.height+2).attr("rx",3)}else k.text(""),b.attr("width",0).attr("height",0)}),s&&this.fit()}transition(t){const{duration:e}=this.options;return t.transition().duration(e)}async fit(t=this.options.maxInitialScale){const n=this.svg.node(),{width:i,height:a}=n.getBoundingClientRect(),{fitRatio:o}=this.options,{x1:l,y1:s,x2:c,y2:h}=this.state.rect,d=c-l,u=h-s,p=Math.min(i/d*o,a/u*o,t),g=e.zoomIdentity.translate((i-d*p)/2-l*p,(a-u*p)/2-s*p).scale(p);return this.transition(this.svg).call(this.zoom.transform,g).end().catch(r)}findElement(t){let e;return this.g.selectAll(T(dt)).each(function(n){n===t&&(e={data:n,g:this})}),e}async ensureVisible(t,n){var i;const a=null==(i=this.findElement(t))?void 0:i.data;if(!a)return;const o=this.svg.node(),l=o.getBoundingClientRect(),s=e.zoomTransform(o),[c,h]=[a.state.rect.x,a.state.rect.x+a.state.rect.width+2].map(t=>t*s.k+s.x),[d,u]=[a.state.rect.y,a.state.rect.y+a.state.rect.height].map(t=>t*s.k+s.y),p={left:0,right:0,top:0,bottom:0,...n},g=[p.left-c,l.width-p.right-h],f=[p.top-d,l.height-p.bottom-u],m=g[0]*g[1]>0?pt(g,Math.abs)/s.k:0,y=f[0]*f[1]>0?pt(f,Math.abs)/s.k:0;if(m||y){const t=s.translate(m,y);return this.transition(this.svg).call(this.zoom.transform,t).end().catch(r)}}async centerNode(t,n){var i;const a=null==(i=this.findElement(t))?void 0:i.data;if(!a)return;const o=this.svg.node(),l=o.getBoundingClientRect(),s=e.zoomTransform(o),c=(a.state.rect.x+a.state.rect.width/2)*s.k+s.x,h=(a.state.rect.y+a.state.rect.height/2)*s.k+s.y,d={left:0,right:0,top:0,bottom:0,...n},u=(d.left+l.width-d.right)/2,p=(d.top+l.height-d.bottom)/2,g=(u-c)/s.k,f=(p-h)/s.k;if(g||f){const t=s.translate(g,f);return this.transition(this.svg).call(this.zoom.transform,t).end().catch(r)}}async rescale(t){const n=this.svg.node(),{width:i,height:a}=n.getBoundingClientRect(),o=i/2,l=a/2,s=e.zoomTransform(n),c=s.translate((o-s.x)*(1-t)/s.k,(l-s.y)*(1-t)/s.k).scale(t);return this.transition(this.svg).call(this.zoom.transform,c).end().catch(r)}destroy(){this.svg.on(".zoom",null),this.svg.html(null),this._disposeList.forEach(t=>{t()})}static create(t,e,n=null){const i=new mt(t,e);return n&&i.setData(n).then(()=>{i.fit()}),i}}t.Markmap=mt,t.childSelector=T,t.defaultColorFn=z,t.defaultOptions=E,t.deriveOptions=function(t){const n={},i={...t},{color:r,colorFreezeLevel:a,lineWidth:o}=i;if(1===(null==r?void 0:r.length)){const t=r[0];n.color=()=>t}else if(null==r?void 0:r.length){const t=e.scaleOrdinal(r);n.color=e=>t(`${e.state.path}`)}if(a){const t=n.color||E.color;n.color=e=>(e={...e,state:{...e.state,path:e.state.path.split(".").slice(0,a).join(".")}},t(e))}if(o){const t=Array.isArray(o)?o:[o,0,1];n.lineWidth=C(...t)}if(["duration","fitRatio","initialExpandLevel","maxInitialScale","maxWidth","nodeMinHeight","paddingX","spacingHorizontal","spacingVertical"].forEach(t=>{const e=i[t];"number"==typeof e&&(n[t]=e)}),["zoom","pan"].forEach(t=>{const e=i[t];null!=e&&(n[t]=!!e)}),null!=i.direction&&(n.direction=i.direction),i.theme){let t=O(i.theme);if(t){if(null!=i.linkStyle&&(t={...t,linkStyle:i.linkStyle}),n.theme=t,t.colors.length&&!(null==r?void 0:r.length)){const i=e.scaleOrdinal(t.colors);n.color=t=>i(`${t.state.path}`)}t.lineWidth&&!o&&(n.lineWidth=C(...t.lineWidth))}}return n},t.getTheme=O,t.globalCSS=ht,t.isMacintosh=S,t.lineWidthFactory=C,t.loadCSS=async function(t){await Promise.all(t.map(t=>async function(t){const e="stylesheet"===t.type&&t.data.href||"";if(t.loaded||(t.loaded=b[e]),!t.loaded){const n=o();t.loaded=n.promise,e&&(b[e]=t.loaded),"style"===t.type?(document.head.append(v("style",{textContent:t.data})),n.resolve()):e&&(document.head.append(v("link",{rel:"stylesheet",...t.data})),fetch(e).then(t=>{if(t.ok)return t.text();throw t}).then(()=>n.resolve(),n.reject))}await t.loaded}(t)))},t.loadJS=async function(t,e){t.forEach(t=>{var e;"script"===t.type&&(null==(e=t.data)?void 0:e.src)&&x(t.data.src)}),e={getMarkmap:()=>window.markmap,...e};for(const n of t)await w(n,e)},t.refreshHook=ft,t.registerTheme=function(t){j[t.name]=t},t.simpleHash=R,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}(this.markmap=this.markmap||{},d3);