13 lines
92 KiB
JavaScript
13 lines
92 KiB
JavaScript
|
|
(function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(".mind-elixir{--gap: 30px;--root-radius: 30px;--main-radius: 20px;--root-color: #ffffff;--root-bgcolor: #4c4f69;--main-color: #444446;--main-bgcolor: #ffffff;--topic-padding: 3px;--color: #777777;--bgcolor: #f6f6f6;--selected: #4dc4ff;--panel-color: #444446;--panel-bgcolor: #ffffff;--panel-border-color: #eaeaea;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0);font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,PingFang SC,Microsoft YaHei,Source Han Sans SC,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif}.mind-elixir .hyper-link{text-decoration:none;margin-left:.3em}.map-container{-webkit-user-select:none;user-select:none;height:100%;width:100%;overflow:scroll;font-size:15px}.map-container::-webkit-scrollbar{width:0px;height:0px}.map-container .selected{box-shadow:0 0 0 2px var(--selected)}.map-container .lhs{direction:rtl}.map-container .lhs me-tpc{direction:ltr}.map-container .map-canvas{height:20000px;width:20000px;position:relative;-webkit-user-select:none;user-select:none;transition:transform .3s;transform:scale(1);background-color:var(--bgcolor)}.map-container .map-canvas me-nodes{position:absolute;display:flex;justify-content:center;align-items:center;height:fit-content;width:fit-content}.map-container .map-canvas me-root{position:relative}.map-container .map-canvas me-root me-tpc{display:block;font-size:25px;line-height:1.2em;color:var(--root-color);padding:10px var(--gap);border-radius:var(--root-radius);white-space:pre-wrap;background-color:var(--root-bgcolor)}.map-container .map-canvas me-root me-tpc #input-box{padding:10px var(--gap)}.map-container me-main>me-wrapper{position:relative;margin:20px 65px}.map-container me-main>me-wrapper>me-parent{margin:var(--gap);padding:0}.map-container me-main>me-wrapper>me-parent>me-tpc{border-radius:var(--main-radius);background-color:var(--main-bgcolor);border:2px solid var(--main-color);color:var(--main-color);padding:8px var(--gap)}.map-container me-main>me-wrapper>me-parent>me-tpc #input-box{padding:8px var(--gap)}.map-container me-wrapper{display:block;pointer-events:none;width:fit-content}.map-container me-children,.map-container me-parent{display:inline-block;vertical-align:middle}.map-container me-parent{position:relative;cursor:pointer;padding:6px var(--gap);margin-top:10px}.map-container me-parent me-tpc{position:relative;display:block;border-radius:3px;color:var(--color);pointer-events:all;max-width:35em;white-space:pre-wrap;padding:var(--topic-padding);line-height:1.2em}.map-container me-parent me-tpc .insert-preview{position:absolute;width:100%;left:0;z-index:9}.map-container me-parent me-tpc .show{background:#7ad5ff;pointer-events:none;opacity:.7}.map-container me-parent me-tpc .before{height:14px;top:-14px}.map-container me-parent me-tpc .in{height:100%;top:0}.map-container me-parent me-tpc .after{height:14px;bottom:-14px}.map-container me-parent me-epd{position:absolute;height:18px;width:18px;opacity:.8;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdD0iMTY1NjY1NDcxNzI0MiIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+CiAgICA8cGF0aCBkPSJNNTEyIDc0LjY2NjY2N0MyNzAuOTMzMzMzIDc0LjY2NjY2NyA3NC42NjY2NjcgMjcwLjkzMzMzMyA3NC42NjY2NjcgNTEyUzI3MC45MzMzMzMgOTQ5LjMzMzMzMyA1MTIgOTQ5LjMzMzMzMyA5NDkuMzMzMzMzIDc1My4wNjY2NjcgOTQ5LjMzMzMzMyA1MTIgNzUzLjA2NjY2NyA3NC42NjY2NjcgNTEyIDc0LjY2NjY2N3oiIHN0cm9rZS13aWR0aD0iNTQiIHN0cm9rZT0nYmxhY2snIGZpbGw9J3doaXRlJyA+PC9wYXRoPgogICAgPHBhdGggZD0iTTY4Mi42NjY2NjcgNDgwaC0xMzguNjY2NjY3VjM0MS4zMzMzMzNjMC0xNy4wNjY2NjctMTQuOTMzMzMzLTMyLTMyLTMycy0zMiAxNC45MzMzMzMtMzIgMzJ2MTM4LjY2NjY2N0gzNDEuMzMzMzMzYy0xNy4wNjY2NjcgMC0zMiAxNC45MzMzMzMtMzIgMzJzMTQuOTMzM
|
||
|
|
var MindElixir=function(){"use strict";const yn="";(function(e){var t,n,o,i,s,r,l='<svg><symbol id="icon-edit" viewBox="0 0 1024 1024"><path d="M423.765333 128a42.666667 42.666667 0 0 1 3.2 85.205333L423.765333 213.333333H234.666667a64 64 0 0 0-63.872 60.245334L170.666667 277.333333v512a64 64 0 0 0 60.245333 63.872L234.666667 853.333333h512a64 64 0 0 0 63.872-60.245333L810.666667 789.333333v-189.098666a42.666667 42.666667 0 0 1 85.205333-3.2l0.128 3.2V789.333333a149.333333 149.333333 0 0 1-144.213333 149.248L746.666667 938.666667h-512a149.333333 149.333333 0 0 1-149.248-144.213334L85.333333 789.333333v-512a149.333333 149.333333 0 0 1 144.213334-149.248L234.666667 128h189.098666z m324.949334-53.248a42.666667 42.666667 0 0 1 60.330666 0l150.869334 150.869333a42.666667 42.666667 0 0 1 0 60.330667l-329.386667 329.386667a42.666667 42.666667 0 0 1-29.44 12.458666l-153.386667 2.517334a42.666667 42.666667 0 0 1-43.349333-43.349334l2.56-153.386666a42.666667 42.666667 0 0 1 12.458667-29.44z m30.165333 90.496L491.946667 452.266667l-1.493334 91.989333 92.032-1.493333 286.976-286.976-90.538666-90.538667z" ></path></symbol><symbol id="icon-rising" viewBox="0 0 1024 1024"><path d="M553.173333 803.84h-64l0.021334-474.581333-224.021334 224-45.269333-45.226667L521.6 206.293333l301.717333 301.696-45.269333 45.269334-224.853333-224.896v475.477333z" ></path></symbol><symbol id="icon-falling" viewBox="0 0 1024 1024"><path d="M553.173333 238.314667h-64l0.021334 474.602666-224.021334-224-45.269333 45.226667L521.6 835.861333l301.717333-301.717333-45.269333-45.226667-224.853333 224.853334V238.336z" ></path></symbol><symbol id="icon-shanchu2" viewBox="0 0 1024 1024"><path d="M516.60601807 107.93026734c-82.64382935 0-149.71865844 65.51751709-152.5729065 147.77160644H171.37136841c-21.40603638 0-38.92044068 17.38504028-38.92044068 38.92126465 0 21.40686036 17.38504028 38.92208862 38.92126466 38.92208862h42.94308471v435.40136719c0 81.73498536 55.39828492 148.55026245 123.90106201 148.55026245h348.99444581c68.37341309 0 123.90106201-66.42553711 123.901062-148.55026245V333.80477906h38.92126465c21.40686036 0 38.92126464-17.38586426 38.92126465-38.92208863 0-21.40686036-17.38504028-38.92126464-38.92126465-38.92126465H668.91854859C666.45321656 173.44860839 599.24902344 107.93109131 516.60601807 107.93109131z m-79.65939331 147.77160644c2.85424805-42.16442872 37.2354126-74.85809326 79.78875732-74.85809326s76.93450927 32.82302857 79.39984131 74.85809326H436.94662476z m-98.86047364 589.01165771c-24.2611084 0-50.98754883-31.13717651-50.98754883-75.76693725V333.80477906h450.97036744V769.33551026c0 44.50039673-26.72644043 75.76776123-50.98754884 75.76776122H338.08615112v-0.38973999z m0 0" ></path><path d="M390.37063599 751.17263794c17.77313232 0 32.43411255-17.7739563 32.43411255-40.08883667V482.35504151c0-22.31488037-14.53079224-40.08966065-32.43411255-40.08966065-17.77478027 0-32.43493653 17.77478027-32.43493653 40.08966065v228.72875976c0 22.18469239 14.27124023 40.08883667 32.43493653 40.08883667z m117.41308594 0c17.7739563 0 32.43411255-17.7739563 32.43411255-40.08883667V482.35504151c0-22.31488037-14.53079224-40.08966065-32.43411255-40.08966065-17.7739563 0-32.43493653 17.77478027-32.43493653 40.08966065v228.72875976c0 22.18469239 14.66098023 40.08883667 32.43493653 40.08883667z m123.51049804 0c17.7739563 0 32.43493653-17.7739563 32.43493652-40.08883667V482.35504151c0-22.31488037-14.53079224-40.08966065-32.43493652-40.08966065-17.7739563 0-32.43411255 17.77478027-32.43411255 40.08966065v228.72875976c0 22.18469239 14.14105224 40.08883667 32.43411255 40.08883667z m0 0" ></path></symbol><symbol id="icon-zijiedian" viewBox="0 0 1024 1024"><path d="M312.208 472c19.568-157.856 153.432-280 315.656-280 175.68 0 318.112 143.272 318.112 320S803.552 832 627.864 832c-162.224 0-296.08-122.144-315.656-280H120a40 40 0 0 1 0-80h192.208zM632 752c132.552 0 240-107.448 240-240 0-132.552-107.448-240-240-240-132.552 0-240 107.448-240 240 0 132.552 107.448 240 240 240z m-40-280v-80a40 40 0 0 1 80 0v80h80a40 40 0 0 1 0 80h-80v80a40 40 0 0 1-80 0v-80h-80a40 40 0 0 1 0-80h80z"
|
||
|
|
<use xlink:href="#icon-${p}"></use>
|
||
|
|
</svg>`,g},o=n("cm-add_child","zijiedian"),i=n("cm-add_sibling","tongjijiedian-"),s=n("cm-remove_child","shanchu2"),r=n("cm-up","rising"),l=n("cm-down","falling"),c=n("cm-edit","edit"),h=document.createElement("ul");if(h.className="menu-list",t&&t.extend)for(let d=0;d<t.extend.length;d++){const p=t.extend[d],g=n(p.name,p.name);h.appendChild(g),g.onclick=m=>{p.onclick(m)}}const a=document.createElement("mmenu");a.className="mobile-menu",a.appendChild(o),a.appendChild(i),a.appendChild(s),a.appendChild(r),a.appendChild(l),a.appendChild(c),a.hidden=!0,e.container.append(a);let u=!0;e.bus.addListener("unselectNode",function(){a.hidden=!0}),e.bus.addListener("selectNode",function(d){a.hidden=!1,d.root?u=!0:u=!1}),a.onclick=d=>{d.target===a&&(a.hidden=!0)},o.onclick=()=>{e.addChild()},i.onclick=()=>{u||e.insertSibling()},s.onclick=()=>{u||e.removeNode()},r.onclick=d=>{u||e.moveUpNode()},l.onclick=d=>{u||e.moveDownNode()},c.onclick=d=>{e.beginEdit()}}const de=document,xt=function(e,t){if(!t)return he(e),e;const n=e.getElementsByClassName("insert-preview"),o=`insert-preview ${t} show`;if(n.length>0)n[0].className=o;else{const i=de.createElement("div");i.className=o,e.appendChild(i)}return e},he=function(e){if(!e)return;const t=e.getElementsByClassName("insert-preview");for(const n of t||[])n.remove()},ke=function(e,t){const n=t.parentElement.parentElement.contains(e);return e&&e.tagName==="ME-TPC"&&e!==t&&!n&&e.nodeObj.root!==!0},Nt=function(e){const t=document.createElement("div");return t.className="mind-elixir-ghost",e.map.appendChild(t),t};function Et(e){let t=null,n=null,o=null;const i=Nt(e),s=12;e.map.addEventListener("dragstart",r=>{var c;const l=r.target;if((l==null?void 0:l.tagName)!=="ME-TPC"){r.preventDefault();return}t=l,t.parentElement.parentElement.style.opacity="0.5",i.innerHTML=t.innerHTML,(c=r.dataTransfer)==null||c.setDragImage(i,0,0),L.clear()}),e.map.addEventListener("dragend",async r=>{if(!t)return;t.parentElement.parentElement.style.opacity="1";const l=r.target;if(l.style.opacity="",!o)return;he(o);const c=t.nodeObj;switch(n){case"before":e.moveNodeBefore(t,o),e.selectNode(w(c.id));break;case"after":e.moveNodeAfter(t,o),e.selectNode(w(c.id));break;case"in":e.moveNode(t,o);break}t=null}),e.map.addEventListener("dragover",Ge(function(r){if(!t)return;he(o);const l=de.elementFromPoint(r.clientX,r.clientY-s);if(ke(l,t)){o=l;const c=l.getBoundingClientRect().y;r.clientY>c+l.clientHeight?n="after":r.clientY>c+l.clientHeight/2&&(n="in")}else{const c=de.elementFromPoint(r.clientX,r.clientY+s);if(ke(c,t)){o=c;const h=c.getBoundingClientRect().y;r.clientY<h?n="before":r.clientY<h+c.clientHeight/2&&(n="in")}else n=o=null}o&&xt(o,n)},200))}const wt=function(e){return["createSummary","removeSummary","finishEditSummary"].includes(e.name)?{type:"summary",value:e.obj.id}:["createCustomLink","removeCustomLink","finishEditCustomLinkLabel"].includes(e.name)?{type:"customLink",value:e.obj.id}:["removeNodes"].includes(e.name)?{type:"nodes",value:e.objs.map(t=>t.id)}:{type:"node",value:e.obj.id}};function Ct(e){let t=[],n=-1,o=e.getData();e.bus.addListener("operation",i=>{if(i.name==="beginEdit")return;t=t.slice(0,n+1);const s=e.getData();t.push({prev:o,currentObject:wt(i),next:s}),o=s,n=t.length-1}),e.undo=function(){if(n>-1){const i=t[n];o=i.prev,e.refresh(i.prev),i.currentObject.type==="node"&&e.selectNode(w(i.currentObject.value)),n--,console.log("current",o)}},e.redo=function(){if(n<t.length-1){n++;const i=t[n];o=i.next,e.refresh(i.next),i.currentObject.type==="node"&&e.selectNode(w(i.currentObject.value))}},e.map.addEventListener("keydown",i=>{(i.metaKey||i.ctrlKey)&&i.shiftKey&&i.key==="Z"?e.redo():(i.metaKey||i.ctrlKey)&&i.key==="z"&&e.undo()})}const En="",z=(e,t)=>{const n=document.createElement("span");return n.id=e,n.innerHTML=`<svg class="icon" aria-hidden="true">
|
||
|
|
<use xlink:href="#icon-${t}"></use>
|
||
|
|
</svg>`,n};function _t(e){const t=document.createElement("div"),n=z("fullscreen","full"),o=z("toCenter","living"),i=z("zoomout","move"),s=z("zoomin","add"),r=document.createElement("span");return r.innerText="100%",t.appendChild(n),t.appendChild(o),t.appendChild(i),t.appendChild(s),t.className="mind-elixir-toolbar rb",n.onclick=()=>{e.container.requestFullscreen()},o.onclick=()=>{e.toCenter()},i.onclick=()=>{e.scaleVal<.6||e.scale(e.scaleVal-=.2)},s.onclick=()=>{e.scaleVal>1.6||e.scale(e.scaleVal+=.2)},t}function St(e){const t=document.createElement("div"),n=z("tbltl","left"),o=z("tbltr","right"),i=z("tblts","side");return t.appendChild(n),t.appendChild(o),t.appendChild(i),t.className="mind-elixir-toolbar lt",n.onclick=()=>{e.initLeft()},o.onclick=()=>{e.initRight()},i.onclick=()=>{e.initSide()},t}function kt(e){e.container.append(_t(e)),e.container.append(St(e))}/*! @viselect/vanilla v3.3.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */var Lt=Object.defineProperty,Mt=(e,t,n)=>t in e?Lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t,n)=>(Mt(e,typeof t!="symbol"?t+"":t,n),n);class Tt{constructor(){N(this,"_listeners",new Map),N(this,"on",this.addEventListener),N(this,"off",this.removeEventListener),N(this,"emit",this.dispatchEvent)}addEventListener(t,n){const o=this._listeners.get(t)??new Set;return this._listeners.set(t,o),o.add(n),this}removeEventListener(t,n){var o;return(o=this._listeners.get(t))==null||o.delete(n),this}dispatchEvent(t,...n){let o=!0;for(const i of this._listeners.get(t)??[])o=i(...n)!==!1&&o;return o}unbindAllListeners(){this._listeners.clear()}}const Le=(e,t="px")=>typeof e=="number"?e+t:e;function j({style:e},t,n){if(typeof t=="object")for(const[o,i]of Object.entries(t))i!==void 0&&(e[o]=Le(i));else n!==void 0&&(e[t]=Le(n))}function Me(e){return(t,n,o,i={})=>{t instanceof HTMLCollection||t instanceof NodeList?t=Array.from(t):Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);for(const s of t)for(const r of n)s[e](r,o,{capture:!1,...i});return[t,n,o,i]}}const W=Me("addEventListener"),O=Me("removeEventListener"),oe=e=>{var t;const{clientX:n,clientY:o,target:i}=((t=e.touches)==null?void 0:t[0])??e;return{x:n,y:o,target:i}};function Te(e,t,n="touch"){switch(n){case"center":{const o=t.left+t.width/2,i=t.top+t.height/2;return o>=e.left&&o<=e.right&&i>=e.top&&i<=e.bottom}case"cover":return t.left>=e.left&&t.top>=e.top&&t.right<=e.right&&t.bottom<=e.bottom;case"touch":return e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}}function I(e,t=document){const n=Array.isArray(e)?e:[e];let o=[];for(let i=0,s=n.length;i<s;i++){const r=n[i];typeof r=="string"?o=o.concat(Array.from(t.querySelectorAll(r))):r instanceof Element&&o.push(r)}return o}const $t=()=>matchMedia("(hover: none), (pointer: coarse)").matches,Dt=()=>"safari"in window,jt=e=>{let t,n=-1,o=!1;return{next(...i){t=i,o||(o=!0,n=requestAnimationFrame(()=>{e(...t),o=!1}))},cancel(){cancelAnimationFrame(n),o=!1}}},{abs:R,max:$e,min:De,ceil:je}=Math;class Oe extends Tt{constructor(t){var n,o,i,s,r;super(),N(this,"_options"),N(this,"_selection",{stored:[],selected:[],touched:[],changed:{added:[],removed:[]}}),N(this,"_area"),N(this,"_clippingElement"),N(this,"_targetElement"),N(this,"_targetRect"),N(this,"_selectables",[]),N(this,"_latestElement"),N(this,"_areaRect",new DOMRect),N(this,"_areaLocation",{y1:0,x2:0,y2:0,x1:0}),N(this,"_singleClick",!0),N(this,"_frame"),N(this,"_scrollAvailable",!0),N(this,"_scrollingActive",!1),N(this,"_scrollSpeed",{x:0,y:0}),N(this,"_scrollDelta",{x:0,y:0}),N(this,"disable",this._bindStartEvents.bind(this,!1)),N(this,"enable",this._bindStartEvents),this._options={selectionAreaClass:"selection-area",selectionContainerClass:void 0,selectables:[],document:window.document,startAreas:["html"],boundaries:["html"],container:"body",...t,behaviour:{overlap:"invert",intersect:"touch",...t.behaviour,startThreshold:(n=t.behaviour)!=null&&n.startThreshold?typeof t.behaviour.startThreshold=="number"?t.behaviour.startThreshold:{x:10,y:10,...t.behaviour.startThreshol
|
||
|
|
|
||
|
|
`;function n(o,i){for(let s=0;s<o.length;s++)i<=6?t+="".padStart(i,"#")+" "+o[s].topic+`
|
||
|
|
|
||
|
|
`:t+="".padStart(i-7," ")+"- "+o[s].topic+`
|
||
|
|
`,o[s].children&&n(o[s].children||[],i+1)}return n(e.children||[],2),t},getDataString:function(){const e=Ae(this);return JSON.stringify(e,(t,n)=>{if(!(t==="parent"&&typeof n!="string"))return n})},initLeft:function(){this.direction=0,this.refresh()},initRight:function(){this.direction=1,this.refresh()},initSide:function(){this.direction=2,this.refresh()},install:function(e){e(this)},refresh:function(e){e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.linkData=e.linkData||{},this.summaries=e.summaries||[]),D(this.nodeData),this.layout(),this.linkDiv()},scale:function(e){this.scaleVal=e,this.map.style.transform="scale("+e+")"},selectFirstChild:function(){if(!this.currentNode)return;const e=this.currentNode.parentElement.nextSibling;if(e&&e.firstChild){const t=e.firstChild.firstChild.firstChild;this.selectNode(t)}},selectNextSibling:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return!1;const e=this.currentNode.parentElement.parentElement.nextSibling;let t;if(e)t=e.firstChild.firstChild;else return!1;return this.selectNode(t),!0},selectNode:function(e,t,n){if(e){if(console.time("selectNode"),typeof e=="string"){const o=w(e);return o?this.selectNode(o):void 0}this.currentNode&&(this.currentNode.className=""),e.className="selected",e.scrollIntoView({block:"nearest",inline:"nearest"}),this.currentNode=e,t?this.bus.fire("selectNewNode",e.nodeObj):this.bus.fire("selectNode",e.nodeObj,n),console.timeEnd("selectNode")}},selectNodes:function(e){if(e){console.time("selectNodes");for(const t of e)t.className="selected";this.currentNodes=e,this.bus.fire("selectNodes",e.map(t=>t.nodeObj)),console.timeEnd("selectNodes")}},selectParent:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return;const e=this.currentNode.parentElement.parentElement.parentElement.previousSibling;if(e){const t=e.firstChild;this.selectNode(t)}},selectPrevSibling:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return!1;const e=this.currentNode.parentElement.parentElement.previousSibling;let t;if(e)t=e.firstChild.firstChild;else return!1;return this.selectNode(t),!0},setLocale:function(e){this.locale=e,this.refresh()},toCenter:function(){this.container.scrollTo(1e4-this.container.offsetWidth/2,1e4-this.container.offsetHeight/2)},unselectNode:function(){this.currentNode&&(this.currentNode.className=""),this.currentNode=null,this.bus.fire("unselectNode")},unselectNodes:function(){if(this.currentNodes)for(const e of this.currentNodes)e.classList.remove("selected");this.currentNodes=null,this.bus.fire("unselectNodes")}},Symbol.toStringTag,{value:"Module"})),A=e=>{var o;const t=(o=e.parent)==null?void 0:o.children,n=t.indexOf(e);return{siblings:t,index:n}};function Ht(e){const{siblings:t,index:n}=A(e),o=t[n];n===0?(t[n]=t[t.length-1],t[t.length-1]=o):(t[n]=t[n-1],t[n-1]=o)}function Bt(e){const{siblings:t,index:n}=A(e),o=t[n];n===t.length-1?(t[n]=t[0],t[0]=o):(t[n]=t[n+1],t[n+1]=o)}function X(e){const{siblings:t,index:n}=A(e);return t.splice(n,1),t.length}function zt(e,t){const{siblings:n,index:o}=A(e);n.splice(o+1,0,t)}function Rt(e,t){const{siblings:n,index:o}=A(e);n.splice(o,0,t)}function qt(e,t){const{siblings:n,index:o}=A(e);n[o]=t,t.children=[e]}function Ft(e,t){X(e),t.children?t.children.push(e):t.children=[e]}function Vt(e,t){e.direction!==void 0&&(e.direction=t.direction),X(e);const{siblings:n,index:o}=A(t);n.splice(o,0,e)}function Wt(e,t){e.direction!==void 0&&(e.direction=t.direction),X(e);const{siblings:n,index:o}=A(t);n.splice(o+1,0,e)}const Pe=function(e,t){var n,o;if(e===k)return k;if(e===P)return P;if(e===U){const i=((n=document.querySelector(".lhs"))==null?void 0:n.childElementCount)||0,s=((o=document.querySelector(".rhs"))==null?void 0:o.childElementCount)||0;return i<=s?(t.direction=k,k):(t.direction=P,P)}},He=function(e,t){var l,c;if(!e)return null;const n=e.nodeObj;n.expanded===!1&&(this.expandNode(e,!0),e=w(n.id));const o=t||this.generateNewObj();n.children?n.children.push(o):n.children=[o],D(this.nodeData);const i=e.parentElement,{grp:s,top:r}=thi
|
||
|
|
`).forEach((l,c)=>{const h=document.createElementNS("http://www.w3.org/2000/svg","text");C(h,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+dn(t.lineHeight,t.fontSize)*(c+1)+parseFloat(t.fontSize)*(c+1)+"","text-anchor":"start","font-family":t.fontFamily,"font-size":`${t.fontSize}`,"font-weight":`${t.fontWeight}`,fill:`${t.color}`}),h.innerHTML=l,i.appendChild(h)}),i}function un(e,t,n,o){let i="";e.text?i=e.text.textContent:i=e.childNodes[0].textContent;const s=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");C(s,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+"",width:t.width,height:t.height});const r=document.createElement("div");return C(r,{xmlns:"http://www.w3.org/1999/xhtml",style:`font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`}),r.innerHTML=i,s.appendChild(r),s}function ue(e,t,n=!1){const o=getComputedStyle(t),{offsetLeft:i,offsetTop:s}=V(e.nodes,t),r=document.createElementNS("http://www.w3.org/2000/svg","rect");C(r,{x:i+"",y:s+"",rx:o.borderRadius,ry:o.borderRadius,width:o.width,height:o.height,fill:o.backgroundColor,stroke:o.borderColor,"stroke-width":o.borderWidth});const l=document.createElementNS("http://www.w3.org/2000/svg","g");l.appendChild(r);let c;return n?c=un(t,o,i,s):c=hn(t,o,i,s),l.appendChild(c),l}function fn(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=V(e.nodes,t),s=document.createElementNS("http://www.w3.org/2000/svg","a"),r=document.createElementNS("http://www.w3.org/2000/svg","text");return C(r,{x:o+"",y:i+parseInt(n.fontSize)+"","text-anchor":"start","font-family":n.fontFamily,"font-size":`${n.fontSize}`,"font-weight":`${n.fontWeight}`,fill:`${n.color}`}),r.innerHTML=t.textContent,s.appendChild(r),s.setAttribute("href",t.href),s}const re=100,pn='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',We=(e,t=!1)=>{var u,d,p;const n=e.nodes,o=n.offsetHeight+re*2,i=n.offsetWidth+re*2,s=an(o+"px",i+"px"),r=document.createElementNS("http://www.w3.org/2000/svg","svg"),l=document.createElementNS("http://www.w3.org/2000/svg","rect");C(l,{x:"0",y:"0",width:`${i}`,height:`${o}`,fill:e.theme.cssVar["--bgcolor"]}),s.appendChild(l),n.querySelectorAll(".subLines").forEach(g=>{const m=g.cloneNode(!0),{offsetLeft:f,offsetTop:v}=V(n,g.parentElement);m.setAttribute("x",`${f}`),m.setAttribute("y",`${v}`),r.appendChild(m)});const c=(u=n.querySelector(".lines"))==null?void 0:u.cloneNode(!0);c&&r.appendChild(c);const h=(d=n.querySelector(".topiclinks"))==null?void 0:d.cloneNode(!0);h&&r.appendChild(h);const a=(p=n.querySelector(".summary"))==null?void 0:p.cloneNode(!0);return a&&r.appendChild(a),n.querySelectorAll("me-tpc").forEach(g=>{r.appendChild(ue(e,g,!t))}),n.querySelectorAll(".tags > span").forEach(g=>{r.appendChild(ue(e,g))}),n.querySelectorAll(".icons > span").forEach(g=>{r.appendChild(ue(e,g))}),n.querySelectorAll(".hyper-link").forEach(g=>{r.appendChild(fn(e,g))}),C(r,{x:re+"",y:re+"",overflow:"visible"}),s.appendChild(r),pn+s.outerHTML};function mn(e){return new Promise((t,n)=>{const o=new FileReader;o.onload=i=>{t(i.target.result)},o.onerror=i=>{n(i)},o.readAsDataURL(e)})}const gn=Object.freeze(Object.defineProperty({__proto__:null,exportPng:async function(e=!1){const t=We(this,e),n=new Blob([t],{type:"image/svg+xml"}),o=await mn(n);return new Promise((i,s)=>{const r=new Image;r.setAttribute("crossOrigin","anonymous"),r.onload=()=>{const l=document.createElement("canvas");l.width=r.width,l.height=r.height,l.getContext("2d").drawImage(r,0,0),l.toBlob(i,"image/png",1)},r.src=o,r.onerror=s})},exportSvg:function(e=!1){const t=We(this,e);return new Blob([t],{type:"image/svg+xml"})}},Symbol.toStringTag,{value:"Module"}));function vn(e,t){return async function(...n){const o=this.before[t];o&&!await o.apply(this,n)||e.apply(this,n)}}const Ie=Object.keys(ze),Ke={};for(let e=0;e<Ie.length;e++){const t=Ie[e];Ke[t]=vn(ze[t],t)}const bn={getObjById:ee,generateNewObj:Xe,layout:et,linkDiv:ht,editT
|