diff --git a/.github/ISSUE_TEMPLATE/bug-report.cn.yaml b/.github/ISSUE_TEMPLATE/bug-report.cn.yaml new file mode 100644 index 0000000..db1eda6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.cn.yaml @@ -0,0 +1,89 @@ +name: 报告 Bug +description: 向我们报告 Bug。 +title: "[Bug]: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + 投我以木桃,报之以琼瑶。 + 填写之前请阅读 [nc-ai | 关于反馈](https://nc-ai.cn/article/cxnqr517/#%E5%85%B3%E4%BA%8E%E5%8F%8D%E9%A6%88) + - type: dropdown + id: os + attributes: + label: 操作系统 + description: 您在什么操作系统上运行? + options: + - Windows + - Mac + - Linux + - 其他 + default: 0 + validations: + required: true + - type: dropdown + id: chip + attributes: + label: 芯片架构 + description: 您在什么架构的芯片上运行? + options: + - x86 + - arm + - loongson + - 其他 + default: 0 + validations: + required: true + - type: dropdown + id: connect + attributes: + label: 运行方式 + description: 您采用何种方式运行? + options: + - 桌面运行 + - SSH 远程连接 + - WSL2 + - 虚拟机 + - 其他 + default: 0 + validations: + required: true + - type: input + id: vscode-version + attributes: + label: Vscode / Vscodium 版本 + placeholder: "1.96.2" + validations: + required: true + - type: input + id: dide-version + attributes: + label: Digital IDE 版本 + placeholder: "0.4.0" + validations: + required: true + - type: textarea + id: meet-question + attributes: + label: 你遇到的问题 + validations: + required: true + - type: textarea + id: expect + attributes: + label: 你希望的运行结果 + validations: + required: false + - type: textarea + id: actual + attributes: + label: 实际的运行结果 + validations: + required: false + - type: textarea + id: log + attributes: + label: 运行日志 + render: shell + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml new file mode 100644 index 0000000..416ed51 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yaml @@ -0,0 +1,89 @@ +name: Bug Report +description: Report a bug to us. +title: "[Bug]: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + "You give me a peach, I repay you with a jade." + Please read [nc-ai | About Feedback](https://nc-ai.cn/article/cxnqr517/#%E5%85%B3%E4%BA%8E%E5%8F%8D%E9%A6%88) before filling out this form. + - type: dropdown + id: os + attributes: + label: Operating System + description: What operating system are you running on? + options: + - Windows + - Mac + - Linux + - Other + default: 0 + validations: + required: true + - type: dropdown + id: chip + attributes: + label: Chip Architecture + description: What chip architecture are you running on? + options: + - x86 + - arm + - loongson + - Other + default: 0 + validations: + required: true + - type: dropdown + id: connect + attributes: + label: Running Method + description: How are you running the software? + options: + - Desktop + - SSH Remote Connection + - WSL2 + - Virtual Machine + - Other + default: 0 + validations: + required: true + - type: input + id: vscode-version + attributes: + label: Vscode / Vscodium Version + placeholder: "1.96.2" + validations: + required: true + - type: input + id: dide-version + attributes: + label: Digital IDE Version + placeholder: "0.4.0" + validations: + required: true + - type: textarea + id: meet-question + attributes: + label: Issue You Encountered + validations: + required: true + - type: textarea + id: expect + attributes: + label: Expected Result + validations: + required: false + - type: textarea + id: actual + attributes: + label: Actual Result + validations: + required: false + - type: textarea + id: log + attributes: + label: Runtime Log + render: shell + validations: + required: false diff --git a/.gitignore b/.gitignore index 431fed4..3e061ea 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,13 @@ parser_stuck.v out-js/ *.pyc *.pyd +*.zip resources/hdlParser/parser.js resources/hdlParser/parser.wasm resources/dide-viewer/view/* resources/dide-lsp/server/* -resources/dide-lsp/static/* \ No newline at end of file +resources/dide-lsp/static/* +resources/dide-netlist/static/* +resources/dide-netlist/view/* +scripts/update-icon.py +scripts/vscode-package.py \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 4042c3f..db4238b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,17 +1,20 @@ -// Place your settings in this file to overwrite default and user settings. { "files.exclude": { - "out": false // set this to true to hide the "out" folder with the compiled JS files + "out": false }, "search.exclude": { - "out": true // set this to false to include "out" folder in search results + "out": true }, - // Turn off tsc task auto detection since we have the necessary tasks as npm scripts "typescript.tsc.autoDetect": "off", "i18n-haru.root": "l10n", "i18n-haru.main": "zh-cn", +<<<<<<< HEAD "i18n-haru.line-hint-max-length": 20, "i18n-haru.custom-language-mapping": { "en": "l10n/bundle.l10n.json" } +======= + "i18n-haru.display": "zh-cn", + "i18n-haru.line-hint-max-length": 20 +>>>>>>> 9fe382446ba6ff3efd72dae6924a0c493b950c52 } \ No newline at end of file diff --git a/.vscodeignore b/.vscodeignore index feb3459..cb616f7 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -2,6 +2,8 @@ .gitignore **/.gitignore .git +.github +doc **/*.map .eslintrc.json dist @@ -13,8 +15,12 @@ script resources/**/*.js resources/**/*.d.ts resources/**/*.wasm +resources/**/*.tar.gz resources/dide-lsp/server tsconfig.json design lib -*.vcd \ No newline at end of file +*.vcd +*.zip +figures +scripts \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 050b9c3..10a021a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,17 +4,17 @@ All notable changes to the "digital-ide" extension will be documented in this fi Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. +## [0.4.0] +- 新的 VCD 波形渲染器 +- 新的 Netlist 渲染器 +- 新的 LSP 后端 ## [0.3.4] - 2024-08-28 Feature -wave 渲染器 https://nc-ai-lab.feishu.cn/wiki/K7gVwwU02iNMc8krIHucPwhqnff#share-NjuodrRQAoxEotxRicOc7BXDnOh - - - ---- +VCA wave 渲染器 https://nc-ai-lab.feishu.cn/wiki/K7gVwwU02iNMc8krIHucPwhqnff#share-NjuodrRQAoxEotxRicOc7BXDnOh ## [0.3.3] - 2024-02-05 @@ -33,7 +33,6 @@ Bug 修复 - 点击 Refuse 会在用户工作区创建 json 文件 ---- ## [0.3.2] - 2023-11-01 Feature @@ -151,4 +150,4 @@ Bug 修复 ## [0.0.1] - 2020-02-15 -- Initial Release \ No newline at end of file +- Initial Release diff --git a/README.md b/README.md index 48d0f1a..4cd6598 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,53 @@ -
Digital IDE
| All in one vscode
plugin for Verilog/VHDL development
-
-
+
+[Document (New)](https://nc-ai.cn/en/) | [中文文档 (New)](https://nc-ai.cn/) | [Bilibili Video](https://www.bilibili.com/video/BV1L19HYcEz6/?spm_id_from=333.1387.list.card_archive.click) | [Github](https://github.com/Digital-EDA/Digital-IDE)
+
+


-
+
-- [Document (New)](https://sterben.nitcloud.cn/)
-- [中文文档 (New)](https://sterben.nitcloud.cn/zh/)
-- [Video](https://www.bilibili.com/video/BV1t14y1179V/?spm_id_from=333.999.0.0)
+`include
加入或去除后,无法通过仿真编译的 bug (没有更新 instance 的 instModPathStatus 属性)
-- 修复其他已知 bug
+
----
+**New VCD Renderer**: Added top toolbar, system beacon, and other components; supports drag-and-drop and grouping of selected signals in the left panel, as well as selecting multiple signals by holding Shift for addition and deletion; supports establishing a relative coordinate system based on system beacons; the top toolbar supports base conversion for displayed numbers of selected signals, rendering mode switching, and rendering signals as analog values.
-## develop
+
-```bash
-python script/command/make_package.py
-<<<<<<< HEAD
-```
+- Brand New Netlist Renderer
-## library更新
+
-library的更新不会随着Digital-IDE的git一起保存,是专门去拉取更新的,但是打包要一起打包进插件之中。
-=======
-```
->>>>>>> 199b7a8af3ea01baea4b20c89273a490dc0dc9d2
+## New 0.4.2
+- Added comprehensive support for VHDL & SV (file tree, LSP, etc.)
+- Added workspace icons for languages or generated files such as Verilog, VHDL, XDC, TCL, VVP, VCD, etc.
+- Added support for Vivado, ModelSim, and Verilator. Users can use these third-party tools for simulation and auto-correction by setting `function.lsp.linter.vhdl.diagnostor` (for VHDL) and `function.lsp.linter.vlog.diagnostor` (for Verilog).
+- Added LSP and syntax highlighting support for scripts like TCL, XDC, and VVP.
+
+## Changes
+- Display the plugin's working status in the status bar at the bottom of VSCode, making it easier for users to understand the current settings.
+- The bottom-right corner of the status bar now shows the currently selected linter and whether it is functioning properly.
+- Optimized project configuration directory.
+- Improved auto-completion performance.
+
+## Bug Fixes
+- Fixed a bug where comments on `input` and `output` were not displayed correctly in the documentation.
+- Fixed a bug in the Icarus Verilog simulation feature where duplicate paths were included as compilation parameters.
+- Fixed a bug in the Icarus Verilog simulation feature where adding or removing include
would cause simulation compilation to fail (the `instModPathStatus` property of the instance was not updated).
+- Fixed simulation issues with Icarus Verilog version 12
+- Fixed the issue of being unable to import Block Design (BD) during Vivado project generation
+- Fixed the issue where libraries in custom mode could not be imported into Vivado
+- Fixed other known bugs.
diff --git a/config/ignore.configuration.json b/config/ignore.configuration.json
new file mode 100644
index 0000000..5e14c1d
--- /dev/null
+++ b/config/ignore.configuration.json
@@ -0,0 +1,16 @@
+{
+ "comments": {
+ "lineComment": "#"
+ },
+ "brackets": [
+ ["{", "}"],
+ ["[", "]"],
+ ["(", ")"]
+ ],
+ "autoClosingPairs": [
+ {"open":"(", "close":")", "notIn":["string", "comment"]},
+ {"open":"[", "close":"]", "notIn":["string", "comment"]},
+ {"open":"{", "close":"}", "notIn":["string", "comment"]},
+ {"open":"\"", "close":"\"", "notIn":["string", "comment"]}
+ ]
+}
\ No newline at end of file
diff --git a/config/ys.configuration.json b/config/ys.configuration.json
new file mode 100644
index 0000000..5e14c1d
--- /dev/null
+++ b/config/ys.configuration.json
@@ -0,0 +1,16 @@
+{
+ "comments": {
+ "lineComment": "#"
+ },
+ "brackets": [
+ ["{", "}"],
+ ["[", "]"],
+ ["(", ")"]
+ ],
+ "autoClosingPairs": [
+ {"open":"(", "close":")", "notIn":["string", "comment"]},
+ {"open":"[", "close":"]", "notIn":["string", "comment"]},
+ {"open":"{", "close":"}", "notIn":["string", "comment"]},
+ {"open":"\"", "close":"\"", "notIn":["string", "comment"]}
+ ]
+}
\ No newline at end of file
diff --git a/design/lsp.drawio b/design/lsp.drawio
deleted file mode 100644
index d39d93f..0000000
--- a/design/lsp.drawio
+++ /dev/null
@@ -1,120 +0,0 @@
-=0&&d[f]<=1&&g.push(d[f]);g.push(1),g.push(0);for(var v,y,m,b=-1,x=0;x t&&(s=t),l0){for(var A=n.pop(),C=0;C=a?m(t,c):0===h?c:x(t,r,r+u)}var E=!1;function T(){E=!0,e===t&&n===r||b()}var _=function(i){return E||T(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};_.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var A="generateBezier("+[e,t,n,r]+")";return _.toString=function(){return A},_}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var oc=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,.5*r,i),o=t(n,.5*r,a),s=t(n,r,o),l=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),u=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,i){var a,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,h=1e-4,d=.016;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,l.tension=t,l.friction=r,a=null!==i,a?(c=e(t,r),o=c/i*d):o=d;;)if(s=n(s||l,o),u.push(1+s.x),c+=16,!(Math.abs(s.x)>h&&Math.abs(s.v)>h))break;return a?function(e){return u[e*(u.length-1)|0]}:c}}(),sc=function(e,t,n,r){var i=ac(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},lc={linear:function(e,t,n){return e+(t-e)*n},ease:sc(.25,.1,.25,1),"ease-in":sc(.42,0,1,1),"ease-out":sc(0,0,.58,1),"ease-in-out":sc(.42,0,.58,1),"ease-in-sine":sc(.47,0,.745,.715),"ease-out-sine":sc(.39,.575,.565,1),"ease-in-out-sine":sc(.445,.05,.55,.95),"ease-in-quad":sc(.55,.085,.68,.53),"ease-out-quad":sc(.25,.46,.45,.94),"ease-in-out-quad":sc(.455,.03,.515,.955),"ease-in-cubic":sc(.55,.055,.675,.19),"ease-out-cubic":sc(.215,.61,.355,1),"ease-in-out-cubic":sc(.645,.045,.355,1),"ease-in-quart":sc(.895,.03,.685,.22),"ease-out-quart":sc(.165,.84,.44,1),"ease-in-out-quart":sc(.77,0,.175,1),"ease-in-quint":sc(.755,.05,.855,.06),"ease-out-quint":sc(.23,1,.32,1),"ease-in-out-quint":sc(.86,0,.07,1),"ease-in-expo":sc(.95,.05,.795,.035),"ease-out-expo":sc(.19,1,.22,1),"ease-in-out-expo":sc(1,0,0,1),"ease-in-circ":sc(.6,.04,.98,.335),"ease-out-circ":sc(.075,.82,.165,1),"ease-in-out-circ":sc(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return lc.linear;var r=oc(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":sc};function uc(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function cc(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function hc(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=cc(e,i),s=cc(t,i);if(S(o)&&S(s))return uc(a,o,s,n,r);if(C(o)&&C(s)){for(var l=[],u=0;u0){var de=c,pe=In(de,Tn(t)),ge=In(de,Tn(he)),fe=pe;if(ge
=u)break;var L=u-A,P=L/_;P=Fn(0,P,1),t=Bn(C,D,P),i=gd(C,D);break}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,i)}};u("source"),u("target"),this.applyLabelDimensions(e)}},dd.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},dd.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=qt(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,h=i.width,d=i.height+(l-1)*(a-1)*u;$t(n.rstyle,"labelWidth",t,h),$t(n.rscratch,"labelWidth",t,h),$t(n.rstyle,"labelHeight",t,d),$t(n.rscratch,"labelHeight",t,d),$t(n.rscratch,"labelLineHeight",t,c)},dd.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?($t(n.rscratch,e,t,r),r):qt(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u="",c=i.split("\n"),h=e.pstyle("text-max-width").pfValue,d=e.pstyle("text-overflow-wrap").value,p="anywhere"===d,g=[],f=/[\s\u200b]+|$/g,y=0;ye&&(r=e),a>t&&(a=t)}return r==i.MAX_VALUE?null:(n=void 0!=o[0].getParent().paddingLeft?o[0].getParent().paddingLeft:this.margin,this.left=a-n,this.top=r-n,new c(this.left,this.top))},d.prototype.updateBounds=function(e){for(var t,n,r,a,o,s=i.MAX_VALUE,l=-i.MAX_VALUE,c=i.MAX_VALUE,h=-i.MAX_VALUE,d=this.nodes,p=d.length,g=0;go)return n[0]=r,n[1]=l,n[2]=a,n[3]=b,!1;if(i
)/).reverse(),a=[],o=1.1,s=n.attr("y"),l=parseFloat(n.attr("dy")),u=n.text(null).append("tspan").attr("x",0).attr("y",s).attr("dy",l+"em");for(let i=0;i
"===e)&&(a.pop(),u.text(a.join(" ").trim()),a="
"===e?[""]:[e],u=n.append("tspan").attr("x",0).attr("y",s).attr("dy",o+"em").text(e))}))}const O=function(e,t,n){const r=5;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("d",`M0 ${t.height-r} v${-t.height+2*r} q0,-5 5,-5 h${t.width-2*r} q5,0 5,5 v${t.height-r} H0 Z`),e.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},R=function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("height",t.height).attr("width",t.width)},B=function(e,t){const n=t.width,r=t.height,i=.15*n,a=.25*n,o=.35*n,s=.2*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("d",`M0 0 a${i},${i} 0 0,1 ${.25*n},${-1*n*.1}\n a${o},${o} 1 0,1 ${.4*n},${-1*n*.1}\n a${a},${a} 1 0,1 ${.35*n},${1*n*.2}\n\n a${i},${i} 1 0,1 ${.15*n},${1*r*.35}\n a${s},${s} 1 0,1 ${-1*n*.15},${1*r*.65}\n\n a${a},${i} 1 0,1 ${-1*n*.25},${.15*n}\n a${o},${o} 1 0,1 ${-1*n*.5},0\n a${i},${i} 1 0,1 ${-1*n*.25},${-1*n*.15}\n\n a${i},${i} 1 0,1 ${-1*n*.1},${-1*r*.35}\n a${s},${s} 1 0,1 ${.1*n},${-1*r*.65}\n\n H0 V0 Z`)},F=function(e,t){const n=t.width,r=t.height,i=.15*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("d",`M0 0 a${i},${i} 1 0,0 ${.25*n},${-1*r*.1}\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},${1*r*.1}\n\n a${i},${i} 1 0,0 ${.15*n},${1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${1*r*.34}\n a${i},${i} 1 0,0 ${-1*n*.15},${1*r*.33}\n\n a${i},${i} 1 0,0 ${-1*n*.25},${.15*r}\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},${-1*r*.15}\n\n a${i},${i} 1 0,0 ${-1*n*.1},${-1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${-1*r*.34}\n a${i},${i} 1 0,0 ${.1*n},${-1*r*.33}\n\n H0 V0 Z`)},z=function(e,t){e.append("circle").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("r",t.width/2)};function G(e,t,n,r,i){return e.insert("polygon",":first-child").attr("points",r.map((function(e){return e.x+","+e.y})).join(" ")).attr("transform","translate("+(i.width-t)/2+", "+n+")")}const V=function(e,t){const n=t.height,r=4,i=n/r,a=t.width-t.padding+2*i,o=[{x:i,y:0},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:i,y:-n},{x:0,y:-n/2}];G(e,a,n,o,t)},X=function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("height",t.height).attr("rx",t.padding).attr("ry",t.padding).attr("width",t.width)},Y=function(e,t,n,r){const i=n%(I-1),a=e.append("g");t.section=i;let o="section-"+i;i<0&&(o+=" section-root"),a.attr("class",(t.class?t.class+" ":"")+"mindmap-node "+o);const s=a.append("g"),l=a.append("g"),u=l.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(M,t.width),c=u.node().getBBox(),h=r.fontSize.replace?r.fontSize.replace("px",""):r.fontSize;if(t.height=c.height+1.1*h*.5+t.padding,t.width=c.width+2*t.padding,t.icon)if(t.type===E.CIRCLE){t.height+=50,t.width+=50;const e=a.append("foreignObject").attr("height","50px").attr("width",t.width).attr("style","text-align: center;");e.append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+t.width/2+", "+(t.height/2-1.5*t.padding)+")")}else{t.width+=50;const e=t.height;t.height=Math.max(e,60);const n=Math.abs(t.height-e),r=a.append("foreignObject").attr("width","60px").attr("height",t.height).attr("style","text-align: center;margin-top:"+n/2+"px;");r.append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+(25+t.width/2)+", "+(n/2+t.padding/2)+")")}else l.attr("transform","translate("+t.width/2+", "+t.padding/2+")");switch(t.type){case E.DEFAULT:O(s,t,i);break;case E.ROUNDED_RECT:X(s,t);break;case E.RECT:R(s,t);break;case E.CIRCLE:s.attr("transform","translate("+t.width/2+", "+ +t.height/2+")"),z(s,t);break;case E.CLOUD:B(s,t);break;case E.BANG:F(s,t);break;case E.HEXAGON:V(s,t);break}return _(t.id,a),t.height},U=function(e,t,n,r,i){const a=i%(I-1),o=n.x+n.width/2,s=n.y+n.height/2,l=t.x+t.width/2,u=t.y+t.height/2,c=l>o?o+Math.abs(o-l)/2:o-Math.abs(o-l)/2,h=u>s?s+Math.abs(s-u)/2:s-Math.abs(s-u)/2,d=l>o?Math.abs(o-c)/2+o:-Math.abs(o-c)/2+o,p=u>s?Math.abs(s-h)/2+s:-Math.abs(s-h)/2+s;e.append("path").attr("d","TB"===n.direction||"BT"===n.direction?`M${o},${s} Q${o},${p} ${c},${h} T${l},${u}`:`M${o},${s} Q${d},${s} ${c},${h} T${l},${u}`).attr("class","edge section-edge-"+a+" edge-depth-"+r)},W=function(e){const t=L(e.id),n=e.x||0,r=e.y||0;t.attr("transform","translate("+n+","+r+")")},j={drawNode:Y,positionNode:W,drawEdge:U};function H(e,t,n,r){j.drawNode(e,t,n,r),t.children&&t.children.forEach(((t,i)=>{H(e,t,n<0?i:n,r)}))}function q(e,t){t.edges().map(((t,n)=>{const i=t.data();if(t[0]._private.bodyBounds){const a=t[0]._private.rscratch;r.l.trace("Edge: ",n,i),e.insert("path").attr("d",`M ${a.startX},${a.startY} L ${a.midX},${a.midY} L${a.endX},${a.endY} `).attr("class","edge section-edge-"+i.section+" edge-depth-"+i.depth)}}))}function $(e,t,n,r){t.add({group:"nodes",data:{id:e.id,labelText:e.descr,height:e.height,width:e.width,level:r,nodeId:e.id,padding:e.padding,type:e.type},position:{x:e.x,y:e.y}}),e.children&&e.children.forEach((i=>{$(i,t,n,r+1),t.add({group:"edges",data:{id:`${e.id}_${i.id}`,source:e.id,target:i.id,depth:r,section:i.section}})}))}function K(e,t){return new Promise((n=>{const a=(0,i.Ltv)("body").append("div").attr("id","cy").attr("style","display:none"),s=o()({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),$(e,s,t,0),s.nodes().forEach((function(e){e.layoutDimensions=()=>{const t=e.data();return{w:t.width,h:t.height}}})),s.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),s.ready((e=>{r.l.info("Ready",e),n(s)}))}))}function Z(e){e.nodes().map(((e,t)=>{const n=e.data();n.x=e.position().x,n.y=e.position().y,j.positionNode(n);const i=L(n.nodeId);r.l.info("Id:",t,"Position: (",e.position().x,", ",e.position().y,")",n),i.attr("transform",`translate(${e.position().x-n.width/2}, ${e.position().y-n.height/2})`),i.attr("attr",`apa-${t})`)}))}o().use(l());const Q=async(e,t,n,a)=>{const o=(0,r.g)();a.db.clear(),a.parser.parse(e),r.l.debug("Renering info diagram\n"+e);const s=(0,r.g)().securityLevel;let l;"sandbox"===s&&(l=(0,i.Ltv)("#i"+t));const u="sandbox"===s?(0,i.Ltv)(l.nodes()[0].contentDocument.body):(0,i.Ltv)("body"),c=u.select("#"+t);c.append("g");const h=a.db.getMindmap(),d=c.append("g");d.attr("class","mindmap-edges");const p=c.append("g");p.attr("class","mindmap-nodes"),H(p,h,-1,o);const g=await K(h,o);q(d,g),Z(g),(0,r.s)(void 0,c,o.mindmap.padding,o.mindmap.useMaxWidth)},J={draw:Q},ee=e=>{let t="";for(let n=0;n