codelith 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- backend/__init__.py +1 -0
- backend/agents/__init__.py +6 -0
- backend/agents/assessment_agent.py +273 -0
- backend/agents/coding_agent.py +779 -0
- backend/agents/concept_categories.py +131 -0
- backend/agents/concept_detector.py +1217 -0
- backend/agents/debug_agent.py +166 -0
- backend/agents/teacher_agent.py +179 -0
- backend/cli/__init__.py +1 -0
- backend/cli/config_cmd.py +135 -0
- backend/cli/main.py +606 -0
- backend/daemon/__init__.py +1 -0
- backend/daemon/launcher.py +243 -0
- backend/daemon/server.py +453 -0
- backend/daemon/state.py +110 -0
- backend/daemon/static/assets/Gambarino-Regular-BjbcsURA.otf +0 -0
- backend/daemon/static/assets/abnfDiagram-VCTEODGH-CCJBE2aE.js +1 -0
- backend/daemon/static/assets/arc-BEvzHx4o.js +1 -0
- backend/daemon/static/assets/architecture-7GRP2DOG-DaWrPggL.js +1 -0
- backend/daemon/static/assets/architectureDiagram-5GKGNRK7-pR-klcZv.js +36 -0
- backend/daemon/static/assets/array-BifhSqXX.js +1 -0
- backend/daemon/static/assets/blockDiagram-I7D4REHJ-C504Gj6_.js +129 -0
- backend/daemon/static/assets/c4Diagram-7LVT6UL2-BjM04Mni.js +38 -0
- backend/daemon/static/assets/channel-DzSauwD3.js +1 -0
- backend/daemon/static/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- backend/daemon/static/assets/chunk-4HAMMTFA-EgoP78tp.js +62 -0
- backend/daemon/static/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- backend/daemon/static/assets/chunk-75Z2AOVW-EXNbuzun.js +2 -0
- backend/daemon/static/assets/chunk-DU6HZSFF-CF3OK3MZ.js +127 -0
- backend/daemon/static/assets/chunk-F27PBJKO-G71ylWJa.js +1 -0
- backend/daemon/static/assets/chunk-FOHPRMQF-DHwB1DNv.js +161 -0
- backend/daemon/static/assets/chunk-GMAD6QVW-2yfGg28o.js +72 -0
- backend/daemon/static/assets/chunk-GVQU2GXP-C_VeaX4U.js +1 -0
- backend/daemon/static/assets/chunk-IMKFNOWR-CNexRjjn.js +231 -0
- backend/daemon/static/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- backend/daemon/static/assets/chunk-P2QGCYS3-E4AByfsD.js +1 -0
- backend/daemon/static/assets/chunk-POPQ4Y6H-Bisbc2-3.js +1 -0
- backend/daemon/static/assets/chunk-PWAF6VOD-DaoPxZAa.js +1 -0
- backend/daemon/static/assets/chunk-SHT3W25Y-DarPToto.js +168 -0
- backend/daemon/static/assets/chunk-SVP7TREG-DvMOAiwI.js +88 -0
- backend/daemon/static/assets/chunk-TICWLB2K-DheuvyGM.js +206 -0
- backend/daemon/static/assets/chunk-XXDRQBXY-DFBUG-OT.js +1 -0
- backend/daemon/static/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- backend/daemon/static/assets/classDiagram-ZZMXUADV-Ys5zkCXW.js +1 -0
- backend/daemon/static/assets/classDiagram-v2-VYDZK3BY-Ys5zkCXW.js +1 -0
- backend/daemon/static/assets/cose-bilkent-JH36ORCC-DLPLnxrP.js +1 -0
- backend/daemon/static/assets/cynefin-OW5HDTMX-Dv1OY_0y.js +1 -0
- backend/daemon/static/assets/cynefinDiagram-5FMLGOSQ-Ur7MTCmF.js +62 -0
- backend/daemon/static/assets/cytoscape.esm-CECbKnxF.js +321 -0
- backend/daemon/static/assets/dagre-CJLTJMFW.js +1 -0
- backend/daemon/static/assets/dagre-GXQ25YYZ-R3BwTvng.js +4 -0
- backend/daemon/static/assets/defaultLocale-BFoDCU3G.js +1 -0
- backend/daemon/static/assets/diagram-S7CK7UJ4-BxIoEKb4.js +30 -0
- backend/daemon/static/assets/diagram-UQ7AKVKN-DO4cuWN-.js +41 -0
- backend/daemon/static/assets/diagram-VSXAHHWV-DW5imp5t.js +3 -0
- backend/daemon/static/assets/diagram-VX7I27RA-CdZ3k7wQ.js +24 -0
- backend/daemon/static/assets/diagram-Z3DM3KII-DPyjbneL.js +24 -0
- backend/daemon/static/assets/dist-DTg6UBE_.js +1 -0
- backend/daemon/static/assets/ebnfDiagram-PWID7BFC-BO7VQsye.js +1 -0
- backend/daemon/static/assets/erDiagram-RLTQ6QDP-CevvjECq.js +99 -0
- backend/daemon/static/assets/eventmodeling-NTZA5JFV-yNfKR6-v.js +1 -0
- backend/daemon/static/assets/flowDiagram-HODETNUW-B4GT41mU.js +1 -0
- backend/daemon/static/assets/ganttDiagram-EL5Y4UJY-DNW5fWw1.js +292 -0
- backend/daemon/static/assets/gitGraph-4MIJSDKK-DKgVkWaZ.js +1 -0
- backend/daemon/static/assets/gitGraphDiagram-WWUBYQGX-0S7OF9Aj.js +106 -0
- backend/daemon/static/assets/index-D3vj8REa.js +63 -0
- backend/daemon/static/assets/index-D4lMFaiv.css +1 -0
- backend/daemon/static/assets/info-A6RAGUB7-Bxy-SzRN.js +1 -0
- backend/daemon/static/assets/infoDiagram-27XIBGKW-ClzQji6X.js +2 -0
- backend/daemon/static/assets/init-C-OQMol4.js +1 -0
- backend/daemon/static/assets/ishikawaDiagram-5VMMS53U-B3Lo-sS3.js +70 -0
- backend/daemon/static/assets/journeyDiagram-3NMN7TZE-0KL6R2Rz.js +139 -0
- backend/daemon/static/assets/kanban-definition-UXKFOSKX-zt5NbEep.js +89 -0
- backend/daemon/static/assets/katex-CXMH3UgJ.js +257 -0
- backend/daemon/static/assets/line-CiAFRJVJ.js +1 -0
- backend/daemon/static/assets/linear-BI6yqEPV.js +1 -0
- backend/daemon/static/assets/logo_darkmode-BPDdj6GZ.png +0 -0
- backend/daemon/static/assets/logo_lightmode-C3ZWMgAH.png +0 -0
- backend/daemon/static/assets/mermaid-parser.core-DEadI1Ja.js +7 -0
- backend/daemon/static/assets/mindmap-definition-YA3MSWOX-TGKGYg5n.js +96 -0
- backend/daemon/static/assets/ordinal-BDEzSJ7C.js +1 -0
- backend/daemon/static/assets/packet-AYTQ26CC-CZTSuh5x.js +1 -0
- backend/daemon/static/assets/path-fybaL0A-.js +1 -0
- backend/daemon/static/assets/pegDiagram-XKGWAZYB-DGd8LACA.js +1 -0
- backend/daemon/static/assets/pie-WAS4IAKB-B59sPr3Z.js +1 -0
- backend/daemon/static/assets/pieDiagram-E7YTZNPT-CpwxCR3L.js +39 -0
- backend/daemon/static/assets/quadrantDiagram-AXDQQJYC-BwSeF_E_.js +7 -0
- backend/daemon/static/assets/radar-RG4KPBEZ-DAa4JvTb.js +1 -0
- backend/daemon/static/assets/railroad-74A4TZTK-BitdNgDt.js +1 -0
- backend/daemon/static/assets/railroad-abnf-HS5TGJTU-DCrNKqAH.js +1 -0
- backend/daemon/static/assets/railroad-ebnf-LZEXJU2U-DmEwx8OK.js +1 -0
- backend/daemon/static/assets/railroad-peg-WCYAUIDC-CPc8dTCP.js +1 -0
- backend/daemon/static/assets/railroadDiagram-O6MQD6OU-DuizuzwD.js +1 -0
- backend/daemon/static/assets/requirementDiagram-BXWQKSXE-BjMk0yS8.js +84 -0
- backend/daemon/static/assets/rough.esm-Dy-Kn_BL.js +1 -0
- backend/daemon/static/assets/sankeyDiagram-P5KCCOFB-0T_bhkmz.js +40 -0
- backend/daemon/static/assets/sequenceDiagram-WJ2MYXX4-Cwa-1Stp.js +162 -0
- backend/daemon/static/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
- backend/daemon/static/assets/src-BH-TyZbA.js +1 -0
- backend/daemon/static/assets/stateDiagram-D77RDMKH-BpQSg_QL.js +1 -0
- backend/daemon/static/assets/stateDiagram-v2-MP3YSRHH-BItVXKof.js +1 -0
- backend/daemon/static/assets/swimlanes-42K2YHIH-h_ED18Vy.js +1 -0
- backend/daemon/static/assets/swimlanesDiagram-VR7AAH4N-D0fo0LN-.js +8 -0
- backend/daemon/static/assets/timeline-definition-24CTP7MA-DKfSO33a.js +120 -0
- backend/daemon/static/assets/treeView-Q6P3EWNA-DAj9fxfC.js +1 -0
- backend/daemon/static/assets/treemap-WGGIJYW6-5IIXD9Zu.js +1 -0
- backend/daemon/static/assets/vennDiagram-4TSXK5OY-BoBvVEci.js +34 -0
- backend/daemon/static/assets/wardley-WFR3VGLG-CGsd7s_-.js +1 -0
- backend/daemon/static/assets/wardleyDiagram-VM6X3IG4-QHdK5NsY.js +78 -0
- backend/daemon/static/assets/xychartDiagram-S5SC5T6Z-MN_fdKCJ.js +7 -0
- backend/daemon/static/index.html +49 -0
- backend/database/__init__.py +1 -0
- backend/database/concept_slug.py +39 -0
- backend/database/concepts.py +804 -0
- backend/llm/__init__.py +5 -0
- backend/llm/client.py +333 -0
- backend/llm/config.py +254 -0
- backend/llm/key_setup.py +237 -0
- backend/main.py +13 -0
- backend/orchestrator/__init__.py +1 -0
- backend/orchestrator/events.py +52 -0
- backend/orchestrator/graph.py +316 -0
- backend/orchestrator/modes.py +125 -0
- codelith-0.1.0.dist-info/METADATA +301 -0
- codelith-0.1.0.dist-info/RECORD +129 -0
- codelith-0.1.0.dist-info/WHEEL +5 -0
- codelith-0.1.0.dist-info/entry_points.txt +2 -0
- codelith-0.1.0.dist-info/licenses/LICENSE +21 -0
- codelith-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as ee,R as te,S as ne,T as re,U as ie,V as ae,W as oe,X as _,Y as se,Z as ce,_ as v,at as le,b as ue,ct as y,dt as b,et as de,f as x,ft as S,g as C,h as w,ht as fe,it as pe,j as me,k as he,lt as T,m as E,mt as ge,nt as _e,ot as ve,p as D,pt as ye,q as be,rt as xe,st as O,tt as Se,ut as k,v as Ce,w as we,x as Te,y as Ee,z as De}from"./index-D3vj8REa.js";var Oe=/\s/;function ke(e){for(var t=e.length;t--&&Oe.test(e.charAt(t)););return t}var Ae=/^\s+/;function je(e){return e&&e.slice(0,ke(e)+1).replace(Ae,``)}var Me=NaN,Ne=/^[-+]0x[0-9a-f]+$/i,Pe=/^0b[01]+$/i,Fe=/^0o[0-7]+$/i,Ie=parseInt;function Le(e){if(typeof e==`number`)return e;if(b(e))return Me;if(y(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=y(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=je(e);var n=Pe.test(e);return n||Fe.test(e)?Ie(e.slice(2),n?2:8):Ne.test(e)?Me:+e}var Re=1/0,ze=17976931348623157e292;function A(e){return e?(e=Le(e),e===Re||e===-Re?(e<0?-1:1)*ze:e===e?e:0):e===0?e:0}function Be(e){var t=A(e),n=t%1;return t===t?n?t-n:t:0}var Ve=Object.create,He=function(){function e(){}return function(t){if(!y(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Ue(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function j(e,t,n){t==`__proto__`&&pe?pe(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var We=Object.prototype.hasOwnProperty;function M(t,n,r){var i=t[n];(!(We.call(t,n)&&e(i,r))||r===void 0&&!(n in t))&&j(t,n,r)}function N(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?j(n,s,c):M(n,s,c)}return n}function P(t,n,r){if(!y(r))return!1;var i=typeof n;return(i==`number`?_(r)&&de(n,r.length):i==`string`&&n in r)?e(r[n],t):!1}function Ge(e){return ce(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&P(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}function Ke(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var qe=Object.prototype.hasOwnProperty;function Je(e){if(!y(e))return Ke(e);var t=se(e),n=[];for(var r in e)r==`constructor`&&(t||!qe.call(e,r))||n.push(r);return n}function F(e){return _(e)?ie(e,!0):Je(e)}function I(e){return e!=null&&e.length?g(e,1):[]}function Ye(e){return xe(ee(e,void 0,I),e+``)}var Xe=c(Object.getPrototypeOf,Object),Ze=`[object Object]`,Qe=Function.prototype,$e=Object.prototype,et=Qe.toString,tt=$e.hasOwnProperty,nt=et.call(Object);function rt(e){if(!S(e)||ye(e)!=Ze)return!1;var t=Xe(e);if(t===null)return!0;var n=tt.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&et.call(n)==nt}var it=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function at(e){return it.test(e)}function ot(e,t){return e&&N(t,n(t),e)}function st(e,t){return e&&N(t,F(t),e)}var ct=typeof exports==`object`&&exports&&!exports.nodeType&&exports,lt=ct&&typeof module==`object`&&module&&!module.nodeType&&module,ut=lt&<.exports===ct?fe.Buffer:void 0,dt=ut?ut.allocUnsafe:void 0;function ft(e,t){if(t)return e.slice();var n=e.length,r=dt?dt(n):new e.constructor(n);return e.copy(r),r}function pt(e,t){return N(e,me(e),t)}var mt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)o(t,me(e)),e=Xe(e);return t}:p;function ht(e,t){return N(e,mt(e),t)}function gt(e){return t(e,F,mt)}var _t=Object.prototype.hasOwnProperty;function vt(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&_t.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function L(e){var t=new e.constructor(e.byteLength);return new i(t).set(new i(e)),t}function yt(e,t){var n=t?L(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var bt=/\w*$/;function xt(e){var t=new e.constructor(e.source,bt.exec(e));return t.lastIndex=e.lastIndex,t}var St=ge?ge.prototype:void 0,Ct=St?St.valueOf:void 0;function wt(e){return Ct?Object(Ct.call(e)):{}}function Tt(e,t){var n=t?L(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Et=`[object Boolean]`,Dt=`[object Date]`,Ot=`[object Map]`,kt=`[object Number]`,At=`[object RegExp]`,jt=`[object Set]`,Mt=`[object String]`,Nt=`[object Symbol]`,Pt=`[object ArrayBuffer]`,Ft=`[object DataView]`,It=`[object Float32Array]`,Lt=`[object Float64Array]`,Rt=`[object Int8Array]`,zt=`[object Int16Array]`,Bt=`[object Int32Array]`,Vt=`[object Uint8Array]`,Ht=`[object Uint8ClampedArray]`,Ut=`[object Uint16Array]`,Wt=`[object Uint32Array]`;function Gt(e,t,n){var r=e.constructor;switch(t){case Pt:return L(e);case Et:case Dt:return new r(+e);case Ft:return yt(e,n);case It:case Lt:case Rt:case zt:case Bt:case Vt:case Ht:case Ut:case Wt:return Tt(e,n);case Ot:return new r;case kt:case Mt:return new r(e);case At:return xt(e);case jt:return new r;case Nt:return wt(e)}}function Kt(e){return typeof e.constructor==`function`&&!se(e)?He(Xe(e)):{}}var qt=`[object Map]`;function Jt(e){return S(e)&&h(e)==qt}var Yt=s&&s.isMap,Xt=Yt?d(Yt):Jt,Zt=`[object Set]`;function Qt(e){return S(e)&&h(e)==Zt}var $t=s&&s.isSet,en=$t?d($t):Qt,tn=1,nn=2,rn=4,an=`[object Arguments]`,on=`[object Array]`,sn=`[object Boolean]`,cn=`[object Date]`,ln=`[object Error]`,un=`[object Function]`,dn=`[object GeneratorFunction]`,fn=`[object Map]`,pn=`[object Number]`,mn=`[object Object]`,hn=`[object RegExp]`,gn=`[object Set]`,_n=`[object String]`,vn=`[object Symbol]`,yn=`[object WeakMap]`,bn=`[object ArrayBuffer]`,xn=`[object DataView]`,Sn=`[object Float32Array]`,Cn=`[object Float64Array]`,wn=`[object Int8Array]`,Tn=`[object Int16Array]`,En=`[object Int32Array]`,Dn=`[object Uint8Array]`,On=`[object Uint8ClampedArray]`,kn=`[object Uint16Array]`,An=`[object Uint32Array]`,R={};R[an]=R[on]=R[bn]=R[xn]=R[sn]=R[cn]=R[Sn]=R[Cn]=R[wn]=R[Tn]=R[En]=R[fn]=R[pn]=R[mn]=R[hn]=R[gn]=R[_n]=R[vn]=R[Dn]=R[On]=R[kn]=R[An]=!0,R[ln]=R[un]=R[yn]=!1;function z(e,t,r,i,a,o){var s,c=t&tn,l=t&nn,u=t&rn;if(r&&(s=a?r(e,i,a,o):r(e)),s!==void 0)return s;if(!y(e))return e;var d=T(e);if(d){if(s=vt(e),!c)return Ue(e,s)}else{var f=h(e),p=f==un||f==dn;if(be(e))return ft(e,c);if(f==mn||f==an||p&&!a){if(s=l||p?{}:Kt(e),!c)return l?ht(e,st(s,e)):pt(e,ot(s,e))}else{if(!R[f])return a?e:{};s=Gt(e,f,c)}}o||=new m;var g=o.get(e);if(g)return g;o.set(e,s),en(e)?e.forEach(function(n){s.add(z(n,t,r,n,e,o))}):Xt(e)&&e.forEach(function(n,i){s.set(i,z(n,t,r,i,e,o))});var ee=d?void 0:(u?l?gt:he:l?F:n)(e);return _e(ee||e,function(n,i){ee&&(i=n,n=e[i]),M(s,i,z(n,t,r,i,e,o))}),s}var jn=1,Mn=4;function Nn(e){return z(e,jn|Mn)}var Pn=function(){return fe.Date.now()},Fn=Object.prototype,In=Fn.hasOwnProperty,Ln=ce(function(t,n){t=Object(t);var r=-1,i=n.length,a=i>2?n[2]:void 0;for(a&&P(n[0],n[1],a)&&(i=1);++r<i;)for(var o=n[r],s=F(o),c=-1,l=s.length;++c<l;){var u=s[c],d=t[u];(d===void 0||e(d,Fn[u])&&!In.call(t,u))&&(t[u]=o[u])}return t});function Rn(t,n,r){(r!==void 0&&!e(t[n],r)||r===void 0&&!(n in t))&&j(t,n,r)}function zn(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}function Bn(e){return N(e,F(e))}function Vn(e,t,n,r,i,a,o){var s=zn(e,n),c=zn(t,n),l=o.get(c);if(l){Rn(e,n,l);return}var d=a?a(s,c,n+``,e,t,o):void 0,f=d===void 0;if(f){var p=T(c),m=!p&&be(c),h=!p&&!m&&oe(c);d=c,p||m||h?T(s)?d=s:Ee(s)?d=Ue(s):m?(f=!1,d=ft(c,!0)):h?(f=!1,d=Tt(c,!0)):d=[]:rt(c)||u(c)?(d=s,u(s)?d=Bn(s):(!y(s)||ve(s))&&(d=Kt(c))):f=!1}f&&(o.set(c,d),i(d,c,r,a,o),o.delete(c)),Rn(e,n,d)}function Hn(e,t,n,r,i){e!==t&&ne(t,function(a,o){if(i||=new m,y(a))Vn(e,t,o,n,Hn,r,i);else{var s=r?r(zn(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),Rn(e,o,s)}},F)}function B(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function Un(e){return function(t,i,a){var o=Object(t);if(!_(t)){var s=r(i,3);t=n(t),i=function(e){return s(o[e],e,o)}}var c=e(t,i,a);return c>-1?o[s?t[c]:c]:void 0}}var Wn=Math.max;function Gn(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:Be(n);return a<0&&(a=Wn(i+a,0)),Se(e,r(t,3),a)}var Kn=Un(Gn);function qn(e,t){var n=-1,r=_(e)?Array(e.length):[];return ue(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function V(e,t){return(T(e)?k:qn)(e,r(t,3))}function Jn(e,t){return e==null?e:ne(e,Ce(t),F)}function Yn(e,t){return e&&Te(e,Ce(t))}function Xn(e,t){return e>t}var Zn=Object.prototype.hasOwnProperty;function Qn(e,t){return e!=null&&Zn.call(e,t)}function $n(e,t){return e!=null&&a(e,t,Qn)}var er=`[object String]`;function tr(e){return typeof e==`string`||!T(e)&&S(e)&&ye(e)==er}function nr(e,t){return e<t}function H(e,t){var n={};return t=r(t,3),Te(e,function(e,r,i){j(n,r,t(e,r,i))}),n}function rr(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(o!=null&&(s===void 0?o===o&&!b(o):n(o,s)))var s=o,c=a}return c}function U(e){return e&&e.length?rr(e,O,Xn):void 0}var ir=Ge(function(e,t,n){Hn(e,t,n)});function W(e){return e&&e.length?rr(e,O,nr):void 0}function ar(e,t){return e&&e.length?rr(e,r(t,2),nr):void 0}function or(e,t,n,r){if(!y(e))return e;t=te(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=f(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=y(u)?u:de(t[i+1])?[]:{})}M(s,c,l),s=s[c]}return e}function sr(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=l(e,o);n(s,o)&&or(a,te(o,e),s)}return a}function cr(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function lr(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=b(e),o=t!==void 0,s=t===null,c=t===t,l=b(t);if(!s&&!l&&!a&&e>t||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}function ur(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=lr(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function dr(e,t,n){t=t.length?k(t,function(e){return T(e)?function(t){return l(t,e.length===1?e[0]:e)}:e}):[O];var i=-1;return t=k(t,d(r)),cr(qn(e,function(e,n,r){return{criteria:k(t,function(t){return t(e)}),index:++i,value:e}}),function(e,t){return ur(e,t,n)})}var fr=we(`length`),pr=`\\ud800-\\udfff`,mr=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,hr=`\\ufe0e\\ufe0f`,gr=`[`+pr+`]`,_r=`[`+mr+`]`,vr=`\\ud83c[\\udffb-\\udfff]`,yr=`(?:`+_r+`|`+vr+`)`,br=`[^`+pr+`]`,xr=`(?:\\ud83c[\\udde6-\\uddff]){2}`,Sr=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Cr=`\\u200d`,wr=yr+`?`,Tr=`[`+hr+`]?`,Er=`(?:`+Cr+`(?:`+[br,xr,Sr].join(`|`)+`)`+Tr+wr+`)*`,Dr=Tr+wr+Er,Or=`(?:`+[br+_r+`?`,_r,xr,Sr,gr].join(`|`)+`)`,kr=RegExp(vr+`(?=`+vr+`)|`+Or+Dr,`g`);function Ar(e){for(var t=kr.lastIndex=0;kr.test(e);)++t;return t}function jr(e){return at(e)?Ar(e):fr(e)}function Mr(e,t){return sr(e,t,function(t,n){return re(e,n)})}var G=Ye(function(e,t){return e==null?{}:Mr(e,t)}),Nr=Math.ceil,Pr=Math.max;function Fr(e,t,n,r){for(var i=-1,a=Pr(Nr((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function Ir(e){return function(t,n,r){return r&&typeof r!=`number`&&P(t,n,r)&&(n=r=void 0),t=A(t),n===void 0?(n=t,t=0):n=A(n),r=r===void 0?t<n?1:-1:A(r),Fr(t,n,r,e)}}var K=Ir(),Lr=`[object Map]`,Rr=`[object Set]`;function zr(e){if(e==null)return 0;if(_(e))return tr(e)?jr(e):e.length;var t=h(e);return t==Lr||t==Rr?e.size:ae(e).length}var q=ce(function(e,t){if(e==null)return[];var n=t.length;return n>1&&P(e,t[0],t[1])?t=[]:n>2&&P(t[0],t[1],t[2])&&(t=[t[0]]),dr(e,g(t,1),[])}),Br=0;function Vr(e){var t=++Br;return De(e)+t}function Hr(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}function Ur(e,t){return Hr(e||[],t||[],M)}var Wr=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return Gr(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&Gr(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,Kr)),n=n._prev;return`[`+e.join(`, `)+`]`}};function Gr(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Kr(e,t){if(e!==`_next`&&e!==`_prev`)return t}var qr=le(1);function Jr(e,t){if(e.nodeCount()<=1)return[];var n=Zr(e,t||qr);return I(V(Yr(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function Yr(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)Xr(e,t,n,o);for(;o=i.dequeue();)Xr(e,t,n,o);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(o=t[s].dequeue(),o){r=r.concat(Xr(e,t,n,o,!0));break}}}return r}function Xr(e,t,n,r,i){var a=i?[]:void 0;return v(e.inEdges(r.v),function(r){var o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,Qr(t,n,s)}),v(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,Qr(t,n,o)}),e.removeNode(r.v),a}function Zr(e,t){var n=new x,r=0,i=0;v(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),v(e.edges(),function(e){var a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s),i=Math.max(i,n.node(e.v).out+=o),r=Math.max(r,n.node(e.w).in+=o)});var a=K(i+r+3).map(function(){return new Wr}),o=r+1;return v(n.nodes(),function(e){Qr(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function Qr(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function $r(e){var t=e.graph().acyclicer===`greedy`?Jr(e,n(e)):ei(e);v(t,function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,Vr(`rev`))});function n(e){return function(t){return e.edge(t).weight}}}function ei(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,v(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return v(e.nodes(),i),t}function ti(e){v(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function J(e,t,n,r){var i;do i=Vr(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function ni(e){var t=new x().setGraph(e.graph());return v(e.nodes(),function(n){t.setNode(n,e.node(n))}),v(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function ri(e){var t=new x({multigraph:e.isMultigraph()}).setGraph(e.graph());return v(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),v(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function ii(e,t){var n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);var c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function Y(e){var t=V(K(ci(e)+1),function(){return[]});return v(e.nodes(),function(n){var r=e.node(n),i=r.rank;E(i)||(t[i][r.order]=n)}),t}function ai(e){var t=W(V(e.nodes(),function(t){return e.node(t).rank}));v(e.nodes(),function(n){var r=e.node(n);$n(r,`rank`)&&(r.rank-=t)})}function oi(e){var t=W(V(e.nodes(),function(t){return e.node(t).rank})),n=[];v(e.nodes(),function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=e.graph().nodeRankFactor;v(n,function(t,n){E(t)&&n%i!==0?--r:r&&v(t,function(t){e.node(t).rank+=r})})}function si(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),J(e,`border`,i,t)}function ci(e){return U(V(e.nodes(),function(t){var n=e.node(t).rank;if(!E(n))return n}))}function li(e,t){var n={lhs:[],rhs:[]};return v(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function ui(e,t){var n=Pn();try{return t()}finally{console.log(e+` time: `+(Pn()-n)+`ms`)}}function di(e,t){return t()}function fi(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&v(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)pi(e,`borderLeft`,`_bl`,n,i,a),pi(e,`borderRight`,`_br`,n,i,a)}}v(e.children(),t)}function pi(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=J(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function mi(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&gi(e)}function hi(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&vi(e),(t===`lr`||t===`rl`)&&(yi(e),gi(e))}function gi(e){v(e.nodes(),function(t){_i(e.node(t))}),v(e.edges(),function(t){_i(e.edge(t))})}function _i(e){var t=e.width;e.width=e.height,e.height=t}function vi(e){v(e.nodes(),function(t){X(e.node(t))}),v(e.edges(),function(t){var n=e.edge(t);v(n.points,X),Object.prototype.hasOwnProperty.call(n,`y`)&&X(n)})}function X(e){e.y=-e.y}function yi(e){v(e.nodes(),function(t){bi(e.node(t))}),v(e.edges(),function(t){var n=e.edge(t);v(n.points,bi),Object.prototype.hasOwnProperty.call(n,`x`)&&bi(n)})}function bi(e){var t=e.x;e.x=e.y,e.y=t}function xi(e){e.graph().dummyChains=[],v(e.edges(),function(t){Si(e,t)})}function Si(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a!==r+1){e.removeEdge(t);var l=void 0,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],l={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},u=J(e,`edge`,l,`_d`),r===c&&(l.width=s.width,l.height=s.height,l.dummy=`edge-label`,l.labelpos=s.labelpos),e.setEdge(n,u,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,i,{weight:s.weight},o)}}function Ci(e){v(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function wi(e){var t={};function n(r){var i=e.node(r);if(Object.prototype.hasOwnProperty.call(t,r))return i.rank;t[r]=!0;var a=W(V(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}v(e.sources(),n)}function Z(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function Ti(e){var t=new x({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Ei(t,e)<r;)i=Di(t,e),a=t.hasNode(i.v)?Z(e,i):-Z(e,i),Oi(t,e,a);return t}function Ei(e,t){function n(r){v(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Z(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return v(e.nodes(),n),e.nodeCount()}function Di(e,t){return ar(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return Z(t,n)})}function Oi(e,t,n){v(e.nodes(),function(e){t.node(e).rank+=n})}le(1),le(1),ki.CycleException=Q;function ki(e){var t={},n={},r=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new Q;Object.prototype.hasOwnProperty.call(t,a)||(n[a]=!0,t[a]=!0,v(e.predecessors(a),i),delete n[a],r.push(a))}if(v(e.sinks(),i),zr(t)!==e.nodeCount())throw new Q;return r}function Q(){}Q.prototype=Error();function Ai(e,t,n){T(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return v(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);ji(e,t,n===`post`,a,r,i)}),i}function ji(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),v(i(t),function(t){ji(e,t,n,r,i,a)}),n&&a.push(t))}function Mi(e,t){return Ai(e,t,`post`)}function Ni(e,t){return Ai(e,t,`pre`)}$.initLowLimValues=Li,$.initCutValues=Pi,$.calcCutValue=Ii,$.leaveEdge=zi,$.enterEdge=Bi,$.exchangeEdges=Vi;function $(e){e=ni(e),wi(e);var t=Ti(e);Li(t),Pi(t,e);for(var n,r;n=zi(t);)r=Bi(t,e,n),Vi(t,e,n,r)}function Pi(e,t){var n=Mi(e,e.nodes());n=n.slice(0,n.length-1),v(n,function(n){Fi(e,t,n)})}function Fi(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=Ii(e,t,n)}function Ii(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,v(t.nodeEdges(n),function(a){var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,Ui(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function Li(e,t){arguments.length<2&&(t=e.nodes()[0]),Ri(e,{},1,t)}function Ri(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,v(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=Ri(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function zi(e){return Kn(e.edges(),function(t){return e.edge(t).cutvalue<0})}function Bi(e,t,n){var r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);var a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),ar(C(t.edges(),function(t){return c===Wi(e,e.node(t.v),s)&&c!==Wi(e,e.node(t.w),s)}),function(e){return Z(t,e)})}function Vi(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Li(e),Pi(e,t),Hi(e,t)}function Hi(e,t){var n=Ni(e,Kn(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),v(n,function(n){var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Ui(e,t,n){return e.hasEdge(t,n)}function Wi(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function Gi(e){switch(e.graph().ranker){case`network-simplex`:Ji(e);break;case`tight-tree`:qi(e);break;case`longest-path`:Ki(e);break;default:Ji(e)}}var Ki=wi;function qi(e){wi(e),Ti(e)}function Ji(e){$(e)}function Yi(e){var t=J(e,`root`,{},`_root`),n=Zi(e),r=U(w(n))-1,i=2*r+1;e.graph().nestingRoot=t,v(e.edges(),function(t){e.edge(t).minlen*=i});var a=Qi(e)+1;v(e.children(),function(o){Xi(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function Xi(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var c=si(e,`_bt`),l=si(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,v(s,function(s){Xi(e,t,n,r,i,a,s);var u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-a[o]+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+a[o]})}function Zi(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&v(a,function(e){n(e,i+1)}),t[r]=i}return v(e.children(),function(e){n(e,1)}),t}function Qi(e){return D(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function $i(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,v(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function ea(e,t,n){var r={},i;v(n,function(n){for(var a=e.parent(n),o,s;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function ta(e,t,n){var r=na(e),i=new x({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return v(e.nodes(),function(a){var o=e.node(a),s=e.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||r),v(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=E(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function na(e){for(var t;e.hasNode(t=Vr(`_root`)););return t}function ra(e,t){for(var n=0,r=1;r<t.length;++r)n+=ia(e,t[r-1],t[r]);return n}function ia(e,t,n){for(var r=Ur(n,V(n,function(e,t){return t})),i=I(V(t,function(t){return q(V(e.outEdges(t),function(t){return{pos:r[t.w],weight:e.edge(t).weight}}),`pos`)})),a=1;a<n.length;)a<<=1;var o=2*a-1;--a;var s=V(Array(o),function(){return 0}),c=0;return v(i.forEach(function(e){var t=e.pos+a;s[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n})),c}function aa(e){var t={},n=C(e.nodes(),function(t){return!e.children(t).length}),r=V(K(U(V(n,function(t){return e.node(t).rank}))+1),function(){return[]});function i(n){$n(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),v(e.successors(n),i))}var a=q(n,function(t){return e.node(t).rank});return v(a,i),r}function oa(e,t){return V(t,function(t){var n=e.inEdges(t);if(n.length){var r=D(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}return{v:t}})}function sa(e,t){var n={};return v(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};E(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),v(t.edges(),function(e){var t=n[e.v],r=n[e.w];!E(t)&&!E(r)&&(r.indegree++,t.out.push(n[e.w]))}),ca(C(n,function(e){return!e.indegree}))}function ca(e){var t=[];function n(e){return function(t){t.merged||(E(t.barycenter)||E(e.barycenter)||t.barycenter>=e.barycenter)&&la(e,t)}}function r(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),v(i.in.reverse(),n(i)),v(i.out,r(i))}return V(C(t,function(e){return!e.merged}),function(e){return G(e,[`vs`,`i`,`barycenter`,`weight`])})}function la(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function ua(e,t){var n=li(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=q(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(fa(!!t)),c=da(a,i,c),v(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=da(a,i,c)});var l={vs:I(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function da(e,t,n){for(var r;t.length&&(r=B(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function fa(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}function pa(e,t,n,r){var i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=C(i,function(e){return e!==o&&e!==s}));var l=oa(e,i);v(l,function(t){if(e.children(t.v).length){var i=pa(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&ha(t,i)}});var u=sa(l,n);ma(u,c);var d=ua(u,r);if(o&&(d.vs=I([o,d.vs,s]),e.predecessors(o).length)){var f=e.node(e.predecessors(o)[0]),p=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function ma(e,t){v(e,function(e){e.vs=I(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function ha(e,t){E(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function ga(e){var t=ci(e),n=_a(e,K(1,t+1),`inEdges`),r=_a(e,K(t-1,-1,-1),`outEdges`),i=aa(e);ya(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){va(s%2?n:r,s%4>=2),i=Y(e);var l=ra(e,i);l<a&&(c=0,o=Nn(i),a=l)}ya(e,o)}function _a(e,t,n){return V(t,function(t){return ta(e,t,n)})}function va(e,t){var n=new x;v(e,function(e){var r=e.graph().root,i=pa(e,r,n,t);v(i.vs,function(t,n){e.node(t).order=n}),ea(e,n,i.vs)})}function ya(e,t){v(t,function(t){v(t,function(t,n){e.node(t).order=n})})}function ba(e){var t=Sa(e);v(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=xa(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(l=o[c+1]).minRank<=r.rank;)c++;l=o[c]}e.setParent(n,l),n=e.successors(n)[0]}})}function xa(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c=n,l;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function Sa(e){var t={},n=0;function r(i){var a=n;v(e.children(i),r),t[i]={low:a,lim:n++}}return v(e.children(),r),t}function Ca(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=B(r);return v(r,function(t,c){var l=Ta(e,t),u=l?e.node(l).order:o;(l||t===s)&&(v(r.slice(a,c+1),function(t){v(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Ea(n,r,t)})}),a=c+1,i=u)}),r}return D(t,r),n}function wa(e,t){var n={};function r(t,r,i,a,o){var s;v(K(r,i),function(r){s=t[r],e.node(s).dummy&&v(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Ea(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return v(n,function(s,c){if(e.node(s).dummy===`border`){var l=e.predecessors(s);l.length&&(a=e.node(l[0]).order,r(n,o,c,i,a),o=c,i=a)}r(n,o,n.length,a,t.length)}),n}return D(t,i),n}function Ta(e,t){if(e.node(t).dummy)return Kn(e.predecessors(t),function(t){return e.node(t).dummy})}function Ea(e,t,n){if(t>n){var r=t;t=n,n=r}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Da(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Oa(e,t,n,r){var i={},a={},o={};return v(t,function(e){v(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),v(t,function(e){var t=-1;v(e,function(e){var s=r(e);if(s.length){s=q(s,function(e){return o[e]});for(var c=(s.length-1)/2,l=Math.floor(c),u=Math.ceil(c);l<=u;++l){var d=s[l];a[e]===e&&t<o[d]&&!Da(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function ka(e,t,n,r,i){var a={},o=Aa(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){for(var n=o.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function u(t){var n=o.outEdges(t).reduce(function(e,t){return Math.min(e,a[t.w]-o.edge(t))},1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),v(r,function(e){a[e]=a[n[e]]}),a}function Aa(e,t,n,r){var i=new x,a=e.graph(),o=Fa(a.nodesep,a.edgesep,r);return v(t,function(t){var r;v(t,function(t){var a=n[t];if(i.setNode(a),r){var s=n[r],c=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),c||0))}r=t})}),i}function ja(e,t){return ar(w(t),function(t){var n=-1/0,r=1/0;return Jn(t,function(t,i){var a=Ia(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Ma(e,t){var n=w(t),r=W(n),i=U(n);v([`u`,`d`],function(n){v([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=w(s);c=a===`l`?r-W(l):i-U(l),c&&(e[o]=H(s,function(e){return e+c}))}})})}function Na(e,t){return H(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=q(V(e,r));return(i[1]+i[2])/2})}function Pa(e){var t=Y(e),n=ir(Ca(e,t),wa(e,t)),r={},i;return v([`u`,`d`],function(a){i=a===`u`?t:w(t).reverse(),v([`l`,`r`],function(t){t===`r`&&(i=V(i,function(e){return w(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Oa(e,i,n,o),c=ka(e,i,s.root,s.align,t===`r`);t===`r`&&(c=H(c,function(e){return-e})),r[a+t]=c})}),Ma(r,ja(e,r)),Na(r,e.graph().align)}function Fa(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),l=0,c}}function Ia(e,t){return e.node(t).width}function La(e){e=ri(e),Ra(e),Yn(Pa(e),function(t,n){e.node(n).x=t})}function Ra(e){var t=Y(e),n=e.graph().ranksep,r=0;v(t,function(t){var i=U(V(t,function(t){return e.node(t).height}));v(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function za(e,t){var n=t&&t.debugTiming?ui:di;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>Xa(e));n(` runLayout`,()=>Ba(t,n)),n(` updateInputGraph`,()=>Va(e,t))})}function Ba(e,t){t(` makeSpaceForEdgeLabels`,()=>Za(e)),t(` removeSelfEdges`,()=>oo(e)),t(` acyclic`,()=>$r(e)),t(` nestingGraph.run`,()=>Yi(e)),t(` rank`,()=>Gi(ri(e))),t(` injectEdgeLabelProxies`,()=>Qa(e)),t(` removeEmptyRanks`,()=>oi(e)),t(` nestingGraph.cleanup`,()=>$i(e)),t(` normalizeRanks`,()=>ai(e)),t(` assignRankMinMax`,()=>$a(e)),t(` removeEdgeLabelProxies`,()=>eo(e)),t(` normalize.run`,()=>xi(e)),t(` parentDummyChains`,()=>ba(e)),t(` addBorderSegments`,()=>fi(e)),t(` order`,()=>ga(e)),t(` insertSelfEdges`,()=>so(e)),t(` adjustCoordinateSystem`,()=>mi(e)),t(` position`,()=>La(e)),t(` positionSelfEdges`,()=>co(e)),t(` removeBorderNodes`,()=>ao(e)),t(` normalize.undo`,()=>Ci(e)),t(` fixupEdgeLabelCoords`,()=>ro(e)),t(` undoCoordinateSystem`,()=>hi(e)),t(` translateGraph`,()=>to(e)),t(` assignNodeIntersects`,()=>no(e)),t(` reversePoints`,()=>io(e)),t(` acyclic.undo`,()=>ti(e))}function Va(e,t){v(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),v(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,Object.prototype.hasOwnProperty.call(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Ha=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],Ua={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},Wa=[`acyclicer`,`ranker`,`rankdir`,`align`],Ga=[`width`,`height`],Ka={width:0,height:0},qa=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Ja={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Ya=[`labelpos`];function Xa(e){var t=new x({multigraph:!0,compound:!0}),n=uo(e.graph());return t.setGraph(ir({},Ua,lo(n,Ha),G(n,Wa))),v(e.nodes(),function(n){var r=uo(e.node(n));t.setNode(n,Ln(lo(r,Ga),Ka)),t.setParent(n,e.parent(n))}),v(e.edges(),function(n){var r=uo(e.edge(n));t.setEdge(n,ir({},Ja,lo(r,qa),G(r,Ya)))}),t}function Za(e){var t=e.graph();t.ranksep/=2,v(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Qa(e){v(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);J(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function $a(e){var t=0;v(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=U(t,r.maxRank))}),e.graph().maxRank=t}function eo(e){v(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function to(e){var t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){var a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}v(e.nodes(),function(t){c(e.node(t))}),v(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,v(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),v(e.edges(),function(n){var i=e.edge(n);v(i.points,function(e){e.x-=t,e.y-=r}),Object.prototype.hasOwnProperty.call(i,`x`)&&(i.x-=t),Object.prototype.hasOwnProperty.call(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function no(e){v(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(ii(r,a)),n.points.push(ii(i,o))})}function ro(e){v(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function io(e){v(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function ao(e){v(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(B(n.borderLeft)),o=e.node(B(n.borderRight));n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),v(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function oo(e){v(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function so(e){var t=Y(e);v(t,function(t){var n=0;v(t,function(t,r){var i=e.node(t);i.order=r+n,v(i.selfEdges,function(t){J(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function co(e){v(e.nodes(),function(t){var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function lo(e,t){return H(G(e,t),Number)}function uo(e){var t={};return v(e,function(e,n){t[n.toLowerCase()]=e}),t}export{za as t};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{m as e}from"./src-BH-TyZbA.js";import{x as t}from"./chunk-DU6HZSFF-CF3OK3MZ.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./chunk-75Z2AOVW-EXNbuzun.js";import"./chunk-P2QGCYS3-E4AByfsD.js";import"./chunk-PWAF6VOD-DaoPxZAa.js";import"./chunk-GMAD6QVW-2yfGg28o.js";import{s as r}from"./chunk-4HAMMTFA-EgoP78tp.js";import{a as i,i as a,n as o}from"./chunk-GVQU2GXP-C_VeaX4U.js";import{t as s}from"./dagre-CJLTJMFW.js";import{_t as c,a as l,bt as u,c as d,d as f,f as p,gt as m,l as h,o as g,s as _,u as v,xt as y}from"./index-D3vj8REa.js";var b=n((e,t,n)=>Math.max(t,Math.min(n,e)),`clamp`),x=n((e=`TB`)=>{switch(e){case`BT`:return`bottom`;case`LR`:return`right`;case`RL`:return`left`;default:return`top`}},`getDefaultSelfLoopSide`),S=n(e=>e===`flowchart`||e===`flowchart-v2`||e===`stateDiagram`||e===`er`||e===`classDiagram`,`shouldMergeSelfLoopSegments`),C=[`x`,`y`,`width`,`height`,`labelBBox`,`intersect`,`calcIntersect`,`diff`,`clusterNode`],w=n((e,t,n,r,i)=>{let a=[],o=new Set;if(n.forEach(({start:e,end:t})=>{e!==r&&o.add(e),t!==r&&o.add(t)}),o.forEach(t=>{let n=e.node(t);typeof n?.x==`number`&&typeof n?.y==`number`&&a.push(n)}),a.length===0&&n.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{typeof e?.x==`number`&&typeof e?.y==`number`&&a.push(e)})}),a.length===0)return x(i);let s=a.reduce((e,t)=>({x:e.x+t.x/a.length,y:e.y+t.y/a.length}),{x:0,y:0}),c=s.x-t.x,l=s.y-t.y;return Math.abs(c)>Math.abs(l)?c>0?`right`:`left`:Math.abs(l)>0?l>0?`bottom`:`top`:x(i)},`getSelfLoopSide`),T=n((e,t=`top`,n=0,r=0)=>{let i=e.x,a=e.y-n,o=e.width/2,s=e.height/2,c=Math.max(36,Math.min(100,e.width*.8)),l=b(Math.max(r,e.width*.35),36,c),u=b(Math.min(e.width,e.height)*.45,24,48);switch(t){case`bottom`:{let e=a+s;return[{x:i-l/2,y:e},{x:i-l/2,y:e+u},{x:i+l/2,y:e+u},{x:i+l/2,y:e}]}case`right`:{let e=i+o;return[{x:e,y:a-l/2},{x:e+u,y:a-l/2},{x:e+u,y:a+l/2},{x:e,y:a+l/2}]}case`left`:{let e=i-o;return[{x:e,y:a-l/2},{x:e-u,y:a-l/2},{x:e-u,y:a+l/2},{x:e,y:a+l/2}]}default:{let e=a-s;return[{x:i-l/2,y:e},{x:i-l/2,y:e-u},{x:i+l/2,y:e-u},{x:i+l/2,y:e}]}}},`getSelfLoopPoints`),E=n((e,t,n=`top`,r=0,i={})=>{let a=e.x,o=e.y-r,s=i.width??0,c=i.height??0;switch(n){case`bottom`:return{x:a,y:Math.max(...t.map(e=>e.y))+c/2+4};case`right`:return{x:Math.max(...t.map(e=>e.x))+s/2+4,y:o};case`left`:return{x:Math.min(...t.map(e=>e.x))-s/2-4,y:o};default:return{x:a,y:Math.min(...t.map(e=>e.y))-c/2-4}}},`getSelfLoopLabelPosition`),D=n((e,t=0,{mergeSelfLoops:n=!0}={})=>{let r=new Map,i=[],a=e.graph()?.rankdir;return e.edges().forEach(t=>{let a=e.edge(t);if(n&&a.selfLoop){let e=a.selfLoop.id;r.has(e)||r.set(e,[]),r.get(e).push({edge:a,start:t.v,end:t.w})}else i.push({edge:a,start:t.v,end:t.w})}),r.forEach(n=>{if(n.length!==3){n.forEach(e=>i.push(e));return}n.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);let[r,o,s]=n,c=r.edge.originalEdge??o.edge.originalEdge??s.edge.originalEdge??o.edge,l=e.node(c.start);if(!l){n.forEach(e=>i.push(e));return}let u={width:o.edge.width,height:o.edge.height},d=w(e,l,n,c.start,a),f=T(l,d,t,u.width??0),p=E(l,f,d,t,u),m={...o.edge,...c,id:c.id,points:f,start:c.start,end:c.end,x:p.x,y:p.y,width:u.width,height:u.height,labelStyle:o.edge.labelStyle,fromCluster:r.edge.fromCluster??o.edge.fromCluster??s.edge.fromCluster,toCluster:r.edge.toCluster??o.edge.toCluster??s.edge.toCluster};delete m.selfLoop,delete m.originalEdge,i.push({edge:m,start:m.start,end:m.end})}),i},`getEdgesToRender`),O=n(async({element:t,graph:a,diagramType:s,id:l,parentCluster:u,siteConfig:f})=>{let p=a.graph().rankdir;e.trace(`Dir in recursive render - dir:`,p);let{clusters:m,edgePaths:_,edgeLabels:y,nodes:b,rootGroups:x}=d(t,{edgePathsClass:`edgePaths`});a.nodes()?e.info(`Recursive render XXX`,a.nodes()):e.info(`No nodes found for`,a),a.edges().length>0&&e.info(`Recursive edges`,a.edge(a.edges()[0]));let C=S(s);await Promise.all(a.nodes().map(async function(t){let n=a.node(t);if(u!==void 0){let n=JSON.parse(JSON.stringify(u.clusterData));e.trace(`Setting data for parent cluster XXX
|
|
2
|
+
Node.id = `,t,`
|
|
3
|
+
data=`,n.height,`
|
|
4
|
+
Parent cluster`,u.height),a.setNode(u.id,n),a.parent(t)||(e.trace(`Setting parent`,t,u.id),a.setParent(t,u.id,n))}if(e.info(`(Insert) Node XXX`+t+`: `+JSON.stringify(a.node(t))),n?.clusterNode){e.info(`Cluster identified XBX`,t,n.width,a.node(t));let{ranksep:o,nodesep:c}=a.graph();n.graph.setGraph({...n.graph.graph(),ranksep:o+25,nodesep:c});let u=await F({element:b,graph:n.graph,diagramType:s,id:l,parentCluster:a.node(t),siteConfig:f}),d=u.elem;r(n,d),n.diff=u.diff||0,e.info(`New compound node after recursive render XAX`,t,`width`,n.width,`height`,n.height),i(d,n)}else a.children(t).length>0?(e.trace(`Cluster - the non recursive path XBX`,t,n.id,n,n.width,`Graph:`,a),e.trace(h(n.id,a)),g.set(n.id,{id:h(n.id,a),node:n})):(e.trace(`Node - the non recursive path XAX`,t,b,a.node(t),p),await v(b,a.node(t),{config:f,dir:p}))})),await n(async()=>{let t=a.edges().map(async function(t){let n=a.edge(t.v,t.w,t.name);if(e.info(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),e.info(`Edge `+t.v+` -> `+t.w+`: `,t,` `,JSON.stringify(a.edge(t))),e.info(`Fix`,g,`ids:`,t.v,t.w,`Translating: `,g.get(t.v),g.get(t.w)),C&&n.selfLoop){if(n.selfLoop.order!==1)return;let e={...n.originalEdge,...n,id:n.selfLoop.id,startLabelLeft:n.originalEdge?.startLabelLeft??n.startLabelLeft,startLabelRight:n.originalEdge?.startLabelRight??n.startLabelRight,endLabelLeft:n.originalEdge?.endLabelLeft??n.endLabelLeft,endLabelRight:n.originalEdge?.endLabelRight??n.endLabelRight};await c(y,e),n.width=e.width,n.height=e.height,n.labelStyle=e.labelStyle;return}await c(y,n)});await Promise.all(t)},`processEdges`)();let{subGraphTitleTotalMargin:w}=o(f);return{elem:x,graph:a,groups:{clusters:m,edgePaths:_,edgeLabels:y,nodes:b,rootGroups:x},diagramType:s,id:l,mergeSelfLoops:C,subGraphTitleTotalMargin:w}},`measureDagreGraph`),k=n(t=>{e.info(`############################################# XXX`),e.info(`### Layout ### XXX`),e.info(`############################################# XXX`),s(t)},`runDagreGraphLayout`),A=n((e,t,n)=>{let r=e.node(t);if(!r)return;let i={...r};return r?.clusterNode?i.y=(r.y??0)+n:e.children(t).length>0?i.height=(r.height??0)+n:i.y=(r.y??0)+n/2,i},`normalizeDagreNode`),j=n((e,t)=>{C.forEach(n=>{t[n]!==void 0&&(e[n]=t[n])})},`applyDagreNodeLayout`),M=n((e,t,n,r)=>({...e,start:e.start??t,end:e.end??n,points:(e.points??[]).map(e=>({...e,y:typeof e.y==`number`?e.y+r:e.y}))}),`normalizeDagreEdge`),N=n((e,t)=>{let{graph:n,mergeSelfLoops:r,subGraphTitleTotalMargin:i=0}=t,a=new Map(e.nodes.map(e=>[e.id,e]));f(n).forEach(e=>{let t=A(n,e,i);if(!t)return;j(n.node(e),t);let r=a.get(e);r&&j(r,t)});let o=i/2;return e.edges=D(n,o,{mergeSelfLoops:r}).map(({edge:e,start:t,end:n})=>M(e,t,n,o)),e},`applyDagreLayoutResult`),P=n(async({elem:t,graph:n,groups:{clusters:r,edgePaths:i},diagramType:o,id:s,mergeSelfLoops:c,subGraphTitleTotalMargin:l})=>{let d=0;await Promise.all(f(n).map(async function(t){let i=n.node(t);if(e.info(`Position XBX => `+t+`: (`+i.x,`,`+i.y,`) width: `,i.width,` height: `,i.height),i?.clusterNode)i.y+=l,e.info(`A tainted cluster node XBX1`,t,i.id,i.width,i.height,i.x,i.y,n.parent(t)),g.get(i.id).node=i,a(i);else if(n.children(t).length>0){e.info(`A pure cluster node XBX1`,t,i.id,i.x,i.y,i.width,i.height,n.parent(t)),i.height+=l,n.node(i.parentId);let a=i?.padding/2||0,o=i?.labelBBox?.height||0,s=o-a||0;e.debug(`OffsetY`,s,`labelHeight`,o,`halfPadding`,a),await y(r,i),g.get(i.id).node=i}else{let t=n.node(i.parentId);i.y+=l/2,e.info(`A regular node XBX1 - using the padding`,i.id,`parent`,i.parentId,i.width,i.height,i.x,i.y,`offsetY`,i.offsetY,`parent`,t,t?.offsetY,i),a(i)}}));let p=l/2;return D(n,p,{mergeSelfLoops:c}).forEach(function({edge:t,start:r,end:a}){e.info(`Edge `+r+` -> `+a+`: `+JSON.stringify(t),t),t.points.forEach(e=>e.y+=p);let c=n.node(r),l=n.node(a),d=m(i,t,g,o,c,l,s);u(t,d)}),n.nodes().forEach(function(t){let r=n.node(t);e.info(t,r.type,r.diff),r.isGroup&&(d=r.diff)}),e.warn(`Returning from recursive render XAX`,t,d),{elem:t,diff:d}},`paintDagreLayoutCore`),F=n(async e=>{let t=await O(e);return k(t.graph),await P(t)},`renderDagreSubgraph`),I=n(t=>{let n=new p({multigraph:!0,compound:!0}).setGraph({rankdir:t.direction,nodesep:t.config?.nodeSpacing||t.nodeSpacing||t.config?.flowchart?.nodeSpacing,ranksep:t.config?.rankSpacing||t.rankSpacing||t.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return t.nodes.forEach(e=>{n.setNode(e.id,{...e}),e.parentId&&n.setParent(e.id,e.parentId)}),e.debug(`Edges:`,t.edges),t.edges.forEach(e=>{if(e.start===e.end){let t=e.start,r=t+`---`+t+`---1`,i=t+`---`+t+`---2`,a=n.node(t);n.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:``,label:``,padding:0,shape:`labelRect`,style:``,width:10,height:10}),n.setParent(r,a.parentId),n.setNode(i,{domId:i,id:i,parentId:a.parentId,labelStyle:``,padding:0,shape:`labelRect`,label:``,style:``,width:10,height:10}),n.setParent(i,a.parentId);let o=structuredClone(e),s=structuredClone(e),c=structuredClone(e),l=structuredClone(e);s.originalEdge=o,s.selfLoop={id:o.id,order:0},c.originalEdge=o,c.selfLoop={id:o.id,order:1},l.originalEdge=o,l.selfLoop={id:o.id,order:2},s.label=``,s.arrowTypeEnd=`none`,s.endLabelLeft=``,s.endLabelRight=``,s.startLabelLeft=``,s.id=t+`-cyclic-special-1`,c.startLabelRight=``,c.startLabelLeft=``,c.endLabelLeft=``,c.endLabelRight=``,c.arrowTypeStart=`none`,c.arrowTypeEnd=`none`,c.id=t+`-cyclic-special-mid`,l.label=``,l.startLabelRight=``,l.startLabelLeft=``,l.arrowTypeStart=`none`,a.isGroup&&(s.fromCluster=t,l.toCluster=t),l.id=t+`-cyclic-special-2`,l.arrowTypeStart=`none`,n.setEdge(t,r,s,t+`-cyclic-special-0`),n.setEdge(r,i,c,t+`-cyclic-special-1`),n.setEdge(i,t,l,t+`-cyclic-special-2`)}else n.setEdge(e.start,e.end,{...e},e.id)}),l(n),{graph:n}},`prepareLayoutForDagre`),L=n(async(e,{element:n,preparedLayout:r})=>{let i=r??I(e),a=t(),o=await O({element:n,graph:i.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:a});return i.measuredLayout=o,o},`measureDagreLayout`),R=n((e,t)=>{let n=t.preparedLayout?.measuredLayout;if(!n)throw Error(`runDagreLayoutCore requires measureDagreLayout to run first`);return k(n.graph),N(e,n),n},`runDagreLayoutCore`),z=_({prepareLayout:I,measureLayout:L,runLayoutCore:R,paintOptions:{clusterDb:g,getNodes:n((e,{measure:t})=>f(t.graph).map(e=>t.graph.node(e)).filter(Boolean),`getDagrePaintNodes`),getEdgeNode:n((e,t,{measure:n})=>e?n.graph.node(e):void 0,`getDagreEdgeNode`),skipNode:n((e,{measure:t})=>!t.graph.hasNode(e.id),`skipNode`),isCluster:n((e,{measure:t})=>t.graph.hasNode(e.id)&&(t.graph.children(e.id)??[]).length>0,`isCluster`)}});export{N as applyDagreLayoutResult,D as getEdgesToRender,L as measureDagreLayout,I as prepareLayoutForDagre,z as render,R as runDagreLayoutCore};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function t(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function n(e){return e=t(Math.abs(e)),e?e[1]:NaN}function r(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function i(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var a=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function o(e){if(!(t=a.exec(e)))throw Error(`invalid format: `+e);var t;return new s({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}o.prototype=s.prototype;function s(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}s.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function c(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var l;function u(e,n){var r=t(e,n);if(!r)return l=void 0,e.toPrecision(n);var i=r[0],a=r[1],o=a-(l=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,s=i.length;return o===s?i:o>s?i+Array(o-s+1).join(`0`):o>0?i.slice(0,o)+`.`+i.slice(o):`0.`+Array(1-o).join(`0`)+t(e,Math.max(0,n+o-1))[0]}function d(e,n){var r=t(e,n);if(!r)return e+``;var i=r[0],a=r[1];return a<0?`0.`+Array(-a).join(`0`)+i:i.length>a+1?i.slice(0,a+1)+`.`+i.slice(a+1):i+Array(a-i.length+2).join(`0`)}var f={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:e,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>d(e*100,t),r:d,s:u,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function p(e){return e}var m=Array.prototype.map,h=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function g(e){var t=e.grouping===void 0||e.thousands===void 0?p:r(m.call(e.grouping,Number),e.thousands+``),a=e.currency===void 0?``:e.currency[0]+``,s=e.currency===void 0?``:e.currency[1]+``,u=e.decimal===void 0?`.`:e.decimal+``,d=e.numerals===void 0?p:i(m.call(e.numerals,String)),g=e.percent===void 0?`%`:e.percent+``,_=e.minus===void 0?`−`:e.minus+``,v=e.nan===void 0?`NaN`:e.nan+``;function y(e,n){e=o(e);var r=e.fill,i=e.align,p=e.sign,m=e.symbol,y=e.zero,b=e.width,x=e.comma,S=e.precision,C=e.trim,w=e.type;w===`n`?(x=!0,w=`g`):f[w]||(S===void 0&&(S=12),C=!0,w=`g`),(y||r===`0`&&i===`=`)&&(y=!0,r=`0`,i=`=`);var T=(n&&n.prefix!==void 0?n.prefix:``)+(m===`$`?a:m===`#`&&/[boxX]/.test(w)?`0`+w.toLowerCase():``),E=(m===`$`?s:/[%p]/.test(w)?g:``)+(n&&n.suffix!==void 0?n.suffix:``),D=f[w],O=/[defgprs%]/.test(w);S=S===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function k(e){var n=T,a=E,o,s,f;if(w===`c`)a=D(e)+a,e=``;else{e=+e;var m=e<0||1/e<0;if(e=isNaN(e)?v:D(Math.abs(e),S),C&&(e=c(e)),m&&+e==0&&p!==`+`&&(m=!1),n=(m?p===`(`?p:_:p===`-`||p===`(`?``:p)+n,a=(w===`s`&&!isNaN(e)&&l!==void 0?h[8+l/3]:``)+a+(m&&p===`(`?`)`:``),O){for(o=-1,s=e.length;++o<s;)if(f=e.charCodeAt(o),48>f||f>57){a=(f===46?u+e.slice(o+1):e.slice(o))+a,e=e.slice(0,o);break}}}x&&!y&&(e=t(e,1/0));var g=n.length+e.length+a.length,k=g<b?Array(b-g+1).join(r):``;switch(x&&y&&(e=t(k+e,k.length?b-a.length:1/0),k=``),i){case`<`:e=n+e+a+k;break;case`=`:e=n+k+e+a;break;case`^`:e=k.slice(0,g=k.length>>1)+n+e+a+k.slice(g);break;default:e=k+n+e+a}return d(e)}return k.toString=function(){return e+``},k}function b(e,t){var r=Math.max(-8,Math.min(8,Math.floor(n(t)/3)))*3,i=10**-r,a=y((e=o(e),e.type=`f`,e),{suffix:h[8+r/3]});return function(e){return a(i*e)}}return{format:y,formatPrefix:b}}var _,v,y;b({thousands:`,`,grouping:[3],currency:[`$`,``]});function b(e){return _=g(e),v=_.format,y=_.formatPrefix,_}export{n as i,y as n,o as r,v as t};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import{m as e}from"./src-BH-TyZbA.js";import{H as t,K as n,U as r,a as i,b as a,c as o,f as s,v as c,w as l,y as u,z as d}from"./chunk-DU6HZSFF-CF3OK3MZ.js";import{n as f}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{i as p}from"./chunk-75Z2AOVW-EXNbuzun.js";import{r as m,t as h}from"./chunk-PWAF6VOD-DaoPxZAa.js";import{St as g}from"./index-D3vj8REa.js";import{n as _}from"./mermaid-parser.core-DEadI1Ja.js";import{t as v}from"./chunk-JWPE2WC7-DVXcaiue.js";import{t as y}from"./chunk-2Q5K7J3B-C1jixKkw.js";var b=/[─━│┃└┗├┣]/,x=/[└┗├┣]/,S=/[─━]/,C=/^[\s│┃]+$/,w=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,T=/^\s*%%/,E=` `;function D(e){return e.some(e=>b.test(e))}f(D,`isBoxDrawingFormat`);function O(e){for(let t of e){let e=x.exec(t);if(e?.index&&e.index>0)return e.index}return 4}f(O,`inferSegmentWidth`);function k(e,t){return e.replace(/\bline\s+(\d+)\b/gi,(e,n)=>{let r=parseInt(n,10),i=t.get(r);return i?`line ${i}`:e})}f(k,`remapErrorLines`);function A(e){let t=e.split(`
|
|
2
|
+
`),n=new Map,r=-1;for(let[e,n]of t.entries())if(n.trim()===`treeView-beta`){r=e;break}if(r===-1)return{text:e,lineMap:n};let i=[];for(let e=r+1;e<t.length;e++){let n=t[e];n.trim()===``||T.test(n)||w.test(n)||C.test(n)||i.push(n.replace(/\t/g,` `))}if(!D(i))return{text:e,lineMap:n};let a=O(i),o=[],s=0;for(let e=0;e<=r;e++)o.push(t[e]),s++,n.set(s,e+1);for(let e=r+1;e<t.length;e++){let r=t[e],i=r.trim(),c=e+1;if(i===``){o.push(r),s++,n.set(s,c);continue}if(T.test(r)){o.push(r),s++,n.set(s,c);continue}if(w.test(r)){o.push(r),s++,n.set(s,c);continue}if(C.test(r))continue;let l=r.replace(/\t/g,` `),u=x.exec(l);if(u?.index!==void 0){let e=u.index,t=Math.round(e/a)+1,r=e+1;for(;r<l.length&&S.test(l[r]);)r++;for(;r<l.length&&l[r]===` `;)r++;let i=l.slice(r).trimEnd();if(!i)throw Error(`Line ${c}: Empty node \u2014 expected a filename or directory name after the box-drawing prefix`);let d=E.repeat(t);o.push(d+i),s++,n.set(s,c)}else if(/^[\s─━│┃└┗├┣]+$/.test(l))continue;else if(b.test(l))o.push(r),s++,n.set(s,c);else if(/^\s+/.test(l))throw Error(`Line ${c}: Unexpected indentation without box-drawing characters. In box-drawing format, use \u251C\u2500\u2500 or \u2514\u2500\u2500 prefixes for indented nodes.`);else o.push(r),s++,n.set(s,c)}return{text:o.join(`
|
|
3
|
+
`),lineMap:n}}f(A,`preprocessBoxDrawing`);var j=new y(()=>({cnt:1,stack:[{id:0,level:-1,name:`/`,nodeType:`directory`,children:[]}]})),M=f(()=>{j.reset(),i()},`clear`),N=f(()=>j.records.stack[0],`getRoot`),P=f(()=>j.records.cnt,`getCount`),F=s.treeView,I={clear:M,addNode:f((e,t,n,r,i,a)=>{for(;e<=j.records.stack[j.records.stack.length-1].level;)j.records.stack.pop();let o={id:j.records.cnt++,level:e,name:t,nodeType:n,icon:i,cssClass:r,description:a,children:[]};j.records.stack[j.records.stack.length-1].children.push(o),j.records.stack.push(o)},`addNode`),getRoot:N,getCount:P,getConfig:f(()=>p(F,a().treeView),`getConfig`),getAccTitle:u,getAccDescription:c,getDiagramTitle:l,setAccDescription:t,setAccTitle:r,setDiagramTitle:n},L=f(e=>{v(e,I);for(let t of e.nodes){let e=typeof t.indent==`number`?t.indent:0,n=t.name,r=n.endsWith(`/`);r&&(n=n.slice(0,-1));let i=r?`directory`:`file`,o=t.classAnnotation||void 0,s=t.iconAnnotation,c=s===void 0?void 0:s||`none`,l=t.descAnnotation||void 0,u=l?d(l,a()):void 0;I.addNode(e,n,i,o,c,u)}},`populate`),R={parse:f(async t=>{let{text:n,lineMap:r}=A(t);try{let t=await _(`treeView`,n);e.debug(t),L(t)}catch(e){throw r.size>0&&e instanceof Error&&(e.message=k(e.message,r)),e}},`parse`)},z={prefix:`mermaid-treeview`,height:24,width:24,icons:{folder:{body:`<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>`},file:{body:`<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>`}}};function B(e,t){let n=t?.filenameIcons?.[e];if(n)return n;let r=e.lastIndexOf(`.`);if(r>0){let n=e.substring(r).toLowerCase(),i=t?.extensionIcons;return i?.[n]??i?.[n.slice(1)]}}f(B,`detectIcon`);function V(e,t){return e.includes(`:`)?e:e in z.icons||!t?`${z.prefix}:${e}`:`${t}:${e}`}f(V,`qualifyIcon`);function H(e,t){if(e.icon!==`none`){if(e.icon)return V(e.icon,t.defaultIconPack);if(t.showIcons){if(e.nodeType===`file`){let n=B(e.name,t);if(n===`none`)return;if(n)return V(n,t.defaultIconPack)}return`${z.prefix}:${e.nodeType===`directory`?`folder`:`file`}`}}}f(H,`getNodeIcon`),m([{name:z.prefix,icons:z}]);var U=14,W=4,G=16,K=f(async(e,t)=>{let n=[],r=f(e=>{let i=H(e,t);i&&n.push({icon:i,node:e}),e.children.forEach(r)},`collect`);r(e);let i=await Promise.all(n.map(async({icon:e,node:t})=>({id:t.id,svg:await h(e,{height:U,width:U})})));return new Map(i.map(({id:e,svg:t})=>[e,t]))},`resolveNodeIcons`),q=f((e,t,n,r,i,a)=>{let o=r.append(`g`),s=`treeView-node-label`;n.nodeType===`directory`&&(s+=` treeView-node-dir`),n.cssClass&&(s+=` ${n.cssClass}`);let c=U+W,l=H(n,i),u=l!==void 0;l&&o.append(`g`).attr(`class`,`treeView-node-icon`).attr(`transform`,`translate(${e+i.paddingX}, ${t+i.paddingY})`).html(a.get(n.id)??``);let d=o.append(`text`).text(n.name).attr(`dominant-baseline`,`middle`).attr(`class`,s),{height:f,width:p}=d.node().getBBox(),m=f+i.paddingY*2,h=e+i.paddingX+(u?c:0);d.attr(`x`,h),d.attr(`y`,t+m/2);let g=h+p;return n.BBox={x:e,y:t,width:p+i.paddingX*2+(u?c:0),height:m},n.cssClass?.split(/\s+/).includes(`highlight`)&&o.insert(`rect`,`:first-child`).attr(`x`,e).attr(`y`,t+1).attr(`width`,0).attr(`height`,m-2).attr(`rx`,3).attr(`class`,`treeView-highlight-bg`),{node:n,nodeGroup:o,labelRightEdge:g,centerY:t+m/2}},`positionLabel`),J=f((e,t,n,r,i,a)=>e.append(`line`).attr(`x1`,t).attr(`y1`,n).attr(`x2`,r).attr(`y2`,i).attr(`stroke-width`,a).attr(`class`,`treeView-node-line`),`positionLine`),Y=f((e,t,n,r)=>{let i=0,a=0,o=[],s=f((e,t,n,s)=>{let c=s*(n.rowIndent+n.paddingX),l=q(c,i,t,e,n,r);o.push(l);let{height:u,width:d}=t.BBox;J(e,c-n.rowIndent,i+u/2,c,i+u/2,n.lineThickness),a=Math.max(a,c+d),i+=u},`drawNode`),c=f((t,r=0)=>{s(e,t,n,r),t.children.forEach(e=>{c(e,r+1)});let{x:i,y:a,height:o}=t.BBox;if(t.children.length){let{y:r,height:s}=t.children[t.children.length-1].BBox;J(e,i+n.paddingX,a+o,i+n.paddingX,r+s/2+n.lineThickness/2,n.lineThickness)}},`processNode`);c(t);let l=o.filter(e=>e.node.description);if(l.length>0){let e=Math.max(...o.map(e=>e.labelRightEdge))+G;for(let t of l){let r=t.nodeGroup.append(`text`).text(t.node.description).attr(`dominant-baseline`,`middle`).attr(`class`,`treeView-node-description`).attr(`x`,e).attr(`y`,t.centerY).node().getBBox();a=Math.max(a,e+r.width+n.paddingX)}}for(let e of o)if(e.node.cssClass?.split(/\s+/).includes(`highlight`)){let t=e.nodeGroup.select(`.treeView-highlight-bg`);if(!t.empty()){let n=a-e.node.BBox.x+8;t.attr(`width`,n),a=Math.max(a,e.node.BBox.x+n+2)}}return{totalHeight:i,totalWidth:a}},`drawTree`),X={draw:f(async(t,n,r,i)=>{e.debug(`Rendering treeView diagram
|
|
4
|
+
`+t);let a=i.db,s=a.getRoot(),c=a.getConfig(),l=g(n),u=l.append(`g`);u.attr(`class`,`tree-view`);let{totalHeight:d,totalWidth:f}=Y(u,s,c,await K(s,c));l.attr(`viewBox`,`-${c.lineThickness/2} 0 ${f} ${d}`),o(l,d,f,c.useMaxWidth)},`draw`)},Z={labelFontSize:`16px`,labelColor:`black`,lineColor:`black`,iconColor:`#546e7a`,descriptionColor:`#6a9955`,highlightBg:`rgba(255, 193, 7, 0.15)`,highlightStroke:`#ffc107`},Q={db:I,renderer:X,parser:R,styles:f(({treeView:e})=>{let{labelFontSize:t,labelColor:n,lineColor:r,iconColor:i,descriptionColor:a,highlightBg:o,highlightStroke:s}=p(Z,e);return`
|
|
5
|
+
.treeView-node-label {
|
|
6
|
+
font-size: ${t};
|
|
7
|
+
fill: ${n};
|
|
8
|
+
white-space: pre;
|
|
9
|
+
}
|
|
10
|
+
.treeView-node-dir {
|
|
11
|
+
font-weight: bold;
|
|
12
|
+
}
|
|
13
|
+
.treeView-node-line {
|
|
14
|
+
stroke: ${r};
|
|
15
|
+
}
|
|
16
|
+
.treeView-node-icon {
|
|
17
|
+
color: ${i};
|
|
18
|
+
}
|
|
19
|
+
.treeView-node-description {
|
|
20
|
+
font-size: ${t};
|
|
21
|
+
fill: ${a};
|
|
22
|
+
font-style: italic;
|
|
23
|
+
white-space: pre;
|
|
24
|
+
}
|
|
25
|
+
.treeView-highlight-bg {
|
|
26
|
+
fill: ${o};
|
|
27
|
+
stroke: ${s};
|
|
28
|
+
stroke-width: 1;
|
|
29
|
+
}
|
|
30
|
+
`},`styles`)};export{Q as diagram};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import{m as e}from"./src-BH-TyZbA.js";import{D as t,H as n,K as r,U as i,a,b as o,c as s,f as c,v as l,w as u,y as d}from"./chunk-DU6HZSFF-CF3OK3MZ.js";import{n as f}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{i as p}from"./chunk-75Z2AOVW-EXNbuzun.js";import{St as m}from"./index-D3vj8REa.js";import{n as h}from"./mermaid-parser.core-DEadI1Ja.js";import{t as g}from"./chunk-JWPE2WC7-DVXcaiue.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v=32,y={axes:[],curves:[],options:_},b=structuredClone(y),x=c.radar,S=f(()=>p({...x,...o().radar}),`getConfig`),C=f(()=>b.axes,`getAxes`),w=f(()=>b.curves,`getCurves`),T=f(()=>b.options,`getOptions`),E=f(e=>{b.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),D=f(e=>{b.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:O(e.entries)}))},`setCurves`),O=f(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=C();if(t.length===0)throw Error(`Axes must be populated before curves for reference entries`);return t.map(t=>{let n=e.find(e=>e.axis?.$refText===t.name);if(n===void 0)throw Error(`Missing entry for axis `+t.label);return n.value})},`computeCurveEntries`),k={getAxes:C,getCurves:w,getOptions:T,setAxes:E,setCurves:D,setOptions:f(t=>{let n=t.reduce((e,t)=>(e[t.name]=t,e),{});b.options={showLegend:n.showLegend?.value??_.showLegend,ticks:n.ticks?.value??_.ticks,max:n.max?.value??_.max,min:n.min?.value??_.min,graticule:n.graticule?.value??_.graticule},b.options.ticks>v&&(e.warn(`Radar diagram ticks (${b.options.ticks}) exceeds maximum allowed (${v}). Using ${v} instead.`),b.options.ticks=v)},`setOptions`),getConfig:S,clear:f(()=>{a(),b=structuredClone(y)},`clear`),setAccTitle:i,getAccTitle:d,setDiagramTitle:r,getDiagramTitle:u,getAccDescription:l,setAccDescription:n},A=f(e=>{g(e,k);let{axes:t,curves:n,options:r}=e;k.setAxes(t),k.setCurves(n),k.setOptions(r)},`populate`),j={parse:f(async t=>{let n=await h(`radar`,t);e.debug(n),A(n)},`parse`)},M=f((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=N(m(t),c),d=s.max??Math.max(...o.map(e=>Math.max(...e.entries))),f=s.min,p=Math.min(c.width,c.height)/2;P(u,a,p,s.ticks,s.graticule),F(u,a,p,c),I(u,a,o,f,d,s.graticule,c),z(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),N=f((e,t)=>{let n=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return s(e,r,n,t.useMaxWidth??!0),e.attr(`viewBox`,`0 0 ${n} ${r}`).attr(`overflow`,`visible`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),P=f((e,t,n,r,i)=>{if(i===`circle`)for(let t=0;t<r;t++){let i=n*(t+1)/r;e.append(`circle`).attr(`r`,i).attr(`class`,`radarGraticule`)}else if(i===`polygon`){let i=t.length;for(let a=0;a<r;a++){let o=n*(a+1)/r,s=t.map((e,t)=>{let n=2*t*Math.PI/i-Math.PI/2;return`${o*Math.cos(n)},${o*Math.sin(n)}`}).join(` `);e.append(`polygon`).attr(`points`,s).attr(`class`,`radarGraticule`)}}},`drawGraticule`),F=f((e,t,n,r)=>{let i=t.length;for(let a=0;a<i;a++){let o=t[a].label,s=2*a*Math.PI/i-Math.PI/2,c=Math.cos(s),l=Math.sin(s);e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*c).attr(`y2`,n*r.axisScaleFactor*l).attr(`class`,`radarAxisLine`);let u=c>.01?`start`:c<-.01?`end`:`middle`,d=l>.01?`hanging`:l<-.01?`auto`:`central`;e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*c+4*c).attr(`y`,n*r.axisLabelFactor*l+4*l).attr(`text-anchor`,u).attr(`dominant-baseline`,d).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function I(e,t,n,r,i,a,o){let s=t.length,c=Math.min(o.width,o.height)/2;n.forEach((t,n)=>{if(t.entries.length!==s)return;let l=t.entries.map((e,t)=>{let n=2*Math.PI*t/s-Math.PI/2,a=L(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,R(l,o.curveTension)).attr(`class`,`radarCurve-${n}`):a===`polygon`&&e.append(`polygon`).attr(`points`,l.map(e=>`${e.x},${e.y}`).join(` `)).attr(`class`,`radarCurve-${n}`)})}f(I,`drawCurves`);function L(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}f(L,`relativeRadius`);function R(e,t){let n=e.length,r=`M${e[0].x},${e[0].y}`;for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=e[(i+2)%n],l={x:o.x+(s.x-a.x)*t,y:o.y+(s.y-a.y)*t},u={x:s.x-(c.x-o.x)*t,y:s.y-(c.y-o.y)*t};r+=` C${l.x},${l.y} ${u.x},${u.y} ${s.x},${s.y}`}return`${r} Z`}f(R,`closedRoundCurve`);function z(e,t,n,r){if(!n)return;let i=(r.width/2+r.marginRight)*3/4,a=-(r.height/2+r.marginTop)*3/4;t.forEach((t,n)=>{let r=e.append(`g`).attr(`transform`,`translate(${i}, ${a+n*20})`);r.append(`rect`).attr(`width`,12).attr(`height`,12).attr(`class`,`radarLegendBox-${n}`),r.append(`text`).attr(`x`,16).attr(`y`,0).attr(`class`,`radarLegendText`).text(t.label)})}f(z,`drawLegend`);var B={draw:M},V=f((e,t)=>{let n=``;for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let i=e[`cScale${r}`];n+=`
|
|
2
|
+
.radarCurve-${r} {
|
|
3
|
+
color: ${i};
|
|
4
|
+
fill: ${i};
|
|
5
|
+
fill-opacity: ${t.curveOpacity};
|
|
6
|
+
stroke: ${i};
|
|
7
|
+
stroke-width: ${t.curveStrokeWidth};
|
|
8
|
+
}
|
|
9
|
+
.radarLegendBox-${r} {
|
|
10
|
+
fill: ${i};
|
|
11
|
+
fill-opacity: ${t.curveOpacity};
|
|
12
|
+
stroke: ${i};
|
|
13
|
+
}
|
|
14
|
+
`}return n},`genIndexStyles`),H=f(e=>{let n=t(),r=o(),i=p(n,r.themeVariables);return{themeVariables:i,radarOptions:p(i.radar,e)}},`buildRadarStyleOptions`),U={parser:j,db:k,renderer:B,styles:f(({radar:e}={})=>{let{themeVariables:t,radarOptions:n}=H(e);return`
|
|
15
|
+
.radarTitle {
|
|
16
|
+
font-size: ${t.fontSize};
|
|
17
|
+
color: ${t.titleColor};
|
|
18
|
+
dominant-baseline: hanging;
|
|
19
|
+
text-anchor: middle;
|
|
20
|
+
}
|
|
21
|
+
.radarAxisLine {
|
|
22
|
+
stroke: ${n.axisColor};
|
|
23
|
+
stroke-width: ${n.axisStrokeWidth};
|
|
24
|
+
}
|
|
25
|
+
.radarAxisLabel {
|
|
26
|
+
font-size: ${n.axisLabelFontSize}px;
|
|
27
|
+
color: ${n.axisColor};
|
|
28
|
+
}
|
|
29
|
+
.radarGraticule {
|
|
30
|
+
fill: ${n.graticuleColor};
|
|
31
|
+
fill-opacity: ${n.graticuleOpacity};
|
|
32
|
+
stroke: ${n.graticuleColor};
|
|
33
|
+
stroke-width: ${n.graticuleStrokeWidth};
|
|
34
|
+
}
|
|
35
|
+
.radarLegendText {
|
|
36
|
+
text-anchor: start;
|
|
37
|
+
font-size: ${n.legendFontSize}px;
|
|
38
|
+
dominant-baseline: hanging;
|
|
39
|
+
}
|
|
40
|
+
${V(t,n)}
|
|
41
|
+
`},`styles`)};export{U as diagram};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{m as e,p as t}from"./src-BH-TyZbA.js";import{H as n,K as r,U as i,Y as a,a as o,b as s,f as c,v as l,w as u,x as d,y as f,z as p}from"./chunk-DU6HZSFF-CF3OK3MZ.js";import{n as m}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{_ as h,i as g,t as ee}from"./chunk-75Z2AOVW-EXNbuzun.js";import{T as te}from"./chunk-FOHPRMQF-DHwB1DNv.js";import{n as ne}from"./mermaid-parser.core-DEadI1Ja.js";import{t as re}from"./chunk-JWPE2WC7-DVXcaiue.js";var _=`position frame`,v=`frame positioned`,y=`position relation`,b=`relation positioned`,ie=m(function(t){e.debug(`options str`,t)},`setOptions`),ae=m(function(){return{}},`getOptions`),oe=m(function(){x(),o()},`clear`);function x(){S={}}m(x,`reset`);var se=c.eventmodeling,ce=m(()=>g({...se,...s().eventmodeling}),`getConfig`),S={};function C(){let t=le,{ast:n}=S,r=E();if(!n)throw Error(`No data for EventModel`);return n.frames.forEach((i,a)=>{let o=N(i,n.dataEntities,r);t=q(t,{$kind:_,index:a,frame:i,textProps:o});let s;B(i)?(e.debug(`source frame`,i.sourceFrames),s=n.frames.filter(e=>i.sourceFrames.some(t=>t.$refText===e.name)),s.forEach(e=>{t=q(t,{$kind:y,index:a,frame:i,sourceFrame:e})})):t=q(t,{$kind:y,index:a,frame:i})}),t={...t,sortedSwimlanesArray:L(t.swimlanes)},t}m(C,`getState`);function w(e){S.ast=e}m(w,`setAst`);var T={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:`bold`,boxTextPadding:10,swimlaneTextFontWeight:`bold`,labelUiAutomation:`UI/Automation`,labelUiAutomationPrefix:`UI/A: `,labelCommandReadModel:`Command/Read Model`,labelCommandReadModelPrefix:`C/RM: `,labelEvents:`Events`,labelEventsPrefix:`Stream: `};function E(){return T}m(E,`getDiagramProps`);var le={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function D(e){let t=e.split(`.`);if(t.length===2)return t[0]}m(D,`extractNamespace`);function O(e){let t=e.split(`.`);return t.length===2?t[1]:e}m(O,`extractName`);function k(e,t){if(!(!t||t.length===0))return Object.values(e).find(e=>e.namespace===t)}m(k,`findSwimlaneByNamespace`);function A(e,t,n){return Math.max(t,...Object.keys(e).filter(e=>{let r=Number.parseInt(e);return r>t&&r<n}).map(e=>Number.parseInt(e)))+1}m(A,`findNextAvailableIndex`);function j(e,t){let n=D(e.entityIdentifier),r=k(t,n);switch(e.modelEntityType){case`ui`:case`pcr`:case`processor`:return r?{index:r.index,label:r.namespace||T.labelUiAutomation}:n?{index:A(t,0,100),label:T.labelUiAutomationPrefix+n}:{index:0,label:T.labelUiAutomation};case`rmo`:case`readmodel`:case`cmd`:case`command`:return r?{index:r.index,label:r.namespace||T.labelCommandReadModel}:n?{index:A(t,100,200),label:T.labelCommandReadModelPrefix+n}:{index:100,label:T.labelCommandReadModel};default:return r?{index:r.index,label:r.namespace||T.labelEvents}:n?{index:A(t,200,300),label:T.labelEventsPrefix+n}:{index:200,label:T.labelEvents}}}m(j,`calculateSwimlaneProps`);function M(e){let{themeVariables:t}=s();switch(e.modelEntityType){case`ui`:return{fill:t.emUiFill??`white`,stroke:t.emUiStroke??`#dbdada`};case`pcr`:case`processor`:return{fill:t.emProcessorFill??`#edb3f6`,stroke:t.emProcessorStroke??`#b88cbf`};case`rmo`:case`readmodel`:return{fill:t.emReadModelFill??`#d3f1a2`,stroke:t.emReadModelStroke??`#a3b732`};case`cmd`:case`command`:return{fill:t.emCommandFill??`#bcd6fe`,stroke:t.emCommandStroke??`#679ac3`};case`evt`:case`event`:return{fill:t.emEventFill??`#ffb778`,stroke:t.emEventStroke??`#c19a0f`};default:return{fill:`red`,stroke:`black`}}}m(M,`calculateEntityVisualProps`);function N(t,n,r){let i=s(),a=p(O(t.entityIdentifier)??``,i),o,c={fontSize:16,fontWeight:700,fontFamily:`"trebuchet ms", verdana, arial, sans-serif`,joinWith:`<br/>`},l=`<b>${h(a,r.textMaxWidth,c)}</b>`;if(t.dataInlineValue&&(o=t.dataInlineValue,o=o.substring(o.indexOf(`{`)+1),o=o.substring(0,o.lastIndexOf(`}`)-1),o=p(o,i),o=h(o,r.textMaxWidth,c),o=o.replaceAll(` `,` `)),t.dataReference){let e=n.find(e=>e.name===t.dataReference?.$refText);e&&(o=e.dataBlockValue,o=o.substring(o.indexOf(`{
|
|
2
|
+
`)+2),o=o.substring(0,o.lastIndexOf(`}`)-1),o=p(o,i),o=h(o,r.textMaxWidth,c),o=o.replaceAll(` `,` `),o+=`<br/>`)}let u=o!==void 0;u&&(l+=`<br/><br/><code style="text-align: left; display: block;max-width:${r.textMaxWidth}px">${o}</code>`);let d={fontSize:c.fontSize,fontWeight:c.fontWeight,fontFamily:c.fontFamily},f=ee(l,d),m=u?f.width/3:f.width,g={content:l,width:m,height:f.height};return e.debug(`[${t.name}] ${t.entityIdentifier} text`,g),g}m(N,`calculateTextProps`);function P(e,t){let n=t,r=M(n.frame),i={width:n.textProps.width+2*T.boxTextPadding,height:n.textProps.height+2*T.boxTextPadding};return[{$kind:v,frame:n.frame,index:n.index,visual:r,dimension:i,textProps:n.textProps}]}m(P,`decidePositionFrame`);function F(e,t,n){return t===void 0?T.contentStartX:t.index===e.index&&e.r?e.r+T.boxPadding:n===void 0?T.contentStartX:n.r-T.boxOverlap+T.boxPadding}m(F,`calculateX`);function I(e,t){let n=[...e.map(e=>e.r),t];return Math.max(...n)}m(I,`calculateMaxRight`);function L(e){return Object.values(e).sort((e,t)=>e.index-t.index)}m(L,`sortedSwimlanesArray`);function R(e,t){let n=t,r=j(n.frame,e.swimlanes),i;i=r.index in e.swimlanes?e.swimlanes[r.index]:{index:r.index,label:r.label,r:0,y:r.index*T.swimlaneMinHeight+T.swimlaneGap,height:T.swimlaneMinHeight,maxHeight:T.swimlaneMinHeight};let a=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,o=e.previousSwimlaneNumber===void 0?void 0:e.swimlanes[e.previousSwimlaneNumber],s={width:Math.max(T.boxMinWidth,Math.min(T.boxMaxWidth,n.dimension.width))+2*T.boxPadding,height:Math.max(T.boxMinHeight,Math.min(T.boxMaxHeight,n.dimension.height))+2*T.boxPadding},c=F(i,o,a),l=c+s.width+T.boxPadding,u=I(Object.values(e.swimlanes),l);i.r=c+s.width,i.maxHeight=Math.max(i.maxHeight,s.height),i.height=Math.max(T.swimlaneMinHeight,i.maxHeight)+2*T.swimlanePadding;let d={x:c,y:T.swimlanePadding+i.y,r:l,dimension:s,leftSibling:!1,swimlane:i,visual:n.visual,text:n.textProps.content,frame:n.frame,index:n.index},f={...e,boxes:[...e.boxes,d],swimlanes:{...e.swimlanes,[`${i.index}`]:i},previousSwimlaneNumber:r.index,previousFrame:n.frame,maxR:u},p=L(f.swimlanes);p.length>0&&(p[0].y=0);for(let e=1;e<p.length;e++){let t=p[e],n=p[e-1];t.y=n.y+n.height+T.swimlaneGap}return f}m(R,`evolveFramePositioned`);function z(e,t){return e===0&&t.sourceFrames.length===0}m(z,`isFirstFrame`);function B(e){return e.sourceFrames!==void 0&&e.sourceFrames!==null&&e.sourceFrames.length>0}m(B,`hasSourceFrame`);function V(e,t){if(t!=null)return e.find(e=>e.frame.name===t.name)}m(V,`findBoxByFrame`);function H(e,t,n){if(!(n<0))for(let r=n;r>=0;r--){let n=e[r];if(n.swimlane.index!==t)return n}}m(H,`findBoxByLineIndex`);function U(e,t){let n=t;if(te(n.frame)||z(n.index,n.frame))return[];let r=V(e.boxes,n.frame);if(r===void 0)throw Error(`Target box not found for frame ${n.frame.name}`);let i;return i=n.sourceFrame?V(e.boxes,n.sourceFrame):H(e.boxes,r.swimlane.index,n.index-1),i===void 0?[]:[{$kind:b,frame:n.frame,index:n.index,sourceBox:i,targetBox:r}]}m(U,`decidePositionRelation`);function W(e,t){let n=t,r={visual:{fill:`none`,stroke:`#000`},source:{x:n.sourceBox.x,y:n.sourceBox.y},target:{x:n.targetBox.x,y:n.targetBox.y},sourceBox:n.sourceBox,targetBox:n.targetBox};return{...e,relations:[...e.relations,r]}}m(W,`evolveRelationPositioned`);var ue={[_]:P,[y]:U},de={[v]:R,[b]:W};function G(t,n){let r=ue[n.$kind];if(r==null)return[];let i=r(t,n);return e.debug(`decided events`,i),i}m(G,`decide`);function K(t,n){let r=n.reduce((e,t)=>{let n=de[t.$kind];return n==null?e:n(e,t)},t);return e.debug(`evolve events`,{state:t,newState:r,events:n}),r}m(K,`evolve`);function q(e,t){return K(e,G(e,t))}m(q,`dispatch`);var J={getConfig:ce,setOptions:ie,getOptions:ae,clear:oe,setAccTitle:i,getAccTitle:f,getAccDescription:l,setAccDescription:n,setDiagramTitle:r,getDiagramTitle:u,setAst:w,getDiagramProps:E,getState:C},fe={parse:m(async t=>{let n=await ne(`eventmodeling`,t);e.debug(n),J.setAst(n),re(n,J)},`parse`)},Y=d()?.eventmodeling;function X(e,t){return n=>{let r=n.swimlane.y+t.swimlanePadding,i=e.append(`g`).attr(`class`,`em-box`);i.append(`rect`).attr(`x`,n.x).attr(`y`,r).attr(`rx`,`3`).attr(`width`,n.dimension.width).attr(`height`,n.dimension.height).attr(`stroke`,n.visual.stroke).attr(`fill`,n.visual.fill),i.append(`foreignObject`).attr(`x`,n.x+t.boxPadding).attr(`y`,r+10).attr(`width`,n.dimension.width-2*t.boxPadding).attr(`height`,n.dimension.height-2*t.boxPadding).append(`xhtml:div`).style(`display`,`table`).style(`height`,`100%`).style(`width`,`100%`).append(`span`).style(`display`,`table-cell`).style(`text-align`,`center`).style(`vertical-align`,`middle`).html(n.text)}}m(X,`renderD3Box`);function Z(e,t){return e>t}m(Z,`dirUpwards`);function Q(t,n,r,i){return a=>{let o=a.sourceBox.swimlane.y+n.swimlanePadding,s=a.targetBox.swimlane.y+n.swimlanePadding,c=Z(o,s),l=a.sourceBox.x+a.sourceBox.dimension.width*2/3,u=a.targetBox.x+a.targetBox.dimension.width/3,d,f;e.debug(`rendering relation up=${c} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),c?(d=o,f=s+a.targetBox.dimension.height):(d=o+a.sourceBox.dimension.height,f=s);let p=i.emRelationStroke??a.visual.stroke;t.append(`path`).attr(`class`,`em-relation`).attr(`fill`,a.visual.fill).attr(`stroke`,p).attr(`stroke-width`,`1`).attr(`marker-end`,`url(#${r})`).attr(`d`,`M${l} ${d} L${u} ${f}`)}}m(Q,`renderD3Relation`);function $(e,t,n,r){return i=>{let a=e.append(`g`).attr(`class`,`em-swimlane`),o=r.emSwimlaneBackgroundOdd??`rgb(250,250,250)`,s=r.emSwimlaneBackgroundStroke??`rgb(240,240,240)`;a.append(`rect`).attr(`x`,0).attr(`y`,i.y).attr(`rx`,`3`).attr(`width`,t+n.swimlanePadding).attr(`height`,i.height).attr(`fill`,o).attr(`stroke`,s),a.append(`text`).attr(`font-weight`,n.swimlaneTextFontWeight).attr(`x`,30).attr(`y`,i.y+30).text(i.label)}}m($,`renderD3Swimlane`);var pe={parser:fe,db:J,renderer:{draw:m(function(n,r,i,o){if(e.debug(`in eventmodeling renderer`,n+`
|
|
3
|
+
`,`id:`,r,i),!Y)throw Error(`EventModeling config not found`);let s=o.db,{themeVariables:c,eventmodeling:l}=d(),u=t(`[id="${r}"]`),f=s.getDiagramProps(),p=s.getState(),m=`em-arrowhead-${r}`,h=c.emArrowhead??`#000000`;p.sortedSwimlanesArray.forEach($(u,p.maxR,f,c)),p.boxes.forEach(X(u,f)),p.relations.forEach(Q(u,f,m,c)),u.append(`defs`).append(`marker`).attr(`id`,m).attr(`markerWidth`,`10`).attr(`markerHeight`,`7`).attr(`refX`,`10`).attr(`refY`,`3.5`).attr(`orient`,`auto`).append(`polygon`).attr(`points`,`0 0, 10 3.5, 0 7`).attr(`fill`,h),a(void 0,u,l?.padding??30,l?.useMaxWidth)},`draw`)},styles:m(e=>``,`getStyles`)};export{pe as diagram};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{m as e,p as t}from"./src-BH-TyZbA.js";import{D as n,H as r,K as i,U as a,a as o,b as s,c,f as l,v as u,w as d,y as f}from"./chunk-DU6HZSFF-CF3OK3MZ.js";import{n as p}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t as m}from"./ordinal-BDEzSJ7C.js";import{t as h}from"./defaultLocale-BFoDCU3G.js";import{i as g}from"./chunk-75Z2AOVW-EXNbuzun.js";import{i as _,n as v}from"./chunk-P2QGCYS3-E4AByfsD.js";import{St as y}from"./index-D3vj8REa.js";import{n as b}from"./mermaid-parser.core-DEadI1Ja.js";import{t as x}from"./chunk-JWPE2WC7-DVXcaiue.js";import{t as S}from"./chunk-POPQ4Y6H-Bisbc2-3.js";function C(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function w(){return this.eachAfter(C)}function T(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function E(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function D(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function O(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function k(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function A(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function j(e){for(var t=this,n=M(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function M(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function N(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function P(){return Array.from(this)}function F(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function I(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*L(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function R(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=V)):t===void 0&&(t=B);for(var n=new W(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new W(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(U)}function z(){return R(this).eachBefore(H)}function B(e){return e.children}function V(e){return Array.isArray(e)?e[1]:null}function H(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function U(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function W(e){this.data=e,this.depth=this.height=0,this.parent=null}W.prototype=R.prototype={constructor:W,count:w,each:T,eachAfter:D,eachBefore:E,find:O,sum:k,sort:A,path:j,ancestors:N,descendants:P,leaves:F,links:I,copy:z,[Symbol.iterator]:L};function G(e){if(typeof e!=`function`)throw Error();return e}function K(){return 0}function q(e){return function(){return e}}function ee(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function te(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function ne(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var re=(1+Math.sqrt(5))/2;function ie(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?te(c,n,r,i,h?r+=m*g/h:a):ne(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var ae=(function e(t){function n(e,n,r,i,a){ie(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(re);function oe(){var e=ae,t=!1,n=1,r=1,i=[0],a=K,o=K,s=K,c=K,l=K;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(ee),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=G(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:q(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:q(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:q(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:q(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:q(+e),u):l},u}var J=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=a,this.getAccTitle=f,this.setDiagramTitle=i,this.getDiagramTitle=d,this.getAccDescription=u,this.setAccDescription=r}static{p(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let e=l,t=s();return g({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:``,children:this.outerNodes}}addClass(e,t){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},r=t.replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);r&&r.forEach(e=>{v(e)&&(n?.textStyles?n.textStyles.push(e):n.textStyles=[e]),n?.styles?n.styles.push(e):n.styles=[e]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){o(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function Y(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}p(Y,`buildHierarchy`);var se=p((e,t)=>{x(e,t);let n=[];for(let n of e.TreemapRows??[])n.$type===`ClassDefStatement`&&t.addClass(n.className??``,n.styleText??``);for(let r of e.TreemapRows??[]){let e=r.item;if(!e)continue;let i=r.indent?parseInt(r.indent):0,a=ce(e),o=e.classSelector?t.getStylesForClass(e.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:s};n.push(c)}let r=Y(n),i=p((e,n)=>{for(let r of e)t.addNode(r,n),r.children&&r.children.length>0&&i(r.children,n+1)},`addNodesRecursively`);i(r,0)},`populate`),ce=p(e=>e.name?String(e.name):``,`getItemName`),X={parser:{yy:void 0},parse:p(async t=>{try{let n=await b(`treemap`,t);e.debug(`Treemap AST:`,n);let r=X.parser?.yy;if(!(r instanceof J))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);se(n,r)}catch(t){throw e.error(`Error parsing treemap:`,t),t}},`parse`)},Z=10,Q=10,$=25,le={draw:p((n,r,i,a)=>{let o=a.db,l=o.getConfig(),u=l.padding??Z,d=o.getDiagramTitle(),f=o.getRoot(),{themeVariables:g}=s();if(!f)return;let v=d?30:0,b=y(r),x=l.nodeWidth?l.nodeWidth*Q:960,C=l.nodeHeight?l.nodeHeight*Q:500,w=x,T=C+v;b.attr(`viewBox`,`0 0 ${w} ${T}`),c(b,T,w,l.useMaxWidth);let E;try{let e=l.valueFormat||`,`;if(e===`$0,0`)E=p(e=>`$`+h(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let t=/\.\d+/.exec(e),n=t?t[0]:``;E=p(e=>`$`+h(`,`+n)(e),`valueFormat`)}else if(e.startsWith(`$`)){let t=e.substring(1);E=p(e=>`$`+h(t||``)(e),`valueFormat`)}else E=h(e)}catch(t){e.error(`Error creating format function:`,t),E=h(`,`)}let D=m().range([`transparent`,g.cScale0,g.cScale1,g.cScale2,g.cScale3,g.cScale4,g.cScale5,g.cScale6,g.cScale7,g.cScale8,g.cScale9,g.cScale10,g.cScale11]),O=m().range([`transparent`,g.cScalePeer0,g.cScalePeer1,g.cScalePeer2,g.cScalePeer3,g.cScalePeer4,g.cScalePeer5,g.cScalePeer6,g.cScalePeer7,g.cScalePeer8,g.cScalePeer9,g.cScalePeer10,g.cScalePeer11]),k=m().range([g.cScaleLabel0,g.cScaleLabel1,g.cScaleLabel2,g.cScaleLabel3,g.cScaleLabel4,g.cScaleLabel5,g.cScaleLabel6,g.cScaleLabel7,g.cScaleLabel8,g.cScaleLabel9,g.cScaleLabel10,g.cScaleLabel11]);d&&b.append(`text`).attr(`x`,w/2).attr(`y`,v/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(d);let A=b.append(`g`).attr(`transform`,`translate(0, ${v})`).attr(`class`,`treemapContainer`),j=R(f).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=oe().size([x,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(u).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${r}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=_({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+`;`+t.borderStyles.join(`;`)}),P.append(`text`).attr(`class`,`treemapSectionLabel`).attr(`x`,6).attr(`y`,$/2).attr(`dominant-baseline`,`middle`).text(e=>e.depth===0?``:e.data.name).attr(`font-weight`,`bold`).attr(`clip-path`,(e,t)=>`url(#clip-section-${r}-${t})`).attr(`style`,e=>e.depth===0?`display: none;`:`dominant-baseline: middle; font-size: 12px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let n=t(this),r=e.data.name;n.text(r);let i=e.x1-e.x0,a;a=l.showValues!==!1&&e.value?i-10-30-10-6:i-6-6;let o=Math.max(15,a),s=n.node();if(s.getComputedTextLength()>o){let e=r;for(;e.length>0;){if(e=r.substring(0,e.length-1),e.length===0){n.text(`...`),s.getComputedTextLength()>o&&n.text(``);break}if(n.text(e+`...`),s.getComputedTextLength()<=o)break}}}),l.showValues!==!1&&P.append(`text`).attr(`class`,`treemapSectionValue`).attr(`x`,e=>e.x1-e.x0-10).attr(`y`,$/2).attr(`text-anchor`,`end`).attr(`dominant-baseline`,`middle`).text(e=>e.value?E(e.value):``).attr(`font-style`,`italic`).attr(`style`,e=>e.depth===0?`display: none;`:`text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=F.length>20,L=I?16:38,z=I?14:28,B=I?4:8,V=I?4:6,H=I?2:4,U=I?8:10,W=I?1:2,G=A.selectAll(`.treemapLeafGroup`).data(F).enter().append(`g`).attr(`class`,(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:``}x`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);G.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,`treemapLeaf`).attr(`fill`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`style`,e=>_({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr(`fill-opacity`,.3).attr(`stroke`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`stroke-width`,3),G.append(`clipPath`).attr(`id`,(e,t)=>`clip-${r}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),G.append(`text`).attr(`class`,`treemapLabel`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,e=>(e.y1-e.y0)/2).attr(`style`,e=>`text-anchor: middle; dominant-baseline: middle; font-size: ${L}px;fill:`+k(e.data.name)+`;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.data.name).each(function(e){let n=t(this),r=e.x1-e.x0,i=e.y1-e.y0,a=n.node(),o=r-2*H,s=i-2*H;if(o<U||s<U){n.style(`display`,`none`);return}let c=parseInt(n.style(`font-size`),10),l=.6;for(;a.getComputedTextLength()>o&&c>B;)c--,n.style(`font-size`,`${c}px`);let u=Math.max(V,Math.min(z,Math.round(c*l))),d=c+W+u;for(;d>s&&c>B&&(c--,u=Math.max(V,Math.min(z,Math.round(c*l))),!(u<V&&c===B));)n.style(`font-size`,`${c}px`),d=c+W+u;n.style(`font-size`,`${c}px`),I?(c<B||s<B)&&n.style(`display`,`none`):(a.getComputedTextLength()>o||c<B||s<c)&&n.style(`display`,`none`)}),l.showValues!==!1&&G.append(`text`).attr(`class`,`treemapValue`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,function(e){return(e.y1-e.y0)/2}).attr(`style`,e=>`text-anchor: middle; dominant-baseline: hanging; font-size: ${z}px;fill:`+k(e.data.name)+`;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let n=t(this),r=this.parentNode;if(!r){n.style(`display`,`none`);return}let i=t(r).select(`.treemapLabel`);if(i.empty()||i.style(`display`)===`none`){n.style(`display`,`none`);return}let a=parseFloat(i.style(`font-size`)),o=Math.max(V,Math.min(z,Math.round(a*.6)));n.style(`font-size`,`${o}px`);let s=(e.y1-e.y0)/2+a/2+W;n.attr(`y`,s);let c=e.x1-e.x0,l=e.y1-e.y0-4,u=c-2*H;n.node().getComputedTextLength()>u||s+o>l||o<V?n.style(`display`,`none`):n.style(`display`,null)});let K=l.diagramPadding??8;S(b,K,`flowchart`,l?.useMaxWidth||!1)},`draw`),getClasses:p(function(e,t){return t.db.getClasses()},`getClasses`)},ue={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelFontSize:`12px`,valueFontSize:`10px`,titleFontSize:`14px`},de={parser:X,get db(){return new J},renderer:le,styles:p(({treemap:e}={})=>{let t=n(),r=s(),i=g(t,r.themeVariables),a=g(ue,e),o=a.titleColor??i.titleColor,c=a.labelColor??i.textColor,l=a.valueColor??i.textColor;return`
|
|
2
|
+
.treemapNode.section {
|
|
3
|
+
stroke: ${a.sectionStrokeColor};
|
|
4
|
+
stroke-width: ${a.sectionStrokeWidth};
|
|
5
|
+
fill: ${a.sectionFillColor};
|
|
6
|
+
}
|
|
7
|
+
.treemapNode.leaf {
|
|
8
|
+
stroke: ${a.leafStrokeColor};
|
|
9
|
+
stroke-width: ${a.leafStrokeWidth};
|
|
10
|
+
fill: ${a.leafFillColor};
|
|
11
|
+
}
|
|
12
|
+
.treemapLabel {
|
|
13
|
+
fill: ${c};
|
|
14
|
+
font-size: ${a.labelFontSize};
|
|
15
|
+
}
|
|
16
|
+
.treemapValue {
|
|
17
|
+
fill: ${l};
|
|
18
|
+
font-size: ${a.valueFontSize};
|
|
19
|
+
}
|
|
20
|
+
.treemapTitle {
|
|
21
|
+
fill: ${o};
|
|
22
|
+
font-size: ${a.titleFontSize};
|
|
23
|
+
}
|
|
24
|
+
`},`getStyles`)};export{de as diagram};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{m as e}from"./src-BH-TyZbA.js";import{H as t,K as n,U as r,a as i,b as a,c as o,f as s,v as c,w as l,y as u}from"./chunk-DU6HZSFF-CF3OK3MZ.js";import{n as d}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{i as f}from"./chunk-75Z2AOVW-EXNbuzun.js";import{St as p}from"./index-D3vj8REa.js";import{n as m}from"./mermaid-parser.core-DEadI1Ja.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";var g=s.packet,_=class{constructor(){this.packet=[],this.setAccTitle=r,this.getAccTitle=u,this.setDiagramTitle=n,this.getDiagramTitle=l,this.getAccDescription=c,this.setAccDescription=t}static{d(this,`PacketDB`)}getConfig(){let e=f({...g,...a().packet});return e.showBits&&(e.paddingY+=10),e}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){i(),this.packet=[]}},v=1e4,y=d((t,n)=>{h(t,n);let r=-1,i=[],a=1,{bitsPerRow:o}=n.getConfig();for(let{start:s,end:c,bits:l,label:u}of t.blocks){if(s!==void 0&&c!==void 0&&c<s)throw Error(`Packet block ${s} - ${c} is invalid. End must be greater than start.`);if(s??=r+1,s!==r+1)throw Error(`Packet block ${s} - ${c??s} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${s} is invalid. Cannot have a zero bit field.`);for(c??=s+(l??1)-1,l??=c-s+1,r=c,e.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&n.getPacket().length<v;){let[e,t]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(n.pushWord(i),i=[],a++),!t)break;({start:s,end:c,bits:l,label:u}=t)}}n.pushWord(i)},`populate`),b=d((e,t,n)=>{if(e.start===void 0)throw Error(`start should have been set during first phase`);if(e.end===void 0)throw Error(`end should have been set during first phase`);if(e.start>e.end)throw Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*n)return[e,void 0];let r=t*n-1,i=t*n;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},`getNextFittingBlock`),x={parser:{yy:void 0},parse:d(async t=>{let n=await m(`packet`,t),r=x.parser?.yy;if(!(r instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);e.debug(n),y(n,r)},`parse`)},S=d((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:s,paddingY:c,bitWidth:l,bitsPerRow:u}=a,d=i.getPacket(),f=i.getDiagramTitle(),m=s+c,h=m*(d.length+1)-(f?0:s),g=l*u+2,_=p(t);_.attr(`viewBox`,`0 0 ${g} ${h}`),o(_,h,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,h-m/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=d((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:d(({packet:e}={})=>{let t=f(T,e);return`
|
|
2
|
+
.packetByte {
|
|
3
|
+
font-size: ${t.byteFontSize};
|
|
4
|
+
}
|
|
5
|
+
.packetByte.start {
|
|
6
|
+
fill: ${t.startByteColor};
|
|
7
|
+
}
|
|
8
|
+
.packetByte.end {
|
|
9
|
+
fill: ${t.endByteColor};
|
|
10
|
+
}
|
|
11
|
+
.packetLabel {
|
|
12
|
+
fill: ${t.labelColor};
|
|
13
|
+
font-size: ${t.labelFontSize};
|
|
14
|
+
}
|
|
15
|
+
.packetTitle {
|
|
16
|
+
fill: ${t.titleColor};
|
|
17
|
+
font-size: ${t.titleFontSize};
|
|
18
|
+
}
|
|
19
|
+
.packetBlock {
|
|
20
|
+
stroke: ${t.blockStrokeColor};
|
|
21
|
+
stroke-width: ${t.blockStrokeWidth};
|
|
22
|
+
fill: ${t.blockFillColor};
|
|
23
|
+
}
|
|
24
|
+
`},`styles`)};export{E as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./src-BH-TyZbA.js";var t=Math.abs,n=Math.atan2,r=Math.cos,i=Math.max,a=Math.min,o=Math.sin,s=Math.sqrt,c=1e-12,l=Math.PI,u=l/2,d=2*l;function f(e){return e>1?0:e<-1?l:Math.acos(e)}function p(e){return e>=1?u:e<=-1?-u:Math.asin(e)}var m=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BLANK_URL=e.relativeFirstCharacters=e.whitespaceEscapeCharsRegex=e.urlSchemeRegex=e.ctrlCharactersRegex=e.htmlCtrlEntityRegex=e.htmlEntitiesRegex=e.invalidProtocolRegex=void 0,e.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,e.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,e.htmlCtrlEntityRegex=/&(newline|tab);/gi,e.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,e.urlSchemeRegex=/^.+(:|:)/gim,e.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,e.relativeFirstCharacters=[`.`,`/`],e.BLANK_URL=`about:blank`})),h=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.sanitizeUrl=o;var t=m();function n(e){return t.relativeFirstCharacters.indexOf(e[0])>-1}function r(e){return e.replace(t.ctrlCharactersRegex,``).replace(t.htmlEntitiesRegex,function(e,t){return String.fromCharCode(t)})}function i(e){return URL.canParse(e)}function a(e){try{return decodeURIComponent(e)}catch{return e}}function o(e){if(!e)return t.BLANK_URL;var o,s=a(e.trim());do s=r(s).replace(t.htmlCtrlEntityRegex,``).replace(t.ctrlCharactersRegex,``).replace(t.whitespaceEscapeCharsRegex,``).trim(),s=a(s),o=s.match(t.ctrlCharactersRegex)||s.match(t.htmlEntitiesRegex)||s.match(t.htmlCtrlEntityRegex)||s.match(t.whitespaceEscapeCharsRegex);while(o&&o.length>0);var c=s;if(!c)return t.BLANK_URL;if(n(c))return c;var l=c.trimStart(),u=l.match(t.urlSchemeRegex);if(!u)return c;var d=u[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(d))return t.BLANK_URL;var f=l.replace(/\\/g,`/`);if(d===`mailto:`||d.includes(`://`))return f;if(d===`http:`||d===`https:`){if(!i(f))return t.BLANK_URL;var p=new URL(f);return p.protocol=p.protocol.toLowerCase(),p.hostname=p.hostname.toLowerCase(),p.toString()}return f}}));export{n as a,u as c,l as d,o as f,p as i,i as l,d as m,t as n,r as o,s as p,f as r,c as s,h as t,a as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as e}from"./src-BH-TyZbA.js";import"./chunk-DU6HZSFF-CF3OK3MZ.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./index-D3vj8REa.js";import{f as n,t as r}from"./mermaid-parser.core-DEadI1Ja.js";import{n as i,r as a,t as o}from"./chunk-SVP7TREG-DvMOAiwI.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";var c=n().RailroadEbnf.parser.LangiumParser,l=t(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformChoice`),u=t(e=>{let t=e.elements.map(p);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformSequence`),d=t(e=>{switch(e.$type){case`EbnfTerminal`:return{type:`terminal`,value:e.value};case`EbnfNonTerminal`:return{type:`nonterminal`,name:e.name};case`EbnfSpecial`:return{type:`special`,text:e.text};case`EbnfGroup`:return l(e.element);case`EbnfOptional`:return{type:`optional`,element:l(e.element)};case`EbnfRepetition`:return{type:`repetition`,element:l(e.element),min:0,max:1/0};default:throw Error(`Unsupported EBNF primary node: ${e.$type}`)}},`transformPrimary`),f=t((e,t)=>{switch(t.$type){case`EbnfOptionalPostfix`:return{type:`optional`,element:e};case`EbnfZeroOrMorePostfix`:return{type:`repetition`,element:e,min:0,max:1/0};case`EbnfOneOrMorePostfix`:return{type:`repetition`,element:e,min:1,max:1/0};case`EbnfExceptionPostfix`:return{type:`sequence`,elements:[e,{type:`terminal`,value:`-`},d(t.except)]};default:throw Error(`Unsupported EBNF postfix node: ${t.$type}`)}},`transformPostfix`),p=t(e=>e.postfixes.reduce((e,t)=>f(e,t),d(e.base)),`transformTerm`),m=t(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=t(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:t(t=>{o.clear(),e.debug(`[EBNF Parser] Starting Langium parse`);let n=c.parse(t);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new r(n);let i=n.value;e.debug(`[EBNF Parser] Parsed rules:`,i.rules.length),h(i),e.debug(`[EBNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import{m as e,p as t}from"./src-BH-TyZbA.js";import{H as n,K as r,U as i,a,it as o,s,v as c,w as l,x as u,y as d}from"./chunk-DU6HZSFF-CF3OK3MZ.js";import{n as f,t as p}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t as m}from"./channel-DzSauwD3.js";import{c as h,g}from"./chunk-75Z2AOVW-EXNbuzun.js";import"./chunk-P2QGCYS3-E4AByfsD.js";import"./chunk-PWAF6VOD-DaoPxZAa.js";import"./chunk-GMAD6QVW-2yfGg28o.js";import"./chunk-4HAMMTFA-EgoP78tp.js";import"./chunk-GVQU2GXP-C_VeaX4U.js";import{n as _,t as v}from"./index-D3vj8REa.js";import{t as y}from"./chunk-XXDRQBXY-DFBUG-OT.js";import{t as b}from"./chunk-POPQ4Y6H-Bisbc2-3.js";var x=(function(){var e=f(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),t=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],n=[2,2],r=[1,7],i=[1,9],a=[1,10],o=[1,11],s=[1,12],c=[1,30],l=[1,23],u=[1,24],d=[1,25],p=[1,26],m=[1,27],h=[1,19],g=[1,28],_=[1,29],v=[1,20],y=[1,18],b=[1,21],x=[1,22],S=[2,6],C=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],w=[1,36],T=[1,37],E=[1,38],D=[1,39],O=[1,40],k=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],A=[1,46],j=[1,47],M=[1,57],N=[43,51,53,54,55,74,75],P=[1,70],F=[1,68],I=[1,65],L=[1,69],R=[1,71],z=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],B=[1,78],V=[1,77],H=[1,76],U=[69,70,71,72,73],W=[1,91],G=[6,9,45,50],K=[6,9,12,44,45,50,51,52],q=[1,101],J=[1,100],Y=[1,99],X=[18,61],ee=[1,110],te=[1,109],ne=[20,43,51,53,54,55],Z=[18,61,64,66],Q={trace:f(function(){},`trace`),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:`error`,4:`ER_DIAGRAM`,6:`EOF`,9:`NEWLINE`,12:`COLON`,14:`STYLE_SEPARATOR`,16:`BLOCK_START`,18:`BLOCK_STOP`,19:`SQS`,20:`SQE`,21:`title`,22:`title_value`,23:`acc_title`,24:`acc_title_value`,25:`acc_descr`,26:`acc_descr_value`,27:`acc_descr_multiline_value`,33:`END`,34:`SUBGRAPH`,37:`direction_tb`,38:`direction_bt`,39:`direction_rl`,40:`direction_lr`,41:`CLASSDEF`,43:`UNICODE_TEXT`,44:`STYLE_TEXT`,45:`COMMA`,46:`CLASS`,47:`STYLE`,50:`SEMI`,51:`NUM`,52:`BRKT`,53:`ENTITY_NAME`,54:`DECIMAL_NUM`,55:`ENTITY_ONE`,61:`ATTRIBUTE_WORD`,62:`?`,64:`,`,65:`ATTRIBUTE_KEY`,66:`COMMENT`,69:`ZERO_OR_ONE`,70:`ZERO_OR_MORE`,71:`ONE_OR_MORE`,72:`ONLY_ONE`,73:`MD_PARENT`,74:`NON_IDENTIFYING`,75:`IDENTIFYING`,76:`WORD`},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:break;case 2:this.$=[];break;case 3:this.$=a[s-1].concat(a[s]);break;case 4:this.$=a[s];break;case 5:case 6:this.$=[];break;case 7:r.addEntity(a[s-4]),r.addEntity(a[s-2]),r.addRelationship(a[s-4],a[s],a[s-2],a[s-3]),this.$=[a[s-4],a[s-2]];break;case 8:r.addEntity(a[s-8]),r.addEntity(a[s-4]),r.addRelationship(a[s-8],a[s],a[s-4],a[s-5]),r.setClass([a[s-8]],a[s-6]),r.setClass([a[s-4]],a[s-2]),this.$=[a[s-8],a[s-4]];break;case 9:r.addEntity(a[s-6]),r.addEntity(a[s-2]),r.addRelationship(a[s-6],a[s],a[s-2],a[s-3]),r.setClass([a[s-6]],a[s-4]),this.$=[a[s-6],a[s-2]];break;case 10:r.addEntity(a[s-6]),r.addEntity(a[s-4]),r.addRelationship(a[s-6],a[s],a[s-4],a[s-5]),r.setClass([a[s-4]],a[s-2]),this.$=[a[s-6],a[s-4]];break;case 11:r.addEntity(a[s-3]),r.addAttributes(a[s-3],a[s-1]),this.$=[a[s-3]];break;case 12:r.addEntity(a[s-5]),r.addAttributes(a[s-5],a[s-1]),r.setClass([a[s-5]],a[s-3]),this.$=[a[s-5]];break;case 13:r.addEntity(a[s-2]),this.$=[a[s-2]];break;case 14:r.addEntity(a[s-4]),r.setClass([a[s-4]],a[s-2]),this.$=[a[s-4]];break;case 15:r.addEntity(a[s]),this.$=[a[s]];break;case 16:r.addEntity(a[s-2]),r.setClass([a[s-2]],a[s]),this.$=[a[s-2]];break;case 17:r.addEntity(a[s-6],a[s-4]),r.addAttributes(a[s-6],a[s-1]),this.$=[a[s-6]];break;case 18:r.addEntity(a[s-8],a[s-6]),r.addAttributes(a[s-8],a[s-1]),r.setClass([a[s-8]],a[s-3]),this.$=[a[s-8]];break;case 19:r.addEntity(a[s-5],a[s-3]),this.$=[a[s-5]];break;case 20:r.addEntity(a[s-7],a[s-5]),r.setClass([a[s-7]],a[s-2]),this.$=[a[s-7]];break;case 21:r.addEntity(a[s-3],a[s-1]);break;case 22:r.addEntity(a[s-5],a[s-3]),r.setClass([a[s-5]],a[s]);break;case 23:case 24:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 25:case 26:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 27:r.subgraphDepth?this.$=a[s]:(r.setDirection(a[s].value),this.$=[]);break;case 31:r.subgraphDepth=(r.subgraphDepth||1)-1,this.$=r.addSubGraph({text:a[s-2].id},a[s-1],{text:a[s-2].text});break;case 32:r.subgraphDepth=(r.subgraphDepth||0)+1,this.$={id:a[s-1],text:a[s-1]};break;case 33:r.subgraphDepth=(r.subgraphDepth||0)+1,this.$={id:a[s-4],text:a[s-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=a[s];break;case 35:this.$=a[s-1]+` `+a[s];break;case 36:this.$={stmt:`dir`,value:`TB`};break;case 37:this.$={stmt:`dir`,value:`BT`};break;case 38:this.$={stmt:`dir`,value:`RL`};break;case 39:this.$={stmt:`dir`,value:`LR`};break;case 40:this.$=a[s-3],r.addClass(a[s-2],a[s-1]);break;case 41:case 42:case 63:case 72:this.$=[a[s]];break;case 43:case 44:this.$=a[s-2].concat([a[s]]);break;case 45:this.$=a[s-2],r.setClass(a[s-1],a[s]);break;case 46:this.$=a[s-3],r.addCssStyles(a[s-2],a[s-1]);break;case 47:this.$=[a[s]];break;case 48:a[s-2].push(a[s]),this.$=a[s-2];break;case 50:this.$=a[s-1]+a[s];break;case 58:case 84:case 85:this.$=a[s].replace(/"/g,``);break;case 64:a[s].push(a[s-1]),this.$=a[s];break;case 65:this.$={type:a[s-1],name:a[s]};break;case 66:this.$={type:a[s-2],name:a[s-1],keys:a[s]};break;case 67:this.$={type:a[s-2],name:a[s-1],comment:a[s]};break;case 68:this.$={type:a[s-3],name:a[s-2],keys:a[s-1],comment:a[s]};break;case 69:case 71:case 74:this.$=a[s];break;case 70:this.$=a[s-1]+a[s];break;case 73:a[s-2].push(a[s]),this.$=a[s-2];break;case 75:this.$=a[s].replace(/"/g,``);break;case 76:this.$={cardA:a[s],relType:a[s-1],cardB:a[s-2]};break;case 77:this.$=r.Cardinality.ZERO_OR_ONE;break;case 78:this.$=r.Cardinality.ZERO_OR_MORE;break;case 79:this.$=r.Cardinality.ONE_OR_MORE;break;case 80:this.$=r.Cardinality.ONLY_ONE;break;case 81:this.$=r.Cardinality.MD_PARENT;break;case 82:this.$=r.Identification.NON_IDENTIFYING;break;case 83:this.$=r.Identification.IDENTIFYING}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},e(t,n,{5:3}),{6:[1,4],7:5,8:6,9:r,10:8,21:i,23:a,25:o,27:s,28:13,29:14,30:15,31:16,32:17,34:c,37:l,38:u,39:d,40:p,41:m,43:h,46:g,47:_,51:v,53:y,54:b,55:x},e(t,S,{1:[2,1]}),e(C,[2,3]),e(C,[2,4]),e(C,[2,5]),e(C,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:w,70:T,71:E,72:D,73:O}),{22:[1,41]},{24:[1,42]},{26:[1,43]},e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,30]),e(C,n,{5:44}),e(k,[2,58]),e(k,[2,59]),e(k,[2,60]),e(k,[2,61]),e(k,[2,62]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),e(C,[2,39]),{15:45,43:A,44:j},{15:48,43:A,44:j},{15:49,43:A,44:j},{10:50,43:h,51:v,53:y,54:b,55:x},{10:51,43:h,51:v,53:y,54:b,55:x},{15:52,43:A,44:j},{17:53,18:[1,54],56:55,57:56,61:M},{10:58,43:h,51:v,53:y,54:b,55:x},{68:59,74:[1,60],75:[1,61]},e(N,[2,77]),e(N,[2,78]),e(N,[2,79]),e(N,[2,80]),e(N,[2,81]),e(C,[2,23]),e(C,[2,24]),e(C,[2,25]),{6:[1,63],7:5,8:6,9:r,10:8,21:i,23:a,25:o,27:s,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:c,37:l,38:u,39:d,40:p,41:m,43:h,46:g,47:_,51:v,53:y,54:b,55:x},{12:P,42:64,44:F,45:I,48:66,49:67,51:L,52:R},e(z,[2,41]),e(z,[2,42]),{15:72,43:A,44:j,45:I},{12:P,42:73,44:F,45:I,48:66,49:67,51:L,52:R},{6:B,9:V,19:[1,75],35:74,50:H},{12:[1,79],14:[1,80]},e(C,[2,16],{67:35,11:81,16:[1,82],45:I,69:w,70:T,71:E,72:D,73:O}),{18:[1,83]},e(C,[2,13]),{17:84,18:[2,63],56:55,57:56,61:M},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:w,70:T,71:E,72:D,73:O},e(U,[2,82]),e(U,[2,83]),e(C,[2,31]),e(C,S),{6:B,9:V,35:90,45:W,50:H},{43:[1,92],44:[1,93]},e(G,[2,47],{49:94,12:P,44:F,51:L,52:R}),e(K,[2,49]),e(K,[2,54]),e(K,[2,55]),e(K,[2,56]),e(K,[2,57]),e(C,[2,45],{45:I}),{6:B,9:V,35:95,45:W,50:H},e(C,[2,32]),{10:97,36:96,43:h,51:v,53:y,54:b,55:x},e(C,[2,51]),e(C,[2,52]),e(C,[2,53]),{13:98,43:q,53:J,76:Y},{15:102,43:A,44:j},{10:103,43:h,51:v,53:y,54:b,55:x},{17:104,18:[1,105],56:55,57:56,61:M},e(C,[2,11]),{18:[2,64]},e(X,[2,65],{59:106,60:107,63:108,65:ee,66:te}),e([18,61,65,66],[2,71]),{61:[2,70]},e(C,[2,21],{14:[1,112],16:[1,111]}),e([43,51,53,54,55],[2,76]),e(C,[2,40]),{12:P,44:F,48:113,49:67,51:L,52:R},e(z,[2,43]),e(z,[2,44]),e(K,[2,50]),e(C,[2,46]),{10:115,20:[1,114],43:h,51:v,53:y,54:b,55:x},e(ne,[2,34]),e(C,[2,7]),e(C,[2,84]),e(C,[2,85]),e(C,[2,86]),{12:[1,116],45:I},{12:[1,118],14:[1,117]},{18:[1,119]},e(C,[2,14]),e(X,[2,66],{60:120,64:[1,121],66:te}),e(X,[2,67]),e(Z,[2,72]),e(X,[2,75]),e(Z,[2,74]),{17:122,18:[1,123],56:55,57:56,61:M},{15:124,43:A,44:j},e(G,[2,48],{49:94,12:P,44:F,51:L,52:R}),{6:B,9:V,35:125,50:H},e(ne,[2,35]),{13:126,43:q,53:J,76:Y},{15:127,43:A,44:j},{13:128,43:q,53:J,76:Y},e(C,[2,12]),e(X,[2,68]),{63:129,65:ee},{18:[1,130]},e(C,[2,19]),e(C,[2,22],{16:[1,131],45:I}),e(C,[2,33]),e(C,[2,10]),{12:[1,132],45:I},e(C,[2,9]),e(Z,[2,73]),e(C,[2,17]),{17:133,18:[1,134],56:55,57:56,61:M},{13:135,43:q,53:J,76:Y},{18:[1,136]},e(C,[2,20]),e(C,[2,8]),e(C,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:f(function(e){var t=this,n=[0],r=[],i=[null],a=[],o=this.table,s=``,c=0,l=0,u=0,d=2,p=1,m=a.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;a.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){n.length-=2*e,i.length-=e,a.length-=e}f(b,`popStack`);function x(){var e=r.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(r=e,e=r.pop()),e=t.symbols_[e]||e),e}f(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=n[n.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=o[w]&&o[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],o[w])this.terminals_[O]&&O>d&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(c+1)+`:
|
|
2
|
+
`+h.showPosition()+`
|
|
3
|
+
Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(c+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:n.push(S),i.push(h.yytext),a.push(h.yylloc),n.push(T[1]),S=null,C?(S=C,C=null):(l=h.yyleng,s=h.yytext,c=h.yylineno,v=h.yylloc,u>0&&u--);break;case 2:if(k=this.productions_[T[1]][1],D.$=i[i.length-k],D._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},y&&(D._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),E=this.performAction.apply(D,[s,l,c,g.yy,T[1],i,a].concat(m)),E!==void 0)return E;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[T[1]][0]),i.push(D.$),a.push(D._$),A=o[n[n.length-2]][n[n.length-1]],n.push(A);break;case 3:return!0}}return!0},`parse`)};Q.lexer=(function(){return{EOF:1,parseError:f(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:f(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:f(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:f(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:f(function(){return this._more=!0,this},`more`),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:f(function(e){this.unput(this.match.slice(e))},`less`),pastInput:f(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:f(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:f(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
|
5
|
+
`+t+`^`},`showPosition`),test_match:f(function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},`test_match`),next:f(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext=``,this.match=``);for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),e!==!1)return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),e!==!1&&e):this._input===``?this.EOF:this.parseError(`Lexical error on line `+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:``,token:null,line:this.yylineno})},`next`),lex:f(function(){return this.next()||this.lex()},`lex`),begin:f(function(e){this.conditionStack.push(e)},`begin`),popState:f(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},`popState`),_currentRules:f(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},`_currentRules`),topState:f(function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:`INITIAL`},`topState`),pushState:f(function(e){this.begin(e)},`pushState`),stateStackSize:f(function(){return this.conditionStack.length},`stateStackSize`),options:{"case-insensitive":!0},performAction:f(function(e,t,n,r){switch(n){case 0:return this.begin(`acc_title`),23;case 1:return this.popState(),`acc_title_value`;case 2:return this.begin(`acc_descr`),25;case 3:return this.popState(),`acc_descr_value`;case 4:this.begin(`acc_descr_multiline`);break;case 5:this.popState();break;case 6:return`acc_descr_multiline_value`;case 7:return 37;case 8:return 38;case 9:return 39;case 10:return 40;case 11:break;case 12:return 9;case 13:return 53;case 14:return 76;case 15:return 4;case 16:return this.begin(`block`),16;case 17:return 52;case 18:return 52;case 19:return 45;case 20:return 14;case 21:return 12;case 22:break;case 23:return 65;case 24:return 61;case 25:return 61;case 26:this.begin(`block_bq`);break;case 27:return 61;case 28:this.popState();break;case 29:return 66;case 30:break;case 31:return this.popState(),18;case 32:return t.yytext[0];case 33:return 19;case 34:return 20;case 35:return this.begin(`style`),47;case 36:return this.popState(),9;case 37:break;case 38:return 12;case 39:return 45;case 40:return 52;case 41:return this.begin(`style`),41;case 42:return 46;case 43:return 34;case 44:return 33;case 45:return 69;case 46:return 71;case 47:return 71;case 48:return 71;case 49:return 69;case 50:return 69;case 51:return 70;case 52:return 70;case 53:return 70;case 54:return 70;case 55:return 70;case 56:return 71;case 57:return 70;case 58:return 71;case 59:return 72;case 60:return 72;case 61:return 54;case 62:return 72;case 63:return 72;case 64:return 72;case 65:return 55;case 66:return 51;case 67:return 72;case 68:return 69;case 69:return 70;case 70:return 71;case 71:return 73;case 72:return 74;case 73:return 75;case 74:return 75;case 75:return 74;case 76:return 74;case 77:return 74;case 78:return 44;case 79:return 50;case 80:return 43;case 81:return t.yytext[0];case 82:return 6}},`anonymous`),rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[ \t\r]+)/i,/^(?:[\n]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:#)/i,/^(?:#)/i,/^(?:,)/i,/^(?::::)/i,/^(?::)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:([^\s]*)[~].*[~]([^\s]*))/i,/^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\.,\u00C0-\uFFFF\*]*))/i,/^(?:[`])/i,/^(?:[^`]+)/i,/^(?:[`])/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:style\b)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?::)/i,/^(?:,)/i,/^(?:#)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:subgraph\b)/i,/^(?:end\b\s*)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:[0-9]+\.[0-9]+)/i,/^(?:1(?=\s+[A-Za-z_"']))/i,/^(?:1(?=\s+[0-9]))/i,/^(?:1(?=(--|\.\.|\.-|-\.)))/i,/^(?:1\b)/i,/^(?:[0-9]+)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:u(?=[\.\-\|]))/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:;)/i,/^(?:([^\x00-\x7F]|\w|-|\*|\.)+)/i,/^(?:.)/i,/^(?:$)/i],conditions:{style:{rules:[36,37,38,39,40,78,79],inclusive:!1},acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},block_bq:{rules:[27,28],inclusive:!1},block:{rules:[22,23,24,25,26,29,30,31,32],inclusive:!1},INITIAL:{rules:[0,2,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,33,34,35,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,80,81,82],inclusive:!0}}}})();function $(){this.yy={}}return f($,`Parser`),$.prototype=Q,Q.Parser=$,new $})();x.parser=x;var S=x,C=class{constructor(){this.entities=new Map,this.relationships=[],this.classes=new Map,this.subgraphDepth=0,this.subGraphs=[],this.subGraphLookup=new Map,this.subCount=0,this.direction=`TB`,this.Cardinality={ZERO_OR_ONE:`ZERO_OR_ONE`,ZERO_OR_MORE:`ZERO_OR_MORE`,ONE_OR_MORE:`ONE_OR_MORE`,ONLY_ONE:`ONLY_ONE`,MD_PARENT:`MD_PARENT`},this.Identification={NON_IDENTIFYING:`NON_IDENTIFYING`,IDENTIFYING:`IDENTIFYING`},this.setAccTitle=i,this.getAccTitle=d,this.setAccDescription=n,this.getAccDescription=c,this.setDiagramTitle=r,this.getDiagramTitle=l,this.getConfig=f(()=>u().er,`getConfig`),this.clear(),this.addEntity=this.addEntity.bind(this),this.addAttributes=this.addAttributes.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setDirection=this.setDirection.bind(this),this.addCssStyles=this.addCssStyles.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this),this.addSubGraph=this.addSubGraph.bind(this)}static{f(this,`ErDB`)}addEntity(t,n=``){return this.entities.has(t)?!this.entities.get(t)?.alias&&n&&(this.entities.get(t).alias=n,e.info(`Add alias '${n}' to entity '${t}'`)):(this.entities.set(t,{id:`entity-${t}-${this.entities.size}`,label:t,attributes:[],alias:n,shape:`erBox`,look:u().look??`default`,cssClasses:`default`,cssStyles:[],labelType:`markdown`}),e.info(`Added new entity :`,t)),this.entities.get(t)}getEntity(e){return this.entities.get(e)}getEntities(){return this.entities}getClasses(){return this.classes}addAttributes(t,n){let r=this.addEntity(t),i;for(i=n.length-1;i>=0;i--)n[i].keys||(n[i].keys=[]),n[i].comment||(n[i].comment=``),r.attributes.push(n[i]),e.debug(`Added attribute `,n[i].name)}addRelationship(t,n,r,i){let a;if(this.subGraphLookup.has(t))a=t;else{let e=this.addEntity(t);if(!e)return;a=e.id}let o;if(this.subGraphLookup.has(r))o=r;else{let e=this.addEntity(r);if(!e)return;o=e.id}let s={entityA:a,roleA:n,entityB:o,relSpec:i};this.relationships.push(s),e.debug(`Added new relationship :`,s)}getRelationships(){return this.relationships}getDirection(){return this.direction}setDirection(e){this.direction=e}getCompiledStyles(e){let t=[];for(let n of e){let e=this.classes.get(n);e?.styles&&(t=[...t,...e.styles??[]].map(e=>e.trim())),e?.textStyles&&(t=[...t,...e.textStyles??[]].map(e=>e.trim()))}return t}addCssStyles(e,t){for(let n of e){let e=this.entities.get(n),r=this.subGraphLookup.get(n);if(t){if(e)for(let n of t)e.cssStyles.push(n);if(r){r.cssStyles||=[];for(let e of t)r.cssStyles.push(e)}}}}addClass(e,t){e.forEach(e=>{let n=this.classes.get(e);n===void 0&&(n={id:e,styles:[],textStyles:[]},this.classes.set(e,n)),t&&t.forEach(function(e){if(/color/.exec(e)){let t=e.replace(`fill`,`bgFill`);n.textStyles.push(t)}n.styles.push(e)})})}addSubGraph(t,n,r){let i=t.text.trim(),a=r.text,o=f(e=>{let t=new Set,n;return{nodeList:e.filter(e=>{if(e?.stmt)return e.stmt===`dir`&&(n=e.value),!1;if(typeof e!=`string`)return!1;let r=e.trim();return!r||t.has(r)?!1:(t.add(r),!0)}),dir:n}},`uniq`)(n.flat()),s=o.nodeList,c=o.dir;i??=`subGraph`+this.subCount,a||=``,a=this.sanitizeText(a),this.subCount+=1;let l={id:i,nodes:s,title:a.trim(),classes:[],cssStyles:[],dir:c,labelType:this.sanitizeNodeLabelType(r?.type)};return e.info(`Adding`,l.id,l.nodes,l.dir),l.nodes=this.makeUniq(l,this.subGraphs).nodes,this.subGraphs.push(l),this.subGraphLookup.set(i,l),i}getSubGraphs(){return this.subGraphs}setClass(e,t){for(let n of e){let e=this.entities.get(n);if(e)for(let n of t)e.cssClasses+=` `+n;let r=this.subGraphLookup.get(n);if(r)for(let e of t)r.classes.push(e)}}subgraphNodeCache(e){let t=new Set;for(let n of e)for(let e of n.nodes)t.add(e);return t}makeUniq(t,n){let r=this.subgraphNodeCache(n),i=[];return t.nodes.forEach((n,a)=>{r.has(n)?e.warn(`Entity '${n}' already belongs to another subgraph and will be ignored`):i.push(t.nodes[a])}),{nodes:i}}sanitizeText(e){return s.sanitizeText(e,u())}sanitizeNodeLabelType(e){switch(e){case`markdown`:case`string`:case`text`:return e;default:return`markdown`}}clear(){this.entities=new Map,this.classes=new Map,this.relationships=[],this.subGraphs=[],this.subGraphLookup=new Map,this.subCount=0,this.subgraphDepth=0,a()}getData(){let e=[],t=[],n=u(),r=this.getSubGraphs(),i=new Map,a=new Map;for(let e=r.length-1;e>=0;e--){let t=r[e];t.nodes.length>0&&a.set(t.id,!0);for(let e of t.nodes)i.set(e,t.id)}for(let t=r.length-1;t>=0;t--){let a=r[t];e.push({id:a.id,label:a.title,labelStyle:``,labelType:a.labelType,parentId:i.get(a.id),padding:8,cssCompiledStyles:this.getCompiledStyles(a.classes),cssStyles:a.cssStyles,cssClasses:a.classes.join(` `),shape:`rect`,dir:a.dir,isGroup:!0,look:n.look})}let o=new Set(r.map(e=>e.id)),s=0;for(let t of this.entities.keys()){if(o.has(t))continue;let n=this.entities.get(t);n&&(n.cssCompiledStyles=this.getCompiledStyles(n.cssClasses.split(` `)),n.colorIndex=s++,e.push({...n,parentId:i.get(t),isGroup:!1}))}let c=0;for(let e of this.relationships){let r={id:h(e.entityA,e.entityB,{prefix:`id`,counter:c++}),type:`normal`,curve:`basis`,start:e.entityA,end:e.entityB,label:e.roleA,labelpos:`c`,thickness:`normal`,classes:`relationshipLine`,arrowTypeStart:e.relSpec.cardB.toLowerCase(),arrowTypeEnd:e.relSpec.cardA.toLowerCase(),pattern:e.relSpec.relType==`IDENTIFYING`?`solid`:`dashed`,look:n.look,labelType:`markdown`};t.push(r)}return{nodes:e,edges:t,other:{},config:n,direction:this.direction}}},w={};p(w,{draw:()=>T});var T=f(async function(n,r,i,a){e.info(`REF0:`),e.info(`Drawing er diagram (unified)`,r);let{securityLevel:o,er:s,layout:c}=u(),l=a.db.getData(),d=y(r,o);l.type=a.type,l.layoutAlgorithm=v(c),l.config.flowchart.nodeSpacing=s?.nodeSpacing||140,l.config.flowchart.rankSpacing=s?.rankSpacing||80,l.direction=a.db.getDirection();let{config:f}=l,{look:p}=f;l.markers=p===`neo`?[`only_one_neo`,`zero_or_one_neo`,`one_or_more_neo`,`zero_or_more_neo`]:[`only_one`,`zero_or_one`,`one_or_more`,`zero_or_more`],l.diagramId=r,await _(l,d),l.layoutAlgorithm===`elk`&&d.select(`.edges`).lower();let m=d.selectAll(`[id*="-background"]`);Array.from(m).length>0&&m.each(function(){let e=t(this),n=e.attr(`id`).replace(`-background`,``),r=d.select(`#${CSS.escape(n)}`);if(!r.empty()){let t=r.attr(`transform`);e.attr(`transform`,t)}}),g.insertTitle(d,`erDiagramTitleText`,s?.titleTopMargin??25,a.db.getDiagramTitle()),b(d,8,`erDiagram`,s?.useMaxWidth??!0)},`draw`),E=f((e,t)=>{let n=m,r=n(e,`r`),i=n(e,`g`),a=n(e,`b`);return o(r,i,a,t)},`fade`),D=new Set([`redux-color`,`redux-dark-color`]),O=f(e=>{let{theme:t,look:n,bkgColorArray:r,borderColorArray:i}=e;if(!D.has(t))return``;let a=r?.length>0,o=``;for(let t=0;t<e.THEME_COLOR_LIMIT;t++)o+=`
|
|
7
|
+
|
|
8
|
+
[data-look="${n}"][data-color-id="color-${t}"].node path {
|
|
9
|
+
stroke: ${i[t]};
|
|
10
|
+
${a?`fill: ${r[t]};`:``}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[data-look="${n}"][data-color-id="color-${t}"].node rect {
|
|
14
|
+
stroke: ${i[t]};
|
|
15
|
+
${a?`fill: ${r[t]};`:``}
|
|
16
|
+
}
|
|
17
|
+
`;return o},`genColor`),k={parser:S,get db(){return new C},renderer:w,styles:f(e=>{let{look:t,theme:n,erEdgeLabelBackground:r,strokeWidth:i}=e;return`
|
|
18
|
+
${O(e)}
|
|
19
|
+
.entityBox {
|
|
20
|
+
fill: ${e.mainBkg};
|
|
21
|
+
stroke: ${e.nodeBorder};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.relationshipLabelBox {
|
|
25
|
+
fill: ${e.tertiaryColor};
|
|
26
|
+
opacity: 0.7;
|
|
27
|
+
background-color: ${e.tertiaryColor};
|
|
28
|
+
rect {
|
|
29
|
+
opacity: 0.5;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.labelBkg {
|
|
34
|
+
background-color: ${D.has(n)&&r?r:E(e.tertiaryColor,.5)};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.edgeLabel {
|
|
38
|
+
background-color: ${D.has(n)&&r?r:e.edgeLabelBackground};
|
|
39
|
+
}
|
|
40
|
+
.edgeLabel .label rect {
|
|
41
|
+
fill: ${D.has(n)&&r?r:e.edgeLabelBackground};
|
|
42
|
+
}
|
|
43
|
+
.edgeLabel .label text {
|
|
44
|
+
fill: ${e.textColor};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.edgeLabel .label {
|
|
48
|
+
fill: ${e.nodeBorder};
|
|
49
|
+
font-size: 14px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.label {
|
|
53
|
+
font-family: ${e.fontFamily};
|
|
54
|
+
color: ${e.nodeTextColor||e.textColor};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.edge-pattern-dashed {
|
|
58
|
+
stroke-dasharray: 8,8;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.node rect,
|
|
62
|
+
.node circle,
|
|
63
|
+
.node ellipse,
|
|
64
|
+
.node polygon
|
|
65
|
+
{
|
|
66
|
+
fill: ${e.mainBkg};
|
|
67
|
+
stroke: ${e.nodeBorder};
|
|
68
|
+
stroke-width: ${t===`neo`?i:`1px`};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.relationshipLine {
|
|
72
|
+
stroke: ${e.lineColor};
|
|
73
|
+
stroke-width: ${t===`neo`?i:`1px`};
|
|
74
|
+
fill: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.marker {
|
|
78
|
+
fill: none !important;
|
|
79
|
+
stroke: ${e.lineColor} !important;
|
|
80
|
+
stroke-width: 1;
|
|
81
|
+
}
|
|
82
|
+
[data-look=neo].labelBkg {
|
|
83
|
+
background-color: ${E(e.tertiaryColor,.5)};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.cluster rect {
|
|
87
|
+
fill: ${e.clusterBkg??e.mainBkg};
|
|
88
|
+
stroke: ${e.clusterBorder??e.nodeBorder};
|
|
89
|
+
stroke-width: 1px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.cluster text {
|
|
93
|
+
fill: ${e.titleColor??e.textColor};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.cluster-label text {
|
|
97
|
+
fill: ${e.titleColor??e.textColor};
|
|
98
|
+
}
|
|
99
|
+
`},`getStyles`)};export{k as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-FOHPRMQF-DHwB1DNv.js";import{O as e}from"./mermaid-parser.core-DEadI1Ja.js";export{e as createEventModelingServices};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./src-BH-TyZbA.js";import"./chunk-DU6HZSFF-CF3OK3MZ.js";import"./chunk-75Z2AOVW-EXNbuzun.js";import"./chunk-P2QGCYS3-E4AByfsD.js";import"./chunk-PWAF6VOD-DaoPxZAa.js";import"./chunk-GMAD6QVW-2yfGg28o.js";import"./chunk-4HAMMTFA-EgoP78tp.js";import"./chunk-GVQU2GXP-C_VeaX4U.js";import"./index-D3vj8REa.js";import"./chunk-F27PBJKO-G71ylWJa.js";import"./chunk-XXDRQBXY-DFBUG-OT.js";import"./chunk-POPQ4Y6H-Bisbc2-3.js";import{n as e}from"./chunk-SHT3W25Y-DarPToto.js";export{e as diagram};
|