From e0b7e0ce3234ee3558a23024666128d3c4fbde40 Mon Sep 17 00:00:00 2001 From: Gk0Wk Date: Sat, 14 Oct 2023 01:45:05 +0800 Subject: [PATCH] try fix [#10] [#11] [#13] --- 1.json | 260 -------------- 1.opml | 87 ----- 2.json | 62 ---- 2.opml | 17 - package.json | 2 +- src/drawio/base64.min.js | 7 - src/drawio/base64.min.js.meta | 5 - src/drawio/edit-drawio.ts | 38 +- src/drawio/plugin.info | 2 +- src/focused-tiddler/hook.ts | 2 +- src/mindmap-elixir/mind-elixir.min.js | 8 +- src/mindmap-elixir/mind-elixir.min.js.meta | 1 + src/mindmap-elixir/widget.ts | 389 +++++++++++---------- src/sidebar-resizer/hook.ts | 8 +- src/sidebar-resizer/plugin.info | 2 +- 15 files changed, 236 insertions(+), 654 deletions(-) delete mode 100644 1.json delete mode 100644 1.opml delete mode 100644 2.json delete mode 100644 2.opml delete mode 100644 src/drawio/base64.min.js delete mode 100644 src/drawio/base64.min.js.meta diff --git a/1.json b/1.json deleted file mode 100644 index 1e541c3..0000000 --- a/1.json +++ /dev/null @@ -1,260 +0,0 @@ -{ - "opml": { - "version": "2.0", - "head": { - "title": "States", - "dateCreated": "Tue, 15 Mar 2005 16:35:45 GMT", - "flPublic": "true", - "urlPublic": "http://drummer.scripting.com/davewiner/states.opml", - "urlJson": "http://drummer.scripting.com/davewiner/states.json", - "ownerTwitterScreenName": "davewiner", - "ownerName": "Dave Winer", - "ownerId": "http://twitter.com/davewiner", - "urlUpdateSocket": "ws://drummer.scripting.com:1232/", - "dateModified": "Sat, 03 Jul 2021 15:19:39 GMT", - "expansionState": "1,4", - "lastCursor": "5", - "generator": "opmlPackage v0.5.1" - }, - "body": { - "subs": [ - { - "text": "United States", - "created": "Tue, 15 Mar 2005 16:35:45 GMT", - "subs": [ - { - "text": "Far West", - "created": "Tue, 15 Mar 2005 16:35:45 GMT", - "subs": [ - { - "text": "Alaska", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "California", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Hawaii", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Nevada", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Oregon", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Washington", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - } - ] - }, - { - "text": "Great Plains", - "created": "Tue, 15 Mar 2005 16:35:45 GMT", - "subs": [ - { - "text": "Kansas", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Nebraska", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "North Dakota", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Oklahoma", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "South Dakota", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - } - ] - }, - { - "text": "Mid-Atlantic", - "created": "Tue, 15 Mar 2005 16:35:45 GMT", - "subs": [ - { - "text": "Delaware", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Maryland", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "New Jersey", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "New York", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Pennsylvania", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - } - ] - }, - { - "text": "Midwest", - "created": "Tue, 15 Mar 2005 16:35:45 GMT", - "subs": [ - { - "text": "Illinois", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Indiana", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { "text": "Iowa", "created": "Tue, 15 Mar 2005 16:35:45 GMT" }, - { - "text": "Kentucky", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Michigan", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Minnesota", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Missouri", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { "text": "Ohio", "created": "Tue, 15 Mar 2005 16:35:45 GMT" }, - { - "text": "West Virginia", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Wisconsin", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - } - ] - }, - { - "text": "Mountains", - "created": "Tue, 15 Mar 2005 16:35:45 GMT", - "subs": [ - { - "text": "Colorado", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { "text": "Idaho", "created": "Tue, 15 Mar 2005 16:35:45 GMT" }, - { - "text": "Montana", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { "text": "Utah", "created": "Tue, 15 Mar 2005 16:35:45 GMT" }, - { - "text": "Wyoming", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - } - ] - }, - { - "text": "New England", - "created": "Tue, 15 Mar 2005 16:35:45 GMT", - "subs": [ - { - "text": "Connecticut", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { "text": "Maine", "created": "Tue, 15 Mar 2005 16:35:45 GMT" }, - { - "text": "Massachusetts", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "New Hampshire", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Rhode Island", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Vermont", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - } - ] - }, - { - "text": "South", - "created": "Tue, 15 Mar 2005 16:35:45 GMT", - "subs": [ - { - "text": "Alabama", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Arkansas", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Florida", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Georgia", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Louisiana", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Mississippi", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "North Carolina", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "South Carolina", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Tennessee", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "Virginia", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - } - ] - }, - { - "text": "Southwest", - "created": "Tue, 15 Mar 2005 16:35:45 GMT", - "subs": [ - { - "text": "Arizona", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { - "text": "New Mexico", - "created": "Tue, 15 Mar 2005 16:35:45 GMT" - }, - { "text": "Texas", "created": "Tue, 15 Mar 2005 16:35:45 GMT" } - ] - } - ] - } - ] - } - } -} diff --git a/1.opml b/1.opml deleted file mode 100644 index 1460654..0000000 --- a/1.opml +++ /dev/null @@ -1,87 +0,0 @@ - - - - States - Tue, 15 Mar 2005 16:35:45 GMT - true - http://drummer.scripting.com/davewiner/states.opml - http://drummer.scripting.com/davewiner/states.json - davewiner - Dave Winer - http://twitter.com/davewiner - ws://drummer.scripting.com:1232/ - Sat, 03 Jul 2021 15:19:39 GMT - 1,4 - 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/2.json b/2.json deleted file mode 100644 index ee7b7bd..0000000 --- a/2.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "opml": { - "version": "2.0", - "head": { "title": "aaaaa", "generator": "opmlPackage v0.5.1" }, - "body": { - "subs": [ - { - "text": "123", - "_mubu_text": "%3Cspan%3E123%3C/span%3E", - "_note": "asdksajflkasd", - "_mubu_note": "%3Cspan%3Easdksajflkasd%3C/span%3E", - "_mubu_images": "%5B%7B%22id%22%3A%22VOLJT0My5K%22%2C%22uri%22%3A%22document_image%2F8f9f449c-f304-46d6-9550-0367e0203cd2-3600499.jpg%22%2C%22ow%22%3A460%2C%22oh%22%3A460%2C%22w%22%3A400%7D%5D", - "subs": [ - { - "text": "123", - "_mubu_text": "%3Cspan%20class=%22bold%22%3E123%3C/span%3E", - "_note": "", - "_mubu_note": "" - }, - { - "text": "dsa", - "_mubu_text": "%3Cspan%20class=%22%20text-color-red%22%3Edsa%3C/span%3E", - "_note": "", - "_mubu_note": "" - }, - { - "text": "sss", - "_mubu_text": "%3Cspan%20class=%22italic%22%3Esss%3C/span%3E", - "_note": "", - "_mubu_note": "" - }, - { - "text": "aaaaaa", - "_mubu_text": "%3Cspan%20class=%22underline%22%3Eaaaaaa%3C/span%3E", - "_note": "", - "_mubu_note": "" - }, - { - "text": "asdasfas", - "_mubu_text": "%3Ca%20class=%22content-link%22%20data-id=%22YnuUkwKNzu%22%20target=%22_blank%22%20spellcheck=%22false%22%20rel=%22noreferrer%22%20href=%22http://newnan.city%22%3E%3Cspan%20class=%22content-link-text%22%3Easdasfas%3C/span%3E%3C/a%3E", - "_note": "", - "_mubu_note": "" - }, - { - "text": "sss", - "_mubu_text": "%3Cspan%3Esss%3C/span%3E", - "_note": "", - "_mubu_note": "", - "_heading": "3" - }, - { - "text": "aaaaa", - "_mubu_text": "%3Cspan%3Eaaaaa%3C/span%3E", - "_note": "", - "_mubu_note": "" - } - ] - } - ] - } - } -} diff --git a/2.opml b/2.opml deleted file mode 100644 index e464ae2..0000000 --- a/2.opml +++ /dev/null @@ -1,17 +0,0 @@ - - - - aaaaa - - - - - - - - - - - - - \ No newline at end of file diff --git a/package.json b/package.json index ed4f98d..b4b1706 100755 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "@mind-elixir/export-xmind": "^2.0.1", "file-saver": "^2.0.5", "jszip": "^3.10.1", - "mind-elixir": "^3.1.4", + "mind-elixir": "^3.2.6", "mind-elixir-ts": "^1.1.11", "npm-check-updates": "^16.14.4", "opml": "^0.5.2", diff --git a/src/drawio/base64.min.js b/src/drawio/base64.min.js deleted file mode 100644 index 7e6fa06..0000000 --- a/src/drawio/base64.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Minified by jsDelivr using Terser v5.15.1. - * Original file: /npm/js-base64@3.7.5/base64.js - * - * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files - */ -!function(t,n){var r,e;"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(r=t.Base64,(e=n()).noConflict=function(){return t.Base64=r,e},t.Meteor&&(Base64=e),t.Base64=e)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this,(function(){"use strict";var t,n="3.7.5",r="function"==typeof atob,e="function"==typeof btoa,o="function"==typeof Buffer,u="function"==typeof TextDecoder?new TextDecoder:void 0,i="function"==typeof TextEncoder?new TextEncoder:void 0,f=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),c=(t={},f.forEach((function(n,r){return t[n]=r})),t),a=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,d=String.fromCharCode.bind(String),s="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){return new Uint8Array(Array.prototype.slice.call(t,0))},l=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},h=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},p=function(t){for(var n,r,e,o,u="",i=t.length%3,c=0;c255||(e=t.charCodeAt(c++))>255||(o=t.charCodeAt(c++))>255)throw new TypeError("invalid character found");u+=f[(n=r<<16|e<<8|o)>>18&63]+f[n>>12&63]+f[n>>6&63]+f[63&n]}return i?u.slice(0,i-3)+"===".substring(i):u},y=e?function(t){return btoa(t)}:o?function(t){return Buffer.from(t,"binary").toString("base64")}:p,A=o?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var n=[],r=0,e=t.length;r>>6)+d(128|63&n):d(224|n>>>12&15)+d(128|n>>>6&63)+d(128|63&n);var n=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return d(240|n>>>18&7)+d(128|n>>>12&63)+d(128|n>>>6&63)+d(128|63&n)},B=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,x=function(t){return t.replace(B,g)},C=o?function(t){return Buffer.from(t,"utf8").toString("base64")}:i?function(t){return A(i.encode(t))}:function(t){return y(x(t))},m=function(t,n){return void 0===n&&(n=!1),n?l(C(t)):C(t)},v=function(t){return m(t,!0)},U=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,F=function(t){switch(t.length){case 4:var n=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return d(55296+(n>>>10))+d(56320+(1023&n));case 3:return d((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return d((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},w=function(t){return t.replace(U,F)},S=function(t){if(t=t.replace(/\s+/g,""),!a.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var n,r,e,o="",u=0;u>16&255):64===e?d(n>>16&255,n>>8&255):d(n>>16&255,n>>8&255,255&n);return o},E=r?function(t){return atob(h(t))}:o?function(t){return Buffer.from(t,"base64").toString("binary")}:S,D=o?function(t){return s(Buffer.from(t,"base64"))}:function(t){return s(E(t).split("").map((function(t){return t.charCodeAt(0)})))},R=function(t){return D(T(t))},z=o?function(t){return Buffer.from(t,"base64").toString("utf8")}:u?function(t){return u.decode(D(t))}:function(t){return w(E(t))},T=function(t){return h(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},Z=function(t){return z(T(t))},j=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},I=function(){var t=function(t,n){return Object.defineProperty(String.prototype,t,j(n))};t("fromBase64",(function(){return Z(this)})),t("toBase64",(function(t){return m(this,t)})),t("toBase64URI",(function(){return m(this,!0)})),t("toBase64URL",(function(){return m(this,!0)})),t("toUint8Array",(function(){return R(this)}))},O=function(){var t=function(t,n){return Object.defineProperty(Uint8Array.prototype,t,j(n))};t("toBase64",(function(t){return b(this,t)})),t("toBase64URI",(function(){return b(this,!0)})),t("toBase64URL",(function(){return b(this,!0)}))},P={version:n,VERSION:"3.7.5",atob:E,atobPolyfill:S,btoa:y,btoaPolyfill:p,fromBase64:Z,toBase64:m,encode:m,encodeURI:v,encodeURL:v,utob:x,btou:w,decode:Z,isValid:function(t){if("string"!=typeof t)return!1;var n=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(n)||!/[^\s0-9a-zA-Z\-_]/.test(n)},fromUint8Array:b,toUint8Array:R,extendString:I,extendUint8Array:O,extendBuiltins:function(){I(),O()},Base64:{}};return Object.keys(P).forEach((function(t){return P.Base64[t]=P[t]})),P})); diff --git a/src/drawio/base64.min.js.meta b/src/drawio/base64.min.js.meta deleted file mode 100644 index 18ebb2e..0000000 --- a/src/drawio/base64.min.js.meta +++ /dev/null @@ -1,5 +0,0 @@ -title: $:/plugins/Gk0Wk/drawio/base64.min.js -type: application/javascript -source: https://www.npmjs.com/package/js-base64 -module-type: library -Modern.TiddlyDev#Minify: false diff --git a/src/drawio/edit-drawio.ts b/src/drawio/edit-drawio.ts index 495df63..dcb6713 100644 --- a/src/drawio/edit-drawio.ts +++ b/src/drawio/edit-drawio.ts @@ -2,13 +2,14 @@ import type { Widget } from 'tiddlywiki'; const { editTextWidgetFactory } = require('$:/core/modules/editor/factory.js'); const { SimpleEngine } = require('$:/core/modules/editor/engines/simple.js'); -const { decode } = require('$:/plugins/Gk0Wk/drawio/base64.min.js'); $tw.utils.registerFileType('application/x-drawio', 'utf8', '.drawio', { flags: ['image'], + deserializerType: 'image/svg+xml', }); $tw.utils.registerFileType('application/vnd.drawio', 'utf8', '.drawio', { flags: ['image'], + deserializerType: 'image/svg+xml', }); const checkIfDarkMode = () => @@ -77,20 +78,18 @@ class DrawIOEditor { // SSR 模式下不渲染 if (!$tw.browser) { - parentNode.insertBefore( - $tw.utils.domMaker('div', { - document: widget.document, - class: 'gk0wk-drawio-preview', - style: { - margin: '0', - border: 'none', - width: '100%', - height: '100%', - }, - innerHTML: value, - }), - nextSibling, - ); + const node = $tw.utils.domMaker('div', { + document: widget.document, + class: 'gk0wk-drawio-preview', + style: { + margin: '0', + border: 'none', + width: '100%', + height: '100%', + }, + innerHTML: value, + }); + parentNode.insertBefore(node, nextSibling); this.xml = ''; this.unmount = () => null; return; @@ -147,7 +146,10 @@ class DrawIOEditor { ) { return; } - const { event, ...payload } = JSON.parse(data); + const { event, ...payload } = $tw.utils.parseJSONSafe( + data, + () => ({}), + ) as any; switch (event) { case 'init': { if (hasInited) { @@ -196,7 +198,9 @@ class DrawIOEditor { case 'export': { const { message, data } = payload; if (data && message.twEditor) { - const newXml = decode(data.split(',', 2)[1]); + const newXml = ($tw.utils as any).base64Decode( + data.split(',', 2)[1], + ); if (newXml === this.xml) { return; } diff --git a/src/drawio/plugin.info b/src/drawio/plugin.info index 5256dbd..af3939b 100644 --- a/src/drawio/plugin.info +++ b/src/drawio/plugin.info @@ -4,6 +4,6 @@ "author": "Gk0Wk", "description": "draw.io powerful diagram editor for TiddlyWiki", "plugin-type": "plugin", - "version": "0.0.5", + "version": "0.0.6", "list": "readme config LICENSE" } diff --git a/src/focused-tiddler/hook.ts b/src/focused-tiddler/hook.ts index b5512d7..256a13c 100644 --- a/src/focused-tiddler/hook.ts +++ b/src/focused-tiddler/hook.ts @@ -52,7 +52,7 @@ const update = (dom: Element | null) => { export const name = 'gk0wk-focused-tiddler'; export const platforms = ['browser']; -export const after = ['story']; +export const after = ['render']; export const synchronous = true; export const startup = () => { updateTopOffset(); diff --git a/src/mindmap-elixir/mind-elixir.min.js b/src/mindmap-elixir/mind-elixir.min.js index d1b979d..0e93bc8 100644 --- a/src/mindmap-elixir/mind-elixir.min.js +++ b/src/mindmap-elixir/mind-elixir.min.js @@ -1,7 +1,9 @@ /** - * Skipped minification because the original files appears to be already minified. - * Original file: /npm/mind-elixir@2.0.2/dist/MindElixir.js + * Minified by jsDelivr using Terser v5.19.2. + * Original file: /npm/mind-elixir@3.2.6/dist/MindElixir.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MindElixir=t():e.MindElixir=t()}(self,(()=>(()=>{var e={74:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var i=n(81),o=n.n(i),r=n(645),a=n.n(r),s=n(667),l=n.n(s),c=new URL(n(848),n.b),d=new URL(n(295),n.b),h=a()(o()),p=l()(c),m=l()(d);h.push([e.id,".mind-elixir {\n --gap: 30px;\n --root-radius: 30px;\n --main-radius: 20px;\n --root-color: #ffffff;\n --root-bgcolor: #4c4f69;\n --main-color: #444446;\n --main-bgcolor: #ffffff;\n --topic-padding: 3px;\n --color: #777777;\n --bgcolor: #f6f6f6;\n position: relative;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n}\n.mind-elixir .hyper-link {\n text-decoration: none;\n}\n.map-container {\n user-select: none;\n height: 100%;\n width: 100%;\n overflow: scroll;\n font-size: 15px;\n}\n.map-container::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n}\n.map-container .selected {\n box-shadow: 0 0 0 2px #4dc4ff;\n}\n.map-container .lhs {\n direction: rtl;\n}\n.map-container .lhs me-tpc {\n direction: ltr;\n}\n.map-container .map-canvas {\n height: 20000px;\n width: 20000px;\n position: relative;\n user-select: none;\n transition: all 0.3s;\n transform: scale(1);\n background-color: var(--bgcolor);\n}\n.map-container .map-canvas me-root {\n position: absolute;\n padding: 10px var(--gap);\n color: var(--root-color);\n background-color: var(--root-bgcolor);\n border-radius: var(--root-radius);\n}\n.map-container .map-canvas me-root me-tpc {\n display: block;\n font-size: 25px;\n white-space: pre-wrap;\n}\n.map-container .map-canvas me-root me-tpc #input-box {\n padding: 10px var(--gap);\n}\n.map-container .box > me-wrapper {\n position: absolute;\n}\n.map-container .box > me-wrapper > me-parent {\n margin: var(--gap);\n background-color: var(--main-bgcolor);\n border: 1px solid var(--main-color);\n border-radius: var(--main-radius);\n padding: 0;\n}\n.map-container .box > me-wrapper > me-parent > me-tpc {\n border-radius: var(--main-radius);\n color: var(--main-color);\n padding: 8px var(--gap);\n}\n.map-container .box > me-wrapper > me-parent > me-tpc #input-box {\n padding: 8px var(--gap);\n}\n.map-container me-wrapper {\n display: block;\n pointer-events: none;\n}\n.map-container me-children,\n.map-container me-parent {\n display: inline-block;\n vertical-align: middle;\n}\n.map-container me-parent {\n position: relative;\n cursor: pointer;\n padding: 6px var(--gap);\n margin-top: 10px;\n}\n.map-container me-parent me-tpc {\n position: relative;\n display: block;\n border-radius: 3px;\n color: var(--color);\n pointer-events: all;\n max-width: 800px;\n white-space: pre-wrap;\n padding: var(--topic-padding);\n line-height: 1.2;\n}\n.map-container me-parent me-tpc .tags {\n direction: ltr;\n}\n.map-container me-parent me-tpc .tags span {\n display: inline-block;\n border-radius: 3px;\n padding: 2px 4px;\n background: #d6f0f8;\n color: #276f86;\n margin: 0px;\n font-size: 12px;\n height: 16px;\n line-height: 16px;\n margin-right: 3px;\n margin-top: 2px;\n}\n.map-container me-parent me-tpc .icons {\n display: inline-block;\n direction: ltr;\n margin-right: 10px;\n}\n.map-container me-parent me-tpc .insert-preview {\n position: absolute;\n width: 100%;\n left: 0px;\n z-index: 9;\n}\n.map-container me-parent me-tpc .show {\n background: #7ad5ff;\n pointer-events: none;\n opacity: 0.7;\n}\n.map-container me-parent me-tpc .before {\n height: 14px;\n top: -14px;\n}\n.map-container me-parent me-tpc .in {\n height: 100%;\n top: 0px;\n}\n.map-container me-parent me-tpc .after {\n height: 14px;\n bottom: -14px;\n}\n.map-container me-parent me-epd {\n position: absolute;\n height: 18px;\n width: 18px;\n opacity: 0.8;\n background-image: url("+p+");\n background-repeat: no-repeat;\n background-size: contain;\n background-position: center;\n pointer-events: all;\n z-index: 9;\n}\n.map-container me-parent me-epd.minus {\n background-image: url("+m+") !important;\n transition: all 0.3s;\n opacity: 0;\n}\n.map-container me-parent me-epd.minus:hover {\n opacity: 0.8;\n}\n.map-container .icon {\n width: 1em;\n height: 1em;\n vertical-align: -0.15em;\n fill: currentColor;\n overflow: hidden;\n}\n.map-container .lines,\n.map-container .subLines,\n.map-container .topiclinks,\n.map-container .linkcontroller {\n position: absolute;\n height: 102%;\n width: 100%;\n top: 0;\n left: 0;\n}\n.map-container .topiclinks,\n.map-container .linkcontroller {\n pointer-events: none;\n}\n.map-container .topiclinks g,\n.map-container .linkcontroller g {\n pointer-events: all;\n}\n.map-container .lines,\n.map-container .subLines {\n pointer-events: none;\n z-index: -1;\n}\n.map-container .topiclinks *,\n.map-container .linkcontroller * {\n z-index: 100;\n}\n.map-container .topiclinks g {\n cursor: pointer;\n}\n.map-container #input-box {\n position: absolute;\n top: 0;\n left: 0;\n padding: var(--topic-padding);\n background-color: #fff;\n color: #666666;\n width: max-content;\n max-width: 800px;\n z-index: 11;\n direction: ltr;\n user-select: auto;\n}\n.map-container me-tpc > img {\n pointer-events: none;\n display: block;\n margin-top: 8px;\n}\n.map-container .circle {\n position: absolute;\n height: 10px;\n width: 10px;\n margin-top: -5px;\n margin-left: -5px;\n border-radius: 100%;\n background: #aaa;\n cursor: pointer;\n}\n",""]);const u=h},165:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(81),o=n.n(i),r=n(645),a=n.n(r)()(o());a.push([e.id,".mind-elixir .context-menu {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 99;\n}\n.mind-elixir .context-menu .menu-list {\n position: fixed;\n list-style: none;\n margin: 0;\n padding: 0;\n font: 300 15px 'Roboto', sans-serif;\n color: #333;\n box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.2);\n}\n.mind-elixir .context-menu .menu-list * {\n transition: color 0.4s, background-color 0.4s;\n}\n.mind-elixir .context-menu .menu-list li {\n min-width: 150px;\n overflow: hidden;\n white-space: nowrap;\n padding: 6px 10px;\n background-color: #fff;\n border-bottom: 1px solid #ecf0f1;\n}\n.mind-elixir .context-menu .menu-list li a {\n color: #333;\n text-decoration: none;\n}\n.mind-elixir .context-menu .menu-list li.disabled {\n color: #5e5e5e;\n background-color: #f7f7f7;\n}\n.mind-elixir .context-menu .menu-list li.disabled:hover {\n cursor: default;\n background-color: #f7f7f7;\n}\n.mind-elixir .context-menu .menu-list li:hover {\n cursor: pointer;\n background-color: #ecf0f1;\n}\n.mind-elixir .context-menu .menu-list li:first-child {\n border-radius: 5px 5px 0 0;\n}\n.mind-elixir .context-menu .menu-list li:last-child {\n border-bottom: 0;\n border-radius: 0 0 5px 5px;\n}\n.mind-elixir .context-menu .menu-list li span:last-child {\n float: right;\n}\n",""]);const s=a},787:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(81),o=n.n(i),r=n(645),a=n.n(r)()(o());a.push([e.id,".mind-elixir .mobile-menu {\n position: absolute;\n left: 20px;\n bottom: 70px;\n z-index: 99;\n margin: 0;\n padding: 0;\n color: #333;\n border-radius: 5px;\n box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.2);\n overflow: hidden;\n}\n.mind-elixir .mobile-menu * {\n transition: color 0.4s, background-color 0.4s;\n}\n.mind-elixir .mobile-menu div {\n float: left;\n text-align: center;\n width: 30px;\n overflow: hidden;\n white-space: nowrap;\n padding: 8px;\n background-color: #fff;\n border-bottom: 1px solid #ecf0f1;\n}\n.mind-elixir .mobile-menu div a {\n color: #333;\n text-decoration: none;\n}\n.mind-elixir .mobile-menu div.disabled {\n color: #5e5e5e;\n background-color: #f7f7f7;\n}\n.mind-elixir .mobile-menu div.disabled:hover {\n cursor: default;\n background-color: #f7f7f7;\n}\n.mind-elixir .mobile-menu div:hover {\n cursor: pointer;\n background-color: #ecf0f1;\n}\n",""]);const s=a},301:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(81),o=n.n(i),r=n(645),a=n.n(r)()(o());a.push([e.id,".mind-elixir-toolbar {\n position: absolute;\n background: #fff;\n padding: 10px;\n border-radius: 5px;\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2);\n}\n.mind-elixir-toolbar span:active {\n opacity: 0.5;\n}\n.mind-elixir-toolbar.rb {\n right: 20px;\n bottom: 20px;\n font-family: iconfont;\n}\n.mind-elixir-toolbar.rb span + span {\n margin-left: 10px;\n}\n.mind-elixir-toolbar.lt {\n font-size: 20px;\n left: 20px;\n top: 20px;\n width: 20px;\n}\n.mind-elixir-toolbar.lt span {\n display: block;\n}\n.mind-elixir-toolbar.lt span + span {\n margin-top: 10px;\n}\n",""]);const s=a},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,o,r){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(i)for(var s=0;s0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=r),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),o&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=o):d[4]="".concat(o)),t.push(d))}},t}},667:e=>{"use strict";e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},81:e=>{"use strict";e.exports=function(e){return e[1]}},379:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i{"use strict";var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},565:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},795:e=>{"use strict";e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,o&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},857:()=>{!function(e){var t,n,i,o,r,a,s='',l=(l=document.getElementsByTagName("script"))[l.length-1].getAttribute("data-injectcss");if(l&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(e){console}}function c(){r||(r=!0,i())}t=function(){var e,t,n,i;(i=document.createElement("div")).innerHTML=s,s=null,(n=i.getElementsByTagName("svg")[0])&&(n.setAttribute("aria-hidden","true"),n.style.position="absolute",n.style.width=0,n.style.height=0,n.style.overflow="hidden",e=n,(t=document.body).firstChild?(i=e,(n=t.firstChild).parentNode.insertBefore(i,n)):t.appendChild(e))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(n=function(){document.removeEventListener("DOMContentLoaded",n,!1),t()},document.addEventListener("DOMContentLoaded",n,!1)):document.attachEvent&&(i=t,o=e.document,r=!1,(a=function(){try{o.documentElement.doScroll("left")}catch(e){return void setTimeout(a,50)}c()})(),o.onreadystatechange=function(){"complete"==o.readyState&&(o.onreadystatechange=null,c())})}(window)},848:e=>{"use strict";e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdD0iMTY1NjY1NDcxNzI0MiIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+CiAgICA8cGF0aCBkPSJNNTEyIDc0LjY2NjY2N0MyNzAuOTMzMzMzIDc0LjY2NjY2NyA3NC42NjY2NjcgMjcwLjkzMzMzMyA3NC42NjY2NjcgNTEyUzI3MC45MzMzMzMgOTQ5LjMzMzMzMyA1MTIgOTQ5LjMzMzMzMyA5NDkuMzMzMzMzIDc1My4wNjY2NjcgOTQ5LjMzMzMzMyA1MTIgNzUzLjA2NjY2NyA3NC42NjY2NjcgNTEyIDc0LjY2NjY2N3oiIHN0cm9rZS13aWR0aD0iNTQiIHN0cm9rZT0nYmxhY2snIGZpbGw9J3doaXRlJyA+PC9wYXRoPgogICAgPHBhdGggZD0iTTY4Mi42NjY2NjcgNDgwaC0xMzguNjY2NjY3VjM0MS4zMzMzMzNjMC0xNy4wNjY2NjctMTQuOTMzMzMzLTMyLTMyLTMycy0zMiAxNC45MzMzMzMtMzIgMzJ2MTM4LjY2NjY2N0gzNDEuMzMzMzMzYy0xNy4wNjY2NjcgMC0zMiAxNC45MzMzMzMtMzIgMzJzMTQuOTMzMzMzIDMyIDMyIDMyaDEzOC42NjY2NjdWNjgyLjY2NjY2N2MwIDE3LjA2NjY2NyAxNC45MzMzMzMgMzIgMzIgMzJzMzItMTQuOTMzMzMzIDMyLTMydi0xMzguNjY2NjY3SDY4Mi42NjY2NjdjMTcuMDY2NjY3IDAgMzItMTQuOTMzMzMzIDMyLTMycy0xNC45MzMzMzMtMzItMzItMzJ6Ij48L3BhdGg+Cjwvc3ZnPg=="},295:e=>{"use strict";e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdD0iMTY1NjY1NTU2NDk4NSIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+CiAgICA8cGF0aCBkPSJNNTEyIDc0LjY2NjY2N0MyNzAuOTMzMzMzIDc0LjY2NjY2NyA3NC42NjY2NjcgMjcwLjkzMzMzMyA3NC42NjY2NjcgNTEyUzI3MC45MzMzMzMgOTQ5LjMzMzMzMyA1MTIgOTQ5LjMzMzMzMyA5NDkuMzMzMzMzIDc1My4wNjY2NjcgOTQ5LjMzMzMzMyA1MTIgNzUzLjA2NjY2NyA3NC42NjY2NjcgNTEyIDc0LjY2NjY2N3oiIHN0cm9rZS13aWR0aD0iNTQiIHN0cm9rZT0nYmxhY2snIGZpbGw9J3doaXRlJyA+PC9wYXRoPgogICAgPHBhdGggZD0iTTY4Mi42NjY2NjcgNTQ0SDM0MS4zMzMzMzNjLTE3LjA2NjY2NyAwLTMyLTE0LjkzMzMzMy0zMi0zMnMxNC45MzMzMzMtMzIgMzItMzJoMzQxLjMzMzMzNGMxNy4wNjY2NjcgMCAzMiAxNC45MzMzMzMgMzIgMzJzLTE0LjkzMzMzMyAzMi0zMiAzMnoiPjwvcGF0aD4KPC9zdmc+"}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={id:i,exports:{}};return e[i](r,r.exports,n),r.exports}n.m=e,n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.b=document.baseURI||self.location.href,n.nc=void 0;var i={};return(()=>{"use strict";n.d(i,{default:()=>ue});const e=30,t={name:"Latte",palette:["#dd7878","#ea76cb","#8839ef","#e64553","#fe640b","#df8e1d","#40a02b","#209fb5","#1e66f5","#7287fd"],cssVar:{"--main-color":"#444446","--main-bgcolor":"#ffffff","--color":"#777777","--bgcolor":"#f6f6f6"}};function o(e){return e.replace(/&/g,"&").replace(/{if(e.parent=t,e.children)for(let t=0;t{let n=Date.now();return function(...i){Date.now()-n>=t&&(e.apply(this,i),n=Date.now())}};function c(e,t,n,i){const o=i-t,r=e-n;let a=Math.atan(Math.abs(o)/Math.abs(r))/3.14*180;r<0&&o>0&&(a=180-a),r<0&&o<0&&(a=180+a),r>0&&o<0&&(a=360-a);const s=a+30,l=a-30;return{x1:n+20*Math.cos(Math.PI*s/180),y1:i-20*Math.sin(Math.PI*s/180),x2:n+20*Math.cos(Math.PI*l/180),y2:i-20*Math.sin(Math.PI*l/180)}}function d(e,t,n){let i,o;const r=(e.cy-n)/(t-e.cx);return r>e.h/e.w||r<-e.h/e.w?e.cy-n<0?(i=e.cx-e.h/2/r,o=e.cy+e.h/2):(i=e.cx+e.h/2/r,o=e.cy-e.h/2):e.cx-t<0?(i=e.cx+e.w/2,o=e.cy-e.w*r/2):(i=e.cx-e.w/2,o=e.cy+e.w*r/2),{x:i,y:o}}function h(e,t,n){let i,o;const r=(e.cy-n)/(t-e.cx);return r>e.h/e.w||r<-e.h/e.w?e.cy-n<0?(i=e.cx-e.h/2/r,o=e.cy+e.h/2):(i=e.cx+e.h/2/r,o=e.cy-e.h/2):e.cx-t<0?(i=e.cx+e.w/2,o=e.cy-e.w*r/2):(i=e.cx-e.w/2,o=e.cy+e.w*r/2),{x:i,y:o}}function p(){return((new Date).getTime().toString(16)+Math.random().toString(16).substr(2)).substr(2,16)}function m(e){const t=e.parent.children,n=t.indexOf(e);return t.splice(n,1),t.length}function u(e){return JSON.parse(JSON.stringify(e,((e,t)=>{if("parent"!==e)return t})))}const f=document,g=(e,t)=>(t?t.mindElixirBox:f).querySelector(`[data-nodeid=me${e}]`),b=function(e,t){if(e.textContent=t.topic,t.style&&(e.style.color=t.style.color||null,e.style.background=t.style.background||null,e.style.fontSize=t.style.fontSize+"px",e.style.fontWeight=t.style.fontWeight||"normal"),t.image){const n=t.image;if(n.url&&n.width&&n.height){const t=f.createElement("img");t.src=n.url,t.style.width=n.width+"px",t.style.height=n.height+"px",e.appendChild(t)}}if(t.hyperLink){const n=f.createElement("a");n.className="hyper-link",n.target="_blank",n.innerText="🔗",n.href=t.hyperLink,e.appendChild(n),e.linkContainer=n}else e.linkContainer&&(e.linkContainer.remove(),e.linkContainer=null);if(t.icons&&t.icons.length){const n=f.createElement("span");n.className="icons",n.innerHTML=t.icons.map((e=>`${o(e)}`)).join(""),e.appendChild(n)}if(t.tags&&t.tags.length){const n=f.createElement("div");n.className="tags",n.innerHTML=t.tags.map((e=>`${o(e)}`)).join(""),e.appendChild(n)}t.branchColor&&(e.style.borderColor=t.branchColor)};const x=function(e){const t=f.createElement("me-epd");return t.expanded=!1!==e,t.className=!1!==e?"minus":"",t},N=document,y=document,v="http://www.w3.org/2000/svg",M=function(e,t){const n=y.createElementNS(v,"path");return n.setAttribute("d",e),n.setAttribute("stroke",t||"#666"),n.setAttribute("fill","none"),n.setAttribute("stroke-width","3"),n},C=function(e){const t=y.createElementNS(v,"svg");return t.setAttribute("class",e),t},k=function(e,t,n,i){const o=y.createElementNS(v,"line");return o.setAttribute("x1",e),o.setAttribute("y1",t),o.setAttribute("x2",n),o.setAttribute("y2",i),o.setAttribute("stroke","#bbb"),o.setAttribute("fill","none"),o.setAttribute("stroke-width","2"),o},w=function(e,t){const n=y.createElementNS(v,"path");return n.setAttribute("d",e),n.setAttribute("stroke",t||"#555"),n.setAttribute("fill","none"),n.setAttribute("stroke-linecap","square"),n.setAttribute("stroke-width","2"),n};function z(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,linkData:e.linkData,direction:e.direction,theme:e.theme}}const E=function(e,t){if(!e)return;const n=e.nodeObj;!1===n.expanded&&(this.expandNode(e,!0),e=g(n.id));const i=t||this.generateNewObj();n.children?n.children.push(i):n.children=[i],a(this.nodeData);const o=e.parentElement,{grp:r,top:s}=this.createWrapper(i);if("ME-PARENT"===o.tagName){if(o.children[1])o.nextSibling.appendChild(r);else{const e=this.createChildren([r]);o.appendChild(x(!0)),o.insertAdjacentElement("afterend",e)}this.linkDiv(r.offsetParent)}else"ME-ROOT"===o.tagName&&(this.judgeDirection(r,i),o.nextSibling.appendChild(r),this.linkDiv());return{newTop:s,newNodeObj:i}};function j(e){this.dom=e,this.mousedown=!1,this.lastX=null,this.lastY=null}j.prototype={init(e,t){this.handleMouseMove=e=>{if(e.stopPropagation(),this.mousedown){if(!this.lastX)return this.lastX=e.pageX,void(this.lastY=e.pageY);const n=this.lastX-e.pageX,i=this.lastY-e.pageY;t(n,i),this.lastX=e.pageX,this.lastY=e.pageY}},this.handleMouseDown=e=>{e.stopPropagation(),this.mousedown=!0},this.handleClear=e=>{e.stopPropagation(),this.clear()},e.addEventListener("mousemove",this.handleMouseMove),e.addEventListener("mouseleave",this.handleClear),e.addEventListener("mouseup",this.handleClear),this.dom.addEventListener("mousedown",this.handleMouseDown)},destory(e){e.removeEventListener("mousemove",this.handleMouseMove),e.removeEventListener("mouseleave",this.handleClear),e.removeEventListener("mouseup",this.handleClear),this.dom.removeEventListener("mousedown",this.handleMouseDown)},clear(){this.mousedown=!1,this.lastX=null,this.lastY=null}};const L=function(e,t,n){let i="";const o=t.offsetTop,r=t.offsetLeft,a=t.offsetWidth,s=t.offsetHeight;for(let t=0;t0&&(i+=L(g,c))}return i};function D({x1:e,y1:t,x2:n,y2:i}){return`M ${e} 10000 V ${i>t?i-20:i+20} C ${e} ${i} ${e} ${i} ${n>e?e+20:e-20} ${i} H ${n}`}function T({x1:e,y1:t,x2:n,y2:i}){return`M ${e} ${t} Q ${e} ${i} ${n} ${i}`}function A({pT:t,pL:n,pW:i,pH:o,cT:r,cL:a,cW:s,cH:l,direction:c,isFirst:d}){let h,p;h=d?t+o/2:t+o;const m=r+l;let u,f,g;return"lhs"===c?(g=n,u=g+e,f=g-e,p=a+e):"rhs"===c&&(g=n+i,u=g-e,f=g+e,p=a+s-e),`M ${u} ${h} C ${g} ${h} ${g} ${m} ${f} ${m} H ${p}`}const I={afterMoving:!1,mousedown:!1,lastX:null,lastY:null,onMove(e,t){if(this.mousedown){if(this.afterMoving=!0,!this.lastX)return this.lastX=e.pageX,void(this.lastY=e.pageY);const n=this.lastX-e.pageX,i=this.lastY-e.pageY;t.scrollTo(t.scrollLeft+n,t.scrollTop+i),this.lastX=e.pageX,this.lastY=e.pageY}},clear(){this.afterMoving=!1,this.mousedown=!1,this.lastX=null,this.lastY=null}};const S={addChild:"插入子节点",addParent:"插入父节点",addSibling:"插入同级节点",removeNode:"删除节点",focus:"专注",cancelFocus:"取消专注",moveUp:"上移",moveDown:"下移",link:"连接",clickTips:"请点击目标节点"},P={cn:S,zh_CN:S,zh_TW:{addChild:"插入子節點",addParent:"插入父節點",addSibling:"插入同級節點",removeNode:"刪除節點",focus:"專注",cancelFocus:"取消專注",moveUp:"上移",moveDown:"下移",link:"連接",clickTips:"請點擊目標節點"},en:{addChild:"Add child",addParent:"Add parent",addSibling:"Add sibling",removeNode:"Remove node",focus:"Focus Mode",cancelFocus:"Cancel Focus Mode",moveUp:"Move up",moveDown:"Move down",link:"Link",clickTips:"Please click the target node"},ru:{addChild:"Добавить дочерний элемент",addParent:"Добавить родительский элемент",addSibling:"Добавить на этом уровне",removeNode:"Удалить узел",focus:"Режим фокусировки",cancelFocus:"Отменить режим фокусировки",moveUp:"Поднять выше",moveDown:"Опустить ниже",link:"Ссылка",clickTips:"Пожалуйста, нажмите на целевой узел"},ja:{addChild:"子ノードを追加する",addParent:"親ノードを追加します",addSibling:"兄弟ノードを追加する",removeNode:"ノードを削除",focus:"集中",cancelFocus:"集中解除",moveUp:"上へ移動",moveDown:"下へ移動",link:"コネクト",clickTips:"ターゲットノードをクリックしてください"},pt:{addChild:"Adicionar item filho",addParent:"Adicionar item pai",addSibling:"Adicionar item irmao",removeNode:"Remover item",focus:"Modo Foco",cancelFocus:"Cancelar Modo Foco",moveUp:"Mover para cima",moveDown:"Mover para baixo",link:"Link",clickTips:"Favor clicar no item alvo"}};var O=n(379),H=n.n(O),Y=n(795),B=n.n(Y),$=n(569),R=n.n($),V=n(565),Z=n.n(V),W=n(216),F=n.n(W),U=n(589),X=n.n(U),G=n(165),_={};_.styleTagTransform=X(),_.setAttributes=Z(),_.insert=R().bind(null,"head"),_.domAPI=B(),_.insertStyleElement=F();H()(G.Z,_);G.Z&&G.Z.locals&&G.Z.locals;function q(e,t){const n=(e,t,n)=>{const i=document.createElement("li");return i.id=e,i.innerHTML=`${o(t)}${o(n)}`,i},i=P[e.locale]?e.locale:"en",r=n("cm-add_child",P[i].addChild,"tab"),a=n("cm-add_parent",P[i].addParent,""),s=n("cm-add_sibling",P[i].addSibling,"enter"),l=n("cm-remove_child",P[i].removeNode,"delete"),c=n("cm-fucus",P[i].focus,""),d=n("cm-unfucus",P[i].cancelFocus,""),h=n("cm-up",P[i].moveUp,"PgUp"),p=n("cm-down",P[i].moveDown,"Pgdn"),m=n("cm-down",P[i].link,""),u=document.createElement("ul");if(u.className="menu-list",u.appendChild(r),u.appendChild(a),u.appendChild(s),u.appendChild(l),t&&!t.focus||(u.appendChild(c),u.appendChild(d)),u.appendChild(h),u.appendChild(p),t&&!t.link||u.appendChild(m),t&&t.extend)for(let e=0;e{i.onclick(e)}}const f=document.createElement("div");f.className="context-menu",f.appendChild(u),f.hidden=!0,e.container.append(f);let g=!0;e.container.oncontextmenu=function(t){if(t.preventDefault(),!e.editable)return;const n=t.target;if("ME-TPC"===n.tagName){g="ME-ROOT"===n.parentElement.tagName,g?(c.className="disabled",h.className="disabled",p.className="disabled",s.className="disabled",l.className="disabled"):(c.className="",h.className="",p.className="",s.className="",l.className=""),e.selectNode(n),f.hidden=!1;const i=u.offsetHeight,o=u.offsetWidth;i+t.clientY>window.innerHeight?(u.style.top="",u.style.bottom="0px"):(u.style.bottom="",u.style.top=t.clientY+15+"px"),o+t.clientX>window.innerWidth?(u.style.left="",u.style.right="0px"):(u.style.right="",u.style.left=t.clientX+10+"px")}},f.onclick=e=>{e.target===f&&(f.hidden=!0)},r.onclick=()=>{e.addChild(),f.hidden=!0},a.onclick=()=>{e.insertParent(),f.hidden=!0},s.onclick=()=>{g||(e.insertSibling(),f.hidden=!0)},l.onclick=()=>{g||(e.removeNode(),f.hidden=!0)},c.onclick=()=>{g||(e.focusNode(e.currentNode),f.hidden=!0)},d.onclick=()=>{e.cancelFocus(),f.hidden=!0},h.onclick=()=>{g||(e.moveUpNode(),f.hidden=!0)},p.onclick=()=>{g||(e.moveDownNode(),f.hidden=!0)},m.onclick=()=>{f.hidden=!0;const t=e.currentNode,n=(e=>{const t=document.createElement("div");return t.innerText=e,t.style.cssText="position:absolute;bottom:20px;left:50%;transform:translateX(-50%);",t})(P[i].clickTips);e.container.appendChild(n),e.map.addEventListener("click",(i=>{i.preventDefault(),n.remove(),"ME-PARENT"!==i.target.parentElement.tagName&&"ME-ROOT"!==i.target.parentElement.tagName||e.createLink(t,e.currentNode)}),{once:!0})}}var J=n(301),Q={};Q.styleTagTransform=X(),Q.setAttributes=Z(),Q.insert=R().bind(null,"head"),Q.domAPI=B(),Q.insertStyleElement=F();H()(J.Z,Q);J.Z&&J.Z.locals&&J.Z.locals;const K=(e,t)=>{const n=document.createElement("span");return n.id=e,n.innerHTML=``,n};function ee(e){e.container.append(function(e){const t=document.createElement("div"),n=K("fullscreen","full"),i=K("toCenter","living"),o=K("zoomout","move"),r=K("zoomin","add");return document.createElement("span").innerText="100%",t.appendChild(n),t.appendChild(i),t.appendChild(o),t.appendChild(r),t.className="mind-elixir-toolbar rb",n.onclick=()=>{e.container.requestFullscreen()},i.onclick=()=>{e.toCenter()},o.onclick=()=>{e.scaleVal<.6||e.scale(e.scaleVal-=.2)},r.onclick=()=>{e.scaleVal>1.6||e.scale(e.scaleVal+=.2)},t}(e)),e.container.append(function(e){const t=document.createElement("div"),n=K("tbltl","left"),i=K("tbltr","right"),o=K("tblts","side");return t.appendChild(n),t.appendChild(i),t.appendChild(o),t.className="mind-elixir-toolbar lt",n.onclick=()=>{e.initLeft()},i.onclick=()=>{e.initRight()},o.onclick=()=>{e.initSide()},t}(e))}const te=document,ne=function(e){if(!e)return;const t=e.getElementsByClassName("insert-preview");for(const e of t||[])e.remove()},ie=function(e,t){const n=t.parentElement.parentElement.contains(e);return e&&"ME-TPC"===e.tagName&&e!==t&&!n&&!0!==e.nodeObj.root};function oe(e){let t,n,i;e.map.addEventListener("dragstart",(function(e){t=e.target,t.parentElement.parentElement.style.opacity="0.5",I.clear()})),e.map.addEventListener("dragend",(async function(o){o.target.style.opacity="",ne(i);const r=t.nodeObj;switch(n){case"before":e.moveNodeBefore(t,i),e.selectNode(g(r.id));break;case"after":e.moveNodeAfter(t,i),e.selectNode(g(r.id));break;case"in":e.moveNode(t,i)}t.parentElement.parentElement.style.opacity="1",t=null})),e.map.addEventListener("dragover",l((function(e){ne(i);const o=te.elementFromPoint(e.clientX,e.clientY-12);if(ie(o,t)){i=o;const t=o.getBoundingClientRect().y;e.clientY>t+o.clientHeight?n="after":e.clientY>t+o.clientHeight/2&&(n="in")}else{const o=te.elementFromPoint(e.clientX,e.clientY+12);if(ie(o,t)){i=o;const t=o.getBoundingClientRect().y;e.clientY0)n[0].className=i;else{const t=te.createElement("div");t.className=i,e.appendChild(t)}}(i,n)}),200))}var re=n(787),ae={};ae.styleTagTransform=X(),ae.setAttributes=Z(),ae.insert=R().bind(null,"head"),ae.domAPI=B(),ae.insertStyleElement=F();H()(re.Z,ae);re.Z&&re.Z.locals&&re.Z.locals;function se(){this.handlers={}}se.prototype={showHandler:function(){},addListener:function(e,t){void 0===this.handlers[e]&&(this.handlers[e]=[]),this.handlers[e].push(t)},fire:function(e,...t){if(this.handlers[e]instanceof Array){const n=this.handlers[e];for(let e=0;e{this.isUndo?this.isUndo=!1:["moveNode","removeNode","addChild","finishEdit","editStyle","editTags","editIcons"].includes(e.name)&&this.history.push(e)})),this.history=[],this.isUndo=!1,this.undo=function(){const e=this.history.pop();e&&(this.isUndo=!0,"moveNode"===e.name?this.moveNode(de(e.obj.fromObj.id),de(e.obj.originParentId)):"removeNode"===e.name?e.originSiblingId?this.insertBefore(de(e.originSiblingId),e.obj):this.addChild(de(e.originParentId),e.obj):"addChild"===e.name||"copyNode"===e.name?this.removeNode(de(e.obj.id)):"finishEdit"===e.name?this.setNodeTopic(de(e.obj.id),e.origin):this.isUndo=!1)},this.container=he.createElement("div"),this.container.className="map-container",this.theme=x||t;const v=he.createElement("div");var M;v.className="map-canvas",this.map=v,this.map.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.mindElixirBox.appendChild(this.container),this.root=he.createElement("me-root"),this.mainNodes=he.createElement("me-children"),this.mainNodes.className="box",this.lines=C("lines"),this.linkController=C("linkcontroller"),this.P2=he.createElement("div"),this.P3=he.createElement("div"),this.P2.className=this.P3.className="circle",this.line1=k(0,0,0,0),this.line2=k(0,0,0,0),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.linkSvgGroup=C("topiclinks"),this.map.appendChild(this.root),this.map.appendChild(this.mainNodes),this.map.appendChild(this.lines),this.map.appendChild(this.linkController),this.map.appendChild(this.linkSvgGroup),this.map.appendChild(this.P2),this.map.appendChild(this.P3),this.overflowHidden?this.container.style.overflow="hidden":((M=this).map.addEventListener("click",(e=>{if("ME-EPD"===e.target.tagName)M.expandNode(e.target.previousSibling);else{if(!M.editable)return;"ME-PARENT"===e.target.parentElement.tagName||"ME-ROOT"===e.target.parentElement.tagName?M.selectNode(e.target,!1,e):"path"===e.target.tagName?"g"===e.target.parentElement.tagName&&M.selectLink(e.target.parentElement):"circle"===e.target.className||(M.unselectNode(),M.hideLinkController&&M.hideLinkController())}})),M.map.addEventListener("dblclick",(e=>{e.preventDefault(),M.editable&&("ME-PARENT"!==e.target.parentElement.tagName&&"ME-ROOT"!==e.target.parentElement.tagName||M.beginEdit(e.target))})),M.map.addEventListener("mousemove",(e=>{"true"!==e.target.contentEditable&&I.onMove(e,M.container)})),M.map.addEventListener("mousedown",(e=>{"true"!==e.target.contentEditable&&(I.afterMoving=!1,I.mousedown=!0)})),M.map.addEventListener("mouseleave",(e=>{I.clear()})),M.map.addEventListener("mouseup",(e=>{I.clear()})))}function me(e,t){return async function(...n){this.before[t]&&!await this.before[t].apply(this,n)||e.apply(this,n)}}pe.prototype={addParentLink:a,getObjById:r,generateNewObj:function(){const e=p();return{topic:this.newTopicName||"new node",id:e}},insertSibling:me((function(e,t){const n=e||this.currentNode;if(!n)return;const i=n.nodeObj;if(!0===i.root)return void this.addChild();const o=t||this.generateNewObj();!function(e,t){const n=e.parent.children,i=n.indexOf(e);n.splice(i+1,0,t)}(i,o),a(this.nodeData);const r=n.parentElement,{grp:s,top:l}=this.createWrapper(o),c=r.parentNode.parentNode;c.insertBefore(s,r.parentNode.nextSibling),"box"===c.className?(this.judgeDirection(s,o),this.linkDiv()):this.linkDiv(s.offsetParent),t||this.createInputDiv(l.children[0]),this.selectNode(l.children[0],!0),this.bus.fire("operation",{name:"insertSibling",obj:o})}),"insertSibling"),insertBefore:me((function(e,t){const n=e||this.currentNode;if(!n)return;const i=n.nodeObj;if(!0===i.root)return void this.addChild();const o=t||this.generateNewObj();!function(e,t){const n=e.parent.children,i=n.indexOf(e);n.splice(i,0,t)}(i,o),a(this.nodeData);const r=n.parentElement,{grp:s,top:l}=this.createWrapper(o),c=r.parentNode.parentNode;c.insertBefore(s,r.parentNode),"box"===c.className?(this.judgeDirection(s,o),this.linkDiv()):this.linkDiv(s.offsetParent),t||this.createInputDiv(l.children[0]),this.selectNode(l.children[0],!0),this.bus.fire("operation",{name:"insertSibling",obj:o})}),"insertBefore"),insertParent:me((function(e,t){const n=e||this.currentNode;if(!n)return;const i=n.nodeObj;if(!0===i.root)return;const o=t||this.generateNewObj();!function(e,t){const n=e.parent.children,i=n.indexOf(e);n[i]=t,t.children=[e]}(i,o),a(this.nodeData);const r=n.parentElement.parentElement,{grp:s,top:l}=this.createWrapper(o,!0);l.appendChild(x(!0)),r.insertAdjacentElement("afterend",s);const c=this.createChildren([r]);l.insertAdjacentElement("afterend",c),"box"===r.parentNode.className?(s.className=r.className,r.className="",r.querySelector(".subLines").remove(),this.linkDiv()):this.linkDiv(s.offsetParent),t||this.createInputDiv(l.children[0]),this.selectNode(l.children[0],!0),this.bus.fire("operation",{name:"insertParent",obj:o})}),"insertParent"),addChild:me((function(e,t){const n=e||this.currentNode;if(!n)return;const{newTop:i,newNodeObj:o}=E.call(this,n,t);this.bus.fire("operation",{name:"addChild",obj:o}),t||this.createInputDiv(i.children[0]),this.selectNode(i.children[0],!0)}),"addChild"),copyNode:me((function(e,t){const n=u(e.nodeObj);s(n);const{newNodeObj:i}=E.call(this,t,n);this.bus.fire("operation",{name:"copyNode",obj:i})}),"copyNode"),moveNode:me((function(e,t){const n=e.nodeObj,i=t.nodeObj,o=n.parent.id;if(!1===i.expanded&&(this.expandNode(t,!0),e=g(n.id),t=g(i.id)),!function(e,t){let n=!0;for(;t.parent;){if(t.parent===e){n=!1;break}t=t.parent}return n}(n,i))return;!function(e,t){m(e),t.children?t.children.push(e):t.children=[e]}(n,i),a(this.nodeData);const r=e.parentElement,s=r.parentElement.parentElement,l=t.parentElement;if("box"===s.className?r.parentElement.lastChild.remove():"box"===r.parentElement.className&&(r.style.cssText=""),"ME-PARENT"===l.tagName)if("box"===s.className&&(r.parentElement.className=""),l.children[1])l.nextSibling.appendChild(r.parentElement);else{const e=this.createChildren([r.parentElement]);l.appendChild(x(!0)),l.parentElement.insertBefore(e,l.nextSibling)}else"ME-ROOT"===l.tagName&&(this.judgeDirection(r.parentElement,n),l.nextSibling.appendChild(r.parentElement));this.linkDiv(),this.bus.fire("operation",{name:"moveNode",obj:{fromObj:n,toObj:i,originParentId:o}})}),"moveNode"),removeNode:me((function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;if(!0===n.root)throw new Error("Can not remove root node");const i=n.parent.children.findIndex((e=>e===n)),o=n.parent.children[i+1],r=o&&o.id,a=m(n),s=t.parentNode;if(0===a){const e=s.parentNode.parentNode.previousSibling;"ME-ROOT"!==e.tagName&&e.children[1].remove(),this.selectParent()}else this.selectPrevSibling()||this.selectNextSibling()||this.selectParent();for(const e in this.linkData){const t=this.linkData[e];t.from!==s.firstChild&&t.to!==s.firstChild||this.removeLink(this.mindElixirBox.querySelector(`[data-linkid=${this.linkData[e].id}]`))}s.parentNode.remove(),this.linkDiv(),this.bus.fire("operation",{name:"removeNode",obj:n,originSiblingId:r,originParentId:n.parent.id})}),"removeNode"),moveUpNode:me((function(e){const t=e||this.currentNode;if(!t)return;const n=t.parentNode.parentNode,i=t.nodeObj;!function(e){const t=e.parent.children,n=t.indexOf(e),i=t[n];0===n?(t[n]=t[t.length-1],t[t.length-1]=i):(t[n]=t[n-1],t[n-1]=i)}(i),n.parentNode.insertBefore(n,n.previousSibling),this.linkDiv(),this.bus.fire("operation",{name:"moveUpNode",obj:i})}),"moveUpNode"),moveDownNode:me((function(e){const t=e||this.currentNode;if(!t)return;const n=t.parentNode.parentNode,i=t.nodeObj;!function(e){const t=e.parent.children,n=t.indexOf(e),i=t[n];n===t.length-1?(t[n]=t[0],t[0]=i):(t[n]=t[n+1],t[n+1]=i)}(i),n.nextSibling?n.insertAdjacentElement("afterend",n.nextSibling):n.parentNode.prepend(n),this.linkDiv(),this.bus.fire("operation",{name:"moveDownNode",obj:i})}),"moveDownNode"),beginEdit:me((function(e){const t=e||this.currentNode;t&&this.createInputDiv(t)}),"beginEdit"),moveNodeBefore:me((function(e,t){const n=e.nodeObj,i=t.nodeObj,o=n.parent.id;!function(e,t){m(e);const n=t.parent.children;let i=0;for(let e=0;e{e-=a/this.scaleVal,t-=s/this.scaleVal;const c=d(r,e,t);l=c.x,p=c.y,this.P2.style.top=t+"px",this.P2.style.left=e+"px",this.currentLink.children[0].setAttribute("d",`M ${l} ${p} C ${e} ${t} ${n} ${i} ${u} ${f}`),this.line1.setAttribute("x1",l),this.line1.setAttribute("y1",p),this.line1.setAttribute("x2",e),this.line1.setAttribute("y2",t),o.delta1.x=e-r.cx,o.delta1.y=t-r.cy})),this.helper2.init(this.map,((r,s)=>{n-=r/this.scaleVal,i-=s/this.scaleVal;const d=h(a,n,i);u=d.x,f=d.y;const m=c(n,i,u,f);this.P3.style.top=i+"px",this.P3.style.left=n+"px",this.currentLink.children[0].setAttribute("d",`M ${l} ${p} C ${e} ${t} ${n} ${i} ${u} ${f}`),this.currentLink.children[1].setAttribute("d",`M ${m.x1} ${m.y1} L ${u} ${f} L ${m.x2} ${m.y2}`),this.line2.setAttribute("x1",n),this.line2.setAttribute("y1",i),this.line2.setAttribute("x2",u),this.line2.setAttribute("y2",f),o.delta2.x=n-a.cx,o.delta2.y=i-a.cy}))},layout:function(){this.root.innerHTML="",this.mainNodes.innerHTML="";const e=this.createTopic(this.nodeData);b(e,this.nodeData),e.draggable=!1,this.root.appendChild(e);const t=this.nodeData.children;if(t&&0!==t.length){if(2===this.direction){let e=0,n=0;t.map((t=>{0===t.direction?e+=1:1===t.direction?n+=1:e<=n?(t.direction=0,e+=1):(t.direction=1,n+=1)}))}this.layoutChildren(this.nodeData.children,this.mainNodes,this.direction)}},linkDiv:function(t){const n=this.mainNodeHorizontalGap||65,i=this.mainNodeVerticalGap||25,o=this.root;o.style.cssText=`top:${1e4-o.offsetHeight/2}px;left:${1e4-o.offsetWidth/2}px;`;const r=this.mainNodes.children;this.lines.innerHTML="";let a,s,l=0,c=0,d=0,h=0,p=0,m=0;if(2===this.direction){let e=0,t=0,n=0,o=0;for(let a=0;am?(s=1e4-Math.max(p)/2,a="r",c=(p-o)/(t-1)):(s=1e4-Math.max(m)/2,a="l",c=(m-n)/(e-1))}else{for(let e=0;e{e.stopPropagation();const t=e.key;if("Enter"===t||"Tab"===t){if(e.shiftKey)return;e.preventDefault(),this.inputDiv.blur(),this.map.focus()}})),t.addEventListener("blur",(()=>{if(!t)return;const i=e.nodeObj,o=t.textContent.trim();i.topic=""===o?n:o,t.remove(),this.inputDiv=t=null,o!==n&&(e.childNodes[0].textContent=i.topic,this.linkDiv(),this.bus.fire("operation",{name:"finishEdit",obj:i,origin:n}))}))},layoutChildren:function(e,t,n){let i;i=t||N.createElement("me-children");for(let t=0;t0){if(a.appendChild(x(o.expanded)),r.appendChild(a),!1!==o.expanded){const e=this.layoutChildren(o.children);r.appendChild(e)}}else r.appendChild(a);i.appendChild(r)}return i},createWrapper:function(e,t){const n=f.createElement("me-wrapper"),i=this.createParent(e);if(n.appendChild(i),!t&&e.children&&e.children.length>0&&(i.appendChild(x(e.expanded)),!1!==e.expanded)){const t=this.layoutChildren(e.children);n.appendChild(t)}return{grp:n,top:i}},createParent:function(e){const t=f.createElement("me-parent"),n=this.createTopic(e);return b(n,e),t.appendChild(n),t},createChildren:function(e){const t=f.createElement("me-children");return t.append(...e),t},createTopic:function(e){const t=f.createElement("me-tpc");return t.nodeObj=e,t.dataset.nodeid="me"+e.id,t.draggable=this.draggable,t},selectNode:function(e,t,n){if(e){if("string"==typeof e)return this.selectNode(g(e));this.currentNode&&(this.currentNode.className=""),e.className="selected",e.scrollIntoView({block:"nearest",inline:"nearest"}),this.currentNode=e,t?this.bus.fire("selectNewNode",e.nodeObj):this.bus.fire("selectNode",e.nodeObj,n)}},unselectNode:function(){this.currentNode&&(this.currentNode.className=""),this.currentNode=null,this.bus.fire("unselectNode")},selectNextSibling:function(){if(!this.currentNode||"meroot"===this.currentNode.dataset.nodeid)return;const e=this.currentNode.parentElement.parentElement.nextSibling;let t;const n=this.currentNode.parentElement.parentElement;if("rhs"===n.className||"lhs"===n.className){const e=this.mindElixirBox.querySelectorAll("."+n.className),i=Array.from(e).indexOf(n);if(!(i+1=0))return!1;t=e[i-1].firstChild.firstChild}else{if(!e)return!1;t=e.firstChild.firstChild}return this.selectNode(t),!0},selectFirstChild:function(){if(!this.currentNode)return;const e=this.currentNode.parentElement.nextSibling;if(e&&e.firstChild){const t=e.firstChild.firstChild.firstChild;this.selectNode(t)}},selectParent:function(){if(!this.currentNode||"meroot"===this.currentNode.dataset.nodeid)return;const e=this.currentNode.parentElement.parentElement.parentElement.previousSibling;if(e){const t=e.firstChild;this.selectNode(t)}},getDataString:function(){const e=z(this);return JSON.stringify(e,((e,t)=>{if("parent"!==e)return"from"===e||"to"===e?t.nodeObj.id:t}))},getData:function(){return JSON.parse(this.getDataString())},getDataMd:function(){const e=z(this).nodeData;let t="# "+e.topic+"\n\n";return function e(n,i){for(let o=0;o{e.insertSibling()},9:()=>{e.addChild()},113:()=>{e.beginEdit()},38:()=>{e.selectPrevSibling()},40:()=>{e.selectNextSibling()},37:()=>{e.currentNode&&("rhs"===e.currentNode.offsetParent.offsetParent.className?e.selectParent():("lhs"===e.currentNode.offsetParent.offsetParent.className||e.currentNode.nodeObj.root)&&e.selectFirstChild())},39:()=>{e.currentNode&&("rhs"===e.currentNode.offsetParent.offsetParent.className||e.currentNode.nodeObj.root?e.selectFirstChild():"lhs"===e.currentNode.offsetParent.offsetParent.className&&e.selectParent())},33(){e.moveUpNode()},34(){e.moveDownNode()},67(t){(t.metaKey||t.ctrlKey)&&(e.waitCopy=e.currentNode)},86(t){e.waitCopy&&(t.metaKey||t.ctrlKey)&&(e.copyNode(e.waitCopy,e.currentNode),e.waitCopy=null)},90:t=>{e.allowUndo&&(t.metaKey||t.ctrlKey)&&e.undo()},187:t=>{if(t.metaKey||t.ctrlKey){if(e.scaleVal>1.6)return;e.scale(e.scaleVal+=.2)}},189:t=>{if(t.metaKey||t.ctrlKey){if(e.scaleVal<.6)return;e.scale(e.scaleVal-=.2)}}};e.map.onkeydown=n=>{n.preventDefault(),e.editable&&n.target===n.currentTarget&&(8===n.keyCode||46===n.keyCode?e.currentLink?e.removeLink():e.removeNode():t[n.keyCode]&&t[n.keyCode](n))}}(this),/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&this.mobileMenu?function(e,t){const n=(e,t)=>{const n=document.createElement("div");return n.id=e,n.innerHTML=``,n},i=n("cm-add_child","zijiedian"),o=n("cm-add_sibling","tongjijiedian-"),r=n("cm-remove_child","shanchu2"),a=n("cm-up","rising"),s=n("cm-down","falling"),l=n("cm-edit","edit"),c=document.createElement("ul");if(c.className="menu-list",t&&t.extend)for(let e=0;e{i.onclick(e)}}const d=document.createElement("mmenu");d.className="mobile-menu",d.appendChild(i),d.appendChild(o),d.appendChild(r),d.appendChild(a),d.appendChild(s),d.appendChild(l),d.hidden=!0,e.container.append(d);let h=!0;e.bus.addListener("unselectNode",(function(){d.hidden=!0})),e.bus.addListener("selectNode",(function(e){d.hidden=!1,h=!!e.root})),d.onclick=e=>{e.target===d&&(d.hidden=!0)},i.onclick=t=>{e.addChild()},o.onclick=t=>{h||e.insertSibling()},r.onclick=t=>{h||e.removeNode()},a.onclick=t=>{h||e.moveUpNode()},s.onclick=t=>{h||e.moveDownNode()},l.onclick=t=>{e.beginEdit()}}(this):this.contextMenu&&q(this,this.contextMenuOption),this.draggable&&oe(this);const t=this.theme.cssVar,n=Object.keys(t);for(let e=0;e({nodeData:{id:p(),topic:e||"new topic",root:!0,children:[]},linkData:{}});const ue=pe})(),i=i.default})())); +!function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".mind-elixir{--gap: 30px;--root-radius: 30px;--main-radius: 20px;--root-color: #ffffff;--root-bgcolor: #4c4f69;--main-color: #444446;--main-bgcolor: #ffffff;--topic-padding: 3px;--color: #777777;--bgcolor: #f6f6f6;--selected: #4dc4ff;--panel-color: #444446;--panel-bgcolor: #ffffff;--panel-border-color: #eaeaea;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0);font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,PingFang SC,Microsoft YaHei,Source Han Sans SC,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif}.mind-elixir .hyper-link{text-decoration:none}.map-container{-webkit-user-select:none;user-select:none;height:100%;width:100%;overflow:scroll;font-size:15px}.map-container::-webkit-scrollbar{width:0px;height:0px}.map-container .selected{box-shadow:0 0 0 2px var(--selected)}.map-container .lhs{direction:rtl}.map-container .lhs me-tpc{direction:ltr}.map-container .map-canvas{height:20000px;width:20000px;position:relative;-webkit-user-select:none;user-select:none;transition:transform .3s;transform:scale(1);background-color:var(--bgcolor)}.map-container .map-canvas me-nodes{position:absolute;display:flex;justify-content:center;align-items:center;height:fit-content;width:fit-content}.map-container .map-canvas me-root{position:relative}.map-container .map-canvas me-root me-tpc{display:block;font-size:25px;line-height:1.2em;color:var(--root-color);padding:10px var(--gap);border-radius:var(--root-radius);white-space:pre-wrap;background-color:var(--root-bgcolor)}.map-container .map-canvas me-root me-tpc #input-box{padding:10px var(--gap)}.map-container me-main>me-wrapper{position:relative;margin:20px 65px}.map-container me-main>me-wrapper>me-parent{margin:var(--gap);padding:0}.map-container me-main>me-wrapper>me-parent>me-tpc{border-radius:var(--main-radius);background-color:var(--main-bgcolor);border:2px solid var(--main-color);color:var(--main-color);padding:8px var(--gap)}.map-container me-main>me-wrapper>me-parent>me-tpc #input-box{padding:8px var(--gap)}.map-container me-wrapper{display:block;pointer-events:none;width:fit-content}.map-container me-children,.map-container me-parent{display:inline-block;vertical-align:middle}.map-container me-parent{position:relative;cursor:pointer;padding:6px var(--gap);margin-top:10px}.map-container me-parent me-tpc{position:relative;display:block;border-radius:3px;color:var(--color);pointer-events:all;max-width:35em;white-space:pre-wrap;padding:var(--topic-padding);line-height:1.2em}.map-container me-parent me-tpc .insert-preview{position:absolute;width:100%;left:0;z-index:9}.map-container me-parent me-tpc .show{background:#7ad5ff;pointer-events:none;opacity:.7}.map-container me-parent me-tpc .before{height:14px;top:-14px}.map-container me-parent me-tpc .in{height:100%;top:0}.map-container me-parent me-tpc .after{height:14px;bottom:-14px}.map-container me-parent me-epd{position:absolute;height:18px;width:18px;opacity:.8;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdD0iMTY1NjY1NDcxNzI0MiIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+CiAgICA8cGF0aCBkPSJNNTEyIDc0LjY2NjY2N0MyNzAuOTMzMzMzIDc0LjY2NjY2NyA3NC42NjY2NjcgMjcwLjkzMzMzMyA3NC42NjY2NjcgNTEyUzI3MC45MzMzMzMgOTQ5LjMzMzMzMyA1MTIgOTQ5LjMzMzMzMyA5NDkuMzMzMzMzIDc1My4wNjY2NjcgOTQ5LjMzMzMzMyA1MTIgNzUzLjA2NjY2NyA3NC42NjY2NjcgNTEyIDc0LjY2NjY2N3oiIHN0cm9rZS13aWR0aD0iNTQiIHN0cm9rZT0nYmxhY2snIGZpbGw9J3doaXRlJyA+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{pointer-events:none}.map-container .topiclinks text,.map-container .linkcontroller text,.map-container .summary text{pointer-events:all}.map-container .topiclinks .selected,.map-container .linkcontroller .selected,.map-container .summary .selected{pointer-events:none}.map-container .lines,.map-container .subLines{pointer-events:none;z-index:-1}.map-container .topiclinks *,.map-container .linkcontroller *{z-index:100}.map-container .topiclinks g{cursor:pointer}.map-container #input-box{position:absolute;top:0;left:0;padding:var(--topic-padding);color:var(--color);background-color:var(--bgcolor);width:max-content;max-width:35em;z-index:11;direction:ltr;-webkit-user-select:auto;user-select:auto;pointer-events:all}.map-container me-tpc>div,.map-container me-tpc>span,.map-container me-tpc>img{pointer-events:none}.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:#aaa;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 3px 0 0;font-size:12px;line-height:1.3em}.map-container .icons{display:inline-block;direction:ltr;margin-right:10px}.map-container .icons span{display:inline-block}.map-container .mind-elixir-ghost{position:fixed;top:-100%;left:-100%;box-sizing:content-box;opacity:.5;background-color:#f6f6f6;max-width:200px;width:fit-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:8px 16px;border-radius:6px;border:#666666 2px solid}.map-container .selection-area{background:#4f90f22d;border:1px solid #4f90f2}.mind-elixir .context-menu{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99}.mind-elixir .context-menu .menu-list{position:fixed;list-style:none;margin:0;padding:0;font:300 15px Roboto,sans-serif;color:var(--panel-color);box-shadow:0 12px 15px #0003}.mind-elixir .context-menu .menu-list li{min-width:200px;overflow:hidden;white-space:nowrap;padding:10px 14px;background:var(--panel-bgcolor);border-bottom:1px solid var(--panel-border-color)}.mind-elixir .context-menu .menu-list li a{color:#333;text-decoration:none}.mind-elixir .context-menu .menu-list li.disabled{display:none;color:#5e5e5e;background-color:#f7f7f7}.mind-elixir .context-menu .menu-list li.disabled:hover{cursor:default;background-color:#f7f7f7}.mind-elixir .context-menu .menu-list li:hover{cursor:pointer;filter:brightness(.9)}.mind-elixir .context-menu .menu-list li:first-child{border-radius:5px 5px 0 0}.mind-elixir .context-menu .menu-list li:last-child{border-bottom:0;border-radius:0 0 5px 5px}.mind-elixir .context-menu .menu-list li span:last-child{float:right}.mind-elixir .tips{position:absolute;bottom:20px;left:50%;transform:translate(-50%);color:var(--panel-color);font-weight:bolder}.mind-elixir .mobile-menu{position:absolute;left:20px;bottom:70px;z-index:99;margin:0;padding:0;color:#333;border-radius:5px;box-shadow:0 12px 15px #0003;overflow:hidden}.mind-elixir .mobile-menu *{transition:color .4s,background-color .4s}.mind-elixir .mobile-menu div{float:left;text-align:center;width:30px;overflow:hidden;white-space:nowrap;padding:8px;background-color:#fff;border-bottom:1px solid #ecf0f1}.mind-elixir .mobile-menu div a{color:#333;text-decoration:none}.mind-elixir .mobile-menu div.disabled{color:#5e5e5e;background-color:#f7f7f7}.mind-elixir .mobile-menu div.disabled:hover{cursor:default;background-color:#f7f7f7}.mind-elixir .mobile-menu div:hover{cursor:pointer;background-color:#ecf0f1}.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(e){console.error("vite-plugin-css-injected-by-js",e)}}(),function(e){var t,n,i,o,s,r,l='',a=(a=document.getElementsByTagName("script"))[a.length-1].getAttribute("data-injectcss");if(a&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(e){console&&console.log(e)}}function c(){s||(s=!0,i())}t=function(){var e,t,n,i;(i=document.createElement("div")).innerHTML=l,l=null,(n=i.getElementsByTagName("svg")[0])&&(n.setAttribute("aria-hidden","true"),n.style.position="absolute",n.style.width=0,n.style.height=0,n.style.overflow="hidden",e=n,(t=document.body).firstChild?(i=e,(n=t.firstChild).parentNode.insertBefore(i,n)):t.appendChild(e))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(n=function(){document.removeEventListener("DOMContentLoaded",n,!1),t()},document.addEventListener("DOMContentLoaded",n,!1)):document.attachEvent&&(i=t,o=e.document,s=!1,(r=function(){try{o.documentElement.doScroll("left")}catch{return void setTimeout(r,50)}c()})(),o.onreadystatechange=function(){"complete"==o.readyState&&(o.onreadystatechange=null,c())})}(window);const S=0,H=1,K=2,M=30,L=8,Le={name:"Latte",palette:["#dd7878","#ea76cb","#8839ef","#e64553","#fe640b","#df8e1d","#40a02b","#209fb5","#1e66f5","#7287fd"],cssVar:{"--main-color":"#444446","--main-bgcolor":"#ffffff","--color":"#777777","--bgcolor":"#f6f6f6","--panel-color":"#444446","--panel-bgcolor":"#ffffff","--panel-border-color":"#eaeaea"}},Me={name:"Dark",palette:["#848FA0","#748BE9","#D2F9FE","#4145A5","#789AFA","#706CF4","#EF987F","#775DD5","#FCEECF","#DA7FBC"],cssVar:{"--main-color":"#ffffff","--main-bgcolor":"#4c4f69","--color":"#cccccc","--bgcolor":"#252526","--panel-color":"#ffffff","--panel-bgcolor":"#2d3748","--panel-border-color":"#696969"}};function ee(e){return e.replace(/&/g,"&").replace(//Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),te=function(e,t){if(t.id===e)return t;if(t.children&&t.children.length){for(let n=0;n{if(e.parent=t,e.children)for(let t=0;t{let n=Date.now();return function(...i){Date.now()-n>=t&&(e(...i),n=Date.now())}};function $e(e,t,n,i){const o=i-t,s=e-n;let r=Math.atan(Math.abs(o)/Math.abs(s))/3.14*180;s<0&&o>0&&(r=180-r),s<0&&o<0&&(r=180+r),s>0&&o<0&&(r=360-r);const l=r+30,a=r-30;return{x1:n+15*Math.cos(Math.PI*l/180),y1:i-15*Math.sin(Math.PI*l/180),x2:n+15*Math.cos(Math.PI*a/180),y2:i-15*Math.sin(Math.PI*a/180)}}function U(){return((new Date).getTime().toString(16)+Math.random().toString(16).substr(2)).substr(2,16)}const Ue=function(){const e=U();return{topic:this.newTopicName,id:e}};function Ge(e,t){let n=!0;for(;t.parent;){if(t.parent===e){n=!1;break}t=t.parent}return n}const P=e=>{var t;const n=null==(t=e.parent)?void 0:t.children,i=n.indexOf(e);return{siblings:n,index:i}};function Je(e){const{siblings:t,index:n}=P(e),i=t[n];0===n?(t[n]=t[t.length-1],t[t.length-1]=i):(t[n]=t[n-1],t[n-1]=i)}function Qe(e){const{siblings:t,index:n}=P(e),i=t[n];n===t.length-1?(t[n]=t[0],t[0]=i):(t[n]=t[n+1],t[n+1]=i)}function oe(e){const{siblings:t,index:n}=P(e);return t.splice(n,1),t.length}function Ze(e,t){const{siblings:n,index:i}=P(e);n.splice(i+1,0,t)}function et(e,t){const{siblings:n,index:i}=P(e);n.splice(i,0,t)}function tt(e,t){const{siblings:n,index:i}=P(e);n[i]=t,t.children=[e]}function nt(e,t){oe(e),t.children?t.children.push(e):t.children=[e]}function it(e,t){oe(e);const{siblings:n,index:i}=P(t);n.splice(i,0,e)}function ot(e,t){oe(e);const{siblings:n,index:i}=P(t);n.splice(i+1,0,e)}function De(e){return JSON.parse(JSON.stringify(e,((e,t)=>{if("parent"!==e)return t})))}const W=(e,t)=>{let n=0,i=0;for(;t&&t!==e;)n+=t.offsetLeft,i+=t.offsetTop,t=t.offsetParent;return{offsetLeft:n,offsetTop:i}},N=(e,t)=>{for(const n in t)e.setAttribute(n,t[n])},D={moved:!1,mousedown:!1,lastX:0,lastY:0,onMove(e,t){if(this.mousedown){if(this.moved=!0,!this.lastX)return this.lastX=e.pageX,void(this.lastY=e.pageY);const n=this.lastX-e.pageX,i=this.lastY-e.pageY;t.scrollTo(t.scrollLeft+n,t.scrollTop+i),this.lastX=e.pageX,this.lastY=e.pageY}},clear(){this.moved=!1,this.mousedown=!1,this.lastX=0,this.lastY=0}},fe=e=>"ME-TPC"===e.tagName;function st(e){e.map.addEventListener("click",(t=>{if(D.moved)return void D.clear();e.unselectNode(),e.unselectNodes(),e.unselectSummary(),e.unselectLink();const n=t.target;if("ME-EPD"===n.tagName)e.expandNode(n.previousSibling);else{if(!e.editable)return;fe(n)?e.selectNode(n,!1,t):"text"===n.tagName?"custom-link"===n.dataset.type?e.selectLink(n.parentElement):e.selectSummary(n.parentElement):"circle"===n.className||e.hideLinkController&&e.hideLinkController()}})),e.map.addEventListener("dblclick",(t=>{if(t.preventDefault(),!e.editable)return;const n=t.target;fe(n)?e.beginEdit(n):"text"===n.tagName&&("custom-link"===n.dataset.type?e.editCutsomLinkLabel(n.parentElement):e.editSummary(n.parentElement))})),e.map.addEventListener("mousemove",(t=>{"true"!==t.target.contentEditable&&D.onMove(t,e.container)})),e.map.addEventListener("mousedown",(e=>{2===e.button&&"true"!==e.target.contentEditable&&(D.moved=!1,D.mousedown=!0)})),e.map.addEventListener("mouseleave",(e=>{console.log(e.button),2===e.button&&D.clear()})),e.map.addEventListener("mouseup",(e=>{2===e.button&&D.clear()})),e.map.addEventListener("contextmenu",(e=>{e.preventDefault()}))}const rt={create:()=>({handlers:{},showHandler:function(){console.log(this.handlers)},addListener:function(e,t){void 0===this.handlers[e]&&(this.handlers[e]=[]),this.handlers[e].push(t)},fire:function(e,...t){if(this.handlers[e]instanceof Array){const n=this.handlers[e];for(let e=0;e{0===n.direction?e+=1:1===n.direction?t+=1:e<=t?(n.direction=0,e+=1):(n.direction=1,t+=1)}))}ct(this,n,t),console.timeEnd("layout")},ct=function(e,t,n){const i=ne.createElement("me-main");i.className="lhs";const o=ne.createElement("me-main");o.className="rhs";for(let n=0;n{const n=(t?t.mindElixirBox:k).querySelector(`[data-nodeid=me${e}]`);if(!n)throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);return n},de=function(e,t){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.branchColor&&(e.style.borderColor=t.branchColor),t.image){const n=t.image;if(n.url&&n.width&&n.height){const t=k.createElement("img");t.src=n.url,t.style.width=n.width+"px",t.style.height=n.height+"px",e.appendChild(t),e.image=t}else console.warn("image url/width/height are required")}else e.image&&(e.image=void 0);{const n=k.createElement("span");n.className="text",n.textContent=t.topic,e.appendChild(n),e.text=n}if(t.hyperLink){const n=k.createElement("a");n.className="hyper-link",n.target="_blank",n.innerText="🔗",n.href=t.hyperLink,e.appendChild(n),e.linkContainer=n}else e.linkContainer&&(e.linkContainer=void 0);if(t.icons&&t.icons.length){const n=k.createElement("span");n.className="icons",n.innerHTML=t.icons.map((e=>`${ee(e)}`)).join(""),e.appendChild(n),e.icons=n}else e.icons&&(e.icons=void 0);if(t.tags&&t.tags.length){const n=k.createElement("div");n.className="tags",n.innerHTML=t.tags.map((e=>`${ee(e)}`)).join(""),e.appendChild(n),e.tags=n}else e.tags&&(e.tags=void 0)},dt=function(e,t){const n=k.createElement("me-wrapper"),{p:i,tpc:o}=this.createParent(e);if(n.appendChild(i),!t&&e.children&&e.children.length>0){const t=se(e.expanded);if(i.appendChild(t),!1!==e.expanded){const t=at(this,e.children);n.appendChild(t)}}return{grp:n,top:i,tpc:o}},ht=function(e){const t=k.createElement("me-parent"),n=this.createTopic(e);return de(n,e),t.appendChild(n),{p:t,tpc:n}},ut=function(e){const t=k.createElement("me-children");return t.append(...e),t},ft=function(e){const t=k.createElement("me-tpc");return t.nodeObj=e,t.dataset.nodeid="me"+e.id,t.draggable=this.draggable,t};function Oe(e){const t=k.createRange();t.selectNodeContents(e);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const pt=function(e){if(console.time("editTopic"),!e)return;const t=k.createElement("div"),n=e.text.textContent;e.appendChild(t),t.id="input-box",t.textContent=n,t.contentEditable="true",t.spellcheck=!1,t.style.cssText=`min-width:${e.offsetWidth-8}px;`,0===this.direction&&(t.style.right="0"),t.focus(),Oe(t),this.bus.fire("operation",{name:"beginEdit",obj:e.nodeObj}),t.addEventListener("keydown",(e=>{e.stopPropagation();const n=e.key;if("Enter"===n||"Tab"===n){if(e.shiftKey)return;e.preventDefault(),null==t||t.blur(),this.map.focus()}})),t.addEventListener("blur",(()=>{var i;if(!t)return;const o=e.nodeObj,s=(null==(i=t.textContent)?void 0:i.trim())||"";console.log(s),o.topic=""===s?n:s,t.remove(),s!==n&&(e.text.textContent=o.topic,this.linkDiv(),this.bus.fire("operation",{name:"finishEdit",obj:o,origin:n}))})),console.timeEnd("editTopic")},se=function(e){const t=k.createElement("me-epd");return t.expanded=!1!==e,t.className=!1!==e?"minus":"",t},z=document,R="http://www.w3.org/2000/svg",mt=function(e,t){const n=z.createElementNS(R,"path");return n.setAttribute("d",e),n.setAttribute("stroke",t||"#666"),n.setAttribute("fill","none"),n.setAttribute("stroke-width","3"),n},X=function(e){const t=z.createElementNS(R,"svg");return t.setAttribute("class",e),t.setAttribute("overflow","visible"),t},pe=function(){const e=z.createElementNS(R,"line");return e.setAttribute("stroke","#bbb"),e.setAttribute("fill","none"),e.setAttribute("stroke-width","2"),e},gt=function(e,t){const n=z.createElementNS(R,"path");return n.setAttribute("d",e),n.setAttribute("stroke",t||"#555"),n.setAttribute("fill","none"),n.setAttribute("stroke-linecap","square"),n.setAttribute("stroke-width","2"),n},vt=function(e,t){const n={stroke:"rgb(235, 95, 82)",fill:"none","stroke-linecap":"cap","stroke-width":"2"},i=z.createElementNS(R,"g"),o=z.createElementNS(R,"path"),s=z.createElementNS(R,"path");return N(s,{d:t,...n}),N(o,{d:e,...n,"stroke-dasharray":"8,2"}),i.appendChild(o),i.appendChild(s),i},Ae=function(e,t,n){if(console.time("editSummary"),!t)return;const i=document.createElement("div");e.nodes.appendChild(i);const o=t.innerHTML;i.id="input-box",i.textContent=o,i.contentEditable="true",i.spellcheck=!1;const s=t.getAttribute("x")+"px",r=t.getAttribute("y")+"px";i.style.cssText=`min-width:92px;position:absolute;left:${s};top:${r};`;const l=t.getAttribute("text-anchor");i.style.cssText+="end"===l?"transform: translate(-100%, -100%);":"middle"===l?"transform: translate(-50%, -100%);":"transform: translate(0, -100%);",i.focus(),Oe(i),i.addEventListener("keydown",(t=>{t.stopPropagation();const n=t.key;if("Enter"===n||"Tab"===n){if(t.shiftKey)return;t.preventDefault(),i.blur(),e.map.focus()}})),i.addEventListener("blur",(()=>{i&&n(i)})),console.timeEnd("editSummary")};let Pe=He;const bt=function(e){console.time("linkDiv");const t=this.map.querySelector("me-root");this.nodes.style.top=1e4-this.nodes.offsetHeight/2+"px",this.nodes.style.left=1e4-t.offsetLeft-t.offsetWidth/2+"px";const n=this.map.querySelectorAll("me-main > me-wrapper");this.lines.innerHTML="",Pe=2===this.subLinkStyle?wt:He;for(let i=0;i0&&(o+=je(g,d,n))}return o};function yt({x1:e,y1:t,x2:n,y2:i}){return`M ${e} ${t} V ${i>t?i-20:i+20} C ${e} ${i} ${e} ${i} ${n>e?e+20:e-20} ${i} H ${n}`}function xt({x1:e,y1:t,x2:n,y2:i}){return`M ${e} ${t} Q ${e} ${i} ${n} ${i}`}function wt({pT:e,pL:t,pW:n,pH:i,cT:o,cL:s,cW:r,cH:l,direction:a,isFirst:c}){let d;d=c?e+i/2:e+i;const h=o+l;let p=0,m=0,u=0;return"lhs"===a?(p=t+M,m=s,u=s+r):"rhs"===a&&(p=t+n-M,m=s+r,u=s),hd-50?`M ${p} ${d} H ${u} V ${h} H ${m}`:h>=d?`M ${p} ${d} H ${u} V ${h-8} A 8 8 0 0 ${p>m?1:0} ${p>m?u-8:u+8} ${h} H ${m}`:`M ${p} ${d} H ${u} V ${h+8} A 8 8 0 0 ${p>m?0:1} ${p>m?u-8:u+8} ${h} H ${m}`}function He({pT:e,pL:t,pW:n,pH:i,cT:o,cL:s,cW:r,cH:l,direction:a,isFirst:c}){let d=0,h=0;d=c?e+i/2:e+i;const p=o+l;let m=0,u=0,f=0;const g=Math.min(Math.abs(d-p)/800,1.2)*M;return"lhs"===a?(f=t,m=f+M,u=f-M,h=s+M,`M ${m} ${d} C ${f} ${d} ${f+g} ${p} ${u} ${p} H ${h}`):(f=t+n,m=f-M,u=f+M,h=s+r-M,`M ${m} ${d} C ${f} ${d} ${f-g} ${p} ${u} ${p} H ${h}`)}const me={addChild:"插入子节点",addParent:"插入父节点",addSibling:"插入同级节点",removeNode:"删除节点",focus:"专注",cancelFocus:"取消专注",moveUp:"上移",moveDown:"下移",link:"连接",clickTips:"请点击目标节点",summary:"摘要"},ge={cn:me,zh_CN:me,zh_TW:{addChild:"插入子節點",addParent:"插入父節點",addSibling:"插入同級節點",removeNode:"刪除節點",focus:"專注",cancelFocus:"取消專注",moveUp:"上移",moveDown:"下移",link:"連接",clickTips:"請點擊目標節點",summary:"摘要"},en:{addChild:"Add child",addParent:"Add parent",addSibling:"Add sibling",removeNode:"Remove node",focus:"Focus Mode",cancelFocus:"Cancel Focus Mode",moveUp:"Move up",moveDown:"Move down",link:"Link",clickTips:"Please click the target node",summary:"Summary"},ru:{addChild:"Добавить дочерний элемент",addParent:"Добавить родительский элемент",addSibling:"Добавить на этом уровне",removeNode:"Удалить узел",focus:"Режим фокусировки",cancelFocus:"Отменить режим фокусировки",moveUp:"Поднять выше",moveDown:"Опустить ниже",link:"Ссылка",clickTips:"Пожалуйста, нажмите на целевой узел",summary:"Описание"},ja:{addChild:"子ノードを追加する",addParent:"親ノードを追加します",addSibling:"兄弟ノードを追加する",removeNode:"ノードを削除",focus:"集中",cancelFocus:"集中解除",moveUp:"上へ移動",moveDown:"下へ移動",link:"コネクト",clickTips:"ターゲットノードをクリックしてください",summary:"概要"},pt:{addChild:"Adicionar item filho",addParent:"Adicionar item pai",addSibling:"Adicionar item irmao",removeNode:"Remover item",focus:"Modo Foco",cancelFocus:"Cancelar Modo Foco",moveUp:"Mover para cima",moveDown:"Mover para baixo",link:"Link",clickTips:"Favor clicar no item alvo",summary:"Resumo"}};function Et(e,t){const n=(e,t,n)=>{const i=document.createElement("li");return i.id=e,i.innerHTML=`${ee(t)}${ee(n)}`,i},i=ge[e.locale]?e.locale:"en",o=ge[i],s=n("cm-add_child",o.addChild,"tab"),r=n("cm-add_parent",o.addParent,""),l=n("cm-add_sibling",o.addSibling,"enter"),a=n("cm-remove_child",o.removeNode,"delete"),c=n("cm-fucus",o.focus,""),d=n("cm-unfucus",o.cancelFocus,""),h=n("cm-up",o.moveUp,"PgUp"),p=n("cm-down",o.moveDown,"Pgdn"),m=n("cm-down",o.link,""),u=n("cm-down",o.summary,""),f=document.createElement("ul");if(f.className="menu-list",f.appendChild(s),f.appendChild(r),f.appendChild(l),f.appendChild(a),(!t||t.focus)&&(f.appendChild(c),f.appendChild(d)),f.appendChild(h),f.appendChild(p),f.appendChild(u),(!t||t.link)&&f.appendChild(m),t&&t.extend)for(let e=0;e{i.onclick(e)}}const g=document.createElement("div");g.className="context-menu",g.appendChild(f),g.hidden=!0,e.container.append(g);let v=!0;e.container.oncontextmenu=function(t){if(t.preventDefault(),!e.editable)return;const n=t.target;if("ME-TPC"===n.tagName){v="ME-ROOT"===n.parentElement.tagName,v?(c.className="disabled",h.className="disabled",p.className="disabled",r.className="disabled",l.className="disabled",a.className="disabled"):(c.className="",h.className="",p.className="",r.className="",l.className="",a.className=""),e.currentNodes||e.selectNode(n),g.hidden=!1;const i=f.offsetHeight,o=f.offsetWidth;i+t.clientY>window.innerHeight?(f.style.top="",f.style.bottom="0px"):(f.style.bottom="",f.style.top=t.clientY+15+"px"),o+t.clientX>window.innerWidth?(f.style.left="",f.style.right="0px"):(f.style.right="",f.style.left=t.clientX+10+"px")}},g.onclick=e=>{e.target===g&&(g.hidden=!0)},s.onclick=()=>{e.addChild(),g.hidden=!0},r.onclick=()=>{e.insertParent(),g.hidden=!0},l.onclick=()=>{v||(e.insertSibling(),g.hidden=!0)},a.onclick=()=>{v||(e.removeNode(),g.hidden=!0)},c.onclick=()=>{v||(e.focusNode(e.currentNode),g.hidden=!0)},d.onclick=()=>{e.cancelFocus(),g.hidden=!0},h.onclick=()=>{v||(e.moveUpNode(),g.hidden=!0)},p.onclick=()=>{v||(e.moveDownNode(),g.hidden=!0)},m.onclick=()=>{g.hidden=!0;const t=e.currentNode,n=(e=>{const t=document.createElement("div");return t.innerText=e,t.className="tips",t})(o.clickTips);e.container.appendChild(n),e.map.addEventListener("click",(i=>{i.preventDefault(),n.remove();const o=i.target;"ME-PARENT"===o.parentElement.tagName||"ME-ROOT"===o.parentElement.tagName?e.createLink(t,o):console.log("link cancel")}),{once:!0})},u.onclick=()=>{g.hidden=!0,e.createSummary(),e.unselectNodes()}}const Nt=e=>{const t=e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},Ct=e=>{const t=e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},ve=e=>{e.selectNode(e.map.querySelector("me-root>me-tpc"))};function _t(e){const t={13:t=>{t.shiftKey?e.insertBefore():e.insertSibling()},9:()=>{e.addChild()},112:()=>{e.toCenter()},113:()=>{e.beginEdit()},38:t=>{if(t.altKey)e.moveUpNode();else{if(t.metaKey||t.ctrlKey)return e.initSide();e.selectPrevSibling()}},40:t=>{t.altKey?e.moveDownNode():e.selectNextSibling()},37:t=>{var n;if(t.metaKey||t.ctrlKey)return e.initLeft();if(!e.currentNode)return;const i=e.currentNode.nodeObj,o=e.currentNode.offsetParent.offsetParent.parentElement;e.currentNode.nodeObj.root?Nt(e):"rhs"===o.className?null!=(n=i.parent)&&n.root?ve(e):e.selectParent():"lhs"===o.className&&e.selectFirstChild()},39:t=>{var n;if(t.metaKey||t.ctrlKey)return e.initRight();if(!e.currentNode)return;const i=e.currentNode.nodeObj,o=e.currentNode.offsetParent.offsetParent.parentElement;i.root?Ct(e):"lhs"===o.className?null!=(n=i.parent)&&n.root?ve(e):e.selectParent():"rhs"===o.className&&e.selectFirstChild()},33(){e.moveUpNode()},34(){e.moveDownNode()},67:t=>{(t.metaKey||t.ctrlKey)&&(e.waitCopy=e.currentNode)},86:t=>{!e.waitCopy||!e.currentNode||(t.metaKey||t.ctrlKey)&&(e.copyNode(e.waitCopy,e.currentNode),e.waitCopy=null)},187:t=>{if(t.metaKey||t.ctrlKey){if(e.scaleVal>1.6)return;e.scale(e.scaleVal+=.2)}},189:t=>{if(t.metaKey||t.ctrlKey){if(e.scaleVal<.6)return;e.scale(e.scaleVal-=.2)}},48:t=>{(t.metaKey||t.ctrlKey)&&e.scale(1)}};e.map.onkeydown=n=>{if(n.preventDefault(),e.editable&&n.target===n.currentTarget)if(8===n.keyCode||46===n.keyCode)e.currentLink?e.removeLink():e.currentSummary?e.removeSummary(e.currentSummary.summaryObj.id):e.removeNode();else{const e=t[n.keyCode];e&&e(n)}}}function kt(e,t){const n=(e,t)=>{const n=document.createElement("div");return n.id=e,n.innerHTML=``,n},i=n("cm-add_child","zijiedian"),o=n("cm-add_sibling","tongjijiedian-"),s=n("cm-remove_child","shanchu2"),r=n("cm-up","rising"),l=n("cm-down","falling"),a=n("cm-edit","edit"),c=document.createElement("ul");if(c.className="menu-list",t&&t.extend)for(let e=0;e{i.onclick(e)}}const d=document.createElement("mmenu");d.className="mobile-menu",d.appendChild(i),d.appendChild(o),d.appendChild(s),d.appendChild(r),d.appendChild(l),d.appendChild(a),d.hidden=!0,e.container.append(d);let h=!0;e.bus.addListener("unselectNode",(function(){d.hidden=!0})),e.bus.addListener("selectNode",(function(e){d.hidden=!1,h=!!e.root})),d.onclick=e=>{e.target===d&&(d.hidden=!0)},i.onclick=()=>{e.addChild()},o.onclick=()=>{h||e.insertSibling()},s.onclick=()=>{h||e.removeNode()},r.onclick=t=>{h||e.moveUpNode()},l.onclick=t=>{h||e.moveDownNode()},a.onclick=t=>{e.beginEdit()}}const ce=document,St=function(e,t){if(!t)return ae(e),e;const n=e.getElementsByClassName("insert-preview"),i=`insert-preview ${t} show`;if(n.length>0)n[0].className=i;else{const t=ce.createElement("div");t.className=i,e.appendChild(t)}return e},ae=function(e){if(!e)return;const t=e.getElementsByClassName("insert-preview");for(const e of t||[])e.remove()},be=function(e,t){const n=t.parentElement.parentElement.contains(e);return e&&"ME-TPC"===e.tagName&&e!==t&&!n&&!0!==e.nodeObj.root},Lt=function(e){const t=document.createElement("div");return t.className="mind-elixir-ghost",e.map.appendChild(t),t};function Mt(e){let t=null,n=null,i=null;const o=Lt(e);e.map.addEventListener("dragstart",(e=>{var n;const i=e.target;"ME-TPC"===(null==i?void 0:i.tagName)?(t=i,t.parentElement.parentElement.style.opacity="0.5",o.innerHTML=t.innerHTML,null==(n=e.dataTransfer)||n.setDragImage(o,0,0),D.clear()):e.preventDefault()})),e.map.addEventListener("dragend",(async o=>{if(!t)return;t.parentElement.parentElement.style.opacity="1";if(o.target.style.opacity="",!i)return;ae(i);const s=t.nodeObj;switch(n){case"before":e.moveNodeBefore(t,i),e.selectNode(E(s.id));break;case"after":e.moveNodeAfter(t,i),e.selectNode(E(s.id));break;case"in":e.moveNode(t,i)}t=null})),e.map.addEventListener("dragover",Ke((function(e){if(!t)return;ae(i);const o=ce.elementFromPoint(e.clientX,e.clientY-12);if(be(o,t)){i=o;const t=o.getBoundingClientRect().y;e.clientY>t+o.clientHeight?n="after":e.clientY>t+o.clientHeight/2&&(n="in")}else{const o=ce.elementFromPoint(e.clientX,e.clientY+12);if(be(o,t)){i=o;const t=o.getBoundingClientRect().y;e.clientY{if("beginEdit"===o.name)return;t=t.slice(0,n+1);const s=e.getData();t.push({prev:i,currentNodeId:o.obj.id,next:s}),i=s,n=t.length-1,console.log("operation",o.obj.id,t)})),e.undo=function(){if(n>-1){const o=t[n];i=o.prev,e.refresh(o.prev),e.selectNode(E(o.currentNodeId)),n--,console.log("current",i)}},e.redo=function(){if(n{(t.metaKey||t.ctrlKey)&&t.shiftKey&&"Z"===t.key?e.redo():(t.metaKey||t.ctrlKey)&&"z"===t.key&&e.undo()}))}const B=(e,t)=>{const n=document.createElement("span");return n.id=e,n.innerHTML=``,n};function $t(e){const t=document.createElement("div"),n=B("fullscreen","full"),i=B("toCenter","living"),o=B("zoomout","move"),s=B("zoomin","add");return document.createElement("span").innerText="100%",t.appendChild(n),t.appendChild(i),t.appendChild(o),t.appendChild(s),t.className="mind-elixir-toolbar rb",n.onclick=()=>{e.container.requestFullscreen()},i.onclick=()=>{e.toCenter()},o.onclick=()=>{e.scaleVal<.6||e.scale(e.scaleVal-=.2)},s.onclick=()=>{e.scaleVal>1.6||e.scale(e.scaleVal+=.2)},t}function Dt(e){const t=document.createElement("div"),n=B("tbltl","left"),i=B("tbltr","right"),o=B("tblts","side");return t.appendChild(n),t.appendChild(i),t.appendChild(o),t.className="mind-elixir-toolbar lt",n.onclick=()=>{e.initLeft()},i.onclick=()=>{e.initRight()},o.onclick=()=>{e.initSide()},t}function Ot(e){e.container.append($t(e)),e.container.append(Dt(e)) +/*! @viselect/vanilla v3.3.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */}var At=Object.defineProperty,Pt=(e,t,n)=>t in e?At(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t,n)=>(Pt(e,"symbol"!=typeof t?t+"":t,n),n);class jt{constructor(){w(this,"_listeners",new Map),w(this,"on",this.addEventListener),w(this,"off",this.removeEventListener),w(this,"emit",this.dispatchEvent)}addEventListener(e,t){const n=this._listeners.get(e)??new Set;return this._listeners.set(e,n),n.add(t),this}removeEventListener(e,t){var n;return null==(n=this._listeners.get(e))||n.delete(t),this}dispatchEvent(e,...t){let n=!0;for(const i of this._listeners.get(e)??[])n=!1!==i(...t)&&n;return n}unbindAllListeners(){this._listeners.clear()}}const ye=(e,t="px")=>"number"==typeof e?e+t:e;function O({style:e},t,n){if("object"==typeof t)for(const[n,i]of Object.entries(t))void 0!==i&&(e[n]=ye(i));else void 0!==n&&(e[t]=ye(n))}function Be(e){return(t,n,i,o={})=>{t instanceof HTMLCollection||t instanceof NodeList?t=Array.from(t):Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);for(const s of t)for(const t of n)s[e](t,i,{capture:!1,...o});return[t,n,i,o]}}const q=Be("addEventListener"),A=Be("removeEventListener"),Q=e=>{var t;const{clientX:n,clientY:i,target:o}=(null==(t=e.touches)?void 0:t[0])??e;return{x:n,y:i,target:o}};function xe(e,t,n="touch"){switch(n){case"center":{const n=t.left+t.width/2,i=t.top+t.height/2;return n>=e.left&&n<=e.right&&i>=e.top&&i<=e.bottom}case"cover":return t.left>=e.left&&t.top>=e.top&&t.right<=e.right&&t.bottom<=e.bottom;case"touch":return e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}}function F(e,t=document){const n=Array.isArray(e)?e:[e];let i=[];for(let e=0,o=n.length;ematchMedia("(hover: none), (pointer: coarse)").matches,Bt=()=>"safari"in window,zt=e=>{let t,n=-1,i=!1;return{next(...o){t=o,i||(i=!0,n=requestAnimationFrame((()=>{e(...t),i=!1})))},cancel(){cancelAnimationFrame(n),i=!1}}},{abs:j,max:we,min:Ee,ceil:Ne}=Math;class ze extends jt{constructor(e){var t,n,i,o,s;super(),w(this,"_options"),w(this,"_selection",{stored:[],selected:[],touched:[],changed:{added:[],removed:[]}}),w(this,"_area"),w(this,"_clippingElement"),w(this,"_targetElement"),w(this,"_targetRect"),w(this,"_selectables",[]),w(this,"_latestElement"),w(this,"_areaRect",new DOMRect),w(this,"_areaLocation",{y1:0,x2:0,y2:0,x1:0}),w(this,"_singleClick",!0),w(this,"_frame"),w(this,"_scrollAvailable",!0),w(this,"_scrollingActive",!1),w(this,"_scrollSpeed",{x:0,y:0}),w(this,"_scrollDelta",{x:0,y:0}),w(this,"disable",this._bindStartEvents.bind(this,!1)),w(this,"enable",this._bindStartEvents),this._options={selectionAreaClass:"selection-area",selectionContainerClass:void 0,selectables:[],document:window.document,startAreas:["html"],boundaries:["html"],container:"body",...e,behaviour:{overlap:"invert",intersect:"touch",...e.behaviour,startThreshold:null!=(t=e.behaviour)&&t.startThreshold?"number"==typeof e.behaviour.startThreshold?e.behaviour.startThreshold:{x:10,y:10,...e.behaviour.startThreshold}:{x:10,y:10},scrolling:{speedDivider:10,manualSpeed:750,...null==(n=e.behaviour)?void 0:n.scrolling,startScrollMargins:{x:0,y:0,...null==(o=null==(i=e.behaviour)?void 0:i.scrolling)?void 0:o.startScrollMargins}}},features:{range:!0,touch:!0,...e.features,singleTap:{allow:!0,intersect:"native",...null==(s=e.features)?void 0:s.singleTap}}};for(const e of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))"function"==typeof this[e]&&(this[e]=this[e].bind(this));const{document:r,selectionAreaClass:l,selectionContainerClass:a}=this._options;this._area=r.createElement("div"),this._clippingElement=r.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(l),a&&this._clippingElement.classList.add(a),O(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),O(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=zt((e=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",e),this._redrawSelectionArea()})),this.enable()}_bindStartEvents(e=!0){const{document:t,features:n}=this._options,i=e?q:A;i(t,"mousedown",this._onTapStart),n.touch&&i(t,"touchstart",this._onTapStart,{passive:!1})}_onTapStart(e,t=!1){const{x:n,y:i,target:o}=Q(e),{_options:s}=this,{document:r}=this._options,l=o.getBoundingClientRect(),a=F(s.startAreas,s.document),c=F(s.boundaries,s.document);this._targetElement=c.find((e=>xe(e.getBoundingClientRect(),l)));const d=e.composedPath();if(!this._targetElement||!a.find((e=>d.includes(e)))||!c.find((e=>d.includes(e)))||!t&&!1===this._emitEvent("beforestart",e))return;this._areaLocation={x1:n,y1:i,x2:0,y2:0};const h=r.scrollingElement??r.body;this._scrollDelta={x:h.scrollLeft,y:h.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),q(r,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),q(r,["mouseup","touchcancel","touchend"],this._onTapStop),q(r,"scroll",this._onScroll)}_onSingleTap(e){const{singleTap:{intersect:t},range:n}=this._options.features,i=Q(e);let o;if("native"===t)o=i.target;else if("touch"===t){this.resolveSelectables();const{x:e,y:t}=i;o=this._selectables.find((n=>{const{right:i,left:o,top:s,bottom:r}=n.getBoundingClientRect();return eo&&ts}))}if(!o)return;for(this.resolveSelectables();!this._selectables.includes(o);){if(!o.parentElement)return;o=o.parentElement}const{stored:s}=this._selection;if(this._emitEvent("start",e),e.shiftKey&&n&&this._latestElement){const e=this._latestElement,[t,n]=4&e.compareDocumentPosition(o)?[o,e]:[e,o],i=[...this._selectables.filter((e=>4&e.compareDocumentPosition(t)&&2&e.compareDocumentPosition(n))),t,n];this.select(i),this._latestElement=e}else s.includes(o)&&(1===s.length||e.ctrlKey||s.every((e=>this._selection.stored.includes(e))))?this.deselect(o):(this.select(o),this._latestElement=o);this._emitEvent("stop",e)}_delayedTapMove(e){const{container:t,document:n,behaviour:{startThreshold:i}}=this._options,{x1:o,y1:s}=this._areaLocation,{x:r,y:l}=Q(e);if("number"==typeof i&&j(r+l-(o+s))>=i||"object"==typeof i&&j(r-o)>=i.x||j(l-s)>=i.y){if(A(n,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),!1===this._emitEvent("beforedrag",e))return void A(n,["mouseup","touchcancel","touchend"],this._onTapStop);q(n,["mousemove","touchmove"],this._onTapMove,{passive:!1}),O(this._area,"display","block"),F(t,n)[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&&(q(n,"wheel",this._manualScroll,{passive:!1}),this._selectables=this._selectables.filter((e=>this._targetElement.contains(e)))),this._setupSelectionArea(),this._emitEvent("start",e),this._onTapMove(e)}this._handleMoveEvent(e)}_setupSelectionArea(){const{_clippingElement:e,_targetElement:t,_area:n}=this,i=this._targetRect=t.getBoundingClientRect();this._scrollAvailable?(O(e,{top:i.top,left:i.left,width:i.width,height:i.height}),O(n,{marginTop:-i.top,marginLeft:-i.left})):(O(e,{top:0,left:0,width:"100%",height:"100%"}),O(n,{marginTop:0,marginLeft:0}))}_onTapMove(e){const{x:t,y:n}=Q(e),{_scrollSpeed:i,_areaLocation:o,_options:s,_frame:r}=this,{speedDivider:l}=s.behaviour.scrolling,a=this._targetElement;if(o.x2=t,o.y2=n,this._scrollAvailable&&!this._scrollingActive&&(i.y||i.x)){this._scrollingActive=!0;const t=()=>{if(!i.x&&!i.y)return void(this._scrollingActive=!1);const{scrollTop:n,scrollLeft:s}=a;i.y&&(a.scrollTop+=Ne(i.y/l),o.y1-=a.scrollTop-n),i.x&&(a.scrollLeft+=Ne(i.x/l),o.x1-=a.scrollLeft-s),r.next(e),requestAnimationFrame(t)};requestAnimationFrame(t)}else r.next(e);this._handleMoveEvent(e)}_handleMoveEvent(e){const{features:t}=this._options;(t.touch&&matchMedia("(hover: none), (pointer: coarse)").matches||this._scrollAvailable&&"safari"in window)&&e.preventDefault()}_onScroll(){const{_scrollDelta:e,_options:{document:t}}=this,{scrollTop:n,scrollLeft:i}=t.scrollingElement??t.body;this._areaLocation.x1+=e.x-i,this._areaLocation.y1+=e.y-n,e.x=i,e.y=n,this._setupSelectionArea(),this._frame.next(null)}_manualScroll(e){const{manualSpeed:t}=this._options.behaviour.scrolling,n=e.deltaY?e.deltaY>0?1:-1:0,i=e.deltaX?e.deltaX>0?1:-1:0;this._scrollSpeed.y+=n*t,this._scrollSpeed.x+=i*t,this._onTapMove(e),e.preventDefault()}_recalculateSelectionAreaRect(){const{_scrollSpeed:e,_areaLocation:t,_areaRect:n,_targetElement:i,_options:o}=this,{scrollTop:s,scrollHeight:r,clientHeight:l,scrollLeft:a,scrollWidth:c,clientWidth:d}=i,h=this._targetRect,{x1:p,y1:m}=t;let{x2:u,y2:f}=t;const{behaviour:{scrolling:{startScrollMargins:g}}}=o;uh.right-g.x?(e.x=c-a-d?j(h.left+h.width-u-g.x):0,u=u>h.right?h.right:u):e.x=0,fh.bottom-g.y?(e.y=r-s-l?j(h.top+h.height-f-g.y):0,f=f>h.bottom?h.bottom:f):e.y=0;const v=Ee(p,u),b=Ee(m,f),y=we(p,u),x=we(m,f);n.x=v,n.y=b,n.width=y-v,n.height=x-b}_redrawSelectionArea(){const{x:e,y:t,width:n,height:i}=this._areaRect,{style:o}=this._area;o.left=`${e}px`,o.top=`${t}px`,o.width=`${n}px`,o.height=`${i}px`}_onTapStop(e,t){var n;const{document:i,features:o}=this._options,{_singleClick:s}=this;A(i,["mousemove","touchmove"],this._delayedTapMove),A(i,["touchmove","mousemove"],this._onTapMove),A(i,["mouseup","touchcancel","touchend"],this._onTapStop),A(i,"scroll",this._onScroll),this._keepSelection(),e&&s&&o.singleTap.allow?this._onSingleTap(e):!s&&!t&&(this._updateElementSelection(),this._emitEvent("stop",e)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,this._scrollAvailable&&A(i,"wheel",this._manualScroll,{passive:!0}),this._clippingElement.remove(),null==(n=this._frame)||n.cancel(),O(this._area,"display","none")}_updateElementSelection(){const{_selectables:e,_options:t,_selection:n,_areaRect:i}=this,{stored:o,selected:s,touched:r}=n,{intersect:l,overlap:a}=t.behaviour,c="invert"===a,d=[],h=[],p=[];for(let t=0;t!s.includes(e))));const m="keep"===a;for(let e=0;e!s.includes(e)));switch(e.behaviour.overlap){case"drop":t.stored=[...r,...s.filter((e=>!o.includes(e)))];break;case"invert":t.stored=[...r,...s.filter((e=>!i.removed.includes(e)))];break;case"keep":t.stored=[...s,...n.filter((e=>!s.includes(e)))]}}trigger(e,t=!0){this._onTapStart(e,t)}resolveSelectables(){this._selectables=F(this._options.selectables,this._options.document)}clearSelection(e=!0,t=!1){const{selected:n,stored:i,changed:o}=this._selection;o.added=[],o.removed.push(...n,...e?i:[]),t||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection={stored:e?[]:i,selected:[],touched:[],changed:{added:[],removed:[]}}}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}cancel(e=!1){this._onTapStop(null,!e)}destroy(){this.cancel(),this.disable(),this._clippingElement.remove(),super.unbindAllListeners()}select(e,t=!1){const{changed:n,selected:i,stored:o}=this._selection,s=F(e,this._options.document).filter((e=>!i.includes(e)&&!o.includes(e)));return o.push(...s),i.push(...s),n.added.push(...s),n.removed=[],this._latestElement=void 0,t||(this._emitEvent("move",null),this._emitEvent("stop",null)),s}deselect(e,t=!1){const{selected:n,stored:i,changed:o}=this._selection,s=F(e,this._options.document).filter((e=>n.includes(e)||i.includes(e)));s.length&&(this._selection.stored=i.filter((e=>!s.includes(e))),this._selection.selected=n.filter((e=>!s.includes(e))),this._selection.changed.added=[],this._selection.changed.removed.push(...s.filter((e=>!o.removed.includes(e)))),this._latestElement=void 0,t||(this._emitEvent("move",null),this._emitEvent("stop",null)))}}function Rt(e){const t=new ze({selectables:[".map-container me-tpc"],boundaries:[e.container],container:e.container,behaviour:{scrolling:{speedDivider:10,manualSpeed:750,startScrollMargins:{x:10,y:10}}}}).on("beforestart",(({event:e})=>!(0!==e.button||"ME-TPC"===e.target.tagName||"input-box"===e.target.id||"circle"===e.target.className))).on("start",(({event:n})=>{!n.ctrlKey&&!n.metaKey&&(e.unselectNode(),e.unselectNodes(),e.unselectSummary(),e.unselectLink(),t.clearSelection(!0,!0))})).on("move",(({store:{changed:{added:e,removed:t}}})=>{D.moved=!0;for(const t of e)t.classList.add("selected");for(const e of t)e.classList.remove("selected")})).on("stop",(({store:{stored:t}})=>{console.log(t,"stored"),e.selectNodes(t)}))}w(ze,"version","3.3.1");const qt=function(e,t=!0){this.theme=e;const n=this.theme.cssVar,i=Object.keys(n);for(let e=0;ee.nodeObj))),console.timeEnd("selectNodes")}},Yt=function(){if(this.currentNodes)for(const e of this.currentNodes)e.classList.remove("selected");this.currentNodes=null,this.bus.fire("unselectNodes")},It=function(){if(!this.currentNode||"meroot"===this.currentNode.dataset.nodeid)return!1;const e=this.currentNode.parentElement.parentElement.nextSibling;let t;return!!e&&(t=e.firstChild.firstChild,this.selectNode(t),!0)},Xt=function(){if(!this.currentNode||"meroot"===this.currentNode.dataset.nodeid)return!1;const e=this.currentNode.parentElement.parentElement.previousSibling;let t;return!!e&&(t=e.firstChild.firstChild,this.selectNode(t),!0)},Kt=function(){if(!this.currentNode)return;const e=this.currentNode.parentElement.nextSibling;if(e&&e.firstChild){const t=e.firstChild.firstChild.firstChild;this.selectNode(t)}},Ut=function(){if(!this.currentNode||"meroot"===this.currentNode.dataset.nodeid)return;const e=this.currentNode.parentElement.parentElement.parentElement.previousSibling;if(e){const t=e.firstChild;this.selectNode(t)}},Gt=function(){const e=Re(this);return JSON.stringify(e,((e,t)=>{if("parent"!==e||"string"==typeof t)return t}))},Jt=function(){return JSON.parse(this.getDataString())},Qt=function(){const e=Re(this).nodeData;let t="# "+e.topic+"\n\n";return function e(n,i){for(let o=0;oe===i)),r=oe(i),l=n.parentNode;if(0===r){const e=l.parentNode.parentNode;"ME-MAIN"!==e.tagName&&e.previousSibling.children[1].remove()}if(0!==o.length){const e=o[s]||o[s-1];this.selectNode(E(e.id))}else this.selectNode(E(i.parent.id));l.parentNode.remove(),this.linkDiv(),this.bus.fire("operation",{name:"removeNode",obj:i,originIndex:s,originParentId:null==(t=null==i?void 0:i.parent)?void 0:t.id})},Nn=function(e,t){var n;const i=e.nodeObj,o=t.nodeObj,s=null==(n=null==i?void 0:i.parent)?void 0:n.id;if(!1===o.expanded&&(this.expandNode(t,!0),e=E(i.id),t=E(o.id)),!Ge(i,o))return void console.warn("Invalid move");console.time("moveNode"),nt(i,o),T(this.nodeData);const r=e.parentElement,l=t.parentElement;if("ME-PARENT"===l.tagName)if(re(e),l.children[1])l.nextSibling.appendChild(r.parentElement);else{const e=this.createChildren([r.parentElement]);l.appendChild(se(!0)),l.parentElement.insertBefore(e,l.nextSibling)}else"ME-ROOT"===l.tagName&&(qe(this.direction,i),l.nextSibling.appendChild(r.parentElement));this.linkDiv(),this.bus.fire("operation",{name:"moveNode",obj:i,toObj:o,originParentId:s}),console.timeEnd("moveNode")},Cn=function(e,t){var n;const i=e.nodeObj,o=t.nodeObj,s=null==(n=i.parent)?void 0:n.id;it(i,o),T(this.nodeData),re(e);const r=e.parentElement.parentNode;t.parentElement.parentNode.insertAdjacentElement("beforebegin",r),this.linkDiv(),this.bus.fire("operation",{name:"moveNodeBefore",obj:i,toObj:o,originParentId:s})},_n=function(e,t){var n;const i=e.nodeObj,o=t.nodeObj,s=null==(n=i.parent)?void 0:n.id;ot(i,o),T(this.nodeData),re(e);const r=e.parentElement.parentElement;t.parentElement.parentElement.insertAdjacentElement("afterend",r),this.linkDiv(),this.bus.fire("operation",{name:"moveNodeAfter",obj:i,toObj:o,originParentId:s})},kn=function(e){const t=e||this.currentNode;t&&this.editTopic(t)},Sn=function(e,t){e.text.textContent=t,e.nodeObj.topic=t,this.linkDiv()},Ve=Object.freeze(Object.defineProperty({__proto__:null,addChild:bn,beginEdit:kn,copyNode:yn,insertBefore:gn,insertParent:vn,insertSibling:mn,moveDownNode:wn,moveNode:Nn,moveNodeAfter:_n,moveNodeBefore:Cn,moveUpNode:xn,removeNode:En,reshapeNode:pn,setNodeTopic:Sn},Symbol.toStringTag,{value:"Module"})),Ln=function(e){return{dom:e,mousedown:!1,lastX:0,lastY:0,handleMouseMove(e){if(this.mousedown){if(!this.lastX)return this.lastX=e.pageX,void(this.lastY=e.pageY);const t=this.lastX-e.pageX,n=this.lastY-e.pageY;this.cb&&this.cb(t,n),this.lastX=e.pageX,this.lastY=e.pageY}},handleMouseDown(e){this.mousedown=!0},handleClear(e){this.clear()},cb:null,init(e,t){this.cb=t,this.handleClear=this.handleClear.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),e.addEventListener("mousemove",this.handleMouseMove),e.addEventListener("mouseleave",this.handleClear),e.addEventListener("mouseup",this.handleClear),this.dom.addEventListener("mousedown",this.handleMouseDown)},destory(e){e.removeEventListener("mousemove",this.handleMouseMove),e.removeEventListener("mouseleave",this.handleClear),e.removeEventListener("mouseup",this.handleClear),this.dom.removeEventListener("mousedown",this.handleMouseDown)},clear(){this.mousedown=!1,this.lastX=0,this.lastY=0}}},Ce={create:Ln};function ie(e,t,n){const{offsetLeft:i,offsetTop:o}=W(e.nodes,t),s=t.offsetWidth,r=t.offsetHeight,l=i+s/2,a=o+r/2;return{w:s,h:r,cx:l,cy:a,ctrlX:l+n.x,ctrlY:a+n.y}}function V(e){let t,n;const i=(e.cy-e.ctrlY)/(e.ctrlX-e.cx);return i>e.h/e.w||i<-e.h/e.w?e.cy-e.ctrlY<0?(t=e.cx-e.h/2/i,n=e.cy+e.h/2):(t=e.cx+e.h/2/i,n=e.cy-e.h/2):e.cx-e.ctrlX<0?(t=e.cx+e.w/2,n=e.cy-e.w*i/2):(t=e.cx-e.w/2,n=e.cy+e.w*i/2),{x:t,y:n}}const Mn=function(e,t,n,i){const o=document.createElementNS("http://www.w3.org/2000/svg","text");return N(o,{"text-anchor":"middle",x:t+"",y:n+"",fill:i||"#666"}),o.dataset.type="custom-link",o.innerHTML=e,o},Tn=function(e,t,n,i){if(!e||!t)return;const o=performance.now();this.hideLinkController();const s=ie(this,e,n.delta1),r=ie(this,t,n.delta2),{x:l,y:a}=V(s),{ctrlX:c,ctrlY:d}=s,{ctrlX:h,ctrlY:p}=r,{x:m,y:u}=V(r),f=$e(h,p,m,u),g=vt(`M ${l} ${a} C ${c} ${d} ${h} ${p} ${m} ${u}`,`M ${f.x1} ${f.y1} L ${m} ${u} L ${f.x2} ${f.y2}`),v=l/8+3*c/8+3*h/8+m/8,b=a/8+3*d/8+3*p/8+u/8,y=Mn(n.label,v,b,this.theme.cssVar["--color"]);g.appendChild(y),g.linkObj=n,g.dataset.linkid=n.id,this.linkSvgGroup.appendChild(g),i||(this.linkData[n.id]=n,this.currentLink=g,this.showLinkController(n,s,r));const x=performance.now();console.log(`DrawCustomLink Execution time: ${x-o} ms`)},$n=function(e,t){const n={id:U(),label:"Custom Link",from:e.nodeObj.id,to:t.nodeObj.id,delta1:{x:0,y:-200},delta2:{x:0,y:-200}};this.drawCustomLink(e,t,n)},Dn=function(e){let t;if(t=e||this.currentLink,!t)return;this.hideLinkController();const n=t.linkObj.id;delete this.linkData[n],t.remove()},On=function(e){this.currentLink=e;const t=e.linkObj,n=E(t.from),i=E(t.to),o=ie(this,n,t.delta1),s=ie(this,i,t.delta2);this.showLinkController(t,o,s)},An=function(){this.currentLink=null,this.hideLinkController()},Pn=function(){this.linkController.style.display="none",this.P2.style.display="none",this.P3.style.display="none"},jn=function(e,t,n){this.linkController.style.display="initial",this.P2.style.display="initial",this.P3.style.display="initial",this.nodes.appendChild(this.linkController),this.nodes.appendChild(this.P2),this.nodes.appendChild(this.P3);let{x:i,y:o}=V(t),{ctrlX:s,ctrlY:r}=t,{ctrlX:l,ctrlY:a}=n,{x:c,y:d}=V(n);this.P2.style.cssText=`top:${r}px;left:${s}px;`,this.P3.style.cssText=`top:${a}px;left:${l}px;`,N(this.line1,{x1:i+"",y1:o+"",x2:s+"",y2:r+""}),N(this.line2,{x1:l+"",y1:a+"",x2:c+"",y2:d+""}),this.helper1&&(this.helper1.destory(this.map),this.helper2.destory(this.map)),this.helper1=Ce.create(this.P2),this.helper2=Ce.create(this.P3),this.helper1.init(this.map,((n,h)=>{var p;s-=n/this.scaleVal,r-=h/this.scaleVal;const m=V({...t,ctrlX:s,ctrlY:r});i=m.x,o=m.y;const u=i/8+3*s/8+3*l/8+c/8,f=o/8+3*r/8+3*a/8+d/8;this.P2.style.top=r+"px",this.P2.style.left=s+"px",null==(p=this.currentLink)||p.children[0].setAttribute("d",`M ${i} ${o} C ${s} ${r} ${l} ${a} ${c} ${d}`),N(this.currentLink.children[2],{x:u+"",y:f+""}),N(this.line1,{x1:i+"",y1:o+"",x2:s+"",y2:r+""}),e.delta1.x=s-t.cx,e.delta1.y=r-t.cy})),this.helper2.init(this.map,((t,h)=>{var p,m;l-=t/this.scaleVal,a-=h/this.scaleVal;const u=V({...n,ctrlX:l,ctrlY:a});c=u.x,d=u.y;const f=i/8+3*s/8+3*l/8+c/8,g=o/8+3*r/8+3*a/8+d/8,v=$e(l,a,c,d);this.P3.style.top=a+"px",this.P3.style.left=l+"px",null==(p=this.currentLink)||p.children[0].setAttribute("d",`M ${i} ${o} C ${s} ${r} ${l} ${a} ${c} ${d}`),null==(m=this.currentLink)||m.children[1].setAttribute("d",`M ${v.x1} ${v.y1} L ${c} ${d} L ${v.x2} ${v.y2}`),N(this.currentLink.children[2],{x:f+"",y:g+""}),N(this.line2,{x1:l+"",y1:a+"",x2:c+"",y2:d+""}),e.delta2.x=l-n.cx,e.delta2.y=a-n.cy}))};function Hn(){this.linkSvgGroup.innerHTML="";for(const e in this.linkData){const t=this.linkData[e];this.drawCustomLink(E(t.from),E(t.to),t,!0)}this.nodes.appendChild(this.linkSvgGroup)}function Bn(e){if(console.time("editSummary"),!e)return;const t=e.children[2];console.log(t,e),Ae(this,t,(n=>{var i;const o=e.linkObj,s=(null==(i=n.textContent)?void 0:i.trim())||"";o.label=""===s?origin:s,n.remove(),s!==origin&&(t.innerHTML=o.label,this.linkDiv())})),console.timeEnd("editSummary")}function zn(){for(const e in this.linkData){const t=this.linkData[e];(!te(t.from,this.nodeData)||!te(t.to,this.nodeData))&&delete this.linkData[t.id]}}const Rn=Object.freeze(Object.defineProperty({__proto__:null,createLink:$n,drawCustomLink:Tn,editCutsomLinkLabel:Bn,hideLinkController:Pn,removeLink:Dn,renderCustomLink:Hn,selectLink:On,showLinkController:jn,tidyCustomLink:zn,unselectLink:An},Symbol.toStringTag,{value:"Module"})),qn=function(e){var t,n;if(0===e.length)throw new Error("No selected node.");if(1===e.length){const t=e[0].nodeObj,n=e[0].nodeObj.parent;if(!n)throw new Error("Can not select root node.");const i=n.children.findIndex((e=>t===e));return{parent:n.id,start:i,end:i}}let i=0;const o=e.map((e=>{let t=e.nodeObj;const n=[];for(;t.parent;){const e=t.parent,i=e.children,o=null==i?void 0:i.indexOf(t);t=e,n.unshift({node:t,index:o})}return n.length>i&&(i=n.length),n}));let s=0;e:for(;se[s-1].index)).sort(),l=r[0]||0,a=r[r.length-1]||0,c=o[0][s-1].node;if(c.root)throw new Error("Please select nodes in the same main topic.");return{parent:c.id,start:l,end:a}},Fn=function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","g");return t.setAttribute("id",e),t},_e=function(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","path");return N(n,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),n},ke=function(e,t,n,i,o){const s=document.createElementNS("http://www.w3.org/2000/svg","text");return N(s,{"text-anchor":i,x:t+"",y:n+"",fill:o||"#666"}),s.innerHTML=e,s},Vn=e=>E(e).parentElement.parentElement,Wn=function({parent:e,start:t}){var n,i;const o=E(e),s=o.nodeObj;let r;return r=!0===s.root?null==(n=E(s.children[t].id).closest("me-main"))?void 0:n.className:null==(i=o.closest("me-main"))?void 0:i.className,r},We=function(e,t){var n;const{id:i,text:o,parent:s,start:r,end:l}=t,a=e.nodes,c=E(s).nodeObj,d=Wn(t);let h,p,m=1/0,u=0,f=0,g=0;for(let t=r;t<=l;t++){const o=null==(n=c.children)?void 0:n[t];if(!o)return console.warn("Child not found"),e.removeSummary(i),null;const s=Vn(o.id),{offsetLeft:d,offsetTop:h}=W(a,s);t===r&&(f=h),t===l&&(g=h+s.offsetHeight),du&&(u=s.offsetWidth+d)}const v=f+10,b=g+10,y=(v+b)/2,x=e.theme.cssVar["--color"];"lhs"===d?(h=_e(`M ${m+10} ${v} c -5 0 -10 5 -10 10 L ${m} ${b-10} c 0 5 5 10 10 10 M ${m} ${y} h -10`,x),p=ke(o,m-20,y+6,"end",x)):(h=_e(`M ${u-10} ${v} c 5 0 10 5 10 10 L ${u} ${b-10} c 0 5 -5 10 -10 10 M ${u} ${y} h 10`,x),p=ke(o,u+20,y+6,"start",x));const N=Fn("s-"+i);return N.appendChild(h),N.appendChild(p),N.summaryObj=t,e.summarySvg.appendChild(N),N},Yn=function(){let e=[];this.currentNode?e=[this.currentNode]:this.currentNodes&&(e=this.currentNodes);const{parent:t,start:n,end:i}=qn(e),o={id:U(),parent:t,start:n,end:i,text:"summary"},s=We(this,o);this.summaries.push(o),this.editSummary(s)},In=function(e){var t;const n=this.summaries.findIndex((t=>t.id===e));n>-1&&(this.summaries.splice(n,1),null==(t=document.querySelector("#s-"+e))||t.remove())},Xn=function(e){const t=e.children[1].getBBox(),n=document.createElementNS("http://www.w3.org/2000/svg","rect");N(n,{x:t.x-6+"",y:t.y-6+"",width:t.width+12+"",height:t.height+12+"",rx:"3",stroke:this.theme.cssVar["--selected"]||"#4dc4ff","stroke-width":"2",fill:"none"}),n.classList.add("selected"),e.appendChild(n),this.currentSummary=e},Kn=function(){var e,t;null==(t=null==(e=this.currentSummary)?void 0:e.querySelector("rect"))||t.remove(),this.currentSummary=null},Un=function(){this.summarySvg.innerHTML="",this.summaries.forEach((e=>{We(this,e)})),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},Gn=function(e){if(console.time("editSummary"),!e)return;const t=e.childNodes[1];Ae(this,t,(n=>{var i;const o=e.summaryObj,s=(null==(i=n.textContent)?void 0:i.trim())||"";o.text=""===s?origin:s,n.remove(),s!==origin&&(t.innerHTML=o.text,this.linkDiv(),this.bus.fire("operation",{name:"finishEditSummary",obj:o,origin:origin}))})),console.timeEnd("editSummary")},Jn=Object.freeze(Object.defineProperty({__proto__:null,createSummary:Yn,editSummary:Gn,removeSummary:In,renderSummary:Un,selectSummary:Xn,unselectSummary:Kn},Symbol.toStringTag,{value:"Module"}));function Qn(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","svg");return N(n,{version:"1.1",xmlns:"http://www.w3.org/2000/svg",height:e,width:t}),n}function Zn(e,t){return(parseInt(e)-parseInt(t))/2}function ei(e,t,n,i){const o=document.createElementNS("http://www.w3.org/2000/svg","g");let s="";return s=e.text?e.text.textContent:e.childNodes[0].textContent,s.split("\n").forEach(((e,s)=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");N(r,{x:n+parseInt(t.paddingLeft)+"",y:i+parseInt(t.paddingTop)+Zn(t.lineHeight,t.fontSize)*(s+1)+parseFloat(t.fontSize)*(s+1)+"","text-anchor":"start","font-family":t.fontFamily,"font-size":`${t.fontSize}`,"font-weight":`${t.fontWeight}`,fill:`${t.color}`}),r.innerHTML=e,o.appendChild(r)})),o}function ti(e,t,n,i){let o="";o=e.text?e.text.textContent:e.childNodes[0].textContent;const s=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");N(s,{x:n+parseInt(t.paddingLeft)+"",y:i+parseInt(t.paddingTop)+"",width:t.width,height:t.height});const r=document.createElement("div");return N(r,{xmlns:"http://www.w3.org/1999/xhtml",style:`font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`}),r.innerHTML=o,s.appendChild(r),s}function le(e,t,n=!1){const i=getComputedStyle(t),{offsetLeft:o,offsetTop:s}=W(e.nodes,t),r=document.createElementNS("http://www.w3.org/2000/svg","rect");N(r,{x:o+"",y:s+"",rx:i.borderRadius,ry:i.borderRadius,width:i.width,height:i.height,fill:i.backgroundColor,stroke:i.borderColor,"stroke-width":i.borderWidth});const l=document.createElementNS("http://www.w3.org/2000/svg","g");let a;return l.appendChild(r),a=n?ti(t,i,o,s):ei(t,i,o,s),l.appendChild(a),l}function ni(e,t){const n=getComputedStyle(t),{offsetLeft:i,offsetTop:o}=W(e.nodes,t),s=document.createElementNS("http://www.w3.org/2000/svg","a"),r=document.createElementNS("http://www.w3.org/2000/svg","text");return N(r,{x:i+"",y:o+parseInt(n.fontSize)+"","text-anchor":"start","font-family":n.fontFamily,"font-size":`${n.fontSize}`,"font-weight":`${n.fontWeight}`,fill:`${n.color}`}),r.innerHTML=t.textContent,s.appendChild(r),s.setAttribute("href",t.href),s}const Z=100,ii='',Ye=(e,t=!1)=>{var n,i,o;const s=e.nodes,r=s.offsetHeight+200,l=s.offsetWidth+200,a=Qn(r+"px",l+"px"),c=document.createElementNS("http://www.w3.org/2000/svg","svg"),d=document.createElementNS("http://www.w3.org/2000/svg","rect");N(d,{x:"0",y:"0",width:`${l}`,height:`${r}`,fill:e.theme.cssVar["--bgcolor"]}),a.appendChild(d),s.querySelectorAll(".subLines").forEach((e=>{const t=e.cloneNode(!0),{offsetLeft:n,offsetTop:i}=W(s,e.parentElement);t.setAttribute("x",`${n}`),t.setAttribute("y",`${i}`),c.appendChild(t)}));const h=null==(n=s.querySelector(".lines"))?void 0:n.cloneNode(!0);h&&c.appendChild(h);const p=null==(i=s.querySelector(".topiclinks"))?void 0:i.cloneNode(!0);p&&c.appendChild(p);const m=null==(o=s.querySelector(".summary"))?void 0:o.cloneNode(!0);return m&&c.appendChild(m),s.querySelectorAll("me-tpc").forEach((n=>{c.appendChild(le(e,n,!t))})),s.querySelectorAll(".tags > span").forEach((t=>{c.appendChild(le(e,t))})),s.querySelectorAll(".icons > span").forEach((t=>{c.appendChild(le(e,t))})),s.querySelectorAll(".hyper-link").forEach((t=>{c.appendChild(ni(e,t))})),N(c,{x:Z+"",y:Z+"",overflow:"visible"}),a.appendChild(c),ii+a.outerHTML};function oi(e){return new Promise(((t,n)=>{const i=new FileReader;i.onload=e=>{t(e.target.result)},i.onerror=e=>{n(e)},i.readAsDataURL(e)}))}const si=function(e=!1){const t=Ye(this,e);return new Blob([t],{type:"image/svg+xml"})},ri=async function(e=!1){const t=Ye(this,e),n=new Blob([t],{type:"image/svg+xml"}),i=await oi(n);return new Promise(((e,t)=>{const n=new Image;n.setAttribute("crossOrigin","anonymous"),n.onload=()=>{const t=document.createElement("canvas");t.width=n.width,t.height=n.height,t.getContext("2d").drawImage(n,0,0),t.toBlob(e,"image/png",1)},n.src=i,n.onerror=t}))},li=Object.freeze(Object.defineProperty({__proto__:null,exportPng:ri,exportSvg:si},Symbol.toStringTag,{value:"Module"}));function ci(e,t){return async function(...n){const i=this.before[t];i&&!await i.apply(this,n)||e.apply(this,n)}}const Se=Object.keys(Ve),Ie={};for(let e=0;e({nodeData:{id:U(),topic:e||"new topic",root:!0,children:[]},linkData:{}});export{$ as default}; +//# sourceMappingURL=/sm/6a959570e2bb170e3017d39ba4eb076aad9664e7b5c74b933089ff2e79bfe2e3.map \ No newline at end of file diff --git a/src/mindmap-elixir/mind-elixir.min.js.meta b/src/mindmap-elixir/mind-elixir.min.js.meta index b33f52d..5b6dd2a 100644 --- a/src/mindmap-elixir/mind-elixir.min.js.meta +++ b/src/mindmap-elixir/mind-elixir.min.js.meta @@ -1,4 +1,5 @@ title: $:/plugins/Gk0Wk/mindmap-elixir/elixir.min.js type: application/javascript module-type: library +version: 3.2.6 Modern.TiddlyDev#Minify: false diff --git a/src/mindmap-elixir/widget.ts b/src/mindmap-elixir/widget.ts index 7168e44..40b9e51 100644 --- a/src/mindmap-elixir/widget.ts +++ b/src/mindmap-elixir/widget.ts @@ -192,112 +192,119 @@ class ElixirWidget extends Widget { ); } catch {} - // Configure - this.draggable = dataAndOptions.options?.draggable ?? true; - this.contextMenu = dataAndOptions.options?.contextMenu ?? true; - this.toolBar = dataAndOptions.options?.toolBar ?? true; - this.nodeMenu = dataAndOptions.options?.nodeMenu ?? true; - this.keypress = dataAndOptions.options?.keypress ?? true; - this.locale = dataAndOptions.options?.locale ?? 'auto'; - this.overflowHidden = dataAndOptions.options?.overflowHidden ?? false; - this.allowUndo = dataAndOptions.options?.allowUndo ?? false; - this.primaryLinkStyle = dataAndOptions.options?.primaryLinkStyle ?? '1'; - // Style - this.loadTheme(dataAndOptions.data?.theme ?? {}); - this.locale_ = this.locale === 'auto' ? this.locale_ : this.locale; - - // Data Loading - const data = - dataAndOptions.data ?? (MindElixir as any).new(i18nMap[this.locale_].new); - data.theme = this.genTheme(); - - // 渲染导图 - const container = $tw.utils.domMaker(this.containerNodeTag, { - class: `gk0wk-mind-elixir-container ${this.containerNodeClass}`, - style: { - height: this.containerHeight, - width: this.containerWidth, - }, - }); - parent.insertBefore(container, nextSibling); - this.domNodes.push(container); - this.elixirInstance = new MindElixir({ - el: container, - data: undefined as any, - locale: this.locale_, - draggable: this.draggable, - contextMenu: this.contextMenu, - toolBar: this.toolBar, - keypress: this.keypress, - allowUndo: this.allowUndo, - overflowHidden: this.overflowHidden, - primaryLinkStyle: this.primaryLinkStyle, - contextMenuOption: { - link: true, - focus: true, - }, - } as any); - if (this.nodeMenu) { - (this.elixirInstance as any).install(nodeMenuPlugin); - } - (this.elixirInstance as any).init(data); - - // 导图变更时保存 - this.elixirInstance.bus.addListener('operation', (operation: any) => { - if ( - { - insertSibling: true, - addChild: true, - removeNode: true, - moveNode: true, - finishEdit: true, - reshapeNode: true, - }[operation.name as string] - ) { - this.saveTiddler(); + try { + // Configure + this.draggable = dataAndOptions.options?.draggable ?? true; + this.contextMenu = dataAndOptions.options?.contextMenu ?? true; + this.toolBar = dataAndOptions.options?.toolBar ?? true; + this.nodeMenu = dataAndOptions.options?.nodeMenu ?? true; + this.keypress = dataAndOptions.options?.keypress ?? true; + this.locale = dataAndOptions.options?.locale ?? 'auto'; + this.overflowHidden = dataAndOptions.options?.overflowHidden ?? false; + this.allowUndo = dataAndOptions.options?.allowUndo ?? false; + this.primaryLinkStyle = dataAndOptions.options?.primaryLinkStyle ?? '1'; + // Style + this.loadTheme(dataAndOptions.data?.theme ?? {}); + this.locale_ = this.locale === 'auto' ? this.locale_ : this.locale; + + // Data Loading + const data = + dataAndOptions.data ?? + (MindElixir as any).new(i18nMap[this.locale_].new); + data.theme = this.genTheme(); + + // 渲染导图 + const container = $tw.utils.domMaker(this.containerNodeTag, { + class: `gk0wk-mind-elixir-container ${this.containerNodeClass}`, + style: { + height: this.containerHeight, + width: this.containerWidth, + }, + }); + parent.insertBefore(container, nextSibling); + this.domNodes.push(container); + this.elixirInstance = new MindElixir({ + el: container, + data: undefined as any, + locale: this.locale_, + draggable: this.draggable, + contextMenu: this.contextMenu, + toolBar: this.toolBar, + keypress: this.keypress, + allowUndo: this.allowUndo, + overflowHidden: this.overflowHidden, + primaryLinkStyle: this.primaryLinkStyle, + contextMenuOption: { + link: true, + focus: true, + }, + } as any); + if (this.nodeMenu) { + (this.elixirInstance as any).install(nodeMenuPlugin); } - }); - (globalThis as any).i = this.elixirInstance; - - // 添加其他菜单的按钮 - const toolbar = container.querySelector( - '.map-container > .mind-elixir-toolbar.rb', - )!; - toolbar.append(this.getThemeButton()); - toolbar.append(this.getExportButton()); - toolbar.appendChild(this.getSettingButton()); - - // 让节点菜单在最前 - ( - container.querySelector('.map-container > .node-menu') as HTMLDivElement - ).style.zIndex = '1000'; - ( - container.querySelector('.map-container > .node-menu') as HTMLDivElement - ).style.color = 'black'; - - // 有些图标自己有颜色,需要清除 - if (initIcon === false) { - const clearFill = (s: Element) => { - s.parentElement!.querySelectorAll('symbol > path').forEach(path => - path.setAttribute('fill', 'inhert'), - ); - initIcon = true; - }; - // 可能需要延迟检测 - setTimeout(() => { - const s = document.querySelector('body > svg > symbol#icon-right'); - if (s?.parentElement) { - clearFill(s); - } else { - const id = setInterval(() => { - const s = document.querySelector('body > svg > symbol#icon-right'); - if (s?.parentElement) { - clearFill(s); - clearInterval(id); - } - }, 100); + (this.elixirInstance as any).init(data); + + // 导图变更时保存 + this.elixirInstance.bus.addListener('operation', (operation: any) => { + if ( + { + insertSibling: true, + addChild: true, + removeNode: true, + moveNode: true, + finishEdit: true, + reshapeNode: true, + }[operation.name as string] + ) { + this.saveTiddler(); } - }, 0); + }); + (globalThis as any).i = this.elixirInstance; + + // 添加其他菜单的按钮 + const toolbar = container.querySelector( + '.map-container > .mind-elixir-toolbar.rb', + )!; + toolbar.append(this.getThemeButton()); + toolbar.append(this.getExportButton()); + toolbar.appendChild(this.getSettingButton()); + + // 让节点菜单在最前 + ( + container.querySelector('.map-container > .node-menu') as HTMLDivElement + ).style.zIndex = '1000'; + ( + container.querySelector('.map-container > .node-menu') as HTMLDivElement + ).style.color = 'black'; + + // 有些图标自己有颜色,需要清除 + if (initIcon === false) { + const clearFill = (s: Element) => { + s.parentElement!.querySelectorAll('symbol > path').forEach(path => + path.setAttribute('fill', 'inhert'), + ); + initIcon = true; + }; + // 可能需要延迟检测 + setTimeout(() => { + const s = document.querySelector('body > svg > symbol#icon-right'); + if (s?.parentElement) { + clearFill(s); + } else { + const id = setInterval(() => { + const s = document.querySelector( + 'body > svg > symbol#icon-right', + ); + if (s?.parentElement) { + clearFill(s); + clearInterval(id); + } + }, 100); + } + }, 0); + } + } catch (e) { + console.error(e); } } @@ -396,94 +403,96 @@ class ElixirWidget extends Widget { }); themeIcon.innerHTML = this.themeButtonText; const svg = themeIcon.firstChild as SVGElement; - let menuContainerHidden = true; - svg.onclick = () => { - menuContainerHidden = !menuContainerHidden; - menuContainer.style.display = menuContainerHidden ? 'none' : 'flex'; - if (menuContainerHidden) { - menuContainer.innerHTML = ''; - } else { - // Export Themes - const btn = $tw.utils.domMaker('button', { - class: 'gk0wk-elixir-export-menu-item', - style: { - width: '100%', - cursor: 'pointer', - padding: '10px', - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - textAlign: 'center', - background: '#57d674', - color: 'black', - fontWeight: '750', - }, - text: i18nMap[this.locale_].exportTheme ?? 'Export Theme', - }); - btn.onclick = () => { - const t = Math.random().toString(16).replace('0.', ''); - // eslint-disable-next-line node/prefer-global/url - const url = URL.createObjectURL( - new Blob( - [ + if (svg) { + let menuContainerHidden = true; + svg.onclick = () => { + menuContainerHidden = !menuContainerHidden; + menuContainer.style.display = menuContainerHidden ? 'none' : 'flex'; + if (menuContainerHidden) { + menuContainer.innerHTML = ''; + } else { + // Export Themes + const btn = $tw.utils.domMaker('button', { + class: 'gk0wk-elixir-export-menu-item', + style: { + width: '100%', + cursor: 'pointer', + padding: '10px', + overflow: 'hidden', + whiteSpace: 'nowrap', + textOverflow: 'ellipsis', + textAlign: 'center', + background: '#57d674', + color: 'black', + fontWeight: '750', + }, + text: i18nMap[this.locale_].exportTheme ?? 'Export Theme', + }); + btn.onclick = () => { + const t = Math.random().toString(16).replace('0.', ''); + // eslint-disable-next-line node/prefer-global/url + const url = URL.createObjectURL( + new Blob( [ - `title: $:/plugins/Gk0Wk/mindmap-elixir/theme/users/${t}`, - `caption: theme-${t}`, - 'tags: $:/mindmap-elixir/themes', - 'type: application/json', - '', - JSON.stringify( - this.elixirInstance!.getData().theme, - undefined, - 2, - ), - ].join('\n'), - ], - { type: 'text/vnd.tiddlywiki' }, - ), - ); - const a = document.createElement('a'); - a.href = url; - a.download = `elixir-theme-${t}.tid`; - a.click(); - // eslint-disable-next-line node/prefer-global/url - URL.revokeObjectURL(url); - }; - menuContainer.appendChild(btn); - // Themes - $tw.wiki - .getTiddlersWithTag('$:/mindmap-elixir/themes') - .forEach(tiddler => { - const btn = $tw.utils.domMaker('button', { - class: 'gk0wk-elixir-export-menu-item', - style: { - width: '100%', - cursor: 'pointer', - padding: '10px', - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - textAlign: 'center', - borderTop: '1px solid #7779', - }, - text: ($tw.wiki.getTiddler(tiddler)?.fields?.caption || - tiddler.split('/').pop() || - tiddler) as string, + [ + `title: $:/plugins/Gk0Wk/mindmap-elixir/theme/users/${t}`, + `caption: theme-${t}`, + 'tags: $:/mindmap-elixir/themes', + 'type: application/json', + '', + JSON.stringify( + this.elixirInstance!.getData().theme, + undefined, + 2, + ), + ].join('\n'), + ], + { type: 'text/vnd.tiddlywiki' }, + ), + ); + const a = document.createElement('a'); + a.href = url; + a.download = `elixir-theme-${t}.tid`; + a.click(); + // eslint-disable-next-line node/prefer-global/url + URL.revokeObjectURL(url); + }; + menuContainer.appendChild(btn); + // Themes + $tw.wiki + .getTiddlersWithTag('$:/mindmap-elixir/themes') + .forEach(tiddler => { + const btn = $tw.utils.domMaker('button', { + class: 'gk0wk-elixir-export-menu-item', + style: { + width: '100%', + cursor: 'pointer', + padding: '10px', + overflow: 'hidden', + whiteSpace: 'nowrap', + textOverflow: 'ellipsis', + textAlign: 'center', + borderTop: '1px solid #7779', + }, + text: ($tw.wiki.getTiddler(tiddler)?.fields?.caption || + tiddler.split('/').pop() || + tiddler) as string, + }); + btn.onclick = () => { + const data = $tw.wiki.getTiddlerData(tiddler); + this.loadTheme(data); + this.saveTiddler(true); + }; + menuContainer.appendChild(btn); }); - btn.onclick = () => { - const data = $tw.wiki.getTiddlerData(tiddler); - this.loadTheme(data); - this.saveTiddler(true); - }; - menuContainer.appendChild(btn); - }); - } - }; - svg.removeAttribute('width'); - svg.removeAttribute('height'); - svg.removeAttribute('class'); - svg.classList.add('icon'); - svg.ariaHidden = 'true'; + } + }; + svg.removeAttribute('width'); + svg.removeAttribute('height'); + svg.removeAttribute('class'); + svg.classList.add('icon'); + svg.ariaHidden = 'true'; + } themeIcon.appendChild(menuContainer); return themeIcon; } diff --git a/src/sidebar-resizer/hook.ts b/src/sidebar-resizer/hook.ts index 21c3fce..6d15520 100755 --- a/src/sidebar-resizer/hook.ts +++ b/src/sidebar-resizer/hook.ts @@ -1,4 +1,8 @@ -if ($tw.browser) { +export const name = 'gk0wk-sidebar-resizer'; +export const platforms = ['browser']; +export const after = ['render']; +export const synchronous = true; +export const startup = () => { let canResize = false; let sidebarResizerNode: HTMLElement | null = null; const { body } = document; @@ -103,4 +107,4 @@ if ($tw.browser) { body.addEventListener('touchmove', drag, true); } }); -} +}; diff --git a/src/sidebar-resizer/plugin.info b/src/sidebar-resizer/plugin.info index 5c5f4de..e524a7f 100755 --- a/src/sidebar-resizer/plugin.info +++ b/src/sidebar-resizer/plugin.info @@ -1,5 +1,5 @@ { - "version": "0.0.5", + "version": "0.0.6", "type": "application/json", "title": "$:/plugins/Gk0Wk/sidebar-resizer", "plugin-type": "plugin",