mind-elixir 5.0.0-beta.9 → 5.0.1

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.
@@ -1,108 +1,100 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".map-container{--gap: 30px;--root-radius: 30px;--main-radius: 20px;--root-color: #ffffff;--root-bgcolor: #4c4f69;--root-border-color: rgba(0, 0, 0, 0);--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;-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;-webkit-user-select:none;user-select:none;height:100%;width:100%;overflow:hidden;font-size:15px}.map-container *{box-sizing:border-box}.map-container::-webkit-scrollbar{width:0px;height:0px}.map-container .selected{outline:2px solid var(--selected);outline-offset:1px}.map-container .hyper-link{text-decoration:none;margin-left:.3em}.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;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;color:var(--root-color);padding:10px var(--gap);border-radius:var(--root-radius);border:var(--root-border-color) 2px solid;white-space:pre-wrap;background-color:var(--root-bgcolor)}.map-container me-main>me-wrapper{position:relative;margin:45px 65px}.map-container me-main>me-wrapper>me-parent{margin:10px;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 25px}.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)}.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+PC9wYXRoPgogICAgPHBhdGggZD0iTTY4Mi42NjY2NjcgNDgwaC0xMzguNjY2NjY3VjM0MS4zMzMzMzNjMC0xNy4wNjY2NjctMTQuOTMzMzMzLTMyLTMyLTMycy0zMiAxNC45MzMzMzMtMzIgMzJ2MTM4LjY2NjY2N0gzNDEuMzMzMzMzYy0xNy4wNjY2NjcgMC0zMiAxNC45MzMzMzMtMzIgMzJzMTQuOTMzMzMzIDMyIDMyIDMyaDEzOC42NjY2NjdWNjgyLjY2NjY2N2MwIDE3LjA2NjY2NyAxNC45MzMzMzMgMzIgMzIgMzJzMzItMTQuOTMzMzMzIDMyLTMydi0xMzguNjY2NjY3SDY4Mi42NjY2NjdjMTcuMDY2NjY3IDAgMzItMTQuOTMzMzMzIDMyLTMycy0xNC45MzMzMzMtMzItMzItMzJ6Ij48L3BhdGg+Cjwvc3ZnPg==);background-repeat:no-repeat;background-size:contain;background-position:center;pointer-events:all;z-index:9}.map-container me-parent me-epd.minus{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdD0iMTY1NjY1NTU2NDk4NSIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+CiAgICA8cGF0aCBkPSJNNTEyIDc0LjY2NjY2N0MyNzAuOTMzMzMzIDc0LjY2NjY2NyA3NC42NjY2NjcgMjcwLjkzMzMzMyA3NC42NjY2NjcgNTEyUzI3MC45MzMzMzMgOTQ5LjMzMzMzMyA1MTIgOTQ5LjMzMzMzMyA5NDkuMzMzMzMzIDc1My4wNjY2NjcgOTQ5LjMzMzMzMyA1MTIgNzUzLjA2NjY2NyA3NC42NjY2NjcgNTEyIDc0LjY2NjY2N3oiIHN0cm9rZS13aWR0aD0iNTQiIHN0cm9rZT0nYmxhY2snIGZpbGw9J3doaXRlJyA+PC9wYXRoPgogICAgPHBhdGggZD0iTTY4Mi42NjY2NjcgNTQ0SDM0MS4zMzMzMzNjLTE3LjA2NjY2NyAwLTMyLTE0LjkzMzMzMy0zMi0zMnMxNC45MzMzMzMtMzIgMzItMzJoMzQxLjMzMzMzNGMxNy4wNjY2NjcgMCAzMiAxNC45MzMzMzMgMzIgMzJzLTE0LjkzMzMzMyAzMi0zMiAzMnoiPjwvcGF0aD4KPC9zdmc+)!important;transition:opacity .3s;opacity:0}.map-container me-parent me-epd.minus:hover{opacity:.8}.map-container .icon{width:1em;height:1em;vertical-align:-.15em;fill:currentColor;overflow:hidden}.map-container .lines,.map-container .summary,.map-container .subLines,.map-container .topiclinks,.map-container .linkcontroller{position:absolute;height:102%;width:100%;top:0;left:0}.map-container .topiclinks,.map-container .linkcontroller,.map-container .summary,.map-container .topiclinks .selected,.map-container .linkcontroller .selected,.map-container .summary .selected{pointer-events:none}.map-container .summary>g,.map-container .topiclinks>g{cursor:pointer;pointer-events:stroke}.map-container .lines,.map-container .subLines{pointer-events:none;z-index:-1}.map-container .topiclinks *,.map-container .linkcontroller *{z-index:100}.map-container #input-box{position:absolute;top:0;left:0;width:max-content;max-width:35em;z-index:11;direction:ltr;-webkit-user-select:auto;user-select:auto;pointer-events:auto;background-color:var(--bgcolor)}.map-container me-tpc>*{pointer-events:none}.map-container me-tpc>a,.map-container me-tpc>iframe{pointer-events:auto}.map-container me-tpc>img{display:block;margin-bottom:8px;object-fit:cover}.map-container me-tpc>.text{display:inline-block}.map-container .circle{position:absolute;height:10px;width:10px;margin-top:-5px;margin-left:-5px;border-radius:100%;background:#757575;border:2px solid #ffffff;cursor:pointer}.map-container .tags{direction:ltr}.map-container .tags span{display:inline-block;border-radius:3px;padding:2px 4px;background:#d6f0f8;color:#276f86;margin:2px 4px 0 0;font-size:12px;line-height:1.3em}.map-container .icons{display:inline-block;direction:ltr;margin-left:5px}.map-container .icons span{display:inline-block;line-height:1.3em}.map-container .mind-elixir-ghost{position:fixed;top:-100%;left:-100%;box-sizing:content-box;opacity:.5;background-color:var(--main-bgcolor);border:2px solid var(--main-color);color:var(--main-color);max-width:200px;width:fit-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:8px 16px;border-radius:6px}.map-container .selection-area{background:#4f90f22d;border:1px solid #4f90f2}.map-container .context-menu{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99}.map-container .context-menu .menu-list{position:fixed;list-style:none;margin:0;padding:0;color:var(--panel-color);box-shadow:0 12px 15px #0003;border-radius:5px;overflow:hidden}.map-container .context-menu .menu-list li{min-width:200px;overflow:hidden;white-space:nowrap;padding:6px 10px;background:var(--panel-bgcolor);border-bottom:1px solid var(--panel-border-color);cursor:pointer}.map-container .context-menu .menu-list li span{line-height:20px}.map-container .context-menu .menu-list li a{color:#333;text-decoration:none}.map-container .context-menu .menu-list li.disabled{display:none}.map-container .context-menu .menu-list li:hover{filter:brightness(.95)}.map-container .context-menu .menu-list li:last-child{border-bottom:0}.map-container .context-menu .menu-list li span:last-child{float:right}.map-container .context-menu .key{font-size:10px;background-color:#f1f1f1;color:#333;padding:2px 5px;border-radius:3px}.map-container .tips{position:absolute;bottom:20px;left:50%;transform:translate(-50%);color:var(--panel-color);font-weight:bolder}.mind-elixir-toolbar{font-family:iconfont;position:absolute;color:var(--panel-color);background:var(--panel-bgcolor);padding:10px;border-radius:5px;box-shadow:0 1px 2px #0003}.mind-elixir-toolbar svg{display:inline-block}.mind-elixir-toolbar span:active{opacity:.5}.mind-elixir-toolbar.rb{right:20px;bottom:20px}.mind-elixir-toolbar.rb span+span{margin-left:10px}.mind-elixir-toolbar.lt{font-size:20px;left:20px;top:20px}.mind-elixir-toolbar.lt span{display:block}.mind-elixir-toolbar.lt span+span{margin-top:10px}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- var nt = Object.defineProperty;
3
- var ot = (e, t, n) => t in e ? nt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
- var G = (e, t, n) => (ot(e, typeof t != "symbol" ? t + "" : t, n), n);
5
- (function(e) {
6
- var t, n, o, s, i, r, c = '<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" ></path></symbol><symbol id="icon-tongjijiedian-" viewBox="0 0 1024 1024"><path d="M803.84 131.626667H410.24A59.733333 59.733333 0 0 0 350.506667 192v45.226667H199.68a51.626667 51.626667 0 0 0-51.626667 51.626666v465.92a51.626667 51.626667 0 0 0 51.626667 51.626667h187.52v-55.466667h-162.133333a21.333333 21.333333 0 0 1-21.333334-21.333333V313.386667a21.333333 21.333333 0 0 1 21.333334-21.333334h125.653333v64a59.733333 59.733333 0 0 0 59.733333 59.733334h393.386667a59.733333 59.733333 0 0 0 59.733333-59.733334V192a59.733333 59.733333 0 0 0-59.733333-60.373333z m4.266667 224.64a4.266667 4.266667 0 0 1-4.266667 4.266666H410.24a4.266667 4.266667 0 0 1-4.266667-4.266666V192a4.266667 4.266667 0 0 1 4.266667-4.266667h393.6a4.266667 4.266667 0 0 1 4.266667 4.266667zM716.16 749.44h-81.28v-81.493333a27.733333 27.733333 0 0 0-55.466667 0v81.28h-81.493333a27.733333 27.733333 0 1 0 0 55.466666h81.28v81.28a27.733333 27.733333 0 1 0 55.466667 0v-81.066666h81.28a27.733333 27.733333 0 0 0 0-55.466667z" ></path></symbol><symbol id="icon-close" viewBox="0 0 1024 1024"><path d="M557.312 513.248l265.28-263.904c12.544-12.48 12.608-32.704 0.128-45.248-12.512-12.576-32.704-12.608-45.248-0.128L512.128 467.904l-263.04-263.84c-12.448-12.48-32.704-12.544-45.248-0.064-12.512 12.48-12.544 32.736-0.064 45.28l262.976 263.776L201.6 776.8c-12.544 12.48-12.608 32.704-0.128 45.248a31.937 31.937 0 0 0 22.688 9.44c8.16 0 16.32-3.104 22.56-9.312l265.216-263.808 265.44 266.24c6.24 6.272 14.432 9.408 22.656 9.408a31.94 31.94 0 0 0 22.592-9.344c12.512-12.48 12.544-32.704 0.064-45.248L557.312 513.248z" fill="" ></path></symbol><symbol id="icon-menu" viewBox="0 0 1024 1024"><path d="M109.714 292.571h804.572c21.943 0 36.571-21.942 36.571-43.885 0-14.629-14.628-29.257-36.571-29.257H109.714c-21.943 0-36.571 14.628-36.571 36.571 0 14.629 14.628 36.571 36.571 36.571zM914.286 512H109.714c-21.943 0-36.571 14.629-36.571 36.571 0 14.629 14.628 36.572 36.571 36.572h804.572c21.943 0 36.571-21.943 36.571-43.886 0-14.628-14.628-29.257-36.571-29.257z m0 292.571H109.714c-21.943 0-36.571 14.629-36.571 36.572s14.628 36.571 36.571 36.571h804.572c21.943 0 36.571-21.943 36.571-36.571 0-21.943-14.628-36.572-36.571-36.572z" ></path></symbol><symbol id="icon-right" viewBox="0 0 1024 1024"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="" ></path></symbol><symbol id="icon-left" viewBox="0 0 1024 1024"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="" ></path></symbol><symbol id="icon-side" viewBox="0 0 1024 1024"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" ></path></symbol><symbol id="icon-B" viewBox="0 0 1024 1024"><path d="M98.067692 65.457231H481.28c75.854769 0 132.411077 3.150769 169.668923 9.452307 37.336615 6.301538 70.656 19.534769 100.036923 39.620924 29.459692 20.007385 53.956923 46.710154 73.570462 80.029538 19.692308 33.398154 29.459692 70.734769 29.459692 112.167385 0 44.898462-12.130462 86.094769-36.233846 123.588923a224.886154 224.886154 0 0 1-98.461539 84.283077c58.368 17.092923 103.266462 46.08 134.695385 87.04 31.350154 40.96 47.025231 89.088 47.025231 144.462769 0 43.638154-10.082462 86.016-30.404923 127.212308-20.243692 41.196308-47.891692 74.043077-83.02277 98.697846-35.052308 24.654769-78.296615 39.778462-129.732923 45.449846-32.295385 3.465846-110.119385 5.671385-233.472 6.537846H98.067692V65.457231z m193.536 159.507692V446.621538h126.818462c75.460923 0 122.328615-1.024 140.603077-3.229538 33.083077-3.938462 59.155692-15.36 78.139077-34.343385 18.904615-18.904615 28.435692-43.874462 28.435692-74.830769 0-29.696-8.192-53.720615-24.497231-72.310154-16.384-18.510769-40.644923-29.696-72.940307-33.634461-19.140923-2.205538-74.279385-3.308308-165.415385-3.308308h-111.064615z m0 381.243077v256.315077h179.2c69.710769 0 113.979077-1.969231 132.726154-5.907692 28.750769-5.198769 52.145231-17.959385 70.262154-38.281847 18.116923-20.243692 27.096615-47.340308 27.096615-81.368615 0-28.750769-6.931692-53.169231-20.873846-73.255385a118.232615 118.232615 0 0 0-60.494769-43.795692c-26.387692-9.137231-83.574154-13.705846-171.638154-13.705846H291.603692z" ></path></symbol><symbol id="icon-a" viewBox="0 0 1024 1024"><path d="M757.76 665.6q0 20.48 1.536 34.304t7.68 22.016 18.944 12.288 34.304 4.096q-3.072 25.6-15.36 44.032-11.264 16.384-33.28 29.696t-62.976 13.312q-11.264 0-20.48-0.512t-17.408-2.56l-6.144-2.048-1.024 0q-4.096-1.024-10.24-4.096-2.048-2.048-4.096-2.048-1.024-1.024-2.048-1.024-14.336-8.192-23.552-17.408t-14.336-17.408q-6.144-10.24-9.216-20.48-63.488 75.776-178.176 75.776-48.128 0-88.064-15.36t-69.12-44.032-45.056-68.096-15.872-88.576 16.896-89.088 47.616-67.584 74.24-42.496 96.768-14.848q48.128 0 88.576 17.408t66.048 49.152q0-8.192 0.512-16.384t0.512-15.36q0-71.68-39.936-104.448t-128-32.768q-43.008 0-84.992 6.656t-84.992 17.92q14.336-28.672 25.088-47.616t24.064-29.184q30.72-24.576 158.72-24.576 79.872 0 135.168 13.824t90.624 43.52 51.2 75.264 15.872 108.032l0 200.704zM487.424 743.424q50.176 0 79.872-33.28t29.696-95.744q0-61.44-28.672-93.696t-76.8-32.256q-52.224 0-82.944 33.28t-30.72 94.72q0 58.368 31.744 92.672t77.824 34.304z" ></path></symbol><symbol id="icon-full" viewBox="0 0 1024 1024"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" ></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" ></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" ></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" ></path></symbol><symbol id="icon-add" viewBox="0 0 1024 1024"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" ></path></symbol><symbol id="icon-move" viewBox="0 0 1024 1024"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" ></path></symbol><symbol id="icon-living" viewBox="0 0 1024 1024"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="" ></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="" ></path></symbol></svg>', l = (l = document.getElementsByTagName("script"))[l.length - 1].getAttribute("data-injectcss");
7
- if (l && !e.__iconfont__svg__cssinject__) {
8
- e.__iconfont__svg__cssinject__ = !0;
9
- try {
10
- document.write(
11
- "<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>"
12
- );
13
- } catch {
14
- }
15
- }
16
- function d() {
17
- i || (i = !0, o());
18
- }
19
- t = function() {
20
- var a, u, h, p;
21
- (p = document.createElement("div")).innerHTML = c, c = null, (h = p.getElementsByTagName("svg")[0]) && (h.setAttribute("aria-hidden", "true"), h.style.position = "absolute", h.style.width = 0, h.style.height = 0, h.style.overflow = "hidden", a = h, (u = document.body).firstChild ? (p = a, (h = u.firstChild).parentNode.insertBefore(p, h)) : u.appendChild(a));
22
- }, document.addEventListener ? ~["complete", "loaded", "interactive"].indexOf(document.readyState) ? setTimeout(t, 0) : (n = function() {
23
- document.removeEventListener("DOMContentLoaded", n, !1), t();
24
- }, document.addEventListener("DOMContentLoaded", n, !1)) : document.attachEvent && (o = t, s = e.document, i = !1, (r = function() {
25
- try {
26
- s.documentElement.doScroll("left");
27
- } catch {
28
- return void setTimeout(r, 50);
29
- }
30
- d();
31
- })(), s.onreadystatechange = function() {
32
- s.readyState == "complete" && (s.onreadystatechange = null, d());
33
- });
34
- })(window);
35
- const A = 0, H = 1, ae = 2, Re = {
1
+ var lt = Object.defineProperty;
2
+ var at = (e, t, n) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var q = (e, t, n) => (at(e, typeof t != "symbol" ? t + "" : t, n), n);
4
+ const fe = {
36
5
  name: "Latte",
37
6
  type: "light",
38
7
  palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
39
8
  cssVar: {
40
- "--gap": "30px",
9
+ "--node-gap-x": "30px",
10
+ "--node-gap-y": "10px",
11
+ "--main-gap-x": "65px",
12
+ "--main-gap-y": "45px",
13
+ "--root-radius": "30px",
14
+ "--main-radius": "20px",
15
+ "--root-color": "#ffffff",
16
+ "--root-bgcolor": "#4c4f69",
17
+ "--root-border-color": "rgba(0, 0, 0, 0)",
41
18
  "--main-color": "#444446",
42
19
  "--main-bgcolor": "#ffffff",
20
+ "--topic-padding": "3px",
43
21
  "--color": "#777777",
44
22
  "--bgcolor": "#f6f6f6",
23
+ "--selected": "#4dc4ff",
45
24
  "--panel-color": "#444446",
46
25
  "--panel-bgcolor": "#ffffff",
47
- "--panel-border-color": "#eaeaea"
26
+ "--panel-border-color": "#eaeaea",
27
+ "--map-padding": "50px"
48
28
  }
49
- }, ze = {
29
+ }, pe = {
50
30
  name: "Dark",
51
31
  type: "dark",
52
32
  palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
53
33
  cssVar: {
34
+ "--node-gap-x": "30px",
35
+ "--node-gap-y": "10px",
36
+ "--main-gap-x": "65px",
37
+ "--main-gap-y": "45px",
38
+ "--root-radius": "30px",
39
+ "--main-radius": "20px",
40
+ "--root-color": "#ffffff",
41
+ "--root-bgcolor": "#2d3748",
42
+ "--root-border-color": "rgba(255, 255, 255, 0.1)",
54
43
  "--main-color": "#ffffff",
55
44
  "--main-bgcolor": "#4c4f69",
45
+ "--topic-padding": "3px",
56
46
  "--color": "#cccccc",
57
47
  "--bgcolor": "#252526",
48
+ "--selected": "#4dc4ff",
58
49
  "--panel-color": "#ffffff",
59
50
  "--panel-bgcolor": "#2d3748",
60
- "--panel-border-color": "#696969"
51
+ "--panel-border-color": "#696969",
52
+ "--map-padding": "50px 80px"
61
53
  }
62
54
  };
63
- function se(e) {
55
+ function te(e) {
64
56
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
65
57
  }
66
- const ie = function(e, t) {
58
+ const ne = function(e, t) {
67
59
  if (t.id === e)
68
60
  return t;
69
61
  if (t.children && t.children.length) {
70
62
  for (let n = 0; n < t.children.length; n++) {
71
- const o = ie(e, t.children[n]);
63
+ const o = ne(e, t.children[n]);
72
64
  if (o)
73
65
  return o;
74
66
  }
75
67
  return null;
76
68
  } else
77
69
  return null;
78
- }, P = (e, t) => {
70
+ }, $ = (e, t) => {
79
71
  if (e.parent = t, e.children)
80
72
  for (let n = 0; n < e.children.length; n++)
81
- P(e.children[n], e);
73
+ $(e.children[n], e);
82
74
  };
83
- function pe(e) {
75
+ function ge(e) {
84
76
  if (e.id = V(), e.children)
85
77
  for (let t = 0; t < e.children.length; t++)
86
- pe(e.children[t]);
78
+ ge(e.children[t]);
87
79
  }
88
- function re(e, t, n, o) {
89
- const s = o - t, i = e - n;
90
- let r = Math.atan(Math.abs(s) / Math.abs(i)) / 3.14 * 180;
80
+ function oe(e, t, n, o) {
81
+ const i = o - t, s = e - n;
82
+ let r = Math.atan(Math.abs(i) / Math.abs(s)) / 3.14 * 180;
91
83
  if (isNaN(r))
92
84
  return;
93
- i < 0 && s > 0 && (r = 180 - r), i < 0 && s < 0 && (r = 180 + r), i > 0 && s < 0 && (r = 360 - r);
94
- const c = 12, l = 30, d = r + l, a = r - l;
85
+ s < 0 && i > 0 && (r = 180 - r), s < 0 && i < 0 && (r = 180 + r), s > 0 && i < 0 && (r = 360 - r);
86
+ const c = 12, u = 30, a = r + u, f = r - u;
95
87
  return {
96
- x1: n + Math.cos(Math.PI * d / 180) * c,
97
- y1: o - Math.sin(Math.PI * d / 180) * c,
98
- x2: n + Math.cos(Math.PI * a / 180) * c,
99
- y2: o - Math.sin(Math.PI * a / 180) * c
88
+ x1: n + Math.cos(Math.PI * a / 180) * c,
89
+ y1: o - Math.sin(Math.PI * a / 180) * c,
90
+ x2: n + Math.cos(Math.PI * f / 180) * c,
91
+ y2: o - Math.sin(Math.PI * f / 180) * c
100
92
  };
101
93
  }
102
94
  function V() {
103
95
  return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
104
96
  }
105
- const st = function() {
97
+ const dt = function() {
106
98
  const e = V();
107
99
  return {
108
100
  topic: this.newTopicName,
@@ -117,7 +109,7 @@ function me(e) {
117
109
  })
118
110
  );
119
111
  }
120
- const B = (e, t) => {
112
+ const H = (e, t) => {
121
113
  let n = 0, o = 0;
122
114
  for (; t && t !== e; )
123
115
  n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
@@ -125,29 +117,160 @@ const B = (e, t) => {
125
117
  }, S = (e, t) => {
126
118
  for (const n in t)
127
119
  e.setAttribute(n, t[n]);
128
- }, he = (e) => e ? e.tagName === "ME-TPC" : !1, de = (e) => e.filter((t) => {
129
- for (let n = 0; n < e.length; n++) {
130
- if (t === e[n])
120
+ }, ae = (e) => e ? e.tagName === "ME-TPC" : !1, ce = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
121
+ for (let i = 0; i < o.length; i++) {
122
+ if (t === o[i])
131
123
  continue;
132
- if (e[n].parentElement.parentElement.contains(t))
124
+ const { parent: s } = t.nodeObj;
125
+ if (s === o[i].nodeObj)
133
126
  return !1;
134
127
  }
135
128
  return !0;
136
- }), Fe = (e) => {
129
+ }), Ye = (e) => {
137
130
  const t = /translate\(([^,]+),\s*([^)]+)\)/, n = e.match(t);
138
131
  return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
132
+ }, ve = function(e) {
133
+ for (let t = 0; t < e.length; t++) {
134
+ const { dom: n, evt: o, func: i } = e[t];
135
+ n.addEventListener(o, i);
136
+ }
137
+ return function() {
138
+ for (let n = 0; n < e.length; n++) {
139
+ const { dom: o, evt: i, func: s } = e[n];
140
+ o.removeEventListener(i, s);
141
+ }
142
+ };
139
143
  };
140
- function it(e) {
141
- const { dragMoveHelper: t } = e;
142
- e.map.addEventListener("click", (n) => {
143
- var i, r, c;
144
- if (n.button !== 0)
144
+ var M = /* @__PURE__ */ ((e) => (e.LHS = "lhs", e.RHS = "rhs", e))(M || {});
145
+ const ht = (e) => {
146
+ const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");
147
+ e.selectNode(t[Math.ceil(t.length / 2) - 1]);
148
+ }, ut = (e) => {
149
+ const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
150
+ e.selectNode(t[Math.ceil(t.length / 2) - 1]);
151
+ }, ft = (e) => {
152
+ e.selectNode(e.map.querySelector("me-root>me-tpc"));
153
+ }, pt = function(e, t) {
154
+ const n = t.parentElement.parentElement.parentElement.previousSibling;
155
+ if (n) {
156
+ const o = n.firstChild;
157
+ e.selectNode(o);
158
+ }
159
+ }, gt = function(e, t) {
160
+ const n = t.parentElement.nextSibling;
161
+ if (n && n.firstChild) {
162
+ const o = n.firstChild.firstChild.firstChild;
163
+ e.selectNode(o);
164
+ }
165
+ }, _e = function(e, t) {
166
+ var s, r;
167
+ const n = e.currentNode || ((s = e.currentNodes) == null ? void 0 : s[0]);
168
+ if (!n)
169
+ return;
170
+ const o = n.nodeObj, i = n.offsetParent.offsetParent.parentElement;
171
+ o.parent ? i.className === t ? gt(e, n) : (r = o.parent) != null && r.parent ? pt(e, n) : ft(e) : t === M.LHS ? ht(e) : ut(e);
172
+ }, ke = function(e, t) {
173
+ const n = e.currentNode;
174
+ if (!n || !n.nodeObj.parent)
175
+ return;
176
+ const i = t + "Sibling", s = n.parentElement.parentElement[i];
177
+ s ? e.selectNode(s.firstChild.firstChild) : e.selectNode(n);
178
+ }, ie = function(e, t, n) {
179
+ const { scaleVal: o, scaleSensitivity: i } = e;
180
+ switch (t) {
181
+ case "in":
182
+ if (o > 1.6)
183
+ return;
184
+ e.scale(o + i, n);
185
+ break;
186
+ case "out":
187
+ if (o < 0.6)
188
+ return;
189
+ e.scale(o - i, n);
190
+ }
191
+ };
192
+ function mt(e, t) {
193
+ t = t === !0 ? {} : t;
194
+ const n = () => {
195
+ e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
196
+ }, o = {
197
+ Enter: (i) => {
198
+ i.shiftKey ? e.insertSibling("before") : i.ctrlKey ? e.insertParent() : e.insertSibling("after");
199
+ },
200
+ Tab: () => {
201
+ e.addChild();
202
+ },
203
+ F1: () => {
204
+ e.toCenter();
205
+ },
206
+ F2: () => {
207
+ e.beginEdit();
208
+ },
209
+ ArrowUp: (i) => {
210
+ if (i.altKey)
211
+ e.moveUpNode();
212
+ else {
213
+ if (i.metaKey || i.ctrlKey)
214
+ return e.initSide();
215
+ ke(e, "previous");
216
+ }
217
+ },
218
+ ArrowDown: (i) => {
219
+ i.altKey ? e.moveDownNode() : ke(e, "next");
220
+ },
221
+ ArrowLeft: (i) => {
222
+ if (i.metaKey || i.ctrlKey)
223
+ return e.initLeft();
224
+ _e(e, M.LHS);
225
+ },
226
+ ArrowRight: (i) => {
227
+ if (i.metaKey || i.ctrlKey)
228
+ return e.initRight();
229
+ _e(e, M.RHS);
230
+ },
231
+ PageUp: () => e.moveUpNode(),
232
+ PageDown: () => {
233
+ e.moveDownNode();
234
+ },
235
+ c: (i) => {
236
+ (i.metaKey || i.ctrlKey) && (e.waitCopy = e.currentNodes);
237
+ },
238
+ x: (i) => {
239
+ (i.metaKey || i.ctrlKey) && (e.waitCopy = e.currentNodes, n());
240
+ },
241
+ v: (i) => {
242
+ !e.waitCopy || !e.currentNode || (i.metaKey || i.ctrlKey) && (e.waitCopy.length === 1 ? e.copyNode(e.waitCopy[0], e.currentNode) : e.copyNodes(e.waitCopy, e.currentNode));
243
+ },
244
+ "=": (i) => {
245
+ (i.metaKey || i.ctrlKey) && ie(e, "in");
246
+ },
247
+ "-": (i) => {
248
+ (i.metaKey || i.ctrlKey) && ie(e, "out");
249
+ },
250
+ 0: (i) => {
251
+ (i.metaKey || i.ctrlKey) && e.scale(1);
252
+ },
253
+ Delete: n,
254
+ Backspace: n,
255
+ ...t
256
+ };
257
+ e.container.onkeydown = (i) => {
258
+ if (i.preventDefault(), !e.editable || i.target !== i.currentTarget)
259
+ return;
260
+ const s = o[i.key];
261
+ s && s(i);
262
+ };
263
+ }
264
+ function vt(e) {
265
+ const { dragMoveHelper: t } = e, n = (d) => {
266
+ var m, v, b;
267
+ if (d.button !== 0)
145
268
  return;
146
- if ((i = e.helper1) != null && i.moved) {
269
+ if ((m = e.helper1) != null && m.moved) {
147
270
  e.helper1.clear();
148
271
  return;
149
272
  }
150
- if ((r = e.helper2) != null && r.moved) {
273
+ if ((v = e.helper2) != null && v.moved) {
151
274
  e.helper2.clear();
152
275
  return;
153
276
  }
@@ -155,41 +278,74 @@ function it(e) {
155
278
  t.clear();
156
279
  return;
157
280
  }
158
- e.clearSelection();
159
- const o = n.target;
160
- if (o.tagName === "ME-EPD")
161
- e.expandNode(o.previousSibling);
162
- else if (he(o))
163
- e.selectNode(o, !1, n);
281
+ const l = d.target;
282
+ if (l.tagName === "ME-EPD")
283
+ d.ctrlKey || d.metaKey ? e.expandNodeAll(l.previousSibling) : e.expandNode(l.previousSibling);
284
+ else if (l.tagName === "ME-TPC" && e.currentNodes.length > 1)
285
+ e.selectNode(l);
164
286
  else if (!e.editable)
165
287
  return;
166
- const s = (c = o.parentElement) == null ? void 0 : c.parentElement;
167
- s.getAttribute("class") === "topiclinks" ? e.selectArrow(o.parentElement) : s.getAttribute("class") === "summary" && e.selectSummary(o.parentElement);
168
- }), e.map.addEventListener("dblclick", (n) => {
169
- var i;
288
+ const p = (b = l.parentElement) == null ? void 0 : b.parentElement;
289
+ p.getAttribute("class") === "topiclinks" ? e.selectArrow(l.parentElement) : p.getAttribute("class") === "summary" && e.selectSummary(l.parentElement);
290
+ }, o = (d) => {
291
+ var m;
170
292
  if (!e.editable)
171
293
  return;
172
- const o = n.target;
173
- he(o) && e.beginEdit(o);
174
- const s = (i = o.parentElement) == null ? void 0 : i.parentElement;
175
- s.getAttribute("class") === "topiclinks" ? e.editArrowLabel(o.parentElement) : s.getAttribute("class") === "summary" && e.editSummary(o.parentElement);
176
- }), e.map.addEventListener("mousedown", (n) => {
177
- const o = e.mouseSelectionButton === 0 ? 2 : 0;
178
- n.button === o && n.target.contentEditable === "inherit" && (t.moved = !1, t.mousedown = !0, e.map.style.transition = "none");
179
- }), document.addEventListener("mousemove", (n) => {
180
- n.target.contentEditable === "inherit" && t.onMove(n), t.x = n.clientX, t.y = n.clientY;
181
- }), document.addEventListener("mouseup", (n) => {
182
- const o = e.mouseSelectionButton === 0 ? 2 : 0;
183
- n.button === o && t.clear();
184
- }), document.addEventListener("contextmenu", (n) => {
185
- t.moved && n.preventDefault();
186
- });
294
+ const l = d.target;
295
+ ae(l) && e.beginEdit(l);
296
+ const p = (m = l.parentElement) == null ? void 0 : m.parentElement;
297
+ p.getAttribute("class") === "topiclinks" ? e.editArrowLabel(l.parentElement) : p.getAttribute("class") === "summary" && e.editSummary(l.parentElement);
298
+ };
299
+ let i = 0;
300
+ const s = (d) => {
301
+ if (d.pointerType === "mouse")
302
+ return;
303
+ const l = (/* @__PURE__ */ new Date()).getTime(), p = l - i;
304
+ p < 300 && p > 0 && o(d), i = l;
305
+ }, r = (d) => {
306
+ t.moved = !1;
307
+ const l = e.mouseSelectionButton === 0 ? 2 : 0;
308
+ if (d.button !== l && d.pointerType === "mouse")
309
+ return;
310
+ t.x = d.clientX, t.y = d.clientY;
311
+ const p = d.target;
312
+ p.className !== "circle" && p.contentEditable !== "plaintext-only" && (t.mousedown = !0, e.map.style.transition = "none", p.setPointerCapture(d.pointerId));
313
+ }, c = (d) => {
314
+ if (d.target.contentEditable !== "plaintext-only") {
315
+ const l = d.clientX - t.x, p = d.clientY - t.y;
316
+ t.onMove(l, p);
317
+ }
318
+ t.x = d.clientX, t.y = d.clientY;
319
+ }, u = (d) => {
320
+ const l = e.mouseSelectionButton === 0 ? 2 : 0;
321
+ if (d.button !== l && d.pointerType === "mouse")
322
+ return;
323
+ const p = d.target;
324
+ p.hasPointerCapture && p.hasPointerCapture(d.pointerId) && p.releasePointerCapture(d.pointerId), t.clear();
325
+ }, a = (d) => {
326
+ if (d.preventDefault(), d.button !== 2 || !e.editable)
327
+ return;
328
+ const l = d.target;
329
+ ae(l) && !l.classList.contains("selected") && e.selectNode(l), setTimeout(() => {
330
+ e.dragMoveHelper.moved || e.bus.fire("showContextMenu", d);
331
+ }, 200);
332
+ }, f = (d) => {
333
+ d.stopPropagation(), d.preventDefault(), d.ctrlKey || d.metaKey ? d.deltaY < 0 ? ie(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && ie(e, "out", e.dragMoveHelper) : d.shiftKey ? e.move(-d.deltaY, 0) : (e.map.style.transition = "none", e.move(-d.deltaX, -d.deltaY), e.map.style.transition = "transform 0.3s");
334
+ }, { container: h } = e;
335
+ return ve([
336
+ { dom: h, evt: "pointerdown", func: r },
337
+ { dom: h, evt: "pointermove", func: c },
338
+ { dom: h, evt: "pointerup", func: u },
339
+ { dom: h, evt: "pointerup", func: s },
340
+ { dom: h, evt: "click", func: n },
341
+ { dom: h, evt: "dblclick", func: o },
342
+ { dom: h, evt: "contextmenu", func: a },
343
+ { dom: h, evt: "wheel", func: f }
344
+ ]);
187
345
  }
188
- function rt() {
346
+ function bt() {
189
347
  return {
190
348
  handlers: {},
191
- showHandler: function() {
192
- },
193
349
  addListener: function(e, t) {
194
350
  this.handlers[e] === void 0 && (this.handlers[e] = []), this.handlers[e].push(t);
195
351
  },
@@ -212,105 +368,109 @@ function rt() {
212
368
  }
213
369
  };
214
370
  }
215
- var M = /* @__PURE__ */ ((e) => (e.LHS = "lhs", e.RHS = "rhs", e))(M || {});
216
- const ce = document, ct = function() {
371
+ const se = document, yt = function() {
217
372
  this.nodes.innerHTML = "";
218
373
  const e = this.createTopic(this.nodeData);
219
- ge(e, this.nodeData), e.draggable = !1;
220
- const t = ce.createElement("me-root");
374
+ be(e, this.nodeData), e.draggable = !1;
375
+ const t = se.createElement("me-root");
221
376
  t.appendChild(e);
222
377
  const n = this.nodeData.children || [];
223
- if (this.direction === ae) {
224
- let o = 0, s = 0;
225
- n.map((i) => {
226
- i.direction === A ? o += 1 : i.direction === H ? s += 1 : o <= s ? (i.direction = A, o += 1) : (i.direction = H, s += 1);
378
+ if (this.direction === 2) {
379
+ let o = 0, i = 0;
380
+ n.map((s) => {
381
+ s.direction === 0 ? o += 1 : s.direction === 1 ? i += 1 : o <= i ? (s.direction = 0, o += 1) : (s.direction = 1, i += 1);
227
382
  });
228
383
  }
229
- lt(this, n, t);
230
- }, lt = function(e, t, n) {
231
- const o = ce.createElement("me-main");
384
+ wt(this, n, t);
385
+ }, wt = function(e, t, n) {
386
+ const o = se.createElement("me-main");
232
387
  o.className = M.LHS;
233
- const s = ce.createElement("me-main");
234
- s.className = M.RHS;
235
- for (let i = 0; i < t.length; i++) {
236
- const r = t[i], { grp: c } = e.createWrapper(r);
237
- e.direction === ae ? r.direction === A ? o.appendChild(c) : s.appendChild(c) : e.direction === A ? o.appendChild(c) : s.appendChild(c);
238
- }
239
- e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines);
240
- }, at = function(e, t) {
241
- const n = ce.createElement("me-children");
388
+ const i = se.createElement("me-main");
389
+ i.className = M.RHS;
390
+ for (let s = 0; s < t.length; s++) {
391
+ const r = t[s], { grp: c } = e.createWrapper(r);
392
+ e.direction === 2 ? r.direction === 0 ? o.appendChild(c) : i.appendChild(c) : e.direction === 0 ? o.appendChild(c) : i.appendChild(c);
393
+ }
394
+ e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(i), e.nodes.appendChild(e.lines);
395
+ }, xt = function(e, t) {
396
+ const n = se.createElement("me-children");
242
397
  for (let o = 0; o < t.length; o++) {
243
- const s = t[o], { grp: i } = e.createWrapper(s);
244
- n.appendChild(i);
398
+ const i = t[o], { grp: s } = e.createWrapper(i);
399
+ n.appendChild(s);
245
400
  }
246
401
  return n;
247
- }, k = document, E = (e, t) => {
248
- const o = (t ? t.mindElixirBox : k).querySelector(`[data-nodeid=me${e}]`);
402
+ }, A = document, Ge = function(e, t) {
403
+ const o = (this != null && this.el ? this.el : t || document).querySelector(`[data-nodeid=me${e}]`);
249
404
  if (!o)
250
405
  throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
251
406
  return o;
252
- }, ge = function(e, t) {
253
- if (e.innerHTML = "", t.style && (e.style.color = t.style.color || "", e.style.background = t.style.background || "", e.style.fontSize = t.style.fontSize + "px", e.style.fontWeight = t.style.fontWeight || "normal"), t.dangerouslySetInnerHTML) {
407
+ }, be = function(e, t) {
408
+ if (e.innerHTML = "", t.style) {
409
+ const n = t.style;
410
+ for (const o in n)
411
+ e.style[o] = n[o];
412
+ }
413
+ if (t.dangerouslySetInnerHTML) {
254
414
  e.innerHTML = t.dangerouslySetInnerHTML;
255
415
  return;
256
416
  }
257
417
  if (t.image) {
258
418
  const n = t.image;
259
419
  if (n.url && n.width && n.height) {
260
- const o = k.createElement("img");
420
+ const o = A.createElement("img");
261
421
  o.src = n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o;
262
422
  }
263
423
  } else
264
424
  e.image && (e.image = void 0);
265
425
  {
266
- const n = k.createElement("span");
426
+ const n = A.createElement("span");
267
427
  n.className = "text", n.textContent = t.topic, e.appendChild(n), e.text = n;
268
428
  }
269
429
  if (t.hyperLink) {
270
- const n = k.createElement("a");
430
+ const n = A.createElement("a");
271
431
  n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n;
272
432
  } else
273
433
  e.link && (e.link = void 0);
274
434
  if (t.icons && t.icons.length) {
275
- const n = k.createElement("span");
276
- n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${se(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
435
+ const n = A.createElement("span");
436
+ n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${te(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
277
437
  } else
278
438
  e.icons && (e.icons = void 0);
279
439
  if (t.tags && t.tags.length) {
280
- const n = k.createElement("div");
281
- n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${se(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
440
+ const n = A.createElement("div");
441
+ n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${te(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
282
442
  } else
283
443
  e.tags && (e.tags = void 0);
284
- }, dt = function(e, t) {
285
- const n = k.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
444
+ }, Et = function(e, t) {
445
+ const n = A.createElement("me-wrapper"), { p: o, tpc: i } = this.createParent(e);
286
446
  if (n.appendChild(o), !t && e.children && e.children.length > 0) {
287
- const i = ve(e.expanded);
288
- if (o.appendChild(i), e.expanded !== !1) {
289
- const r = at(this, e.children);
447
+ const s = ye(e.expanded);
448
+ if (o.appendChild(s), e.expanded !== !1) {
449
+ const r = xt(this, e.children);
290
450
  n.appendChild(r);
291
451
  }
292
452
  }
293
- return { grp: n, top: o, tpc: s };
294
- }, ht = function(e) {
295
- const t = k.createElement("me-parent"), n = this.createTopic(e);
296
- return ge(n, e), t.appendChild(n), { p: t, tpc: n };
297
- }, ut = function(e) {
298
- const t = k.createElement("me-children");
453
+ return { grp: n, top: o, tpc: i };
454
+ }, Ct = function(e) {
455
+ const t = A.createElement("me-parent"), n = this.createTopic(e);
456
+ return be(n, e), t.appendChild(n), { p: t, tpc: n };
457
+ }, St = function(e) {
458
+ const t = A.createElement("me-children");
299
459
  return t.append(...e), t;
300
- }, ft = function(e) {
301
- const t = k.createElement("me-tpc");
460
+ }, Nt = function(e) {
461
+ const t = A.createElement("me-tpc");
302
462
  return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
303
463
  };
304
- function qe(e) {
305
- const t = k.createRange();
464
+ function Ke(e) {
465
+ const t = A.createRange();
306
466
  t.selectNodeContents(e);
307
467
  const n = window.getSelection();
308
468
  n && (n.removeAllRanges(), n.addRange(t));
309
469
  }
310
- const pt = function(e) {
470
+ const _t = function(e) {
311
471
  if (!e)
312
472
  return;
313
- const t = k.createElement("div"), n = e.text.textContent;
473
+ const t = A.createElement("div"), n = e.text.textContent;
314
474
  e.appendChild(t), t.id = "input-box", t.textContent = n, t.contentEditable = "plaintext-only", t.spellcheck = !1;
315
475
  const o = getComputedStyle(e);
316
476
  t.style.cssText = `min-width:${e.offsetWidth - 8}px;
@@ -319,47 +479,47 @@ const pt = function(e) {
319
479
  margin:${o.margin};
320
480
  font:${o.font};
321
481
  background-color:${o.backgroundColor !== "rgba(0, 0, 0, 0)" && o.backgroundColor};
322
- border-radius:${o.borderRadius};`, this.direction === A && (t.style.right = "0"), t.focus(), qe(t), this.bus.fire("operation", {
482
+ border-radius:${o.borderRadius};`, this.direction === 0 && (t.style.right = "0"), Ke(t), this.bus.fire("operation", {
323
483
  name: "beginEdit",
324
484
  obj: e.nodeObj
325
- }), t.addEventListener("keydown", (s) => {
326
- s.stopPropagation();
327
- const i = s.key;
328
- if (i === "Enter" || i === "Tab") {
329
- if (s.shiftKey)
485
+ }), t.addEventListener("keydown", (i) => {
486
+ i.stopPropagation();
487
+ const s = i.key;
488
+ if (s === "Enter" || s === "Tab") {
489
+ if (i.shiftKey)
330
490
  return;
331
- s.preventDefault(), t.blur(), this.map.focus();
491
+ i.preventDefault(), t.blur(), this.container.focus();
332
492
  }
333
493
  }), t.addEventListener("blur", () => {
334
494
  var r;
335
495
  if (!t)
336
496
  return;
337
- const s = e.nodeObj, i = ((r = t.textContent) == null ? void 0 : r.trim()) || "";
338
- i === "" ? s.topic = n : s.topic = i, t.remove(), i !== n && (e.text.textContent = s.topic, this.linkDiv(), this.bus.fire("operation", {
497
+ const i = e.nodeObj, s = ((r = t.textContent) == null ? void 0 : r.trim()) || "";
498
+ s === "" ? i.topic = n : i.topic = s, t.remove(), s !== n && (e.text.textContent = i.topic, this.linkDiv(), this.bus.fire("operation", {
339
499
  name: "finishEdit",
340
- obj: s,
500
+ obj: i,
341
501
  origin: n
342
502
  }));
343
503
  });
344
- }, ve = function(e) {
345
- const t = k.createElement("me-epd");
504
+ }, ye = function(e) {
505
+ const t = A.createElement("me-epd");
346
506
  return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
347
- }, q = document, Y = "http://www.w3.org/2000/svg", Ve = function(e, t, n) {
348
- const o = q.createElementNS(Y, "path");
507
+ }, W = document, k = "http://www.w3.org/2000/svg", qe = function(e, t, n) {
508
+ const o = W.createElementNS(k, "path");
349
509
  return S(o, {
350
510
  d: e,
351
511
  stroke: t || "#666",
352
512
  fill: "none",
353
513
  "stroke-width": n
354
514
  }), o;
355
- }, Z = function(e) {
356
- const t = q.createElementNS(Y, "svg");
515
+ }, U = function(e) {
516
+ const t = W.createElementNS(k, "svg");
357
517
  return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
358
- }, Ce = function() {
359
- const e = q.createElementNS(Y, "line");
360
- return e.setAttribute("stroke", "#bbb"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e;
361
- }, mt = function(e, t, n) {
362
- const o = q.createElementNS(Y, "g");
518
+ }, Te = function() {
519
+ const e = W.createElementNS(k, "line");
520
+ return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
521
+ }, kt = function(e, t, n, o) {
522
+ const i = W.createElementNS(k, "g");
363
523
  return [
364
524
  {
365
525
  name: "line",
@@ -373,52 +533,52 @@ const pt = function(e) {
373
533
  name: "arrow2",
374
534
  d: n
375
535
  }
376
- ].forEach((i, r) => {
377
- const c = i.d, l = q.createElementNS(Y, "path");
378
- S(l, {
379
- d: c,
380
- stroke: "rgb(235, 95, 82)",
536
+ ].forEach((r, c) => {
537
+ const u = r.d, a = W.createElementNS(k, "path"), f = {
538
+ d: u,
539
+ stroke: (o == null ? void 0 : o.stroke) || "rgb(235, 95, 82)",
381
540
  fill: "none",
382
- "stroke-linecap": "cap",
383
- "stroke-width": "2"
384
- }), r === 0 && l.setAttribute("stroke-dasharray", "8,2");
385
- const a = q.createElementNS(Y, "path");
386
- S(a, {
387
- d: c,
541
+ "stroke-linecap": (o == null ? void 0 : o.strokeLinecap) || "cap",
542
+ "stroke-width": String((o == null ? void 0 : o.strokeWidth) || "2")
543
+ };
544
+ (o == null ? void 0 : o.opacity) !== void 0 && (f.opacity = String(o.opacity)), S(a, f), c === 0 && a.setAttribute("stroke-dasharray", (o == null ? void 0 : o.strokeDasharray) || "8,2");
545
+ const h = W.createElementNS(k, "path");
546
+ S(h, {
547
+ d: u,
388
548
  stroke: "transparent",
389
549
  fill: "none",
390
550
  "stroke-width": "15"
391
- }), o.appendChild(a), o.appendChild(l), o[i.name] = l;
392
- }), o;
393
- }, Ie = function(e, t, n) {
551
+ }), i.appendChild(h), i.appendChild(a), i[r.name] = a;
552
+ }), i;
553
+ }, ze = function(e, t, n) {
394
554
  if (!t)
395
555
  return;
396
- const o = q.createElement("div");
556
+ const o = W.createElement("div");
397
557
  e.nodes.appendChild(o);
398
- const s = t.innerHTML;
399
- o.id = "input-box", o.textContent = s, o.contentEditable = "plaintext-only", o.spellcheck = !1;
400
- const i = t.getBBox();
558
+ const i = t.innerHTML;
559
+ o.id = "input-box", o.textContent = i, o.contentEditable = "plaintext-only", o.spellcheck = !1;
560
+ const s = t.getBBox();
401
561
  o.style.cssText = `
402
- min-width:${Math.max(88, i.width)}px;
562
+ min-width:${Math.max(88, s.width)}px;
403
563
  position:absolute;
404
- left:${i.x}px;
405
- top:${i.y}px;
564
+ left:${s.x}px;
565
+ top:${s.y}px;
406
566
  padding: 2px 4px;
407
567
  margin: -2px -4px;
408
- `, o.focus(), qe(o), o.addEventListener("keydown", (r) => {
568
+ `, Ke(o), e.scrollIntoView(o), o.addEventListener("keydown", (r) => {
409
569
  r.stopPropagation();
410
570
  const c = r.key;
411
571
  if (c === "Enter" || c === "Tab") {
412
572
  if (r.shiftKey)
413
573
  return;
414
- r.preventDefault(), o.blur(), e.map.focus();
574
+ r.preventDefault(), o.blur(), e.container.focus();
415
575
  }
416
576
  }), o.addEventListener("blur", () => {
417
577
  var c;
418
578
  if (!o)
419
579
  return;
420
580
  const r = ((c = o.textContent) == null ? void 0 : c.trim()) || "";
421
- r === "" ? n.label = s : n.label = r, o.remove(), r !== s && (t.innerHTML = n.label, e.linkDiv(), "parent" in n ? e.bus.fire("operation", {
581
+ r === "" ? n.label = i : n.label = r, o.remove(), r !== i && (t.innerHTML = n.label, e.linkDiv(), "parent" in n ? e.bus.fire("operation", {
422
582
  name: "finishEditSummary",
423
583
  obj: n
424
584
  }) : e.bus.fire("operation", {
@@ -426,38 +586,34 @@ const pt = function(e) {
426
586
  obj: n
427
587
  }));
428
588
  });
429
- }, gt = function(e) {
430
- const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, c = this.map.querySelector("me-nodes").offsetWidth;
431
- this.nodes.style.top = `${1e4 - this.nodes.offsetHeight / 2}px`, this.alignment === "root" ? this.nodes.style.left = `${1e4 - o - s / 2}px` : this.nodes.style.left = `${1e4 - c / 2}px`;
432
- const l = this.map.querySelectorAll("me-main > me-wrapper");
589
+ }, Tt = function(e) {
590
+ const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, i = t.offsetWidth, s = t.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
433
591
  this.lines.innerHTML = "";
434
- for (let d = 0; d < l.length; d++) {
435
- const a = l[d], u = a.querySelector("me-tpc"), { offsetLeft: h, offsetTop: p } = B(this.nodes, u), g = u.offsetWidth, v = u.offsetHeight, m = a.parentNode.className, f = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: p, cL: h, cW: g, cH: v, direction: m, containerHeight: this.nodes.offsetHeight }), y = this.theme.palette, x = u.nodeObj.branchColor || y[d % y.length];
436
- u.style.borderColor = x, this.lines.appendChild(Ve(f, x, "3"));
437
- const N = a.children[0].children[1];
438
- if (N && (N.style.top = (N.parentNode.offsetHeight - N.offsetHeight) / 2 + "px", m === M.LHS ? N.style.left = "-10px" : N.style.right = "-10px"), e && e !== a)
592
+ for (let c = 0; c < r.length; c++) {
593
+ const u = r[c], a = u.querySelector("me-tpc"), { offsetLeft: f, offsetTop: h } = H(this.nodes, a), g = a.offsetWidth, d = a.offsetHeight, l = u.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: i, pH: s, cT: h, cL: f, cW: g, cH: d, direction: l, containerHeight: this.nodes.offsetHeight }), m = this.theme.palette, v = a.nodeObj.branchColor || m[c % m.length];
594
+ if (a.style.borderColor = v, this.lines.appendChild(qe(p, v, "3")), e && e !== u)
439
595
  continue;
440
- const b = Z("subLines"), w = a.lastChild;
441
- w.tagName === "svg" && w.remove(), a.appendChild(b), Ke(this, b, x, a, m, !0);
596
+ const b = U("subLines"), y = u.lastChild;
597
+ y.tagName === "svg" && y.remove(), u.appendChild(b), Ue(this, b, v, u, l, !0);
442
598
  }
443
599
  this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
444
- }, Ke = function(e, t, n, o, s, i) {
600
+ }, Ue = function(e, t, n, o, i, s) {
445
601
  const r = o.firstChild, c = o.children[1].children;
446
602
  if (c.length === 0)
447
603
  return;
448
- const l = r.offsetTop, d = r.offsetLeft, a = r.offsetWidth, u = r.offsetHeight;
449
- for (let h = 0; h < c.length; h++) {
450
- const p = c[h], g = p.firstChild, v = g.offsetTop, m = g.offsetLeft, f = g.offsetWidth, y = g.offsetHeight, x = g.firstChild.nodeObj.branchColor || n, N = e.generateSubBranch({ pT: l, pL: d, pW: a, pH: u, cT: v, cL: m, cW: f, cH: y, direction: s, isFirst: i });
451
- t.appendChild(Ve(N, x, "2"));
452
- const b = g.children[1];
453
- if (b) {
454
- if (b.style.bottom = -(b.offsetHeight / 2) + "px", s === M.LHS ? b.style.left = "10px" : s === M.RHS && (b.style.right = "10px"), !b.expanded)
604
+ const u = r.offsetTop, a = r.offsetLeft, f = r.offsetWidth, h = r.offsetHeight;
605
+ for (let g = 0; g < c.length; g++) {
606
+ const d = c[g], l = d.firstChild, p = l.offsetTop, m = l.offsetLeft, v = l.offsetWidth, b = l.offsetHeight, y = l.firstChild.nodeObj.branchColor || n, E = e.generateSubBranch({ pT: u, pL: a, pW: f, pH: h, cT: p, cL: m, cW: v, cH: b, direction: i, isFirst: s });
607
+ t.appendChild(qe(E, y, "2"));
608
+ const N = l.children[1];
609
+ if (N) {
610
+ if (!N.expanded)
455
611
  continue;
456
612
  } else
457
613
  continue;
458
- Ke(e, t, x, p, s);
614
+ Ue(e, t, y, d, i);
459
615
  }
460
- }, Se = {
616
+ }, Ae = {
461
617
  addChild: "插入子节点",
462
618
  addParent: "插入父节点",
463
619
  addSibling: "插入同级节点",
@@ -469,9 +625,9 @@ const pt = function(e) {
469
625
  link: "连接",
470
626
  clickTips: "请点击目标节点",
471
627
  summary: "摘要"
472
- }, _e = {
473
- cn: Se,
474
- zh_CN: Se,
628
+ }, Le = {
629
+ cn: Ae,
630
+ zh_CN: Ae,
475
631
  zh_TW: {
476
632
  addChild: "插入子節點",
477
633
  addParent: "插入父節點",
@@ -590,221 +746,105 @@ const pt = function(e) {
590
746
  summary: "요약"
591
747
  }
592
748
  };
593
- function vt(e, t) {
594
- const n = (b) => {
595
- const w = document.createElement("div");
596
- return w.innerText = b, w.className = "tips", w;
597
- }, o = (b, w, _) => {
598
- const L = document.createElement("li");
599
- return L.id = b, L.innerHTML = `<span>${se(w)}</span><span ${_ ? 'class="key"' : ""}>${se(_)}</span>`, L;
600
- }, s = _e[e.locale] ? e.locale : "en", i = _e[s], r = o("cm-add_child", i.addChild, "Tab"), c = o("cm-add_parent", i.addParent, "Ctrl + Enter"), l = o("cm-add_sibling", i.addSibling, "Enter"), d = o("cm-remove_child", i.removeNode, "Delete"), a = o("cm-fucus", i.focus, ""), u = o("cm-unfucus", i.cancelFocus, ""), h = o("cm-up", i.moveUp, "PgUp"), p = o("cm-down", i.moveDown, "Pgdn"), g = o("cm-link", i.link, ""), v = o("cm-link-bidirectional", "Bidreactional Link", ""), m = o("cm-summary", i.summary, ""), f = document.createElement("ul");
601
- if (f.className = "menu-list", f.appendChild(r), f.appendChild(c), f.appendChild(l), f.appendChild(d), (!t || t.focus) && (f.appendChild(a), f.appendChild(u)), f.appendChild(h), f.appendChild(p), f.appendChild(m), (!t || t.link) && (f.appendChild(g), f.appendChild(v)), t && t.extend)
602
- for (let b = 0; b < t.extend.length; b++) {
603
- const w = t.extend[b], _ = o(w.name, w.name, w.key || "");
604
- f.appendChild(_), _.onclick = (L) => {
605
- w.onclick(L);
749
+ function At(e, t) {
750
+ t = t === !0 ? {
751
+ focus: !0,
752
+ link: !0
753
+ } : t;
754
+ const n = (w) => {
755
+ const x = document.createElement("div");
756
+ return x.innerText = w, x.className = "tips", x;
757
+ }, o = (w, x, C) => {
758
+ const _ = document.createElement("li");
759
+ return _.id = w, _.innerHTML = `<span>${te(x)}</span><span ${C ? 'class="key"' : ""}>${te(C)}</span>`, _;
760
+ }, i = Le[e.locale] ? e.locale : "en", s = Le[i], r = o("cm-add_child", s.addChild, "Tab"), c = o("cm-add_parent", s.addParent, "Ctrl + Enter"), u = o("cm-add_sibling", s.addSibling, "Enter"), a = o("cm-remove_child", s.removeNode, "Delete"), f = o("cm-fucus", s.focus, ""), h = o("cm-unfucus", s.cancelFocus, ""), g = o("cm-up", s.moveUp, "PgUp"), d = o("cm-down", s.moveDown, "Pgdn"), l = o("cm-link", s.link, ""), p = o("cm-link-bidirectional", "Bidirectional Link", ""), m = o("cm-summary", s.summary, ""), v = document.createElement("ul");
761
+ if (v.className = "menu-list", v.appendChild(r), v.appendChild(c), v.appendChild(u), v.appendChild(a), t.focus && (v.appendChild(f), v.appendChild(h)), v.appendChild(g), v.appendChild(d), v.appendChild(m), t.link && (v.appendChild(l), v.appendChild(p)), t && t.extend)
762
+ for (let w = 0; w < t.extend.length; w++) {
763
+ const x = t.extend[w], C = o(x.name, x.name, x.key || "");
764
+ v.appendChild(C), C.onclick = (_) => {
765
+ x.onclick(_);
606
766
  };
607
767
  }
608
- const y = document.createElement("div");
609
- y.className = "context-menu", y.appendChild(f), y.hidden = !0, e.container.append(y);
610
- let x = !0;
611
- e.container.oncontextmenu = function(b) {
612
- if (b.preventDefault(), !e.editable || e.dragMoveHelper.moved)
613
- return;
614
- const w = b.target;
615
- if (he(w)) {
616
- w.parentElement.tagName === "ME-ROOT" ? x = !0 : x = !1, x ? (a.className = "disabled", h.className = "disabled", p.className = "disabled", c.className = "disabled", l.className = "disabled", d.className = "disabled") : (a.className = "", h.className = "", p.className = "", c.className = "", l.className = "", d.className = ""), e.currentNodes || e.selectNode(w), y.hidden = !1, f.style.top = "", f.style.bottom = "", f.style.left = "", f.style.right = "";
617
- const _ = f.getBoundingClientRect(), L = f.offsetHeight, $ = f.offsetWidth, R = b.clientY - _.top, X = b.clientX - _.left;
618
- L + R > window.innerHeight ? (f.style.top = "", f.style.bottom = "0px") : (f.style.bottom = "", f.style.top = R + 15 + "px"), $ + X > window.innerWidth ? (f.style.left = "", f.style.right = "0px") : (f.style.right = "", f.style.left = X + 10 + "px");
768
+ const b = document.createElement("div");
769
+ b.className = "context-menu", b.appendChild(v), b.hidden = !0, e.container.append(b);
770
+ let y = !0;
771
+ const E = (w) => {
772
+ const x = w.target;
773
+ if (ae(x)) {
774
+ x.parentElement.tagName === "ME-ROOT" ? y = !0 : y = !1, y ? (f.className = "disabled", g.className = "disabled", d.className = "disabled", c.className = "disabled", u.className = "disabled", a.className = "disabled") : (f.className = "", g.className = "", d.className = "", c.className = "", u.className = "", a.className = ""), b.hidden = !1, v.style.top = "", v.style.bottom = "", v.style.left = "", v.style.right = "";
775
+ const C = v.getBoundingClientRect(), _ = v.offsetHeight, O = v.offsetWidth, B = w.clientY - C.top, R = w.clientX - C.left;
776
+ _ + B > window.innerHeight ? (v.style.top = "", v.style.bottom = "0px") : (v.style.bottom = "", v.style.top = B + 15 + "px"), O + R > window.innerWidth ? (v.style.left = "", v.style.right = "0px") : (v.style.right = "", v.style.left = R + 10 + "px");
619
777
  }
620
- }, y.onclick = (b) => {
621
- b.target === y && (y.hidden = !0);
778
+ };
779
+ e.bus.addListener("showContextMenu", E), b.onclick = (w) => {
780
+ w.target === b && (b.hidden = !0);
622
781
  }, r.onclick = () => {
623
- e.addChild(), y.hidden = !0;
782
+ e.addChild(), b.hidden = !0;
624
783
  }, c.onclick = () => {
625
- e.insertParent(), y.hidden = !0;
626
- }, l.onclick = () => {
627
- x || (e.insertSibling("after"), y.hidden = !0);
628
- }, d.onclick = () => {
629
- x || (e.removeNode(), y.hidden = !0);
630
- }, a.onclick = () => {
631
- x || (e.focusNode(e.currentNode), y.hidden = !0);
784
+ e.insertParent(), b.hidden = !0;
632
785
  }, u.onclick = () => {
633
- e.cancelFocus(), y.hidden = !0;
786
+ y || (e.insertSibling("after"), b.hidden = !0);
787
+ }, a.onclick = () => {
788
+ y || (e.removeNodes(e.currentNodes || []), b.hidden = !0);
789
+ }, f.onclick = () => {
790
+ y || (e.focusNode(e.currentNode), b.hidden = !0);
634
791
  }, h.onclick = () => {
635
- x || (e.moveUpNode(), y.hidden = !0);
636
- }, p.onclick = () => {
637
- x || (e.moveDownNode(), y.hidden = !0);
792
+ e.cancelFocus(), b.hidden = !0;
793
+ }, g.onclick = () => {
794
+ y || (e.moveUpNode(), b.hidden = !0);
795
+ }, d.onclick = () => {
796
+ y || (e.moveDownNode(), b.hidden = !0);
638
797
  };
639
- const N = (b) => {
640
- y.hidden = !0;
641
- const w = e.currentNode, _ = n(i.clickTips);
642
- e.container.appendChild(_), e.map.addEventListener(
798
+ const N = (w) => {
799
+ b.hidden = !0;
800
+ const x = e.currentNode, C = n(s.clickTips);
801
+ e.container.appendChild(C), e.map.addEventListener(
643
802
  "click",
644
- (L) => {
645
- L.preventDefault(), _.remove();
646
- const $ = L.target;
647
- ($.parentElement.tagName === "ME-PARENT" || $.parentElement.tagName === "ME-ROOT") && e.createArrow(w, $, b);
803
+ (_) => {
804
+ _.preventDefault(), C.remove();
805
+ const O = _.target;
806
+ (O.parentElement.tagName === "ME-PARENT" || O.parentElement.tagName === "ME-ROOT") && e.createArrow(x, O, w);
648
807
  },
649
808
  {
650
809
  once: !0
651
810
  }
652
811
  );
653
812
  };
654
- return g.onclick = () => N(), v.onclick = () => N({ bidirectional: !0 }), m.onclick = () => {
655
- y.hidden = !0, e.createSummary(), e.unselectNodes();
813
+ return l.onclick = () => N(), p.onclick = () => N({ bidirectional: !0 }), m.onclick = () => {
814
+ b.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
656
815
  }, () => {
657
- r.onclick = null, c.onclick = null, l.onclick = null, d.onclick = null, a.onclick = null, u.onclick = null, h.onclick = null, p.onclick = null, g.onclick = null, m.onclick = null, y.onclick = null, e.container.oncontextmenu = null;
658
- };
659
- }
660
- const yt = (e) => {
661
- const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");
662
- e.selectNode(t[Math.ceil(t.length / 2) - 1]);
663
- }, bt = (e) => {
664
- const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
665
- e.selectNode(t[Math.ceil(t.length / 2) - 1]);
666
- }, xt = (e) => {
667
- e.selectNode(e.map.querySelector("me-root>me-tpc"));
668
- }, wt = function(e, t) {
669
- const n = t.parentElement.parentElement.parentElement.previousSibling;
670
- if (n) {
671
- const o = n.firstChild;
672
- e.selectNode(o);
673
- }
674
- }, Et = function(e, t) {
675
- const n = t.parentElement.nextSibling;
676
- if (n && n.firstChild) {
677
- const o = n.firstChild.firstChild.firstChild;
678
- e.selectNode(o);
679
- }
680
- }, Me = function(e, t) {
681
- var i, r;
682
- const n = e.currentNode || ((i = e.currentNodes) == null ? void 0 : i[0]);
683
- if (!n)
684
- return;
685
- const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
686
- o.parent ? s.className === t ? Et(e, n) : (r = o.parent) != null && r.parent ? wt(e, n) : xt(e) : t === M.LHS ? yt(e) : bt(e);
687
- }, Le = function(e, t) {
688
- var r;
689
- const n = e.currentNode || ((r = e.currentNodes) == null ? void 0 : r[0]);
690
- if (!n || !n.nodeObj.parent)
691
- return;
692
- const s = t + "Sibling", i = n.parentElement.parentElement[s];
693
- i && e.selectNode(i.firstChild.firstChild);
694
- }, ee = function(e, t, n) {
695
- switch (t) {
696
- case "in":
697
- if (e.scaleVal > 1.6)
698
- return;
699
- e.scale(e.scaleVal + 0.2, n);
700
- break;
701
- case "out":
702
- if (e.scaleVal < 0.6)
703
- return;
704
- e.scale(e.scaleVal - 0.2, n);
705
- }
706
- };
707
- function Nt(e) {
708
- const t = () => {
709
- e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNode ? e.removeNode() : e.currentNodes && e.removeNodes(e.currentNodes);
710
- }, n = {
711
- Enter: (o) => {
712
- o.shiftKey ? e.insertSibling("before") : o.ctrlKey ? e.insertParent() : e.insertSibling("after");
713
- },
714
- Tab: () => {
715
- e.addChild();
716
- },
717
- F1: () => {
718
- e.toCenter();
719
- },
720
- F2: () => {
721
- e.beginEdit();
722
- },
723
- ArrowUp: (o) => {
724
- if (o.altKey)
725
- e.moveUpNode();
726
- else {
727
- if (o.metaKey || o.ctrlKey)
728
- return e.initSide();
729
- Le(e, "previous");
730
- }
731
- },
732
- ArrowDown: (o) => {
733
- o.altKey ? e.moveDownNode() : Le(e, "next");
734
- },
735
- ArrowLeft: (o) => {
736
- if (o.metaKey || o.ctrlKey)
737
- return e.initLeft();
738
- Me(e, M.LHS);
739
- },
740
- ArrowRight: (o) => {
741
- if (o.metaKey || o.ctrlKey)
742
- return e.initRight();
743
- Me(e, M.RHS);
744
- },
745
- PageUp: () => e.moveUpNode(),
746
- PageDown: () => {
747
- e.moveDownNode();
748
- },
749
- c: (o) => {
750
- (o.metaKey || o.ctrlKey) && (e.currentNode ? e.waitCopy = [e.currentNode] : e.currentNodes && (e.waitCopy = e.currentNodes));
751
- },
752
- x: (o) => {
753
- (o.metaKey || o.ctrlKey) && (e.currentNode ? e.waitCopy = [e.currentNode] : e.currentNodes && (e.waitCopy = e.currentNodes), t());
754
- },
755
- v: (o) => {
756
- !e.waitCopy || !e.currentNode || (o.metaKey || o.ctrlKey) && (e.waitCopy.length === 1 ? e.copyNode(e.waitCopy[0], e.currentNode) : e.copyNodes(e.waitCopy, e.currentNode));
757
- },
758
- "=": (o) => {
759
- (o.metaKey || o.ctrlKey) && ee(e, "in");
760
- },
761
- "-": (o) => {
762
- (o.metaKey || o.ctrlKey) && ee(e, "out");
763
- },
764
- 0: (o) => {
765
- (o.metaKey || o.ctrlKey) && e.scale(1);
766
- },
767
- Delete: t,
768
- Backspace: t
769
- };
770
- e.map.onkeydown = (o) => {
771
- if (o.preventDefault(), !e.editable || o.target !== o.currentTarget)
772
- return;
773
- const s = n[o.key];
774
- s && s(o);
775
- }, e.map.onwheel = (o) => {
776
- o.stopPropagation(), o.preventDefault(), o.ctrlKey || o.metaKey ? o.deltaY < 0 ? ee(e, "in", e.dragMoveHelper) : e.scaleVal - 0.2 > 0 && ee(e, "out", e.dragMoveHelper) : o.shiftKey ? e.move(-o.deltaY, 0) : e.move(0, -o.deltaY);
816
+ r.onclick = null, c.onclick = null, u.onclick = null, a.onclick = null, f.onclick = null, h.onclick = null, g.onclick = null, d.onclick = null, l.onclick = null, m.onclick = null, b.onclick = null, e.container.oncontextmenu = null;
777
817
  };
778
818
  }
779
- const ue = document, Ct = function(e, t) {
819
+ const de = document, Lt = function(e, t) {
780
820
  if (!t)
781
- return fe(e), e;
821
+ return he(e), e;
782
822
  let n = e.querySelector(".insert-preview");
783
823
  const o = `insert-preview ${t} show`;
784
- return n || (n = ue.createElement("div"), e.appendChild(n)), n.className = o, e;
785
- }, fe = function(e) {
824
+ return n || (n = de.createElement("div"), e.appendChild(n)), n.className = o, e;
825
+ }, he = function(e) {
786
826
  if (!e)
787
827
  return;
788
828
  const t = e.querySelectorAll(".insert-preview");
789
829
  for (const n of t || [])
790
830
  n.remove();
791
- }, ke = function(e, t) {
831
+ }, Me = function(e, t) {
792
832
  for (const n of t) {
793
833
  const o = n.parentElement.parentElement.contains(e);
794
834
  if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent))
795
835
  return !1;
796
836
  }
797
837
  return !0;
798
- }, St = function(e) {
838
+ }, Mt = function(e) {
799
839
  const t = document.createElement("div");
800
- return t.className = "mind-elixir-ghost", e.map.appendChild(t), t;
840
+ return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
801
841
  };
802
- class _t {
842
+ class Dt {
803
843
  constructor(t) {
804
- G(this, "mind");
805
- G(this, "isMoving", !1);
806
- G(this, "interval", null);
807
- G(this, "speed", 20);
844
+ q(this, "mind");
845
+ q(this, "isMoving", !1);
846
+ q(this, "interval", null);
847
+ q(this, "speed", 20);
808
848
  this.mind = t;
809
849
  }
810
850
  move(t, n) {
@@ -816,50 +856,59 @@ class _t {
816
856
  this.isMoving = !1, clearInterval(this.interval);
817
857
  }
818
858
  }
819
- function Mt(e) {
820
- let t = null, n = null, o = null;
821
- const s = St(e), i = 12, r = new _t(e);
822
- e.map.addEventListener("dragstart", (c) => {
823
- var d;
824
- const l = c.target;
825
- if ((l == null ? void 0 : l.tagName) !== "ME-TPC") {
826
- c.preventDefault();
859
+ function Ot(e) {
860
+ let t = null, n = null;
861
+ const o = Mt(e), i = new Dt(e), s = (a) => {
862
+ e.selection.cancel();
863
+ const f = a.target;
864
+ if ((f == null ? void 0 : f.tagName) !== "ME-TPC") {
865
+ a.preventDefault();
827
866
  return;
828
867
  }
829
- (d = e.currentNodes) != null && d.includes(l) || (e.unselectNodes(), e.selectNode(l)), e.currentNodes ? (t = e.currentNodes, s.innerHTML = e.currentNodes.length + "") : (t = [l], s.innerHTML = l.innerHTML);
830
- for (const a of t)
831
- a.parentElement.parentElement.style.opacity = "0.5";
832
- c.dataTransfer.setDragImage(s, 0, 0), c.dataTransfer.dropEffect = "move", e.dragMoveHelper.clear();
833
- }), e.map.addEventListener("dragend", async (c) => {
834
- if (!t)
868
+ let h = e.currentNodes;
869
+ h != null && h.includes(f) || (e.selectNode(f), h = e.currentNodes), e.dragged = h, h.length > 1 ? o.innerHTML = h.length + "" : o.innerHTML = f.innerHTML;
870
+ for (const g of h)
871
+ g.parentElement.parentElement.style.opacity = "0.5";
872
+ a.dataTransfer.setDragImage(o, 0, 0), a.dataTransfer.dropEffect = "move", e.dragMoveHelper.clear();
873
+ }, r = (a) => {
874
+ const { dragged: f } = e;
875
+ if (!f)
835
876
  return;
836
- for (const d of t)
837
- d.parentElement.parentElement.style.opacity = "1";
838
- const l = c.target;
839
- l.style.opacity = "", o && (fe(o), n === "before" ? e.moveNodeBefore(t, o) : n === "after" ? e.moveNodeAfter(t, o) : n === "in" && e.moveNodeIn(t, o), t = null);
840
- }), e.map.addEventListener("dragover", function(c) {
841
- if (c.preventDefault(), !t)
877
+ i.stop();
878
+ for (const g of f)
879
+ g.parentElement.parentElement.style.opacity = "1";
880
+ const h = a.target;
881
+ h.style.opacity = "", n && (he(n), t === "before" ? e.moveNodeBefore(f, n) : t === "after" ? e.moveNodeAfter(f, n) : t === "in" && e.moveNodeIn(f, n), e.dragged = null);
882
+ }, c = (a) => {
883
+ a.preventDefault();
884
+ const f = 12 * e.scaleVal, { dragged: h } = e;
885
+ if (!h)
842
886
  return;
843
- const l = e.container.getBoundingClientRect();
844
- c.clientX < l.x + 50 ? r.move(1, 0) : c.clientX > l.x + l.width - 50 ? r.move(-1, 0) : c.clientY < l.y + 50 ? r.move(0, 1) : c.clientY > l.y + l.height - 50 ? r.move(0, -1) : r.stop(), fe(o);
845
- const d = ue.elementFromPoint(c.clientX, c.clientY - i);
846
- if (ke(d, t)) {
847
- o = d;
848
- const a = d.getBoundingClientRect().y;
849
- c.clientY > a + d.clientHeight ? n = "after" : n = "in";
887
+ const g = e.container.getBoundingClientRect();
888
+ a.clientX < g.x + 50 ? i.move(1, 0) : a.clientX > g.x + g.width - 50 ? i.move(-1, 0) : a.clientY < g.y + 50 ? i.move(0, 1) : a.clientY > g.y + g.height - 50 ? i.move(0, -1) : i.stop(), he(n);
889
+ const d = de.elementFromPoint(a.clientX, a.clientY - f);
890
+ if (Me(d, h)) {
891
+ n = d;
892
+ const l = d.getBoundingClientRect(), p = l.y;
893
+ a.clientY > p + l.height ? t = "after" : t = "in";
850
894
  } else {
851
- const a = ue.elementFromPoint(c.clientX, c.clientY + i);
852
- if (ke(a, t)) {
853
- o = a;
854
- const u = a.getBoundingClientRect().y;
855
- c.clientY < u ? n = "before" : n = "in";
895
+ const l = de.elementFromPoint(a.clientX, a.clientY + f), p = l.getBoundingClientRect();
896
+ if (Me(l, h)) {
897
+ n = l;
898
+ const m = p.y;
899
+ a.clientY < m ? t = "before" : t = "in";
856
900
  } else
857
- n = o = null;
901
+ t = n = null;
858
902
  }
859
- o && Ct(o, n);
860
- });
903
+ n && Lt(n, t);
904
+ };
905
+ return ve([
906
+ { dom: e.map, evt: "dragstart", func: s },
907
+ { dom: e.map, evt: "dragend", func: r },
908
+ { dom: e.map, evt: "dragover", func: c }
909
+ ]);
861
910
  }
862
- const Lt = function(e) {
911
+ const jt = function(e) {
863
912
  return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
864
913
  type: "summary",
865
914
  value: e.obj.id
@@ -874,20 +923,14 @@ const Lt = function(e) {
874
923
  value: e.obj.id
875
924
  };
876
925
  };
877
- function kt(e) {
926
+ function Pt(e) {
878
927
  let t = [], n = -1, o = e.getData();
879
- e.bus.addListener("operation", (s) => {
880
- if (s.name === "beginEdit")
881
- return;
882
- t = t.slice(0, n + 1);
883
- const i = e.getData();
884
- t.push({ prev: o, currentObject: Lt(s), next: i }), o = i, n = t.length - 1;
885
- }), e.undo = function() {
928
+ e.undo = function() {
886
929
  if (n > -1) {
887
- const s = t[n];
888
- o = s.prev, e.refresh(s.prev);
930
+ const r = t[n];
931
+ o = r.prev, e.refresh(r.prev);
889
932
  try {
890
- s.currentObject.type === "node" ? e.selectNode(E(s.currentObject.value)) : s.currentObject.type === "nodes" && e.selectNodes(s.currentObject.value.map((i) => E(i)));
933
+ r.currentObject.type === "node" ? e.selectNode(this.findEle(r.currentObject.value)) : r.currentObject.type === "nodes" && e.selectNodes(r.currentObject.value.map((c) => this.findEle(c)));
891
934
  } catch {
892
935
  } finally {
893
936
  n--;
@@ -896,49 +939,65 @@ function kt(e) {
896
939
  }, e.redo = function() {
897
940
  if (n < t.length - 1) {
898
941
  n++;
899
- const s = t[n];
900
- o = s.next, e.refresh(s.next), s.currentObject.type === "node" ? e.selectNode(E(s.currentObject.value)) : s.currentObject.type === "nodes" && e.selectNodes(s.currentObject.value.map((i) => E(i)));
942
+ const r = t[n];
943
+ o = r.next, e.refresh(r.next), r.currentObject.type === "node" ? e.selectNode(this.findEle(r.currentObject.value)) : r.currentObject.type === "nodes" && (e.unselectNodes(this.currentNodes), e.selectNodes(r.currentObject.value.map((c) => this.findEle(c))));
901
944
  }
902
- }, e.map.addEventListener("keydown", (s) => {
903
- (s.metaKey || s.ctrlKey) && (s.shiftKey && s.key === "Z" || s.key === "y") ? e.redo() : (s.metaKey || s.ctrlKey) && s.key === "z" && e.undo();
904
- });
945
+ };
946
+ const i = function(r) {
947
+ if (r.name === "beginEdit")
948
+ return;
949
+ t = t.slice(0, n + 1);
950
+ const c = e.getData();
951
+ t.push({ prev: o, currentObject: jt(r), next: c }), o = c, n = t.length - 1;
952
+ }, s = function(r) {
953
+ (r.metaKey || r.ctrlKey) && (r.shiftKey && r.key === "Z" || r.key === "y") ? e.redo() : (r.metaKey || r.ctrlKey) && r.key === "z" && e.undo();
954
+ };
955
+ return e.bus.addListener("operation", i), e.map.addEventListener("keydown", s), () => {
956
+ e.bus.removeListener("operation", i), e.map.removeEventListener("keydown", s);
957
+ };
905
958
  }
906
- const F = (e, t) => {
959
+ const $t = '<?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"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" p-id="2022"></path></svg>', Ht = '<?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"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="currentColor" p-id="1776"></path></svg>', Bt = '<?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"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>', Rt = '<?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"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>', Ft = '<?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"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>', It = '<?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"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" p-id="2481"></path></svg>', Wt = '<?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"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" p-id="2731"></path></svg>';
960
+ const Vt = {
961
+ side: $t,
962
+ left: Ht,
963
+ right: Bt,
964
+ full: Rt,
965
+ living: Ft,
966
+ zoomin: It,
967
+ zoomout: Wt
968
+ }, I = (e, t) => {
907
969
  const n = document.createElement("span");
908
- return n.id = e, n.innerHTML = `<svg class="icon" aria-hidden="true">
909
- <use xlink:href="#icon-${t}"></use>
910
- </svg>`, n;
970
+ return n.id = e, n.innerHTML = Vt[t], n;
911
971
  };
912
- function Tt(e) {
913
- const t = document.createElement("div"), n = F("fullscreen", "full"), o = F("toCenter", "living"), s = F("zoomout", "move"), i = F("zoomin", "add"), r = document.createElement("span");
914
- return r.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
915
- e.mindElixirBox.requestFullscreen();
972
+ function Yt(e) {
973
+ const t = document.createElement("div"), n = I("fullscreen", "full"), o = I("toCenter", "living"), i = I("zoomout", "zoomout"), s = I("zoomin", "zoomin"), r = document.createElement("span");
974
+ return r.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(i), t.appendChild(s), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
975
+ document.fullscreenElement === e.el ? document.exitFullscreen() : e.el.requestFullscreen();
916
976
  }, o.onclick = () => {
917
977
  e.toCenter();
918
- }, s.onclick = () => {
919
- e.scaleVal < 0.6 || e.scale(e.scaleVal - 0.2);
920
978
  }, i.onclick = () => {
921
- e.scaleVal > 1.6 || e.scale(e.scaleVal + 0.2);
979
+ e.scaleVal < 0.6 || e.scale(e.scaleVal - e.scaleSensitivity);
980
+ }, s.onclick = () => {
981
+ e.scaleVal > 1.6 || e.scale(e.scaleVal + e.scaleSensitivity);
922
982
  }, t;
923
983
  }
924
- function At(e) {
925
- const t = document.createElement("div"), n = F("tbltl", "left"), o = F("tbltr", "right"), s = F("tblts", "side");
926
- return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
984
+ function Gt(e) {
985
+ const t = document.createElement("div"), n = I("tbltl", "left"), o = I("tbltr", "right"), i = I("tblts", "side");
986
+ return t.appendChild(n), t.appendChild(o), t.appendChild(i), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
927
987
  e.initLeft();
928
988
  }, o.onclick = () => {
929
989
  e.initRight();
930
- }, s.onclick = () => {
990
+ }, i.onclick = () => {
931
991
  e.initSide();
932
992
  }, t;
933
993
  }
934
- function $t(e) {
935
- e.container.append(Tt(e)), e.container.append(At(e));
994
+ function Kt(e) {
995
+ e.container.append(Yt(e)), e.container.append(Gt(e));
936
996
  }
937
- /*! @viselect/vanilla v3.5.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */
938
- var jt = Object.defineProperty, Dt = (e, t, n) => t in e ? jt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Dt(e, typeof t != "symbol" ? t + "" : t, n), n);
939
- class Ot {
997
+ /*! @viselect/vanilla v3.9.0 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */
998
+ class qt {
940
999
  constructor() {
941
- C(this, "_listeners", /* @__PURE__ */ new Map()), C(this, "on", this.addEventListener), C(this, "off", this.removeEventListener), C(this, "emit", this.dispatchEvent);
1000
+ this._listeners = /* @__PURE__ */ new Map(), this.on = this.addEventListener, this.off = this.removeEventListener, this.emit = this.dispatchEvent;
942
1001
  }
943
1002
  addEventListener(t, n) {
944
1003
  const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
@@ -950,103 +1009,76 @@ class Ot {
950
1009
  }
951
1010
  dispatchEvent(t, ...n) {
952
1011
  let o = !0;
953
- for (const s of this._listeners.get(t) ?? [])
954
- o = s(...n) !== !1 && o;
1012
+ for (const i of this._listeners.get(t) ?? [])
1013
+ o = i(...n) !== !1 && o;
955
1014
  return o;
956
1015
  }
957
1016
  unbindAllListeners() {
958
1017
  this._listeners.clear();
959
1018
  }
960
1019
  }
961
- const Te = (e, t = "px") => typeof e == "number" ? e + t : e;
962
- function D({ style: e }, t, n) {
1020
+ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e }, t, n) => {
963
1021
  if (typeof t == "object")
964
- for (const [o, s] of Object.entries(t))
965
- s !== void 0 && (e[o] = Te(s));
1022
+ for (const [o, i] of Object.entries(t))
1023
+ i !== void 0 && (e[o] = De(i));
966
1024
  else
967
- n !== void 0 && (e[t] = Te(n));
968
- }
969
- const We = (e) => (t, n, o, s = {}) => {
970
- t instanceof HTMLCollection || t instanceof NodeList ? t = Array.from(t) : Array.isArray(t) || (t = [t]), Array.isArray(n) || (n = [n]);
971
- for (const i of t)
972
- if (i)
973
- for (const r of n)
974
- i[e](r, o, { capture: !1, ...s });
975
- return [t, n, o, s];
976
- }, I = We("addEventListener"), O = We("removeEventListener"), te = (e) => {
977
- var t;
978
- const { clientX: n, clientY: o, target: s } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
979
- return { x: n, y: o, target: s };
980
- };
981
- function Ae(e, t, n = "touch") {
982
- switch (n) {
983
- case "center": {
984
- const o = t.left + t.width / 2, s = t.top + t.height / 2;
985
- return o >= e.left && o <= e.right && s >= e.top && s <= e.bottom;
986
- }
987
- case "cover":
988
- return t.left >= e.left && t.top >= e.top && t.right <= e.right && t.bottom <= e.bottom;
989
- case "touch":
990
- return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
991
- }
992
- }
993
- function K(e, t = document) {
994
- const n = Array.isArray(e) ? e : [e];
995
- let o = [];
996
- for (let s = 0, i = n.length; s < i; s++) {
997
- const r = n[s];
998
- typeof r == "string" ? o = o.concat(Array.from(t.querySelectorAll(r))) : r instanceof Element && o.push(r);
999
- }
1000
- return o;
1001
- }
1002
- const Ht = () => matchMedia("(hover: none), (pointer: coarse)").matches, Pt = () => "safari" in window, Bt = (e) => {
1025
+ n !== void 0 && (e[t] = De(n));
1026
+ }, Oe = (e = 0, t = 0, n = 0, o = 0) => {
1027
+ const i = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
1028
+ return { ...i, toJSON: () => JSON.stringify(i) };
1029
+ }, zt = (e) => {
1003
1030
  let t, n = -1, o = !1;
1004
1031
  return {
1005
- next(...s) {
1006
- t = s, o || (o = !0, n = requestAnimationFrame(() => {
1032
+ next: (...i) => {
1033
+ t = i, o || (o = !0, n = requestAnimationFrame(() => {
1007
1034
  e(...t), o = !1;
1008
1035
  }));
1009
1036
  },
1010
- cancel() {
1037
+ cancel: () => {
1011
1038
  cancelAnimationFrame(n), o = !1;
1012
1039
  }
1013
1040
  };
1014
- };
1015
- function Rt(e, t) {
1016
- for (const n of t) {
1017
- if (typeof n == "number")
1018
- return e.button === n;
1019
- if (typeof n == "object") {
1020
- const o = n.button === e.button, s = n.modifiers.every((i) => {
1021
- switch (i) {
1022
- case "alt":
1023
- return e.altKey;
1024
- case "ctrl":
1025
- return e.ctrlKey || e.metaKey;
1026
- case "shift":
1027
- return e.shiftKey;
1028
- }
1029
- });
1030
- return o && s;
1041
+ }, je = (e, t, n = "touch") => {
1042
+ switch (n) {
1043
+ case "center": {
1044
+ const o = t.left + t.width / 2, i = t.top + t.height / 2;
1045
+ return o >= e.left && o <= e.right && i >= e.top && i <= e.bottom;
1031
1046
  }
1047
+ case "cover":
1048
+ return t.left >= e.left && t.top >= e.top && t.right <= e.right && t.bottom <= e.bottom;
1049
+ case "touch":
1050
+ return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
1032
1051
  }
1033
- return !1;
1034
- }
1035
- const { abs: z, max: $e, min: je, ceil: De } = Math;
1036
- class Ye extends Ot {
1052
+ }, Ut = () => matchMedia("(hover: none), (pointer: coarse)").matches, Xt = () => "safari" in window, ue = (e) => Array.isArray(e) ? e : [e], Xe = (e) => (t, n, o, i = {}) => {
1053
+ (t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = ue(n), t = ue(t);
1054
+ for (const s of t)
1055
+ if (s)
1056
+ for (const r of n)
1057
+ s[e](r, o, { capture: !1, ...i });
1058
+ }, P = Xe("addEventListener"), L = Xe("removeEventListener"), J = (e) => {
1059
+ var t;
1060
+ const { clientX: n, clientY: o, target: i } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
1061
+ return { x: n, y: o, target: i };
1062
+ }, Y = (e, t = document) => ue(e).map(
1063
+ (n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null
1064
+ ).flat().filter(Boolean), Jt = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
1065
+ switch (o) {
1066
+ case "alt":
1067
+ return e.altKey;
1068
+ case "ctrl":
1069
+ return e.ctrlKey || e.metaKey;
1070
+ case "shift":
1071
+ return e.shiftKey;
1072
+ }
1073
+ }) : !1), { abs: F, max: Pe, min: $e, ceil: He } = Math, Be = (e = []) => ({
1074
+ stored: e,
1075
+ selected: [],
1076
+ touched: [],
1077
+ changed: { added: [], removed: [] }
1078
+ }), Je = class extends qt {
1037
1079
  constructor(t) {
1038
- var n, o, s, i, r;
1039
- super(), C(this, "_options"), C(this, "_selection", {
1040
- stored: [],
1041
- selected: [],
1042
- touched: [],
1043
- changed: {
1044
- added: [],
1045
- // Added elements since last selection
1046
- removed: []
1047
- // Removed elements since last selection
1048
- }
1049
- }), C(this, "_area"), C(this, "_clippingElement"), C(this, "_targetElement"), C(this, "_targetRect"), C(this, "_selectables", []), C(this, "_latestElement"), C(this, "_areaRect", new DOMRect()), C(this, "_areaLocation", { y1: 0, x2: 0, y2: 0, x1: 0 }), C(this, "_singleClick", !0), C(this, "_frame"), C(this, "_scrollAvailable", !0), C(this, "_scrollingActive", !1), C(this, "_scrollSpeed", { x: 0, y: 0 }), C(this, "_scrollDelta", { x: 0, y: 0 }), C(this, "disable", this._bindStartEvents.bind(this, !1)), C(this, "enable", this._bindStartEvents), this._options = {
1080
+ var n, o, i, s, r;
1081
+ super(), this._selection = Be(), this._targetBoundaryScrolled = !0, this._selectables = [], this._areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 }, this._areaRect = Oe(), this._singleClick = !0, this._scrollAvailable = !0, this._scrollingActive = !1, this._scrollSpeed = { x: 0, y: 0 }, this._scrollDelta = { x: 0, y: 0 }, this._lastMousePosition = { x: 0, y: 0 }, this.enable = this._toggleStartEvents, this.disable = this._toggleStartEvents.bind(this, !1), this._options = {
1050
1082
  selectionAreaClass: "selection-area",
1051
1083
  selectionContainerClass: void 0,
1052
1084
  selectables: [],
@@ -1068,13 +1100,14 @@ class Ye extends Ot {
1068
1100
  startScrollMargins: {
1069
1101
  x: 0,
1070
1102
  y: 0,
1071
- ...(i = (s = t.behaviour) == null ? void 0 : s.scrolling) == null ? void 0 : i.startScrollMargins
1103
+ ...(s = (i = t.behaviour) == null ? void 0 : i.scrolling) == null ? void 0 : s.startScrollMargins
1072
1104
  }
1073
1105
  }
1074
1106
  },
1075
1107
  features: {
1076
1108
  range: !0,
1077
1109
  touch: !0,
1110
+ deselectOnBlur: !1,
1078
1111
  ...t.features,
1079
1112
  singleTap: {
1080
1113
  allow: !0,
@@ -1083,180 +1116,192 @@ class Ye extends Ot {
1083
1116
  }
1084
1117
  }
1085
1118
  };
1086
- for (const a of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
1087
- typeof this[a] == "function" && (this[a] = this[a].bind(this));
1088
- const { document: c, selectionAreaClass: l, selectionContainerClass: d } = this._options;
1089
- this._area = c.createElement("div"), this._clippingElement = c.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(l), d && this._clippingElement.classList.add(d), D(this._area, {
1119
+ for (const f of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
1120
+ typeof this[f] == "function" && (this[f] = this[f].bind(this));
1121
+ const { document: c, selectionAreaClass: u, selectionContainerClass: a } = this._options;
1122
+ this._area = c.createElement("div"), this._clippingElement = c.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(u), a && this._clippingElement.classList.add(a), j(this._area, {
1090
1123
  willChange: "top, left, bottom, right, width, height",
1091
1124
  top: 0,
1092
1125
  left: 0,
1093
1126
  position: "fixed"
1094
- }), D(this._clippingElement, {
1127
+ }), j(this._clippingElement, {
1095
1128
  overflow: "hidden",
1096
1129
  position: "fixed",
1097
1130
  transform: "translate3d(0, 0, 0)",
1098
1131
  // https://stackoverflow.com/a/38268846
1099
1132
  pointerEvents: "none",
1100
1133
  zIndex: "1"
1101
- }), this._frame = Bt((a) => {
1102
- this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", a), this._redrawSelectionArea();
1134
+ }), this._frame = zt((f) => {
1135
+ this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", f), this._redrawSelectionArea();
1103
1136
  }), this.enable();
1104
1137
  }
1105
- _bindStartEvents(t = !0) {
1106
- const { document: n, features: o } = this._options, s = t ? I : O;
1107
- s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, {
1108
- passive: !1
1109
- });
1138
+ _toggleStartEvents(t = !0) {
1139
+ const { document: n, features: o } = this._options, i = t ? P : L;
1140
+ i(n, "mousedown", this._onTapStart), o.touch && i(n, "touchstart", this._onTapStart, { passive: !1 });
1110
1141
  }
1111
1142
  _onTapStart(t, n = !1) {
1112
- const { x: o, y: s, target: i } = te(t), { _options: r } = this, { document: c } = this._options, l = i.getBoundingClientRect();
1113
- if (t instanceof MouseEvent && !Rt(t, r.behaviour.triggers))
1143
+ const { x: o, y: i, target: s } = J(t), { document: r, startAreas: c, boundaries: u, features: a, behaviour: f } = this._options, h = s.getBoundingClientRect();
1144
+ if (t instanceof MouseEvent && !Jt(t, f.triggers))
1114
1145
  return;
1115
- const d = K(r.startAreas, r.document), a = K(r.boundaries, r.document);
1116
- this._targetElement = a.find(
1117
- (p) => Ae(p.getBoundingClientRect(), l)
1146
+ const g = Y(c, r), d = Y(u, r);
1147
+ this._targetElement = d.find(
1148
+ (v) => je(v.getBoundingClientRect(), h)
1118
1149
  );
1119
- const u = t.composedPath();
1120
- if (!this._targetElement || !d.find((p) => u.includes(p)) || !a.find((p) => u.includes(p)) || !n && this._emitEvent("beforestart", t) === !1)
1150
+ const l = t.composedPath(), p = g.find((v) => l.includes(v));
1151
+ if (this._targetBoundary = d.find((v) => l.includes(v)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
1121
1152
  return;
1122
- this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
1123
- const h = c.scrollingElement ?? c.body;
1124
- this._scrollDelta = { x: h.scrollLeft, y: h.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), I(c, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), I(c, ["mouseup", "touchcancel", "touchend"], this._onTapStop), I(c, "scroll", this._onScroll);
1153
+ this._areaLocation = { x1: o, y1: i, x2: 0, y2: 0 };
1154
+ const m = r.scrollingElement ?? r.body;
1155
+ this._scrollDelta = { x: m.scrollLeft, y: m.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), P(r, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), P(r, ["mouseup", "touchcancel", "touchend"], this._onTapStop), P(r, "scroll", this._onScroll), a.deselectOnBlur && (this._targetBoundaryScrolled = !1, P(this._targetBoundary, "scroll", this._onStartAreaScroll));
1125
1156
  }
1126
1157
  _onSingleTap(t) {
1127
- const { singleTap: { intersect: n }, range: o } = this._options.features, s = te(t);
1128
- let i;
1158
+ const { singleTap: { intersect: n }, range: o } = this._options.features, i = J(t);
1159
+ let s;
1129
1160
  if (n === "native")
1130
- i = s.target;
1161
+ s = i.target;
1131
1162
  else if (n === "touch") {
1132
1163
  this.resolveSelectables();
1133
- const { x: c, y: l } = s;
1134
- i = this._selectables.find((d) => {
1135
- const { right: a, left: u, top: h, bottom: p } = d.getBoundingClientRect();
1136
- return c < a && c > u && l < p && l > h;
1164
+ const { x: c, y: u } = i;
1165
+ s = this._selectables.find((a) => {
1166
+ const { right: f, left: h, top: g, bottom: d } = a.getBoundingClientRect();
1167
+ return c < f && c > h && u < d && u > g;
1137
1168
  });
1138
1169
  }
1139
- if (!i)
1170
+ if (!s)
1140
1171
  return;
1141
- for (this.resolveSelectables(); !this._selectables.includes(i); ) {
1142
- if (!i.parentElement)
1172
+ for (this.resolveSelectables(); !this._selectables.includes(s); )
1173
+ if (s.parentElement)
1174
+ s = s.parentElement;
1175
+ else {
1176
+ this._targetBoundaryScrolled || this.clearSelection();
1143
1177
  return;
1144
- i = i.parentElement;
1145
- }
1178
+ }
1146
1179
  const { stored: r } = this._selection;
1147
1180
  if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
1148
- const c = this._latestElement, [l, d] = c.compareDocumentPosition(i) & 4 ? [i, c] : [c, i], a = [...this._selectables.filter(
1149
- (u) => u.compareDocumentPosition(l) & 4 && u.compareDocumentPosition(d) & 2
1150
- ), l, d];
1151
- this.select(a), this._latestElement = c;
1181
+ const c = this._latestElement, [u, a] = c.compareDocumentPosition(s) & 4 ? [s, c] : [c, s], f = [...this._selectables.filter(
1182
+ (h) => h.compareDocumentPosition(u) & 4 && h.compareDocumentPosition(a) & 2
1183
+ ), u, a];
1184
+ this.select(f), this._latestElement = c;
1152
1185
  } else
1153
- r.includes(i) && (r.length === 1 || t.ctrlKey || r.every((c) => this._selection.stored.includes(c))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
1186
+ r.includes(s) && (r.length === 1 || t.ctrlKey || r.every((c) => this._selection.stored.includes(c))) ? this.deselect(s) : (this.select(s), this._latestElement = s);
1154
1187
  }
1155
1188
  _delayedTapMove(t) {
1156
- const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: r } = this._areaLocation, { x: c, y: l } = te(t);
1189
+ const { container: n, document: o, behaviour: { startThreshold: i } } = this._options, { x1: s, y1: r } = this._areaLocation, { x: c, y: u } = J(t);
1157
1190
  if (
1158
1191
  // Single number for both coordinates
1159
- typeof s == "number" && z(c + l - (i + r)) >= s || // Different x and y threshold
1160
- typeof s == "object" && z(c - i) >= s.x || z(l - r) >= s.y
1192
+ typeof i == "number" && F(c + u - (s + r)) >= i || // Different x and y threshold
1193
+ typeof i == "object" && F(c - s) >= i.x || F(u - r) >= i.y
1161
1194
  ) {
1162
- if (O(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
1163
- O(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
1195
+ if (L(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
1196
+ L(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
1164
1197
  return;
1165
1198
  }
1166
- I(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), D(this._area, "display", "block"), K(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (I(this._targetElement, "wheel", this._manualScroll, { passive: !1 }), this._selectables = this._selectables.filter((d) => this._targetElement.contains(d))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
1199
+ P(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), j(this._area, "display", "block"), Y(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (P(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), P(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
1167
1200
  }
1168
1201
  this._handleMoveEvent(t);
1169
1202
  }
1170
1203
  _setupSelectionArea() {
1171
- const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
1172
- this._scrollAvailable ? (D(t, {
1173
- top: s.top,
1174
- left: s.left,
1175
- width: s.width,
1176
- height: s.height
1177
- }), D(o, {
1178
- marginTop: -s.top,
1179
- marginLeft: -s.left
1180
- })) : (D(t, {
1204
+ const { _clippingElement: t, _targetElement: n, _area: o } = this, i = this._targetRect = n.getBoundingClientRect();
1205
+ this._scrollAvailable ? (j(t, {
1206
+ top: i.top,
1207
+ left: i.left,
1208
+ width: i.width,
1209
+ height: i.height
1210
+ }), j(o, {
1211
+ marginTop: -i.top,
1212
+ marginLeft: -i.left
1213
+ })) : (j(t, {
1181
1214
  top: 0,
1182
1215
  left: 0,
1183
1216
  width: "100%",
1184
1217
  height: "100%"
1185
- }), D(o, {
1218
+ }), j(o, {
1186
1219
  marginTop: 0,
1187
1220
  marginLeft: 0
1188
1221
  }));
1189
1222
  }
1190
1223
  _onTapMove(t) {
1191
- const { x: n, y: o } = te(t), { _scrollSpeed: s, _areaLocation: i, _options: r, _frame: c } = this, { speedDivider: l } = r.behaviour.scrolling, d = this._targetElement;
1192
- if (i.x2 = n, i.y2 = o, this._scrollAvailable && !this._scrollingActive && (s.y || s.x)) {
1224
+ const { _scrollSpeed: n, _areaLocation: o, _options: i, _frame: s } = this, { speedDivider: r } = i.behaviour.scrolling, c = this._targetElement, { x: u, y: a } = J(t);
1225
+ if (o.x2 = u, o.y2 = a, this._lastMousePosition.x = u, this._lastMousePosition.y = a, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
1193
1226
  this._scrollingActive = !0;
1194
- const a = () => {
1195
- if (!s.x && !s.y) {
1227
+ const f = () => {
1228
+ if (!n.x && !n.y) {
1196
1229
  this._scrollingActive = !1;
1197
1230
  return;
1198
1231
  }
1199
- const { scrollTop: u, scrollLeft: h } = d;
1200
- s.y && (d.scrollTop += De(s.y / l), i.y1 -= d.scrollTop - u), s.x && (d.scrollLeft += De(s.x / l), i.x1 -= d.scrollLeft - h), c.next(t), requestAnimationFrame(a);
1232
+ const { scrollTop: h, scrollLeft: g } = c;
1233
+ n.y && (c.scrollTop += He(n.y / r), o.y1 -= c.scrollTop - h), n.x && (c.scrollLeft += He(n.x / r), o.x1 -= c.scrollLeft - g), s.next(t), requestAnimationFrame(f);
1201
1234
  };
1202
- requestAnimationFrame(a);
1235
+ requestAnimationFrame(f);
1203
1236
  } else
1204
- c.next(t);
1237
+ s.next(t);
1205
1238
  this._handleMoveEvent(t);
1206
1239
  }
1207
1240
  _handleMoveEvent(t) {
1208
1241
  const { features: n } = this._options;
1209
- (n.touch && Ht() || this._scrollAvailable && Pt()) && t.preventDefault();
1242
+ (n.touch && Ut() || this._scrollAvailable && Xt()) && t.preventDefault();
1210
1243
  }
1211
1244
  _onScroll() {
1212
- const { _scrollDelta: t, _options: { document: n } } = this, { scrollTop: o, scrollLeft: s } = n.scrollingElement ?? n.body;
1213
- this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
1214
- }
1215
- _manualScroll(t) {
1216
- const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0, s = t.deltaX ? t.deltaX > 0 ? 1 : -1 : 0;
1217
- this._scrollSpeed.y += o * n, this._scrollSpeed.x += s * n, this._onTapMove(t), t.preventDefault();
1245
+ const { _scrollDelta: t, _options: { document: n } } = this, { scrollTop: o, scrollLeft: i } = n.scrollingElement ?? n.body;
1246
+ this._areaLocation.x1 += t.x - i, this._areaLocation.y1 += t.y - o, t.x = i, t.y = o, this._setupSelectionArea(), this._frame.next(null);
1247
+ }
1248
+ _onStartAreaScroll() {
1249
+ this._targetBoundaryScrolled = !0, L(this._targetElement, "scroll", this._onStartAreaScroll);
1250
+ }
1251
+ _wheelScroll(t) {
1252
+ const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0, i = t.deltaX ? t.deltaX > 0 ? 1 : -1 : 0;
1253
+ this._scrollSpeed.y += o * n, this._scrollSpeed.x += i * n, this._onTapMove(t), t.preventDefault();
1254
+ }
1255
+ _keyboardScroll(t) {
1256
+ const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0, i = t.key === "ArrowUp" ? -1 : t.key === "ArrowDown" ? 1 : 0;
1257
+ this._scrollSpeed.x += Math.sign(o) * n, this._scrollSpeed.y += Math.sign(i) * n, t.preventDefault(), this._onTapMove({
1258
+ clientX: this._lastMousePosition.x,
1259
+ clientY: this._lastMousePosition.y,
1260
+ preventDefault: () => {
1261
+ }
1262
+ });
1218
1263
  }
1219
1264
  _recalculateSelectionAreaRect() {
1220
- const { _scrollSpeed: t, _areaLocation: n, _areaRect: o, _targetElement: s, _options: i } = this, { scrollTop: r, scrollHeight: c, clientHeight: l, scrollLeft: d, scrollWidth: a, clientWidth: u } = s, h = this._targetRect, { x1: p, y1: g } = n;
1221
- let { x2: v, y2: m } = n;
1222
- const { behaviour: { scrolling: { startScrollMargins: f } } } = i;
1223
- v < h.left + f.x ? (t.x = d ? -z(h.left - v + f.x) : 0, v = v < h.left ? h.left : v) : v > h.right - f.x ? (t.x = a - d - u ? z(h.left + h.width - v - f.x) : 0, v = v > h.right ? h.right : v) : t.x = 0, m < h.top + f.y ? (t.y = r ? -z(h.top - m + f.y) : 0, m = m < h.top ? h.top : m) : m > h.bottom - f.y ? (t.y = c - r - l ? z(h.top + h.height - m - f.y) : 0, m = m > h.bottom ? h.bottom : m) : t.y = 0;
1224
- const y = je(p, v), x = je(g, m), N = $e(p, v), b = $e(g, m);
1225
- o.x = y, o.y = x, o.width = N - y, o.height = b - x;
1265
+ const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: i } = this, { scrollTop: s, scrollHeight: r, clientHeight: c, scrollLeft: u, scrollWidth: a, clientWidth: f } = o, h = this._targetRect, { x1: g, y1: d } = n;
1266
+ let { x2: l, y2: p } = n;
1267
+ const { behaviour: { scrolling: { startScrollMargins: m } } } = i;
1268
+ l < h.left + m.x ? (t.x = u ? -F(h.left - l + m.x) : 0, l = l < h.left ? h.left : l) : l > h.right - m.x ? (t.x = a - u - f ? F(h.left + h.width - l - m.x) : 0, l = l > h.right ? h.right : l) : t.x = 0, p < h.top + m.y ? (t.y = s ? -F(h.top - p + m.y) : 0, p = p < h.top ? h.top : p) : p > h.bottom - m.y ? (t.y = r - s - c ? F(h.top + h.height - p - m.y) : 0, p = p > h.bottom ? h.bottom : p) : t.y = 0;
1269
+ const v = $e(g, l), b = $e(d, p), y = Pe(g, l), E = Pe(d, p);
1270
+ this._areaRect = Oe(v, b, y - v, E - b);
1226
1271
  }
1227
1272
  _redrawSelectionArea() {
1228
- const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
1229
- i.left = `${t}px`, i.top = `${n}px`, i.width = `${o}px`, i.height = `${s}px`;
1273
+ const { x: t, y: n, width: o, height: i } = this._areaRect, { style: s } = this._area;
1274
+ s.left = `${t}px`, s.top = `${n}px`, s.width = `${o}px`, s.height = `${i}px`;
1230
1275
  }
1231
1276
  _onTapStop(t, n) {
1232
1277
  var o;
1233
- const { document: s, features: i } = this._options, { _singleClick: r } = this;
1234
- O(s, ["mousemove", "touchmove"], this._delayedTapMove), O(s, ["touchmove", "mousemove"], this._onTapMove), O(s, ["mouseup", "touchcancel", "touchend"], this._onTapStop), O(s, "scroll", this._onScroll), this._keepSelection(), t && r && i.singleTap.allow ? this._onSingleTap(t) : !r && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, O(this._targetElement, "wheel", this._manualScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), D(this._area, "display", "none");
1278
+ const { document: i, features: s } = this._options, { _singleClick: r } = this;
1279
+ L(this._targetElement, "scroll", this._onStartAreaScroll), L(i, ["mousemove", "touchmove"], this._delayedTapMove), L(i, ["touchmove", "mousemove"], this._onTapMove), L(i, ["mouseup", "touchcancel", "touchend"], this._onTapStop), L(i, "scroll", this._onScroll), this._keepSelection(), t && r && s.singleTap.allow ? this._onSingleTap(t) : !r && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, L(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), L(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), j(this._area, "display", "none");
1235
1280
  }
1236
1281
  _updateElementSelection() {
1237
- const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: r, touched: c } = o, { intersect: l, overlap: d } = n.behaviour, a = d === "invert", u = [], h = [], p = [];
1238
- for (let v = 0; v < t.length; v++) {
1239
- const m = t[v];
1240
- if (Ae(s, m.getBoundingClientRect(), l)) {
1282
+ const { _selectables: t, _options: n, _selection: o, _areaRect: i } = this, { stored: s, selected: r, touched: c } = o, { intersect: u, overlap: a } = n.behaviour, f = a === "invert", h = [], g = [], d = [];
1283
+ for (let p = 0; p < t.length; p++) {
1284
+ const m = t[p];
1285
+ if (je(i, m.getBoundingClientRect(), u)) {
1241
1286
  if (r.includes(m))
1242
- i.includes(m) && !c.includes(m) && c.push(m);
1243
- else if (a && i.includes(m)) {
1244
- p.push(m);
1287
+ s.includes(m) && !c.includes(m) && c.push(m);
1288
+ else if (f && s.includes(m)) {
1289
+ d.push(m);
1245
1290
  continue;
1246
1291
  } else
1247
- h.push(m);
1248
- u.push(m);
1292
+ g.push(m);
1293
+ h.push(m);
1249
1294
  }
1250
1295
  }
1251
- a && h.push(...i.filter((v) => !r.includes(v)));
1252
- const g = d === "keep";
1253
- for (let v = 0; v < r.length; v++) {
1254
- const m = r[v];
1255
- !u.includes(m) && !// Check if user wants to keep previously selected elements, e.g.
1296
+ f && g.push(...s.filter((p) => !r.includes(p)));
1297
+ const l = a === "keep";
1298
+ for (let p = 0; p < r.length; p++) {
1299
+ const m = r[p];
1300
+ !h.includes(m) && !// Check if the user wants to keep previously selected elements, e.g.,
1256
1301
  // not make them part of the current selection as soon as they're touched.
1257
- (g && i.includes(m)) && p.push(m);
1302
+ (l && s.includes(m)) && d.push(m);
1258
1303
  }
1259
- o.selected = u, o.changed = { added: h, removed: p }, this._latestElement = void 0;
1304
+ o.selected = h, o.changed = { added: g, removed: d }, this._latestElement = void 0;
1260
1305
  }
1261
1306
  _emitEvent(t, n) {
1262
1307
  return this.emit(t, {
@@ -1266,12 +1311,12 @@ class Ye extends Ot {
1266
1311
  });
1267
1312
  }
1268
1313
  _keepSelection() {
1269
- const { _options: t, _selection: n } = this, { selected: o, changed: s, touched: i, stored: r } = n, c = o.filter((l) => !r.includes(l));
1314
+ const { _options: t, _selection: n } = this, { selected: o, changed: i, touched: s, stored: r } = n, c = o.filter((u) => !r.includes(u));
1270
1315
  switch (t.behaviour.overlap) {
1271
1316
  case "drop": {
1272
1317
  n.stored = [
1273
1318
  ...c,
1274
- ...r.filter((l) => !i.includes(l))
1319
+ ...r.filter((u) => !s.includes(u))
1275
1320
  // Elements not touched
1276
1321
  ];
1277
1322
  break;
@@ -1279,7 +1324,7 @@ class Ye extends Ot {
1279
1324
  case "invert": {
1280
1325
  n.stored = [
1281
1326
  ...c,
1282
- ...r.filter((l) => !s.removed.includes(l))
1327
+ ...r.filter((u) => !i.removed.includes(u))
1283
1328
  // Elements not removed from selection
1284
1329
  ];
1285
1330
  break;
@@ -1287,7 +1332,7 @@ class Ye extends Ot {
1287
1332
  case "keep": {
1288
1333
  n.stored = [
1289
1334
  ...r,
1290
- ...o.filter((l) => !r.includes(l))
1335
+ ...o.filter((u) => !r.includes(u))
1291
1336
  // Newly added
1292
1337
  ];
1293
1338
  break;
@@ -1296,35 +1341,30 @@ class Ye extends Ot {
1296
1341
  }
1297
1342
  /**
1298
1343
  * Manually triggers the start of a selection
1299
- * @param evt A MouseEvent / TouchEvent -like object
1300
- * @param silent If beforestart should be fired,
1344
+ * @param evt A MouseEvent / TouchEvent-like object
1345
+ * @param silent If beforestart should be fired
1301
1346
  */
1302
1347
  trigger(t, n = !0) {
1303
1348
  this._onTapStart(t, n);
1304
1349
  }
1305
1350
  /**
1306
- * Can be used if during a selection elements have been added.
1307
- * Will update everything which can be selected.
1351
+ * Can be used if during a selection elements have been added
1352
+ * Will update everything that can be selected
1308
1353
  */
1309
1354
  resolveSelectables() {
1310
- this._selectables = K(this._options.selectables, this._options.document);
1355
+ this._selectables = Y(this._options.selectables, this._options.document);
1311
1356
  }
1312
1357
  /**
1313
- * Same as deselect, but for all elements currently selected.
1358
+ * Same as deselecting, but for all elements currently selected
1314
1359
  * @param includeStored If the store should also get cleared
1315
1360
  * @param quiet If move / stop events should be fired
1316
1361
  */
1317
1362
  clearSelection(t = !0, n = !1) {
1318
- const { selected: o, stored: s, changed: i } = this._selection;
1319
- i.added = [], i.removed.push(
1363
+ const { selected: o, stored: i, changed: s } = this._selection;
1364
+ s.added = [], s.removed.push(
1320
1365
  ...o,
1321
- ...t ? s : []
1322
- ), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = {
1323
- stored: t ? [] : s,
1324
- selected: [],
1325
- touched: [],
1326
- changed: { added: [], removed: [] }
1327
- };
1366
+ ...t ? i : []
1367
+ ), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Be(t ? [] : i);
1328
1368
  }
1329
1369
  /**
1330
1370
  * @returns {Array} Selected elements
@@ -1339,8 +1379,27 @@ class Ye extends Ot {
1339
1379
  return this._area;
1340
1380
  }
1341
1381
  /**
1342
- * Cancel the current selection process.
1343
- * @param keepEvent {boolean} true to fire a stop event after cancel.
1382
+ * @returns {Element[]} Available selectable elements for current selection
1383
+ */
1384
+ getSelectables() {
1385
+ return this._selectables;
1386
+ }
1387
+ /**
1388
+ * Set the location of the selection area
1389
+ * @param location A partial AreaLocation object
1390
+ */
1391
+ setAreaLocation(t) {
1392
+ Object.assign(this._areaLocation, t), this._redrawSelectionArea();
1393
+ }
1394
+ /**
1395
+ * @returns {AreaLocation} The current location of the selection area
1396
+ */
1397
+ getAreaLocation() {
1398
+ return this._areaLocation;
1399
+ }
1400
+ /**
1401
+ * Cancel the current selection process, pass true to fire a stop event after cancel
1402
+ * @param keepEvent If a stop event should be fired
1344
1403
  */
1345
1404
  cancel(t = !1) {
1346
1405
  this._onTapStop(null, !t);
@@ -1353,35 +1412,40 @@ class Ye extends Ot {
1353
1412
  }
1354
1413
  /**
1355
1414
  * Adds elements to the selection
1356
- * @param query - CSS Query, can be an array of queries
1357
- * @param quiet - If this should not trigger the move event
1415
+ * @param query CSS Query, can be an array of queries
1416
+ * @param quiet If this should not trigger the move event
1358
1417
  */
1359
1418
  select(t, n = !1) {
1360
- const { changed: o, selected: s, stored: i } = this._selection, r = K(t, this._options.document).filter(
1361
- (c) => !s.includes(c) && !i.includes(c)
1419
+ const { changed: o, selected: i, stored: s } = this._selection, r = Y(t, this._options.document).filter(
1420
+ (c) => !i.includes(c) && !s.includes(c)
1362
1421
  );
1363
- return i.push(...r), s.push(...r), o.added.push(...r), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), r;
1422
+ return s.push(...r), i.push(...r), o.added.push(...r), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), r;
1364
1423
  }
1365
1424
  /**
1366
- * Removes a particular element from the selection.
1367
- * @param query - CSS Query, can be an array of queries
1368
- * @param quiet - If this should not trigger the move event
1425
+ * Removes a particular element from the selection
1426
+ * @param query CSS Query, can be an array of queries
1427
+ * @param quiet If this should not trigger the move event
1369
1428
  */
1370
1429
  deselect(t, n = !1) {
1371
- const { selected: o, stored: s, changed: i } = this._selection, r = K(t, this._options.document).filter(
1372
- (c) => o.includes(c) || s.includes(c)
1430
+ const { selected: o, stored: i, changed: s } = this._selection, r = Y(t, this._options.document).filter(
1431
+ (c) => o.includes(c) || i.includes(c)
1373
1432
  );
1374
- r.length && (this._selection.stored = s.filter((c) => !r.includes(c)), this._selection.selected = o.filter((c) => !r.includes(c)), this._selection.changed.added = [], this._selection.changed.removed.push(
1375
- ...r.filter((c) => !i.removed.includes(c))
1376
- ), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)));
1433
+ this._selection.stored = i.filter((c) => !r.includes(c)), this._selection.selected = o.filter((c) => !r.includes(c)), this._selection.changed.added = [], this._selection.changed.removed.push(
1434
+ ...r.filter((c) => !s.removed.includes(c))
1435
+ ), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
1377
1436
  }
1378
- }
1379
- C(Ye, "version", "3.5.1");
1380
- function zt(e) {
1381
- const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new Ye({
1437
+ };
1438
+ Je.version = "3.9.0";
1439
+ let Zt = Je;
1440
+ function Qt(e) {
1441
+ const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new Zt({
1382
1442
  selectables: [".map-container me-tpc"],
1383
1443
  boundaries: [e.container],
1384
1444
  container: e.selectionContainer,
1445
+ features: {
1446
+ // deselectOnBlur: true,
1447
+ touch: !1
1448
+ },
1385
1449
  behaviour: {
1386
1450
  triggers: t,
1387
1451
  // Scroll configuration.
@@ -1399,334 +1463,329 @@ function zt(e) {
1399
1463
  }
1400
1464
  }
1401
1465
  }).on("beforestart", ({ event: o }) => {
1402
- if (o.target.tagName === "ME-TPC" || o.target.id === "input-box" || o.target.className === "circle")
1466
+ var r;
1467
+ const i = o.target;
1468
+ if (i.id === "input-box" || i.className === "circle" || (r = e.container.querySelector(".context-menu")) != null && r.contains(i))
1403
1469
  return !1;
1470
+ if (!o.ctrlKey && !o.metaKey) {
1471
+ if (i.tagName === "ME-TPC" && i.classList.contains("selected"))
1472
+ return !1;
1473
+ e.clearSelection();
1474
+ }
1404
1475
  const s = n.getSelectionArea();
1405
1476
  return s.style.background = "#4f90f22d", s.style.border = "1px solid #4f90f2", s.parentElement && (s.parentElement.style.zIndex = "9999"), !0;
1406
- }).on("start", ({ event: o }) => {
1407
- !o.ctrlKey && !o.metaKey && (e.clearSelection(), n.clearSelection(!0, !0));
1408
1477
  }).on(
1409
1478
  "move",
1410
1479
  ({
1411
1480
  store: {
1412
- changed: { added: o, removed: s }
1481
+ changed: { added: o, removed: i }
1413
1482
  }
1414
1483
  }) => {
1415
- e.dragMoveHelper.moved = !0;
1416
- for (const i of o)
1417
- i.classList.add("selected");
1418
- for (const i of s)
1419
- i.classList.remove("selected");
1484
+ if (o.length > 0 || i.length > 0, o.length > 0) {
1485
+ for (const s of o)
1486
+ s.className = "selected";
1487
+ e.currentNodes = [...e.currentNodes, ...o], e.bus.fire(
1488
+ "selectNodes",
1489
+ o.map((s) => s.nodeObj)
1490
+ );
1491
+ }
1492
+ if (i.length > 0) {
1493
+ for (const s of i)
1494
+ s.classList.remove("selected");
1495
+ e.currentNodes = e.currentNodes.filter((s) => !(i != null && i.includes(s))), e.bus.fire(
1496
+ "unselectNodes",
1497
+ i.map((s) => s.nodeObj)
1498
+ );
1499
+ }
1420
1500
  }
1421
- ).on("stop", ({ store: { stored: o } }) => {
1422
- e.selectNodes(o);
1423
- });
1501
+ );
1424
1502
  e.selection = n;
1425
1503
  }
1426
- const Ft = function(e, t = !0) {
1504
+ const en = function(e, t = !0) {
1427
1505
  this.theme = e;
1428
- const n = this.theme.cssVar, o = Object.keys(n);
1429
- this.container.style.cssText = "";
1430
- for (let s = 0; s < o.length; s++) {
1431
- const i = o[s];
1432
- this.container.style.setProperty(i, n[i]);
1433
- }
1434
- e.cssVar["--gap"] || this.container.style.setProperty("--gap", "30px"), t && this.refresh();
1435
- }, U = (e) => {
1506
+ const o = {
1507
+ ...(e.type === "dark" ? pe : fe).cssVar,
1508
+ ...e.cssVar
1509
+ }, i = Object.keys(o);
1510
+ for (let s = 0; s < i.length; s++) {
1511
+ const r = i[s];
1512
+ this.container.style.setProperty(r, o[r]);
1513
+ }
1514
+ t && this.refresh();
1515
+ }, K = (e) => {
1436
1516
  var o;
1437
1517
  const t = (o = e.parent) == null ? void 0 : o.children, n = (t == null ? void 0 : t.indexOf(e)) ?? 0;
1438
1518
  return { siblings: t, index: n };
1439
1519
  };
1440
- function qt(e) {
1441
- const { siblings: t, index: n } = U(e);
1520
+ function tn(e) {
1521
+ const { siblings: t, index: n } = K(e);
1442
1522
  if (t === void 0)
1443
1523
  return;
1444
1524
  const o = t[n];
1445
1525
  n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
1446
1526
  }
1447
- function Vt(e) {
1448
- const { siblings: t, index: n } = U(e);
1527
+ function nn(e) {
1528
+ const { siblings: t, index: n } = K(e);
1449
1529
  if (t === void 0)
1450
1530
  return;
1451
1531
  const o = t[n];
1452
1532
  n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
1453
1533
  }
1454
- function ye(e) {
1455
- const { siblings: t, index: n } = U(e);
1534
+ function Ze(e) {
1535
+ const { siblings: t, index: n } = K(e);
1456
1536
  return t === void 0 ? 0 : (t.splice(n, 1), t.length);
1457
1537
  }
1458
- function It(e, t, n) {
1459
- const { siblings: o, index: s } = U(n);
1460
- o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
1538
+ function on(e, t, n) {
1539
+ const { siblings: o, index: i } = K(n);
1540
+ o !== void 0 && (t === "before" ? o.splice(i, 0, e) : o.splice(i + 1, 0, e));
1461
1541
  }
1462
- function Kt(e, t) {
1463
- const { siblings: n, index: o } = U(e);
1542
+ function sn(e, t) {
1543
+ const { siblings: n, index: o } = K(e);
1464
1544
  n !== void 0 && (n[o] = t, t.children = [e]);
1465
1545
  }
1466
- function Ue(e, t, n) {
1546
+ function Qe(e, t, n) {
1467
1547
  var o;
1468
- if (ye(t), (o = n.parent) != null && o.parent || (t.direction = n.direction), e === "in")
1548
+ if (Ze(t), (o = n.parent) != null && o.parent || (t.direction = n.direction), e === "in")
1469
1549
  n.children ? n.children.push(t) : n.children = [t];
1470
1550
  else {
1471
1551
  t.direction !== void 0 && (t.direction = n.direction);
1472
- const { siblings: s, index: i } = U(n);
1473
- if (s === void 0)
1552
+ const { siblings: i, index: s } = K(n);
1553
+ if (i === void 0)
1474
1554
  return;
1475
- e === "before" ? s.splice(i, 0, t) : s.splice(i + 1, 0, t);
1555
+ e === "before" ? i.splice(s, 0, t) : i.splice(s + 1, 0, t);
1476
1556
  }
1477
1557
  }
1478
- const Wt = function({ map: e, direction: t }, n) {
1479
- var o, s;
1480
- if (t === A)
1481
- return A;
1482
- if (t === H)
1483
- return H;
1484
- if (t === ae) {
1485
- const i = ((o = e.querySelector(".lhs")) == null ? void 0 : o.childElementCount) || 0, r = ((s = e.querySelector(".rhs")) == null ? void 0 : s.childElementCount) || 0;
1486
- return i <= r ? (n.direction = A, A) : (n.direction = H, H);
1487
- }
1488
- }, Xe = function(e, t, n) {
1489
- var i, r;
1490
- const o = n.children[0].children[0], s = t.parentElement;
1491
- if (s.tagName === "ME-PARENT") {
1492
- if (Q(o), s.children[1])
1493
- s.nextSibling.appendChild(n);
1558
+ const rn = function({ map: e, direction: t }, n) {
1559
+ var o, i;
1560
+ if (t === 0)
1561
+ return 0;
1562
+ if (t === 1)
1563
+ return 1;
1564
+ if (t === 2) {
1565
+ const s = ((o = e.querySelector(".lhs")) == null ? void 0 : o.childElementCount) || 0, r = ((i = e.querySelector(".rhs")) == null ? void 0 : i.childElementCount) || 0;
1566
+ return s <= r ? (n.direction = 0, 0) : (n.direction = 1, 1);
1567
+ }
1568
+ }, et = function(e, t, n) {
1569
+ var s, r;
1570
+ const o = n.children[0].children[0], i = t.parentElement;
1571
+ if (i.tagName === "ME-PARENT") {
1572
+ if (X(o), i.children[1])
1573
+ i.nextSibling.appendChild(n);
1494
1574
  else {
1495
1575
  const c = e.createChildren([n]);
1496
- s.appendChild(ve(!0)), s.insertAdjacentElement("afterend", c);
1576
+ i.appendChild(ye(!0)), i.insertAdjacentElement("afterend", c);
1497
1577
  }
1498
1578
  e.linkDiv(n.offsetParent);
1499
1579
  } else
1500
- s.tagName === "ME-ROOT" && (Wt(e, o.nodeObj) === A ? (i = e.container.querySelector(".lhs")) == null || i.appendChild(n) : (r = e.container.querySelector(".rhs")) == null || r.appendChild(n), e.linkDiv());
1501
- }, Ge = function(e, t) {
1580
+ i.tagName === "ME-ROOT" && (rn(e, o.nodeObj) === 0 ? (s = e.container.querySelector(".lhs")) == null || s.appendChild(n) : (r = e.container.querySelector(".rhs")) == null || r.appendChild(n), e.linkDiv());
1581
+ }, cn = function(e, t) {
1502
1582
  const n = e.parentNode;
1503
1583
  if (t === 0) {
1504
1584
  const o = n.parentNode.parentNode;
1505
1585
  o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
1506
1586
  }
1507
1587
  n.parentNode.remove();
1508
- }, Je = {
1588
+ }, tt = {
1509
1589
  before: "beforebegin",
1510
1590
  after: "afterend"
1511
- }, Q = function(e) {
1591
+ }, X = function(e) {
1512
1592
  const n = e.parentElement.parentElement.lastElementChild;
1513
1593
  (n == null ? void 0 : n.tagName) === "svg" && (n == null || n.remove());
1514
- }, Yt = function(e, t) {
1594
+ }, ln = function(e, t) {
1515
1595
  const n = e.nodeObj, o = me(n);
1516
1596
  o.style && t.style && (t.style = Object.assign(o.style, t.style));
1517
- const s = Object.assign(n, t);
1518
- ge(e, s), this.linkDiv(), this.bus.fire("operation", {
1597
+ const i = Object.assign(n, t);
1598
+ be(e, i), this.linkDiv(), this.bus.fire("operation", {
1519
1599
  name: "reshapeNode",
1520
- obj: s,
1600
+ obj: i,
1521
1601
  origin: o
1522
1602
  });
1523
- }, be = function(e, t, n) {
1603
+ }, we = function(e, t, n) {
1524
1604
  if (!t)
1525
1605
  return null;
1526
1606
  const o = t.nodeObj;
1527
- o.expanded === !1 && (e.expandNode(t, !0), t = E(o.id));
1528
- const s = n || e.generateNewObj();
1529
- o.children ? o.children.push(s) : o.children = [s], P(e.nodeData);
1530
- const { grp: i, top: r } = e.createWrapper(s);
1531
- return Xe(e, t, i), { newTop: r, newNodeObj: s };
1532
- }, Ut = function(e, t, n) {
1533
- var d, a, u, h;
1607
+ o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
1608
+ const i = n || e.generateNewObj();
1609
+ o.children ? o.children.push(i) : o.children = [i], $(e.nodeData);
1610
+ const { grp: s, top: r } = e.createWrapper(i);
1611
+ return et(e, t, s), { newTop: r, newNodeObj: i };
1612
+ }, an = function(e, t, n) {
1613
+ var a, f, h, g;
1534
1614
  const o = t || this.currentNode;
1535
1615
  if (!o)
1536
1616
  return;
1537
- const s = o.nodeObj;
1538
- if (s.parent) {
1539
- if (!((d = s.parent) != null && d.parent) && ((u = (a = s.parent) == null ? void 0 : a.children) == null ? void 0 : u.length) === 1) {
1540
- this.addChild(E(s.parent.id), n);
1617
+ const i = o.nodeObj;
1618
+ if (i.parent) {
1619
+ if (!((a = i.parent) != null && a.parent) && ((h = (f = i.parent) == null ? void 0 : f.children) == null ? void 0 : h.length) === 1 && this.direction === 2) {
1620
+ this.addChild(this.findEle(i.parent.id), n);
1541
1621
  return;
1542
1622
  }
1543
1623
  } else {
1544
1624
  this.addChild();
1545
1625
  return;
1546
1626
  }
1547
- const i = n || this.generateNewObj();
1548
- if (!((h = s.parent) != null && h.parent)) {
1549
- const p = o.closest("me-main").className === M.LHS ? A : H;
1550
- i.direction = p;
1627
+ const s = n || this.generateNewObj();
1628
+ if (!((g = i.parent) != null && g.parent)) {
1629
+ const d = o.closest("me-main").className === M.LHS ? 0 : 1;
1630
+ s.direction = d;
1551
1631
  }
1552
- It(i, e, s), P(this.nodeData);
1553
- const r = o.parentElement, { grp: c, top: l } = this.createWrapper(i);
1554
- r.parentElement.insertAdjacentElement(Je[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(l.firstChild), this.selectNode(l.firstChild, !0), this.bus.fire("operation", {
1632
+ on(s, e, i), $(this.nodeData);
1633
+ const r = o.parentElement, { grp: c, top: u } = this.createWrapper(s);
1634
+ r.parentElement.insertAdjacentElement(tt[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(u.firstChild), this.selectNode(u.firstChild, !0), this.bus.fire("operation", {
1555
1635
  name: "insertSibling",
1556
1636
  type: e,
1557
- obj: i
1637
+ obj: s
1558
1638
  });
1559
- }, Xt = function(e, t) {
1639
+ }, dn = function(e, t) {
1560
1640
  const n = e || this.currentNode;
1561
1641
  if (!n)
1562
1642
  return;
1563
- Q(n);
1643
+ X(n);
1564
1644
  const o = n.nodeObj;
1565
1645
  if (!o.parent)
1566
1646
  return;
1567
- const s = t || this.generateNewObj();
1568
- Kt(o, s), P(this.nodeData);
1569
- const i = n.parentElement.parentElement, { grp: r, top: c } = this.createWrapper(s, !0);
1570
- c.appendChild(ve(!0)), i.insertAdjacentElement("afterend", r);
1571
- const l = this.createChildren([i]);
1572
- c.insertAdjacentElement("afterend", l), this.linkDiv(), t || this.editTopic(c.firstChild), this.selectNode(c.firstChild, !0), this.bus.fire("operation", {
1647
+ const i = t || this.generateNewObj();
1648
+ sn(o, i), $(this.nodeData);
1649
+ const s = n.parentElement.parentElement, { grp: r, top: c } = this.createWrapper(i, !0);
1650
+ c.appendChild(ye(!0)), s.insertAdjacentElement("afterend", r);
1651
+ const u = this.createChildren([s]);
1652
+ c.insertAdjacentElement("afterend", u), this.linkDiv(), t || this.editTopic(c.firstChild), this.selectNode(c.firstChild, !0), this.bus.fire("operation", {
1573
1653
  name: "insertParent",
1574
- obj: s
1654
+ obj: i
1575
1655
  });
1576
- }, Gt = function(e, t) {
1656
+ }, hn = function(e, t) {
1577
1657
  const n = e || this.currentNode;
1578
1658
  if (!n)
1579
1659
  return;
1580
- const o = be(this, n, t);
1660
+ const o = we(this, n, t);
1581
1661
  if (!o)
1582
1662
  return;
1583
- const { newTop: s, newNodeObj: i } = o;
1663
+ const { newTop: i, newNodeObj: s } = o;
1584
1664
  this.bus.fire("operation", {
1585
1665
  name: "addChild",
1586
- obj: i
1587
- }), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
1588
- }, Jt = function(e, t) {
1666
+ obj: s
1667
+ }), t || this.editTopic(i.firstChild), this.selectNode(i.firstChild, !0);
1668
+ }, un = function(e, t) {
1589
1669
  const n = me(e.nodeObj);
1590
- pe(n);
1591
- const o = be(this, t, n);
1670
+ ge(n);
1671
+ const o = we(this, t, n);
1592
1672
  if (!o)
1593
1673
  return;
1594
- const { newNodeObj: s } = o;
1595
- this.selectNode(E(s.id)), this.bus.fire("operation", {
1674
+ const { newNodeObj: i } = o;
1675
+ this.selectNode(this.findEle(i.id)), this.bus.fire("operation", {
1596
1676
  name: "copyNode",
1597
- obj: s
1677
+ obj: i
1598
1678
  });
1599
- }, Zt = function(e, t) {
1600
- e = de(e);
1679
+ }, fn = function(e, t) {
1680
+ e = ce(e);
1601
1681
  const n = [];
1602
1682
  for (let o = 0; o < e.length; o++) {
1603
- const s = e[o], i = me(s.nodeObj);
1604
- pe(i);
1605
- const r = be(this, t, i);
1683
+ const i = e[o], s = me(i.nodeObj);
1684
+ ge(s);
1685
+ const r = we(this, t, s);
1606
1686
  if (!r)
1607
1687
  return;
1608
1688
  const { newNodeObj: c } = r;
1609
1689
  n.push(c);
1610
1690
  }
1611
- this.selectNodes(n.map((o) => E(o.id))), this.bus.fire("operation", {
1691
+ this.unselectNodes(this.currentNodes), this.selectNodes(n.map((o) => this.findEle(o.id))), this.bus.fire("operation", {
1612
1692
  name: "copyNodes",
1613
1693
  objs: n
1614
1694
  });
1615
- }, Qt = function(e) {
1695
+ }, pn = function(e) {
1616
1696
  const t = e || this.currentNode;
1617
1697
  if (!t)
1618
1698
  return;
1619
1699
  const n = t.nodeObj;
1620
- qt(n);
1700
+ tn(n);
1621
1701
  const o = t.parentNode.parentNode;
1622
1702
  o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
1623
1703
  name: "moveUpNode",
1624
1704
  obj: n
1625
1705
  });
1626
- }, en = function(e) {
1706
+ }, gn = function(e) {
1627
1707
  const t = e || this.currentNode;
1628
1708
  if (!t)
1629
1709
  return;
1630
1710
  const n = t.nodeObj;
1631
- Vt(n);
1711
+ nn(n);
1632
1712
  const o = t.parentNode.parentNode;
1633
1713
  o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
1634
1714
  name: "moveDownNode",
1635
1715
  obj: n
1636
1716
  });
1637
- }, tn = function(e) {
1638
- var r;
1639
- const t = e || this.currentNode;
1640
- if (!t)
1717
+ }, mn = function(e) {
1718
+ if (e.length === 0)
1641
1719
  return;
1642
- const n = t.nodeObj;
1643
- if (!n.parent)
1644
- throw new Error("Can not remove root node");
1645
- const o = n.parent.children, s = o.findIndex((c) => c === n), i = ye(n);
1646
- if (Ge(t, i), o.length !== 0) {
1647
- const c = o[s] || o[s - 1];
1648
- this.selectNode(E(c.id));
1649
- } else
1650
- this.selectNode(E(n.parent.id));
1651
- this.linkDiv(), this.bus.fire("operation", {
1652
- name: "removeNode",
1653
- obj: n,
1654
- originIndex: s,
1655
- originParentId: (r = n == null ? void 0 : n.parent) == null ? void 0 : r.id
1656
- });
1657
- }, nn = function(e) {
1658
- e = de(e);
1659
- for (const t of e) {
1660
- const n = t.nodeObj;
1661
- if (!n.parent)
1662
- continue;
1663
- const o = ye(n);
1664
- Ge(t, o);
1720
+ e = ce(e);
1721
+ for (const n of e) {
1722
+ const o = n.nodeObj, i = Ze(o);
1723
+ cn(n, i);
1665
1724
  }
1666
- this.linkDiv(), this.bus.fire("operation", {
1725
+ const t = e[e.length - 1];
1726
+ this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
1667
1727
  name: "removeNodes",
1668
- objs: e.map((t) => t.nodeObj)
1728
+ objs: e.map((n) => n.nodeObj)
1669
1729
  });
1670
- }, on = function(e, t) {
1671
- e = de(e);
1730
+ }, vn = function(e, t) {
1731
+ e = ce(e);
1672
1732
  const n = t.nodeObj;
1673
- n.expanded === !1 && (this.expandNode(t, !0), t = E(n.id));
1733
+ n.expanded === !1 && (this.expandNode(t, !0), t = this.findEle(n.id));
1674
1734
  for (const o of e) {
1675
- const s = o.nodeObj;
1676
- Ue("in", s, n), P(this.nodeData);
1677
- const i = o.parentElement;
1678
- Xe(this, t, i.parentElement);
1735
+ const i = o.nodeObj;
1736
+ Qe("in", i, n), $(this.nodeData);
1737
+ const s = o.parentElement;
1738
+ et(this, t, s.parentElement);
1679
1739
  }
1680
1740
  this.linkDiv(), this.bus.fire("operation", {
1681
1741
  name: "moveNodeIn",
1682
1742
  objs: e.map((o) => o.nodeObj),
1683
1743
  toObj: n
1684
1744
  });
1685
- }, Ze = (e, t, n, o) => {
1686
- e = de(e), t === "after" && (e = e.reverse());
1687
- const s = n.nodeObj, i = [];
1745
+ }, nt = (e, t, n, o) => {
1746
+ e = ce(e), t === "after" && (e = e.reverse());
1747
+ const i = n.nodeObj, s = [];
1688
1748
  for (const r of e) {
1689
1749
  const c = r.nodeObj;
1690
- Ue(t, c, s), P(o.nodeData), Q(r);
1691
- const l = r.parentElement.parentNode;
1692
- i.includes(l.parentElement) || i.push(l.parentElement), n.parentElement.parentNode.insertAdjacentElement(Je[t], l);
1750
+ Qe(t, c, i), $(o.nodeData), X(r);
1751
+ const u = r.parentElement.parentNode;
1752
+ s.includes(u.parentElement) || s.push(u.parentElement), n.parentElement.parentNode.insertAdjacentElement(tt[t], u);
1693
1753
  }
1694
- for (const r of i)
1754
+ for (const r of s)
1695
1755
  r.childElementCount === 0 && r.tagName !== "ME-MAIN" && (r.previousSibling.children[1].remove(), r.remove());
1696
1756
  o.linkDiv(), o.bus.fire("operation", {
1697
1757
  name: t === "before" ? "moveNodeBefore" : "moveNodeAfter",
1698
1758
  objs: e.map((r) => r.nodeObj),
1699
- toObj: s
1759
+ toObj: i
1700
1760
  });
1701
- }, sn = function(e, t) {
1702
- Ze(e, "before", t, this);
1703
- }, rn = function(e, t) {
1704
- Ze(e, "after", t, this);
1705
- }, cn = function(e) {
1761
+ }, bn = function(e, t) {
1762
+ nt(e, "before", t, this);
1763
+ }, yn = function(e, t) {
1764
+ nt(e, "after", t, this);
1765
+ }, wn = function(e) {
1706
1766
  const t = e || this.currentNode;
1707
1767
  t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
1708
- }, ln = function(e, t) {
1768
+ }, xn = function(e, t) {
1709
1769
  e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
1710
- }, Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1770
+ }, ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1711
1771
  __proto__: null,
1712
- addChild: Gt,
1713
- beginEdit: cn,
1714
- copyNode: Jt,
1715
- copyNodes: Zt,
1716
- insertParent: Xt,
1717
- insertSibling: Ut,
1718
- moveDownNode: en,
1719
- moveNodeAfter: rn,
1720
- moveNodeBefore: sn,
1721
- moveNodeIn: on,
1722
- moveUpNode: Qt,
1723
- removeNode: tn,
1724
- removeNodes: nn,
1725
- reshapeNode: Yt,
1726
- rmSubline: Q,
1727
- setNodeTopic: ln
1772
+ addChild: hn,
1773
+ beginEdit: wn,
1774
+ copyNode: un,
1775
+ copyNodes: fn,
1776
+ insertParent: dn,
1777
+ insertSibling: an,
1778
+ moveDownNode: gn,
1779
+ moveNodeAfter: yn,
1780
+ moveNodeBefore: bn,
1781
+ moveNodeIn: vn,
1782
+ moveUpNode: pn,
1783
+ removeNodes: mn,
1784
+ reshapeNode: ln,
1785
+ rmSubline: X,
1786
+ setNodeTopic: xn
1728
1787
  }, Symbol.toStringTag, { value: "Module" }));
1729
- function an(e) {
1788
+ function En(e) {
1730
1789
  return {
1731
1790
  nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
1732
1791
  arrows: e.arrows,
@@ -1735,150 +1794,202 @@ function an(e) {
1735
1794
  theme: e.theme
1736
1795
  };
1737
1796
  }
1738
- const dn = function(e, t, n) {
1739
- if (e) {
1740
- if (this.clearSelection(), typeof e == "string") {
1741
- const o = E(e);
1742
- return o ? this.selectNode(o) : void 0;
1743
- }
1744
- 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);
1745
- }
1746
- }, hn = function() {
1747
- this.currentNode && (this.currentNode.className = ""), this.currentNode = null, this.bus.fire("unselectNode");
1748
- }, un = function(e) {
1749
- this.clearSelection();
1750
- for (const t of e)
1751
- t.className = "selected";
1752
- this.currentNodes = e, this.bus.fire(
1753
- "selectNodes",
1754
- e.map((t) => t.nodeObj)
1755
- );
1756
- }, fn = function() {
1757
- if (this.currentNodes)
1758
- for (const e of this.currentNodes)
1759
- e.classList.remove("selected");
1760
- this.currentNodes = null, this.bus.fire("unselectNodes");
1761
- }, pn = function() {
1762
- this.unselectNode(), this.unselectNodes(), this.unselectSummary(), this.unselectArrow();
1763
- }, mn = function() {
1764
- const e = an(this);
1797
+ const Cn = function(e) {
1798
+ const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
1799
+ if (n.top > o.bottom || n.bottom < o.top || n.left > o.right || n.right < o.left) {
1800
+ const s = n.left + n.width / 2, r = n.top + n.height / 2, c = o.left + o.width / 2, u = o.top + o.height / 2, a = s - c, f = r - u;
1801
+ this.move(-a, -f);
1802
+ }
1803
+ }, Sn = function(e, t, n) {
1804
+ this.clearSelection(), this.scrollIntoView(e), this.selection.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
1805
+ }, Nn = function(e) {
1806
+ this.selection.select(e);
1807
+ }, _n = function(e) {
1808
+ this.selection.deselect(e);
1809
+ }, kn = function() {
1810
+ this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
1811
+ }, Tn = function() {
1812
+ const e = En(this);
1765
1813
  return JSON.stringify(e, (t, n) => {
1766
1814
  if (!(t === "parent" && typeof n != "string"))
1767
1815
  return n;
1768
1816
  });
1769
- }, gn = function() {
1817
+ }, An = function() {
1770
1818
  return JSON.parse(this.getDataString());
1771
- }, vn = function() {
1819
+ }, Ln = function() {
1772
1820
  this.editable = !0;
1773
- }, yn = function() {
1821
+ }, Mn = function() {
1774
1822
  this.editable = !1;
1775
- }, bn = function(e, t = { x: 0, y: 0 }) {
1776
- const n = this.container.getBoundingClientRect(), o = n.width / 2 - 1e4, s = n.height / 2 - 1e4, i = this.scaleVal, r = this.map.style.transform, { x: c, y: l } = Fe(r), d = c - (t.x - n.left - n.width / 2), a = l - (t.y - n.top - n.height / 2), u = (o - d) * (1 - e / i), h = (s - a) * (1 - e / i);
1777
- this.map.style.transform = `translate(${c + u}px, ${l + h}px) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
1778
- }, xn = function() {
1823
+ }, Dn = function(e, t = { x: 0, y: 0 }) {
1824
+ const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, i = t.y ? t.y - n.top - n.height / 2 : 0, { dx: s, dy: r } = it(this), c = this.map.style.transform, { x: u, y: a } = Ye(c), f = u - s, h = a - r, g = this.scaleVal, d = (-o + f) * (1 - e / g), l = (-i + h) * (1 - e / g);
1825
+ this.map.style.transform = `translate(${u - d}px, ${a - l}px) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
1826
+ }, On = function() {
1779
1827
  const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
1780
1828
  this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
1781
- }, wn = function(e, t) {
1782
- const { map: n, scaleVal: o, container: s, bus: i } = this, r = n.style.transform, { x: c, y: l } = Fe(r), d = c + e, a = l + t, u = (1 - o) * 1e4, h = 0 - u, p = -2e4 + s.offsetWidth + u, g = -2e4 + s.offsetHeight + u, v = Math.min(h, Math.max(p, d)), m = Math.min(h, Math.max(g, a));
1783
- n.style.transform = `translate(${v}px, ${m}px) scale(${o})`, i.fire("move", { dx: e, dy: t });
1784
- }, En = function() {
1785
- const e = this.container.getBoundingClientRect(), t = e.width / 2 - 1e4, n = e.height / 2 - 1e4;
1786
- this.map.style.transform = `translate(${t}px, ${n}px) scale(${this.scaleVal})`;
1787
- }, Nn = function(e) {
1829
+ }, jn = function(e, t) {
1830
+ const { map: n, scaleVal: o, bus: i } = this, s = n.style.transform;
1831
+ let { x: r, y: c } = Ye(s);
1832
+ r += e, c += t, n.style.transform = `translate(${r}px, ${c}px) scale(${o})`, i.fire("move", { dx: e, dy: t });
1833
+ }, it = (e) => {
1834
+ const { container: t, map: n, nodes: o } = e, i = n.querySelector("me-root"), s = i.offsetTop, r = i.offsetLeft, c = i.offsetWidth, u = i.offsetHeight;
1835
+ let a, f;
1836
+ return e.alignment === "root" ? (a = t.offsetWidth / 2 - r - c / 2, f = t.offsetHeight / 2 - s - u / 2, n.style.transformOrigin = `${r + c / 2}px 50%`) : (a = (t.offsetWidth - o.offsetWidth) / 2, f = (t.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: a, dy: f };
1837
+ }, Pn = function() {
1838
+ const { map: e } = this, { dx: t, dy: n } = it(this);
1839
+ e.style.transform = `translate(${t}px, ${n}px) scale(${this.scaleVal})`;
1840
+ }, $n = function(e) {
1788
1841
  e(this);
1789
- }, Cn = function(e) {
1790
- e.nodeObj.parent && (this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
1791
- }, Sn = function() {
1842
+ }, Hn = function(e) {
1843
+ e.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
1844
+ }, Bn = function() {
1792
1845
  this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
1793
- }, _n = function() {
1794
- this.direction = 0, this.refresh();
1795
- }, Mn = function() {
1796
- this.direction = 1, this.refresh();
1797
- }, Ln = function() {
1798
- this.direction = 2, this.refresh();
1799
- }, kn = function(e) {
1846
+ }, Rn = function() {
1847
+ this.direction = 0, this.refresh(), this.toCenter();
1848
+ }, Fn = function() {
1849
+ this.direction = 1, this.refresh(), this.toCenter();
1850
+ }, In = function() {
1851
+ this.direction = 2, this.refresh(), this.toCenter();
1852
+ }, Wn = function(e) {
1800
1853
  this.locale = e, this.refresh();
1801
- }, Tn = function(e, t) {
1854
+ }, Vn = function(e, t) {
1802
1855
  const n = e.nodeObj;
1803
1856
  typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
1804
- const o = e.parentNode, s = o.children[1];
1805
- if (s.expanded = n.expanded, s.className = n.expanded ? "minus" : "", Q(e), n.expanded) {
1806
- const l = this.createChildren(
1807
- n.children.map((d) => this.createWrapper(d).grp)
1857
+ const o = e.parentNode, i = o.children[1];
1858
+ if (i.expanded = n.expanded, i.className = n.expanded ? "minus" : "", X(e), n.expanded) {
1859
+ const u = this.createChildren(
1860
+ n.children.map((a) => this.createWrapper(a).grp)
1808
1861
  );
1809
- o.parentNode.appendChild(l);
1862
+ o.parentNode.appendChild(u);
1810
1863
  } else
1811
1864
  o.parentNode.children[1].remove();
1812
1865
  this.linkDiv(e.closest("me-main > me-wrapper"));
1813
- const i = e.getBoundingClientRect(), r = this.container.getBoundingClientRect();
1814
- (i.bottom > r.bottom || i.top < r.top || i.right > r.right || i.left < r.left) && e.scrollIntoView({ block: "center", inline: "center" }), this.bus.fire("expandNode", n);
1815
- }, An = function(e) {
1816
- e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []), P(this.nodeData), this.layout(), this.linkDiv();
1817
- }, $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1866
+ const s = e.getBoundingClientRect(), r = this.container.getBoundingClientRect();
1867
+ (s.bottom > r.bottom || s.top < r.top || s.right > r.right || s.left < r.left) && this.scrollIntoView(e), this.bus.fire("expandNode", n);
1868
+ }, Yn = function(e, t) {
1869
+ const n = e.nodeObj, o = (i, s) => {
1870
+ i.expanded = s, i.children && i.children.forEach((r) => {
1871
+ o(r, s);
1872
+ });
1873
+ };
1874
+ typeof t == "boolean" ? o(n, t) : n.expanded !== !1 ? o(n, !1) : o(n, !0), this.refresh();
1875
+ }, Gn = function(e) {
1876
+ e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []), $(this.nodeData), this.layout(), this.linkDiv();
1877
+ }, Kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1818
1878
  __proto__: null,
1819
- cancelFocus: Sn,
1820
- clearSelection: pn,
1821
- disableEdit: yn,
1822
- enableEdit: vn,
1823
- expandNode: Tn,
1824
- focusNode: Cn,
1825
- getData: gn,
1826
- getDataString: mn,
1827
- initLeft: _n,
1828
- initRight: Mn,
1829
- initSide: Ln,
1830
- install: Nn,
1831
- move: wn,
1832
- refresh: An,
1833
- scale: bn,
1834
- scaleFit: xn,
1835
- selectNode: dn,
1836
- selectNodes: un,
1837
- setLocale: kn,
1838
- toCenter: En,
1839
- unselectNode: hn,
1840
- unselectNodes: fn
1841
- }, Symbol.toStringTag, { value: "Module" })), jn = function(e) {
1879
+ cancelFocus: Bn,
1880
+ clearSelection: kn,
1881
+ disableEdit: Mn,
1882
+ enableEdit: Ln,
1883
+ expandNode: Vn,
1884
+ expandNodeAll: Yn,
1885
+ focusNode: Hn,
1886
+ getData: An,
1887
+ getDataString: Tn,
1888
+ initLeft: Rn,
1889
+ initRight: Fn,
1890
+ initSide: In,
1891
+ install: $n,
1892
+ move: jn,
1893
+ refresh: Gn,
1894
+ scale: Dn,
1895
+ scaleFit: On,
1896
+ scrollIntoView: Cn,
1897
+ selectNode: Sn,
1898
+ selectNodes: Nn,
1899
+ setLocale: Wn,
1900
+ toCenter: Pn,
1901
+ unselectNodes: _n
1902
+ }, Symbol.toStringTag, { value: "Module" })), qn = function(e) {
1842
1903
  return {
1843
1904
  dom: e,
1844
1905
  moved: !1,
1845
- // diffrentiate click and move
1846
- mousedown: !1,
1847
- handleMouseMove(t) {
1848
- this.mousedown && (this.moved = !0, this.cb && this.cb(t.movementX, t.movementY));
1906
+ // differentiate click and move
1907
+ pointerdown: !1,
1908
+ lastX: 0,
1909
+ lastY: 0,
1910
+ handlePointerMove(t) {
1911
+ if (this.pointerdown) {
1912
+ this.moved = !0;
1913
+ const n = t.clientX - this.lastX, o = t.clientY - this.lastY;
1914
+ this.lastX = t.clientX, this.lastY = t.clientY, this.cb && this.cb(n, o);
1915
+ }
1849
1916
  },
1850
- handleMouseDown(t) {
1851
- t.button === 0 && (this.mousedown = !0);
1917
+ handlePointerDown(t) {
1918
+ t.button === 0 && (this.pointerdown = !0, this.lastX = t.clientX, this.lastY = t.clientY, this.dom.setPointerCapture(t.pointerId));
1852
1919
  },
1853
1920
  handleClear(t) {
1854
- this.mousedown = !1;
1921
+ this.pointerdown = !1, t.pointerId !== void 0 && this.dom.releasePointerCapture(t.pointerId);
1855
1922
  },
1856
1923
  cb: null,
1857
1924
  init(t, n) {
1858
- this.cb = n, this.handleClear = this.handleClear.bind(this), this.handleMouseMove = this.handleMouseMove.bind(this), this.handleMouseDown = this.handleMouseDown.bind(this), t.addEventListener("mousemove", this.handleMouseMove), t.addEventListener("mouseleave", this.handleClear), t.addEventListener("mouseup", this.handleClear), this.dom.addEventListener("mousedown", this.handleMouseDown);
1859
- },
1860
- destory(t) {
1861
- t.removeEventListener("mousemove", this.handleMouseMove), t.removeEventListener("mouseleave", this.handleClear), t.removeEventListener("mouseup", this.handleClear), this.dom.removeEventListener("mousedown", this.handleMouseDown);
1925
+ this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = ve([
1926
+ { dom: t, evt: "pointermove", func: this.handlePointerMove },
1927
+ { dom: t, evt: "pointerleave", func: this.handleClear },
1928
+ { dom: t, evt: "pointerup", func: this.handleClear },
1929
+ { dom: this.dom, evt: "pointerdown", func: this.handlePointerDown }
1930
+ ]);
1862
1931
  },
1932
+ destroy: null,
1863
1933
  clear() {
1864
- this.moved = !1, this.mousedown = !1;
1934
+ this.moved = !1, this.pointerdown = !1;
1865
1935
  }
1866
1936
  };
1867
- }, Oe = {
1868
- create: jn
1869
- };
1870
- function le(e, t, n) {
1871
- const { offsetLeft: o, offsetTop: s } = B(e.nodes, t), i = t.offsetWidth, r = t.offsetHeight, c = o + i / 2, l = s + r / 2, d = c + n.x, a = l + n.y;
1937
+ }, Re = {
1938
+ create: qn
1939
+ }, zn = "#4dc4ff";
1940
+ function st(e, t, n, o, i, s, r, c) {
1872
1941
  return {
1873
- w: i,
1942
+ x: e / 8 + n * 3 / 8 + i * 3 / 8 + r / 8,
1943
+ y: t / 8 + o * 3 / 8 + s * 3 / 8 + c / 8
1944
+ };
1945
+ }
1946
+ function Un(e, t, n) {
1947
+ S(e, {
1948
+ x: t + "",
1949
+ y: n + ""
1950
+ });
1951
+ }
1952
+ function Z(e, t, n, o, i) {
1953
+ S(e, {
1954
+ x1: t + "",
1955
+ y1: n + "",
1956
+ x2: o + "",
1957
+ y2: i + ""
1958
+ });
1959
+ }
1960
+ function Fe(e, t, n, o, i, s, r, c, u, a) {
1961
+ var d;
1962
+ if (e.line.setAttribute("d", `M ${t} ${n} C ${o} ${i} ${s} ${r} ${c} ${u}`), a.style) {
1963
+ const l = a.style;
1964
+ l.stroke && e.line.setAttribute("stroke", l.stroke), l.strokeWidth && e.line.setAttribute("stroke-width", String(l.strokeWidth)), l.strokeDasharray && e.line.setAttribute("stroke-dasharray", l.strokeDasharray), l.strokeLinecap && e.line.setAttribute("stroke-linecap", l.strokeLinecap), l.opacity !== void 0 && e.line.setAttribute("opacity", String(l.opacity));
1965
+ }
1966
+ const f = oe(s, r, c, u);
1967
+ if (f && (e.arrow1.setAttribute("d", `M ${f.x1} ${f.y1} L ${c} ${u} L ${f.x2} ${f.y2}`), a.style)) {
1968
+ const l = a.style;
1969
+ l.stroke && e.arrow1.setAttribute("stroke", l.stroke), l.strokeWidth && e.arrow1.setAttribute("stroke-width", String(l.strokeWidth)), l.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", l.strokeLinecap), l.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(l.opacity));
1970
+ }
1971
+ if (a.bidirectional) {
1972
+ const l = oe(o, i, t, n);
1973
+ if (l && (e.arrow2.setAttribute("d", `M ${l.x1} ${l.y1} L ${t} ${n} L ${l.x2} ${l.y2}`), a.style)) {
1974
+ const p = a.style;
1975
+ p.stroke && e.arrow2.setAttribute("stroke", p.stroke), p.strokeWidth && e.arrow2.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(p.opacity));
1976
+ }
1977
+ }
1978
+ const { x: h, y: g } = st(t, n, o, i, s, r, c, u);
1979
+ Un(e.label, h, g), (d = a.style) != null && d.labelColor && e.label.setAttribute("fill", a.style.labelColor), io(e);
1980
+ }
1981
+ function re(e, t, n) {
1982
+ const { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = t.offsetWidth, r = t.offsetHeight, c = o + s / 2, u = i + r / 2, a = c + n.x, f = u + n.y;
1983
+ return {
1984
+ w: s,
1874
1985
  h: r,
1875
1986
  cx: c,
1876
- cy: l,
1877
- ctrlX: d,
1878
- ctrlY: a
1987
+ cy: u,
1988
+ ctrlX: a,
1989
+ ctrlY: f
1879
1990
  };
1880
1991
  }
1881
- function W(e) {
1992
+ function G(e) {
1882
1993
  let t, n;
1883
1994
  const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
1884
1995
  return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
@@ -1886,32 +1997,32 @@ function W(e) {
1886
1997
  y: n
1887
1998
  };
1888
1999
  }
1889
- const Dn = function(e, t, n, o) {
1890
- const s = document.createElementNS("http://www.w3.org/2000/svg", "text");
1891
- return S(s, {
2000
+ const Xn = function(e, t, n, o) {
2001
+ const i = document.createElementNS(k, "text");
2002
+ return S(i, {
1892
2003
  "text-anchor": "middle",
1893
2004
  x: t + "",
1894
2005
  y: n + "",
1895
- fill: o || "#666"
1896
- }), s.dataset.type = "custom-link", s.innerHTML = e, s;
1897
- }, xe = function(e, t, n, o, s) {
2006
+ fill: o || "rgb(235, 95, 82)"
2007
+ }), i.dataset.type = "custom-link", i.innerHTML = e, i;
2008
+ }, xe = function(e, t, n, o, i) {
2009
+ var x;
1898
2010
  if (!t || !n)
1899
2011
  return;
1900
- performance.now();
1901
- const i = le(e, t, o.delta1), r = le(e, n, o.delta2), { x: c, y: l } = W(i), { ctrlX: d, ctrlY: a } = i, { ctrlX: u, ctrlY: h } = r, { x: p, y: g } = W(r), v = re(u, h, p, g);
1902
- if (!v)
2012
+ const s = re(e, t, o.delta1), r = re(e, n, o.delta2), { x: c, y: u } = G(s), { ctrlX: a, ctrlY: f } = s, { ctrlX: h, ctrlY: g } = r, { x: d, y: l } = G(r), p = oe(h, g, d, l);
2013
+ if (!p)
1903
2014
  return;
1904
- const m = `M ${v.x1} ${v.y1} L ${p} ${g} L ${v.x2} ${v.y2}`;
1905
- let f = "";
2015
+ const m = `M ${p.x1} ${p.y1} L ${d} ${l} L ${p.x2} ${p.y2}`;
2016
+ let v = "";
1906
2017
  if (o.bidirectional) {
1907
- const w = re(d, a, c, l);
1908
- if (!w)
2018
+ const C = oe(a, f, c, u);
2019
+ if (!C)
1909
2020
  return;
1910
- f = `M ${w.x1} ${w.y1} L ${c} ${l} L ${w.x2} ${w.y2}`;
2021
+ v = `M ${C.x1} ${C.y1} L ${c} ${u} L ${C.x2} ${C.y2}`;
1911
2022
  }
1912
- const y = mt(`M ${c} ${l} C ${d} ${a} ${u} ${h} ${p} ${g}`, m, f), x = c / 8 + d * 3 / 8 + u * 3 / 8 + p / 8, N = l / 8 + a * 3 / 8 + h * 3 / 8 + g / 8, b = Dn(o.label, x, N, e.theme.cssVar["--color"]);
1913
- y.appendChild(b), y.label = b, y.arrowObj = o, y.dataset.linkid = o.id, e.linkSvgGroup.appendChild(y), s || (e.arrows.push(o), e.currentArrow = y, et(e, o, i, r)), performance.now();
1914
- }, On = function(e, t, n = {}) {
2023
+ const b = kt(`M ${c} ${u} C ${a} ${f} ${h} ${g} ${d} ${l}`, m, v, o.style), { x: y, y: E } = st(c, u, a, f, h, g, d, l), N = (x = o.style) == null ? void 0 : x.labelColor, w = Xn(o.label, y, E, N);
2024
+ b.appendChild(w), b.label = w, b.arrowObj = o, b.dataset.linkid = o.id, e.linkSvgGroup.appendChild(b), i || (e.arrows.push(o), e.currentArrow = b, rt(e, o, s, r));
2025
+ }, Jn = function(e, t, n = {}) {
1915
2026
  const o = {
1916
2027
  id: V(),
1917
2028
  label: "Custom Link",
@@ -1931,17 +2042,17 @@ const Dn = function(e, t, n, o) {
1931
2042
  name: "createArrow",
1932
2043
  obj: o
1933
2044
  });
1934
- }, Hn = function(e) {
2045
+ }, Zn = function(e) {
1935
2046
  const t = { ...e, id: V() };
1936
- xe(this, E(t.from), E(t.to), t), this.bus.fire("operation", {
2047
+ xe(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
1937
2048
  name: "createArrow",
1938
2049
  obj: t
1939
2050
  });
1940
- }, Pn = function(e) {
2051
+ }, Qn = function(e) {
1941
2052
  let t;
1942
2053
  if (e ? t = e : t = this.currentArrow, !t)
1943
2054
  return;
1944
- we(this);
2055
+ Ee(this);
1945
2056
  const n = t.arrowObj.id;
1946
2057
  this.arrows = this.arrows.filter((o) => o.id !== n), t.remove(), this.bus.fire("operation", {
1947
2058
  name: "removeArrow",
@@ -1949,146 +2060,139 @@ const Dn = function(e, t, n, o) {
1949
2060
  id: n
1950
2061
  }
1951
2062
  });
1952
- }, Bn = function(e) {
2063
+ }, eo = function(e) {
1953
2064
  this.currentArrow = e;
1954
- const t = e.arrowObj, n = E(t.from), o = E(t.to), s = le(this, n, t.delta1), i = le(this, o, t.delta2);
1955
- et(this, t, s, i);
1956
- }, Rn = function() {
1957
- this.currentArrow = null, we(this);
1958
- }, we = function(e) {
2065
+ const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), i = re(this, n, t.delta1), s = re(this, o, t.delta2);
2066
+ rt(this, t, i, s);
2067
+ }, to = function() {
2068
+ Ee(this), this.currentArrow = null;
2069
+ }, le = function(e, t) {
2070
+ const n = document.createElementNS(k, "path");
2071
+ return S(n, {
2072
+ d: e,
2073
+ stroke: t,
2074
+ fill: "none",
2075
+ "stroke-width": "6",
2076
+ "stroke-linecap": "round",
2077
+ "stroke-linejoin": "round"
2078
+ }), n;
2079
+ }, no = function(e, t) {
2080
+ const n = document.createElementNS(k, "g");
2081
+ n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
2082
+ const o = le(e.line.getAttribute("d"), t);
2083
+ n.appendChild(o);
2084
+ const i = le(e.arrow1.getAttribute("d"), t);
2085
+ if (n.appendChild(i), e.arrow2.getAttribute("d")) {
2086
+ const s = le(e.arrow2.getAttribute("d"), t);
2087
+ n.appendChild(s);
2088
+ }
2089
+ e.insertBefore(n, e.firstChild);
2090
+ }, oo = function(e) {
2091
+ const t = e.querySelector(".arrow-highlight");
2092
+ t && t.remove();
2093
+ }, io = function(e) {
2094
+ const t = e.querySelector(".arrow-highlight");
2095
+ if (!t)
2096
+ return;
2097
+ const n = t.querySelectorAll("path");
2098
+ n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
2099
+ }, Ee = function(e) {
1959
2100
  var t, n;
1960
- (t = e.helper1) == null || t.destory(e.map), (n = e.helper2) == null || n.destory(e.map), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none";
1961
- }, et = function(e, t, n, o) {
1962
- e.linkController.style.display = "initial", e.P2.style.display = "initial", e.P3.style.display = "initial", e.nodes.appendChild(e.linkController), e.nodes.appendChild(e.P2), e.nodes.appendChild(e.P3);
1963
- let { x: s, y: i } = W(n), { ctrlX: r, ctrlY: c } = n, { ctrlX: l, ctrlY: d } = o, { x: a, y: u } = W(o);
1964
- e.P2.style.cssText = `top:${c}px;left:${r}px;`, e.P3.style.cssText = `top:${d}px;left:${l}px;`, S(e.line1, {
1965
- x1: s + "",
1966
- y1: i + "",
1967
- x2: r + "",
1968
- y2: c + ""
1969
- }), S(e.line2, {
1970
- x1: l + "",
1971
- y1: d + "",
1972
- x2: a + "",
1973
- y2: u + ""
1974
- }), e.helper1 = Oe.create(e.P2), e.helper2 = Oe.create(e.P3), e.helper1.init(e.map, (h, p) => {
1975
- if (!e.currentArrow)
1976
- return;
1977
- r = r + h / e.scaleVal, c = c + p / e.scaleVal;
1978
- const g = W({ ...n, ctrlX: r, ctrlY: c });
1979
- s = g.x, i = g.y;
1980
- const v = s / 8 + r * 3 / 8 + l * 3 / 8 + a / 8, m = i / 8 + c * 3 / 8 + d * 3 / 8 + u / 8;
1981
- if (e.P2.style.top = c + "px", e.P2.style.left = r + "px", e.currentArrow.line.setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${d} ${a} ${u}`), t.bidirectional) {
1982
- const f = re(r, c, s, i);
1983
- if (!f)
1984
- return;
1985
- e.currentArrow.arrow2.setAttribute("d", `M ${f.x1} ${f.y1} L ${s} ${i} L ${f.x2} ${f.y2}`);
1986
- }
1987
- S(e.currentArrow.label, {
1988
- x: v + "",
1989
- y: m + ""
1990
- }), S(e.line1, {
1991
- x1: s + "",
1992
- y1: i + "",
1993
- x2: r + "",
1994
- y2: c + ""
1995
- }), t.delta1.x = r - n.cx, t.delta1.y = c - n.cy, e.bus.fire("updateArrowDelta", t);
1996
- }), e.helper2.init(e.map, (h, p) => {
1997
- if (!e.currentArrow)
1998
- return;
1999
- l = l + h / e.scaleVal, d = d + p / e.scaleVal;
2000
- const g = W({ ...o, ctrlX: l, ctrlY: d });
2001
- a = g.x, u = g.y;
2002
- const v = s / 8 + r * 3 / 8 + l * 3 / 8 + a / 8, m = i / 8 + c * 3 / 8 + d * 3 / 8 + u / 8, f = re(l, d, a, u);
2003
- f && (e.P3.style.top = d + "px", e.P3.style.left = l + "px", e.currentArrow.line.setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${d} ${a} ${u}`), e.currentArrow.arrow1.setAttribute("d", `M ${f.x1} ${f.y1} L ${a} ${u} L ${f.x2} ${f.y2}`), S(e.currentArrow.label, {
2004
- x: v + "",
2005
- y: m + ""
2006
- }), S(e.line2, {
2007
- x1: l + "",
2008
- y1: d + "",
2009
- x2: a + "",
2010
- y2: u + ""
2011
- }), t.delta2.x = l - o.cx, t.delta2.y = d - o.cy, e.bus.fire("updateArrowDelta", t));
2101
+ (t = e.helper1) == null || t.destroy(), (n = e.helper2) == null || n.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && oo(e.currentArrow);
2102
+ }, rt = function(e, t, n, o) {
2103
+ const { linkController: i, P2: s, P3: r, line1: c, line2: u, nodes: a, map: f, currentArrow: h, bus: g } = e;
2104
+ if (!h)
2105
+ return;
2106
+ i.style.display = "initial", s.style.display = "initial", r.style.display = "initial", a.appendChild(i), a.appendChild(s), a.appendChild(r), no(h, zn);
2107
+ let { x: d, y: l } = G(n), { ctrlX: p, ctrlY: m } = n, { ctrlX: v, ctrlY: b } = o, { x: y, y: E } = G(o);
2108
+ s.style.cssText = `top:${m}px;left:${p}px;`, r.style.cssText = `top:${b}px;left:${v}px;`, Z(c, d, l, p, m), Z(u, v, b, y, E), e.helper1 = Re.create(s), e.helper2 = Re.create(r), e.helper1.init(f, (N, w) => {
2109
+ p = p + N / e.scaleVal, m = m + w / e.scaleVal;
2110
+ const x = G({ ...n, ctrlX: p, ctrlY: m });
2111
+ d = x.x, l = x.y, s.style.top = m + "px", s.style.left = p + "px", Fe(h, d, l, p, m, v, b, y, E, t), Z(c, d, l, p, m), t.delta1.x = p - n.cx, t.delta1.y = m - n.cy, g.fire("updateArrowDelta", t);
2112
+ }), e.helper2.init(f, (N, w) => {
2113
+ v = v + N / e.scaleVal, b = b + w / e.scaleVal;
2114
+ const x = G({ ...o, ctrlX: v, ctrlY: b });
2115
+ y = x.x, E = x.y, r.style.top = b + "px", r.style.left = v + "px", Fe(h, d, l, p, m, v, b, y, E, t), Z(u, v, b, y, E), t.delta2.x = v - o.cx, t.delta2.y = b - o.cy, g.fire("updateArrowDelta", t);
2012
2116
  });
2013
2117
  };
2014
- function zn() {
2118
+ function so() {
2015
2119
  this.linkSvgGroup.innerHTML = "";
2016
2120
  for (let e = 0; e < this.arrows.length; e++) {
2017
2121
  const t = this.arrows[e];
2018
2122
  try {
2019
- xe(this, E(t.from), E(t.to), t, !0);
2123
+ xe(this, this.findEle(t.from), this.findEle(t.to), t, !0);
2020
2124
  } catch {
2021
2125
  }
2022
2126
  }
2023
2127
  this.nodes.appendChild(this.linkSvgGroup);
2024
2128
  }
2025
- function Fn(e) {
2026
- if (we(this), !e)
2129
+ function ro(e) {
2130
+ if (Ee(this), !e)
2027
2131
  return;
2028
2132
  const t = e.label;
2029
- Ie(this, t, e.arrowObj);
2133
+ ze(this, t, e.arrowObj);
2030
2134
  }
2031
- function qn() {
2032
- this.arrows = this.arrows.filter((e) => ie(e.from, this.nodeData) && ie(e.to, this.nodeData));
2135
+ function co() {
2136
+ this.arrows = this.arrows.filter((e) => ne(e.from, this.nodeData) && ne(e.to, this.nodeData));
2033
2137
  }
2034
- const Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2138
+ const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2035
2139
  __proto__: null,
2036
- createArrow: On,
2037
- createArrowFrom: Hn,
2038
- editArrowLabel: Fn,
2039
- removeArrow: Pn,
2040
- renderArrow: zn,
2041
- selectArrow: Bn,
2042
- tidyArrow: qn,
2043
- unselectArrow: Rn
2044
- }, Symbol.toStringTag, { value: "Module" })), In = function(e) {
2045
- var l, d;
2140
+ createArrow: Jn,
2141
+ createArrowFrom: Zn,
2142
+ editArrowLabel: ro,
2143
+ removeArrow: Qn,
2144
+ renderArrow: so,
2145
+ selectArrow: eo,
2146
+ tidyArrow: co,
2147
+ unselectArrow: to
2148
+ }, Symbol.toStringTag, { value: "Module" })), ao = function(e) {
2149
+ var u, a;
2046
2150
  if (e.length === 0)
2047
2151
  throw new Error("No selected node.");
2048
2152
  if (e.length === 1) {
2049
- const a = e[0].nodeObj, u = e[0].nodeObj.parent;
2050
- if (!u)
2153
+ const f = e[0].nodeObj, h = e[0].nodeObj.parent;
2154
+ if (!h)
2051
2155
  throw new Error("Can not select root node.");
2052
- const h = u.children.findIndex((p) => a === p);
2156
+ const g = h.children.findIndex((d) => f === d);
2053
2157
  return {
2054
- parent: u.id,
2055
- start: h,
2056
- end: h
2158
+ parent: h.id,
2159
+ start: g,
2160
+ end: g
2057
2161
  };
2058
2162
  }
2059
2163
  let t = 0;
2060
- const n = e.map((a) => {
2061
- let u = a.nodeObj;
2062
- const h = [];
2063
- for (; u.parent; ) {
2064
- const p = u.parent, g = p.children, v = g == null ? void 0 : g.indexOf(u);
2065
- u = p, h.unshift({ node: u, index: v });
2164
+ const n = e.map((f) => {
2165
+ let h = f.nodeObj;
2166
+ const g = [];
2167
+ for (; h.parent; ) {
2168
+ const d = h.parent, l = d.children, p = l == null ? void 0 : l.indexOf(h);
2169
+ h = d, g.unshift({ node: h, index: p });
2066
2170
  }
2067
- return h.length > t && (t = h.length), h;
2171
+ return g.length > t && (t = g.length), g;
2068
2172
  });
2069
2173
  let o = 0;
2070
2174
  e:
2071
2175
  for (; o < t; o++) {
2072
- const a = (l = n[0][o]) == null ? void 0 : l.node;
2073
- for (let u = 1; u < n.length; u++)
2074
- if (((d = n[u][o]) == null ? void 0 : d.node) !== a)
2176
+ const f = (u = n[0][o]) == null ? void 0 : u.node;
2177
+ for (let h = 1; h < n.length; h++)
2178
+ if (((a = n[h][o]) == null ? void 0 : a.node) !== f)
2075
2179
  break e;
2076
2180
  }
2077
2181
  if (!o)
2078
2182
  throw new Error("Can not select root node.");
2079
- const s = n.map((a) => a[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0, c = n[0][o - 1].node;
2183
+ const i = n.map((f) => f[o - 1].index).sort(), s = i[0] || 0, r = i[i.length - 1] || 0, c = n[0][o - 1].node;
2080
2184
  if (!c.parent)
2081
2185
  throw new Error("Please select nodes in the same main topic.");
2082
2186
  return {
2083
2187
  parent: c.id,
2084
- start: i,
2188
+ start: s,
2085
2189
  end: r
2086
2190
  };
2087
- }, Kn = function(e) {
2088
- const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
2191
+ }, ho = function(e) {
2192
+ const t = document.createElementNS(k, "g");
2089
2193
  return t.setAttribute("id", e), t;
2090
- }, He = function(e, t) {
2091
- const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
2194
+ }, Ie = function(e, t) {
2195
+ const n = document.createElementNS(k, "path");
2092
2196
  return S(n, {
2093
2197
  d: e,
2094
2198
  stroke: t || "#666",
@@ -2096,58 +2200,58 @@ const Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2096
2200
  "stroke-linecap": "round",
2097
2201
  "stroke-width": "2"
2098
2202
  }), n;
2099
- }, Pe = function(e, t, n, o, s) {
2100
- const i = document.createElementNS("http://www.w3.org/2000/svg", "text");
2101
- return S(i, {
2203
+ }, We = function(e, t, n, o, i) {
2204
+ const s = document.createElementNS(k, "text");
2205
+ return S(s, {
2102
2206
  "text-anchor": o,
2103
2207
  x: t + "",
2104
2208
  y: n + "",
2105
- fill: s || "#666"
2106
- }), i.innerHTML = e, i;
2107
- }, Wn = (e) => E(e).parentElement.parentElement, Yn = function({ parent: e, start: t }) {
2108
- const n = E(e), o = n.nodeObj;
2209
+ fill: i || "#666"
2210
+ }), s.innerHTML = e, s;
2211
+ }, uo = (e) => e.parentElement.parentElement, fo = function(e, { parent: t, start: n }) {
2212
+ const o = e.findEle(t), i = o.nodeObj;
2109
2213
  let s;
2110
- return o.parent ? s = n.closest("me-main").className : s = E(o.children[t].id).closest("me-main").className, s;
2111
- }, Ee = function(e, t) {
2112
- var w;
2113
- const { id: n, label: o, parent: s, start: i, end: r } = t, c = e.nodes, d = E(s).nodeObj, a = Yn(t);
2114
- let u = 1 / 0, h = 0, p = 0, g = 0;
2115
- for (let _ = i; _ <= r; _++) {
2116
- const L = (w = d.children) == null ? void 0 : w[_];
2117
- if (!L)
2214
+ return i.parent ? s = o.closest("me-main").className : s = e.findEle(i.children[n].id).closest("me-main").className, s;
2215
+ }, Ce = function(e, t) {
2216
+ var C;
2217
+ const { id: n, label: o, parent: i, start: s, end: r } = t, { nodes: c, theme: u, summarySvg: a } = e, h = e.findEle(i).nodeObj, g = fo(e, t);
2218
+ let d = 1 / 0, l = 0, p = 0, m = 0;
2219
+ for (let _ = s; _ <= r; _++) {
2220
+ const O = (C = h.children) == null ? void 0 : C[_];
2221
+ if (!O)
2118
2222
  return e.removeSummary(n), null;
2119
- const $ = Wn(L.id), { offsetLeft: R, offsetTop: X } = B(c, $), Ne = i === r ? 10 : 20;
2120
- _ === i && (p = X + Ne), _ === r && (g = X + $.offsetHeight - Ne), R < u && (u = R), $.offsetWidth + R > h && (h = $.offsetWidth + R);
2121
- }
2122
- let v, m;
2123
- const f = p + 10, y = g + 10, x = (f + y) / 2, N = e.theme.cssVar["--color"];
2124
- a === M.LHS ? (v = He(`M ${u + 10} ${f} c -5 0 -10 5 -10 10 L ${u} ${y - 10} c 0 5 5 10 10 10 M ${u} ${x} h -10`, N), m = Pe(o, u - 20, x + 6, "end", N)) : (v = He(`M ${h - 10} ${f} c 5 0 10 5 10 10 L ${h} ${y - 10} c 0 5 -5 10 -10 10 M ${h} ${x} h 10`, N), m = Pe(o, h + 20, x + 6, "start", N));
2125
- const b = Kn("s-" + n);
2126
- return b.appendChild(v), b.appendChild(m), b.summaryObj = t, e.summarySvg.appendChild(b), b;
2127
- }, Un = function() {
2128
- let e = [];
2129
- this.currentNode ? e = [this.currentNode] : this.currentNodes && (e = this.currentNodes);
2130
- const { parent: t, start: n, end: o } = In(e), s = { id: V(), parent: t, start: n, end: o, label: "summary" }, i = Ee(this, s);
2131
- this.summaries.push(s), this.editSummary(i), this.bus.fire("operation", {
2223
+ const B = uo(e.findEle(O.id)), { offsetLeft: R, offsetTop: Se } = H(c, B), Ne = s === r ? 10 : 20;
2224
+ _ === s && (p = Se + Ne), _ === r && (m = Se + B.offsetHeight - Ne), R < d && (d = R), B.offsetWidth + R > l && (l = B.offsetWidth + R);
2225
+ }
2226
+ let v, b;
2227
+ const y = p + 10, E = m + 10, N = (y + E) / 2, w = u.cssVar["--color"];
2228
+ g === M.LHS ? (v = Ie(`M ${d + 10} ${y} c -5 0 -10 5 -10 10 L ${d} ${E - 10} c 0 5 5 10 10 10 M ${d} ${N} h -10`, w), b = We(o, d - 20, N + 6, "end", w)) : (v = Ie(`M ${l - 10} ${y} c 5 0 10 5 10 10 L ${l} ${E - 10} c 0 5 -5 10 -10 10 M ${l} ${N} h 10`, w), b = We(o, l + 20, N + 6, "start", w));
2229
+ const x = ho("s-" + n);
2230
+ return x.appendChild(v), x.appendChild(b), x.summaryObj = t, a.appendChild(x), x;
2231
+ }, po = function() {
2232
+ if (!this.currentNodes)
2233
+ return;
2234
+ const { currentNodes: e, summaries: t, bus: n } = this, { parent: o, start: i, end: s } = ao(e), r = { id: V(), parent: o, start: i, end: s, label: "summary" }, c = Ce(this, r);
2235
+ t.push(r), this.editSummary(c), n.fire("operation", {
2132
2236
  name: "createSummary",
2133
- obj: s
2237
+ obj: r
2134
2238
  });
2135
- }, Xn = function(e) {
2239
+ }, go = function(e) {
2136
2240
  const t = V(), n = { ...e, id: t };
2137
- Ee(this, n), this.summaries.push(n), this.bus.fire("operation", {
2241
+ Ce(this, n), this.summaries.push(n), this.bus.fire("operation", {
2138
2242
  name: "createSummary",
2139
2243
  obj: n
2140
2244
  });
2141
- }, Gn = function(e) {
2245
+ }, mo = function(e) {
2142
2246
  var n;
2143
2247
  const t = this.summaries.findIndex((o) => o.id === e);
2144
2248
  t > -1 && (this.summaries.splice(t, 1), (n = document.querySelector("#s-" + e)) == null || n.remove()), this.bus.fire("operation", {
2145
2249
  name: "removeSummary",
2146
2250
  obj: { id: e }
2147
2251
  });
2148
- }, Jn = function(e) {
2149
- const t = e.children[1].getBBox(), n = 6, o = 3, s = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2150
- S(s, {
2252
+ }, vo = function(e) {
2253
+ const t = e.children[1].getBBox(), n = 6, o = 3, i = document.createElementNS(k, "rect");
2254
+ S(i, {
2151
2255
  x: t.x - n + "",
2152
2256
  y: t.y - n + "",
2153
2257
  width: t.width + n * 2 + "",
@@ -2156,33 +2260,33 @@ const Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2156
2260
  stroke: this.theme.cssVar["--selected"] || "#4dc4ff",
2157
2261
  "stroke-width": "2",
2158
2262
  fill: "none"
2159
- }), e.appendChild(s), this.currentSummary = e;
2160
- }, Zn = function() {
2263
+ }), e.appendChild(i), this.currentSummary = e;
2264
+ }, bo = function() {
2161
2265
  var e, t;
2162
2266
  (t = (e = this.currentSummary) == null ? void 0 : e.querySelector("rect")) == null || t.remove(), this.currentSummary = null;
2163
- }, Qn = function() {
2267
+ }, yo = function() {
2164
2268
  this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
2165
2269
  try {
2166
- Ee(this, e);
2270
+ Ce(this, e);
2167
2271
  } catch {
2168
2272
  }
2169
2273
  }), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
2170
- }, eo = function(e) {
2274
+ }, wo = function(e) {
2171
2275
  if (!e)
2172
2276
  return;
2173
2277
  const t = e.childNodes[1];
2174
- Ie(this, t, e.summaryObj);
2175
- }, to = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2278
+ ze(this, t, e.summaryObj);
2279
+ }, xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2176
2280
  __proto__: null,
2177
- createSummary: Un,
2178
- createSummaryFrom: Xn,
2179
- editSummary: eo,
2180
- removeSummary: Gn,
2181
- renderSummary: Qn,
2182
- selectSummary: Jn,
2183
- unselectSummary: Zn
2281
+ createSummary: po,
2282
+ createSummaryFrom: go,
2283
+ editSummary: wo,
2284
+ removeSummary: mo,
2285
+ renderSummary: yo,
2286
+ selectSummary: vo,
2287
+ unselectSummary: bo
2184
2288
  }, Symbol.toStringTag, { value: "Module" })), T = "http://www.w3.org/2000/svg";
2185
- function no(e, t) {
2289
+ function Eo(e, t) {
2186
2290
  const n = document.createElementNS(T, "svg");
2187
2291
  return S(n, {
2188
2292
  version: "1.1",
@@ -2191,32 +2295,32 @@ function no(e, t) {
2191
2295
  width: t
2192
2296
  }), n;
2193
2297
  }
2194
- function oo(e, t) {
2298
+ function Co(e, t) {
2195
2299
  return (parseInt(e) - parseInt(t)) / 2;
2196
2300
  }
2197
- function so(e, t, n, o) {
2198
- const s = document.createElementNS(T, "g");
2199
- let i = "";
2200
- return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
2201
- `).forEach((c, l) => {
2202
- const d = document.createElementNS(T, "text");
2203
- S(d, {
2301
+ function So(e, t, n, o) {
2302
+ const i = document.createElementNS(T, "g");
2303
+ let s = "";
2304
+ return e.text ? s = e.text.textContent : s = e.childNodes[0].textContent, s.split(`
2305
+ `).forEach((c, u) => {
2306
+ const a = document.createElementNS(T, "text");
2307
+ S(a, {
2204
2308
  x: n + parseInt(t.paddingLeft) + "",
2205
- y: o + parseInt(t.paddingTop) + oo(t.lineHeight, t.fontSize) * (l + 1) + parseFloat(t.fontSize) * (l + 1) + "",
2309
+ y: o + parseInt(t.paddingTop) + Co(t.lineHeight, t.fontSize) * (u + 1) + parseFloat(t.fontSize) * (u + 1) + "",
2206
2310
  "text-anchor": "start",
2207
2311
  "font-family": t.fontFamily,
2208
2312
  "font-size": `${t.fontSize}`,
2209
2313
  "font-weight": `${t.fontWeight}`,
2210
2314
  fill: `${t.color}`
2211
- }), d.innerHTML = c, s.appendChild(d);
2212
- }), s;
2315
+ }), a.innerHTML = c, i.appendChild(a);
2316
+ }), i;
2213
2317
  }
2214
- function io(e, t, n, o) {
2318
+ function No(e, t, n, o) {
2215
2319
  var c;
2216
- let s = "";
2217
- (c = e.nodeObj) != null && c.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
2218
- const i = document.createElementNS(T, "foreignObject");
2219
- S(i, {
2320
+ let i = "";
2321
+ (c = e.nodeObj) != null && c.dangerouslySetInnerHTML ? i = e.nodeObj.dangerouslySetInnerHTML : e.text ? i = e.text.textContent : i = e.childNodes[0].textContent;
2322
+ const s = document.createElementNS(T, "foreignObject");
2323
+ S(s, {
2220
2324
  x: n + parseInt(t.paddingLeft) + "",
2221
2325
  y: o + parseInt(t.paddingTop) + "",
2222
2326
  width: t.width,
@@ -2226,13 +2330,13 @@ function io(e, t, n, o) {
2226
2330
  return S(r, {
2227
2331
  xmlns: "http://www.w3.org/1999/xhtml",
2228
2332
  style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
2229
- }), r.innerHTML = s, i.appendChild(r), i;
2333
+ }), r.innerHTML = i, s.appendChild(r), s;
2230
2334
  }
2231
- function ro(e, t) {
2232
- const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = B(e.nodes, t), i = document.createElementNS(T, "rect");
2233
- return S(i, {
2335
+ function _o(e, t) {
2336
+ const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(T, "rect");
2337
+ return S(s, {
2234
2338
  x: o + "",
2235
- y: s + "",
2339
+ y: i + "",
2236
2340
  rx: n.borderRadius,
2237
2341
  ry: n.borderRadius,
2238
2342
  width: n.width,
@@ -2240,13 +2344,13 @@ function ro(e, t) {
2240
2344
  fill: n.backgroundColor,
2241
2345
  stroke: n.borderColor,
2242
2346
  "stroke-width": n.borderWidth
2243
- }), i;
2347
+ }), s;
2244
2348
  }
2245
- function ne(e, t, n = !1) {
2246
- const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = B(e.nodes, t), r = document.createElementNS(T, "rect");
2349
+ function Q(e, t, n = !1) {
2350
+ const o = getComputedStyle(t), { offsetLeft: i, offsetTop: s } = H(e.nodes, t), r = document.createElementNS(T, "rect");
2247
2351
  S(r, {
2248
- x: s + "",
2249
- y: i + "",
2352
+ x: i + "",
2353
+ y: s + "",
2250
2354
  rx: o.borderRadius,
2251
2355
  ry: o.borderRadius,
2252
2356
  width: o.width,
@@ -2257,212 +2361,212 @@ function ne(e, t, n = !1) {
2257
2361
  });
2258
2362
  const c = document.createElementNS(T, "g");
2259
2363
  c.appendChild(r);
2260
- let l;
2261
- return n ? l = io(t, o, s, i) : l = so(t, o, s, i), c.appendChild(l), c;
2364
+ let u;
2365
+ return n ? u = No(t, o, i, s) : u = So(t, o, i, s), c.appendChild(u), c;
2262
2366
  }
2263
- function co(e, t) {
2264
- const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = B(e.nodes, t), i = document.createElementNS(T, "a"), r = document.createElementNS(T, "text");
2367
+ function ko(e, t) {
2368
+ const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(T, "a"), r = document.createElementNS(T, "text");
2265
2369
  return S(r, {
2266
2370
  x: o + "",
2267
- y: s + parseInt(n.fontSize) + "",
2371
+ y: i + parseInt(n.fontSize) + "",
2268
2372
  "text-anchor": "start",
2269
2373
  "font-family": n.fontFamily,
2270
2374
  "font-size": `${n.fontSize}`,
2271
2375
  "font-weight": `${n.fontWeight}`,
2272
2376
  fill: `${n.color}`
2273
- }), r.innerHTML = t.textContent, i.appendChild(r), i.setAttribute("href", t.href), i;
2377
+ }), r.innerHTML = t.textContent, s.appendChild(r), s.setAttribute("href", t.href), s;
2274
2378
  }
2275
- function lo(e, t) {
2276
- const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = B(e.nodes, t), i = document.createElementNS(T, "image");
2277
- return S(i, {
2379
+ function To(e, t) {
2380
+ const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(T, "image");
2381
+ return S(s, {
2278
2382
  x: o + "",
2279
- y: s + "",
2383
+ y: i + "",
2280
2384
  width: n.width + "",
2281
2385
  height: n.height + "",
2282
2386
  href: t.src
2283
- }), i;
2387
+ }), s;
2284
2388
  }
2285
- const oe = 100, ao = '<?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">', ho = (e, t = !1) => {
2286
- var u, h, p;
2287
- const n = e.nodes, o = n.offsetHeight + oe * 2, s = n.offsetWidth + oe * 2, i = no(o + "px", s + "px"), r = document.createElementNS(T, "svg"), c = document.createElementNS(T, "rect");
2389
+ const ee = 100, Ao = '<?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">', Lo = (e, t = !1) => {
2390
+ var h, g, d;
2391
+ const n = e.nodes, o = n.offsetHeight + ee * 2, i = n.offsetWidth + ee * 2, s = Eo(o + "px", i + "px"), r = document.createElementNS(T, "svg"), c = document.createElementNS(T, "rect");
2288
2392
  S(c, {
2289
2393
  x: "0",
2290
2394
  y: "0",
2291
- width: `${s}`,
2395
+ width: `${i}`,
2292
2396
  height: `${o}`,
2293
2397
  fill: e.theme.cssVar["--bgcolor"]
2294
- }), i.appendChild(c), n.querySelectorAll(".subLines").forEach((g) => {
2295
- const v = g.cloneNode(!0), { offsetLeft: m, offsetTop: f } = B(n, g.parentElement);
2296
- v.setAttribute("x", `${m}`), v.setAttribute("y", `${f}`), r.appendChild(v);
2398
+ }), s.appendChild(c), n.querySelectorAll(".subLines").forEach((l) => {
2399
+ const p = l.cloneNode(!0), { offsetLeft: m, offsetTop: v } = H(n, l.parentElement);
2400
+ p.setAttribute("x", `${m}`), p.setAttribute("y", `${v}`), r.appendChild(p);
2297
2401
  });
2298
- const l = (u = n.querySelector(".lines")) == null ? void 0 : u.cloneNode(!0);
2299
- l && r.appendChild(l);
2300
- const d = (h = n.querySelector(".topiclinks")) == null ? void 0 : h.cloneNode(!0);
2301
- d && r.appendChild(d);
2302
- const a = (p = n.querySelector(".summary")) == null ? void 0 : p.cloneNode(!0);
2303
- return a && r.appendChild(a), n.querySelectorAll("me-tpc").forEach((g) => {
2304
- g.nodeObj.dangerouslySetInnerHTML ? r.appendChild(ne(e, g, !t)) : (r.appendChild(ro(e, g)), r.appendChild(ne(e, g.text, !t)));
2305
- }), n.querySelectorAll(".tags > span").forEach((g) => {
2306
- r.appendChild(ne(e, g));
2307
- }), n.querySelectorAll(".icons > span").forEach((g) => {
2308
- r.appendChild(ne(e, g));
2309
- }), n.querySelectorAll(".hyper-link").forEach((g) => {
2310
- r.appendChild(co(e, g));
2311
- }), n.querySelectorAll("img").forEach((g) => {
2312
- r.appendChild(lo(e, g));
2402
+ const u = (h = n.querySelector(".lines")) == null ? void 0 : h.cloneNode(!0);
2403
+ u && r.appendChild(u);
2404
+ const a = (g = n.querySelector(".topiclinks")) == null ? void 0 : g.cloneNode(!0);
2405
+ a && r.appendChild(a);
2406
+ const f = (d = n.querySelector(".summary")) == null ? void 0 : d.cloneNode(!0);
2407
+ return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((l) => {
2408
+ l.nodeObj.dangerouslySetInnerHTML ? r.appendChild(Q(e, l, !t)) : (r.appendChild(_o(e, l)), r.appendChild(Q(e, l.text, !t)));
2409
+ }), n.querySelectorAll(".tags > span").forEach((l) => {
2410
+ r.appendChild(Q(e, l));
2411
+ }), n.querySelectorAll(".icons > span").forEach((l) => {
2412
+ r.appendChild(Q(e, l));
2413
+ }), n.querySelectorAll(".hyper-link").forEach((l) => {
2414
+ r.appendChild(ko(e, l));
2415
+ }), n.querySelectorAll("img").forEach((l) => {
2416
+ r.appendChild(To(e, l));
2313
2417
  }), S(r, {
2314
- x: oe + "",
2315
- y: oe + "",
2418
+ x: ee + "",
2419
+ y: ee + "",
2316
2420
  overflow: "visible"
2317
- }), i.appendChild(r), i;
2318
- }, uo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), ao + e.outerHTML);
2319
- function fo(e) {
2421
+ }), s.appendChild(r), s;
2422
+ }, Mo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Ao + e.outerHTML);
2423
+ function Do(e) {
2320
2424
  return new Promise((t, n) => {
2321
2425
  const o = new FileReader();
2322
- o.onload = (s) => {
2323
- t(s.target.result);
2324
- }, o.onerror = (s) => {
2325
- n(s);
2426
+ o.onload = (i) => {
2427
+ t(i.target.result);
2428
+ }, o.onerror = (i) => {
2429
+ n(i);
2326
2430
  }, o.readAsDataURL(e);
2327
2431
  });
2328
2432
  }
2329
- const po = function(e = !1, t) {
2330
- const n = ho(this, e), o = uo(n, t);
2433
+ const Oo = function(e = !1, t) {
2434
+ const n = Lo(this, e), o = Mo(n, t);
2331
2435
  return new Blob([o], { type: "image/svg+xml" });
2332
- }, mo = async function(e = !1, t) {
2333
- const n = this.exportSvg(e, t), o = await fo(n);
2334
- return new Promise((s, i) => {
2436
+ }, jo = async function(e = !1, t) {
2437
+ const n = this.exportSvg(e, t), o = await Do(n);
2438
+ return new Promise((i, s) => {
2335
2439
  const r = new Image();
2336
2440
  r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
2337
2441
  const c = document.createElement("canvas");
2338
- c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(s, "image/png", 1);
2339
- }, r.src = o, r.onerror = i;
2442
+ c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(i, "image/png", 1);
2443
+ }, r.src = o, r.onerror = s;
2340
2444
  });
2341
- }, go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2445
+ }, Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2342
2446
  __proto__: null,
2343
- exportPng: mo,
2344
- exportSvg: po
2447
+ exportPng: jo,
2448
+ exportSvg: Oo
2345
2449
  }, Symbol.toStringTag, { value: "Module" }));
2346
- function vo(e, t) {
2450
+ function $o(e, t) {
2347
2451
  return async function(...n) {
2348
2452
  const o = this.before[t];
2349
2453
  o && !await o.apply(this, n) || e.apply(this, n);
2350
2454
  };
2351
2455
  }
2352
- const Be = Object.keys(Qe), tt = {};
2353
- for (let e = 0; e < Be.length; e++) {
2354
- const t = Be[e];
2355
- tt[t] = vo(Qe[t], t);
2456
+ const Ve = Object.keys(ot), ct = {};
2457
+ for (let e = 0; e < Ve.length; e++) {
2458
+ const t = Ve[e];
2459
+ ct[t] = $o(ot[t], t);
2356
2460
  }
2357
- const yo = {
2358
- getObjById: ie,
2359
- generateNewObj: st,
2360
- layout: ct,
2361
- linkDiv: gt,
2362
- editTopic: pt,
2363
- createWrapper: dt,
2364
- createParent: ht,
2365
- createChildren: ut,
2366
- createTopic: ft,
2367
- findEle: E,
2368
- changeTheme: Ft,
2369
- ...$n,
2370
- ...tt,
2371
- ...Vn,
2372
- ...to,
2373
- ...go,
2461
+ const Ho = {
2462
+ getObjById: ne,
2463
+ generateNewObj: dt,
2464
+ layout: yt,
2465
+ linkDiv: Tt,
2466
+ editTopic: _t,
2467
+ createWrapper: Et,
2468
+ createParent: Ct,
2469
+ createChildren: St,
2470
+ createTopic: Nt,
2471
+ findEle: Ge,
2472
+ changeTheme: en,
2473
+ ...Kn,
2474
+ ...ct,
2475
+ ...lo,
2476
+ ...xo,
2477
+ ...Po,
2374
2478
  init(e) {
2375
2479
  if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData)
2376
2480
  return new Error("MindElixir: `data` is required");
2377
- e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, P(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && $t(this), this.keypress && Nt(this), this.editable && zt(this), this.contextMenu && this.disposable.push(vt(this, this.contextMenuOption)), this.draggable && Mt(this), this.allowUndo && kt(this), this.toCenter(), this.layout(), this.linkDiv();
2481
+ e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, $(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Kt(this), this.keypress && mt(this, this.keypress), this.editable && Qt(this), this.contextMenu && this.disposable.push(At(this, this.contextMenu)), this.draggable && this.disposable.push(Ot(this)), this.allowUndo && this.disposable.push(Pt(this)), this.layout(), this.linkDiv(), this.toCenter();
2378
2482
  },
2379
2483
  destroy() {
2380
2484
  var e;
2381
- this.disposable.forEach((t) => t()), this.mindElixirBox && (this.mindElixirBox.innerHTML = ""), this.mindElixirBox = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNode = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, (e = this.selection) == null || e.destroy(), this.selection = void 0;
2485
+ this.disposable.forEach((t) => t()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, (e = this.selection) == null || e.destroy(), this.selection = void 0;
2382
2486
  }
2383
2487
  };
2384
- function bo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, containerHeight: d }) {
2385
- let a = t + n / 2;
2386
- const u = e + o / 2;
2387
- let h;
2388
- l === M.LHS ? h = i + r : h = i;
2389
- const p = s + c / 2, v = (1 - Math.abs(p - u) / d) * 0.25 * (n / 2);
2390
- return l === M.LHS ? a = a - n / 10 - v : a = a + n / 10 + v, `M ${a} ${u} Q ${a} ${p} ${h} ${p}`;
2488
+ function Bo({ pT: e, pL: t, pW: n, pH: o, cT: i, cL: s, cW: r, cH: c, direction: u, containerHeight: a }) {
2489
+ let f = t + n / 2;
2490
+ const h = e + o / 2;
2491
+ let g;
2492
+ u === M.LHS ? g = s + r : g = s;
2493
+ const d = i + c / 2, p = (1 - Math.abs(d - h) / a) * 0.25 * (n / 2);
2494
+ return u === M.LHS ? f = f - n / 10 - p : f = f + n / 10 + p, `M ${f} ${h} Q ${f} ${d} ${g} ${d}`;
2391
2495
  }
2392
- function xo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, isFirst: d }) {
2393
- const a = parseInt(this.container.style.getPropertyValue("--gap"));
2394
- let u = 0, h = 0;
2395
- d ? u = e + o / 2 : u = e + o;
2396
- const p = s + c;
2397
- let g = 0, v = 0, m = 0;
2398
- const f = Math.abs(u - p) / 300 * a;
2399
- return l === M.LHS ? (m = t, g = m + a, v = m - a, h = i + a, `M ${g} ${u} C ${m} ${u} ${m + f} ${p} ${v} ${p} H ${h}`) : (m = t + n, g = m - a, v = m + a, h = i + r - a, `M ${g} ${u} C ${m} ${u} ${m - f} ${p} ${v} ${p} H ${h}`);
2496
+ function Ro({ pT: e, pL: t, pW: n, pH: o, cT: i, cL: s, cW: r, cH: c, direction: u, isFirst: a }) {
2497
+ const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
2498
+ let h = 0, g = 0;
2499
+ a ? h = e + o / 2 : h = e + o;
2500
+ const d = i + c;
2501
+ let l = 0, p = 0, m = 0;
2502
+ const v = Math.abs(h - d) / 300 * f;
2503
+ return u === M.LHS ? (m = t, l = m + f, p = m - f, g = s + f, `M ${l} ${h} C ${m} ${h} ${m + v} ${d} ${p} ${d} H ${g}`) : (m = t + n, l = m - f, p = m + f, g = s + r - f, `M ${l} ${h} C ${m} ${h} ${m - v} ${d} ${p} ${d} H ${g}`);
2400
2504
  }
2401
- const wo = "5.0.0-beta.9";
2402
- function Eo(e) {
2505
+ const Fo = "5.0.1";
2506
+ function Io(e) {
2403
2507
  return {
2404
2508
  x: 0,
2405
2509
  y: 0,
2406
2510
  moved: !1,
2407
2511
  // diffrentiate click and move
2408
2512
  mousedown: !1,
2409
- onMove(t) {
2410
- if (this.mousedown) {
2411
- this.moved = !0;
2412
- const n = t.movementX, o = t.movementY;
2413
- e.move(n, o);
2414
- }
2513
+ onMove(t, n) {
2514
+ this.mousedown && (this.moved = !0, e.move(t, n));
2415
2515
  },
2416
2516
  clear() {
2417
- setTimeout(() => {
2418
- this.moved = !1, this.mousedown = !1, e.map.style.transition = "transform 0.3s";
2419
- }, 0);
2517
+ this.mousedown = !1, e.map.style.transition = "transform 0.3s";
2420
2518
  }
2421
2519
  };
2422
2520
  }
2423
- const J = document;
2424
- function j({
2521
+ const z = document;
2522
+ function D({
2425
2523
  el: e,
2426
2524
  direction: t,
2427
2525
  locale: n,
2428
2526
  draggable: o,
2429
- editable: s,
2430
- contextMenu: i,
2431
- contextMenuOption: r,
2432
- toolBar: c,
2433
- keypress: l,
2434
- mouseSelectionButton: d,
2527
+ editable: i,
2528
+ contextMenu: s,
2529
+ toolBar: r,
2530
+ keypress: c,
2531
+ mouseSelectionButton: u,
2435
2532
  selectionContainer: a,
2436
- before: u,
2533
+ before: f,
2437
2534
  newTopicName: h,
2438
- allowUndo: p,
2439
- generateMainBranch: g,
2440
- generateSubBranch: v,
2441
- overflowHidden: m,
2442
- theme: f,
2443
- alignment: y
2535
+ allowUndo: g,
2536
+ generateMainBranch: d,
2537
+ generateSubBranch: l,
2538
+ overflowHidden: p,
2539
+ theme: m,
2540
+ alignment: v,
2541
+ scaleSensitivity: b
2444
2542
  }) {
2445
- let x = null;
2446
- const N = Object.prototype.toString.call(e);
2447
- if (N === "[object HTMLDivElement]" ? x = e : N === "[object String]" && (x = document.querySelector(e)), !x)
2543
+ let y = null;
2544
+ const E = Object.prototype.toString.call(e);
2545
+ if (E === "[object HTMLDivElement]" ? y = e : E === "[object String]" && (y = document.querySelector(e)), !y)
2448
2546
  throw new Error("MindElixir: el is not a valid element");
2449
- x.style.position = "relative", x.innerHTML = "", this.mindElixirBox = x, this.disposable = [], this.before = u || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = c === void 0 ? !0 : c, this.keypress = l === void 0 ? !0 : l, this.mouseSelectionButton = d || 0, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName = h || "new node", this.editable = s === void 0 ? !0 : s, this.allowUndo = p === void 0 ? !1 : p, this.currentNode = null, this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = g || bo, this.generateSubBranch = v || xo, this.overflowHidden = m || !1, this.dragMoveHelper = Eo(this), this.bus = rt(), this.container = J.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
2450
- const b = window.matchMedia("(prefers-color-scheme: dark)");
2451
- this.theme = f || (b.matches ? ze : Re);
2452
- const w = J.createElement("div");
2547
+ y.style.position = "relative", y.innerHTML = "", this.el = y, this.disposable = [], this.before = f || {}, this.locale = n || "en", this.contextMenu = s === void 0 ? !0 : s, this.toolBar = r === void 0 ? !0 : r, this.keypress = c === void 0 ? !0 : c, this.mouseSelectionButton = u || 0, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName = h || "new node", this.editable = i === void 0 ? !0 : i, this.allowUndo = g === void 0 ? !1 : g, this.scaleSensitivity = typeof b == "number" ? b : 0.2, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = d || Bo, this.generateSubBranch = l || Ro, this.overflowHidden = p || !1, this.dragMoveHelper = Io(this), this.bus = bt(), this.container = z.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
2548
+ const N = window.matchMedia("(prefers-color-scheme: dark)");
2549
+ this.theme = m || (N.matches ? pe : fe);
2550
+ const w = z.createElement("div");
2453
2551
  w.className = "map-canvas", setTimeout(() => {
2454
2552
  w.style.transition = "all 0.3s";
2455
- }, 300), this.map = w, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = J.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = Z("lines"), this.summarySvg = Z("summary"), this.linkController = Z("linkcontroller"), this.P2 = J.createElement("div"), this.P3 = J.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Ce(), this.line2 = Ce(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = Z("topiclinks"), this.alignment = y ?? "root", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : it(this);
2553
+ }, 300), this.map = w, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = z.createElement("me-nodes"), this.lines = U("lines"), this.summarySvg = U("summary"), this.linkController = U("linkcontroller"), this.P2 = z.createElement("div"), this.P3 = z.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Te(), this.line2 = Te(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = U("topiclinks"), this.alignment = v ?? "root", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(vt(this));
2456
2554
  }
2457
- j.prototype = yo;
2458
- j.LEFT = A;
2459
- j.RIGHT = H;
2460
- j.SIDE = ae;
2461
- j.THEME = Re;
2462
- j.DARK_THEME = ze;
2463
- j.version = wo;
2464
- j.E = E;
2465
- j.new = (e) => ({
2555
+ D.prototype = Ho;
2556
+ Object.defineProperty(D.prototype, "currentNode", {
2557
+ get() {
2558
+ return this.currentNodes[this.currentNodes.length - 1];
2559
+ },
2560
+ enumerable: !0
2561
+ });
2562
+ D.LEFT = 0;
2563
+ D.RIGHT = 1;
2564
+ D.SIDE = 2;
2565
+ D.THEME = fe;
2566
+ D.DARK_THEME = pe;
2567
+ D.version = Fo;
2568
+ D.E = Ge;
2569
+ D.new = (e) => ({
2466
2570
  nodeData: {
2467
2571
  id: V(),
2468
2572
  topic: e || "new topic",
@@ -2470,5 +2574,5 @@ j.new = (e) => ({
2470
2574
  }
2471
2575
  });
2472
2576
  export {
2473
- j as default
2577
+ D as default
2474
2578
  };