@hardikg/mdview 0.9.1 → 0.10.0
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.
- package/CHANGELOG.md +19 -0
- package/README.md +2 -2
- package/bin/mdview.mjs +60 -26
- package/dist/client/assets/2DXBBFLN-BxPqHNSN.js +5 -0
- package/dist/client/assets/46IJ22JX-u_jvQJNg.js +2 -0
- package/dist/client/assets/4TTDE5I4-BgbNAVNj.js +3 -0
- package/dist/client/assets/4UF3HTLV-DNbPxlOE.js +2 -0
- package/dist/client/assets/5THPTBWS-D57irc_4.js +1 -0
- package/dist/client/assets/7WLXJQOR-CHhKreq0.js +1 -0
- package/dist/client/assets/AAXQQPKT-CsAJqrOC.js +5 -0
- package/dist/client/assets/AKE5O7KZ-MSuBOjCG.js +2 -0
- package/dist/client/assets/BNMLP6AG-Ca3zyKQY.js +3 -0
- package/dist/client/assets/DKTLEL5E-B7ILCVTH.js +1 -0
- package/dist/client/assets/DR6PKOQU-Bw7cHvYp.js +2 -0
- package/dist/client/assets/E4RJ7UJB-CYB5C4K7.js +2 -0
- package/dist/client/assets/ELSXBIJH-DG0MW5dC.js +1 -0
- package/dist/client/assets/ERTIBQVS-BMWumWfk.js +2 -0
- package/dist/client/assets/F653G4FO-FI8M9Mc0.js +12 -0
- package/dist/client/assets/FKCDD66M-BPFkyrwI.js +1 -0
- package/dist/client/assets/FP7KDXVC-BLEBNkCO.js +2 -0
- package/dist/client/assets/FT5I3RHX-j5YoMicq.js +6 -0
- package/dist/client/assets/FTXIJQGB-nrHdCfp7.js +1 -0
- package/dist/client/assets/G3MDBVQH-EkdejvdW.js +1 -0
- package/dist/client/assets/GY35JXOZ-3ovTGxgz.js +2 -0
- package/dist/client/assets/H5EEJPP2-CNVQBEB3.js +1 -0
- package/dist/client/assets/HWDLEDTA-C_JcdBMO.js +1 -0
- package/dist/client/assets/JZWSX6AR-OwVPptYv.js +1 -0
- package/dist/client/assets/KQOEJWJY-DKTXya68.js +2 -0
- package/dist/client/assets/KS3BB3KE-QkpqVdmA.js +1 -0
- package/dist/client/assets/KXJRRZHI-BQRjeGWj.js +2 -0
- package/dist/client/assets/MFVI5XKI-DrRaRE9X.js +1 -0
- package/dist/client/assets/MWY2J62P-AbEgJnzK.js +12 -0
- package/dist/client/assets/MXGNCBL2-DG3CZR8g.js +2 -0
- package/dist/client/assets/N6DAJLIZ-BsZQKTyT.js +3 -0
- package/dist/client/assets/NU5M23IW-CvtpIovv.js +2 -0
- package/dist/client/assets/NV4XNBIS-nS8wAx3h.js +8 -0
- package/dist/client/assets/OGLU4SIR-DoTUWhkz.js +2 -0
- package/dist/client/assets/OUNS5N76-BwVLonT4.js +8 -0
- package/dist/client/assets/PU4ISKXV-BYX7eA_r.js +2 -0
- package/dist/client/assets/PUZGS23X-n6IKOr7S.js +1 -0
- package/dist/client/assets/Q3IYVLG5-hWt1rVyh.js +4 -0
- package/dist/client/assets/QYHQDLKZ-CjGeJM7R.js +4 -0
- package/dist/client/assets/RVARI57O-CXmrUIiS.js +1 -0
- package/dist/client/assets/RZSVICHU-BiwjruZZ.js +4 -0
- package/dist/client/assets/UEXXS2NB-Dkz_tz-N.js +2 -0
- package/dist/client/assets/UHTQJXKL-lvl-7QeT.js +5 -0
- package/dist/client/assets/URA2L2QI-B8pYKxOk.js +1 -0
- package/dist/client/assets/UXCHDUKG-BGy3ZRLM.js +2 -0
- package/dist/client/assets/VKNV3BUX-DZnoX4IV.js +5 -0
- package/dist/client/assets/VMV7XPHP-6QkisQwm.js +4 -0
- package/dist/client/assets/WEVWDWVA-nohBBhTA.js +2 -0
- package/dist/client/assets/XRRJ35LF-BE7gSN1k.js +2 -0
- package/dist/client/assets/YFKBLVVN-CVTPpei6.js +6 -0
- package/dist/client/assets/YHRE5QGZ-Bs7dUKjj.js +4 -0
- package/dist/client/assets/ZF3OVT4B-6LaC6iLs.js +3 -0
- package/dist/client/assets/index-392ivruk.js +2 -0
- package/dist/client/assets/{index-BP_8buXC.css → index-CGQuEJ_w.css} +1 -1
- package/dist/client/assets/lazy-CKqR1774.js +43 -0
- package/dist/client/index.html +2 -2
- package/package.json +4 -3
- package/dist/client/assets/abnfDiagram-VCTEODGH-BJQEGN-7.js +0 -1
- package/dist/client/assets/arc-C6Oi4WlG.js +0 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-CvFdvi3K.js +0 -36
- package/dist/client/assets/blockDiagram-NRAW4CY4-D8P8a3XW.js +0 -129
- package/dist/client/assets/c4Diagram-UCG6FXSJ-WcmmjfHX.js +0 -38
- package/dist/client/assets/channel-UA4WTF8Q.js +0 -1
- package/dist/client/assets/chunk-2Q5K7J3B-LeZsbe9d.js +0 -1
- package/dist/client/assets/chunk-5VM5RSS4-COq9euGx.js +0 -15
- package/dist/client/assets/chunk-F27PBJKO-BxcjnaqW.js +0 -1
- package/dist/client/assets/chunk-G27WJ6UU-CscpPXiS.js +0 -231
- package/dist/client/assets/chunk-JWPE2WC7-DD0M0JL-.js +0 -1
- package/dist/client/assets/chunk-LCL6LL3I-DXhJ59Qq.js +0 -206
- package/dist/client/assets/chunk-POPQ4Y6H-Bj3eKHA8.js +0 -1
- package/dist/client/assets/chunk-SVP7TREG-CDQ9vZv1.js +0 -88
- package/dist/client/assets/chunk-XXDRQBXY-91VBn0TQ.js +0 -1
- package/dist/client/assets/classDiagram-DTDB5LWJ-Ch3MnxRH.js +0 -1
- package/dist/client/assets/classDiagram-v2-JRS7N3AN-Ch3MnxRH.js +0 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-BaQN6N6K.js +0 -1
- package/dist/client/assets/cynefin-OW5HDTMX-DFpC3uqz.js +0 -178
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CSeSIxw6.js +0 -62
- package/dist/client/assets/cytoscape.esm-BjAbmLdb.js +0 -331
- package/dist/client/assets/dagre-3AP2YEHR-BBkMnw1s.js +0 -4
- package/dist/client/assets/defaultLocale-DX6XiGOO.js +0 -1
- package/dist/client/assets/diagram-S7CK7UJ4-BRdjuShi.js +0 -30
- package/dist/client/assets/diagram-UQ7AKVKN-D-RaNNET.js +0 -41
- package/dist/client/assets/diagram-VSXAHHWV-eL5_j9pa.js +0 -3
- package/dist/client/assets/diagram-VX7I27RA-nlUjCwlX.js +0 -24
- package/dist/client/assets/diagram-Z3DM3KII-DvhXGz8M.js +0 -24
- package/dist/client/assets/ebnfDiagram-PWID7BFC-LgynLQ4Z.js +0 -1
- package/dist/client/assets/erDiagram-SSCWMZ5O-Bc2j9FRV.js +0 -99
- package/dist/client/assets/flowDiagram-A5DVABFB-ClpDS0y_.js +0 -168
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-_RmNHCQH.js +0 -292
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-F1UGJQ4d.js +0 -106
- package/dist/client/assets/index-DqIihcNP.js +0 -2
- package/dist/client/assets/infoDiagram-RXCK75RN-BR20W1yx.js +0 -2
- package/dist/client/assets/init-Gi6I4Gst.js +0 -1
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-D6bgpoOj.js +0 -70
- package/dist/client/assets/journeyDiagram-EYS64GPL-CBjB_0Bx.js +0 -139
- package/dist/client/assets/kanban-definition-3QL26DDD-Bz0HhYZd.js +0 -89
- package/dist/client/assets/layout-BmTy4KT7.js +0 -1
- package/dist/client/assets/linear-Cgk2Kw-d.js +0 -1
- package/dist/client/assets/mermaid.core-Dq2piIpp.js +0 -312
- package/dist/client/assets/mindmap-definition-FBJOCRG2-BSbZ3zKk.js +0 -96
- package/dist/client/assets/ordinal-Cboi1Yqb.js +0 -1
- package/dist/client/assets/pegDiagram-XKGWAZYB-BLsHBZ_O.js +0 -1
- package/dist/client/assets/pieDiagram-E7YTZNPT-BTtaojGC.js +0 -39
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-W-VPz1gZ.js +0 -7
- package/dist/client/assets/railroadDiagram-O6MQD6OU-CstXUJhE.js +0 -1
- package/dist/client/assets/requirementDiagram-EFPCY7ZU-DPpI_Lvd.js +0 -84
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-B3HiW1sY.js +0 -40
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-CfpZAY9b.js +0 -162
- package/dist/client/assets/sizeCapture-X5ZJPWSS-Dsdx6W_J.js +0 -1
- package/dist/client/assets/stateDiagram-HBIQ2CUA-DPm-o7Ee.js +0 -1
- package/dist/client/assets/stateDiagram-v2-4QOOHH4V-DDqXMzve.js +0 -1
- package/dist/client/assets/swimlanes-XN3QIQJK-BPdZeRls.js +0 -1
- package/dist/client/assets/swimlanesDiagram-VK2B7HYN-BHORPcrU.js +0 -8
- package/dist/client/assets/timeline-definition-24CTP7MA-1bs3iV0k.js +0 -120
- package/dist/client/assets/vennDiagram-4TSXK5OY-vYOlmqTL.js +0 -34
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-DTPUMRNL.js +0 -78
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-M5kqQyt7.js +0 -7
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var nt=Object.defineProperty;var st=(t,e,l)=>e in t?nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l;var z=(t,e,l)=>st(t,typeof e!="symbol"?e+"":e,l);import{i as ct}from"./PUZGS23X-n6IKOr7S.js";import{f as dt}from"./DKTLEL5E-B7ILCVTH.js";import{x as pt,D as ft,G as Xe,$ as ht,v as $t,w as mt,V as yt,W as ut,O as bt,P as gt,j as $e,Y as xt,z as wt,U as vt}from"./VMV7XPHP-6QkisQwm.js";import{w as Z,D as me}from"./HWDLEDTA-C_JcdBMO.js";import{f as ae,x as n,a as He,y as R,_ as Ve,$ as kt,Y as _t,T as Mt,b as Nt,q as At}from"./RZSVICHU-BiwjruZZ.js";import{x as ue,H as Pt}from"./lazy-CKqR1774.js";import"./index-392ivruk.js";var It=class{constructor(){z(this,"nodes",new Map);z(this,"labels");z(this,"links",[]);z(this,"trends",new Map);z(this,"pipelines",new Map);z(this,"annotations",[]);z(this,"notes",[]);z(this,"accelerators",[]);z(this,"deaccelerators",[]);z(this,"annotationsBox");z(this,"axes",{});z(this,"size")}addNode(t){let e=this.nodes.get(t.id)??{id:t.id,label:t.label};this.nodes.set(t.id,{...e,...t,className:t.className??e.className,labelOffsetX:t.labelOffsetX??e.labelOffsetX,labelOffsetY:t.labelOffsetY??e.labelOffsetY}),this.labels=void 0}addLink(t){this.links.push(t)}addTrend(t){this.trends.set(t.nodeId,t)}startPipeline(t){this.pipelines.set(t,{nodeId:t,componentIds:[]});let e=this.nodes.get(t);e&&(e.isPipelineParent=!0)}addPipelineComponent(t,e){var a;(a=this.pipelines.get(t))==null||a.componentIds.push(e);let l=this.nodes.get(e);l&&(l.inPipeline=!0)}addAnnotation(t){this.annotations.push(t)}addNote(t){this.notes.push(t)}addAccelerator(t){this.accelerators.push(t)}addDeaccelerator(t){this.deaccelerators.push(t)}setAnnotationsBox(t,e){this.annotationsBox={x:t,y:e}}setAxes(t){this.axes={...this.axes,...t}}setSize(t,e){this.size={width:t,height:e}}getNode(t){return this.nodes.get(t)}resolveNodeId(t){if(this.nodes.has(t))return t;if(!this.labels){this.labels=new Map;for(let[e,l]of this.nodes)this.labels.has(l.label)||this.labels.set(l.label,e)}return this.labels.get(t)??t}build(){let t=[];for(let e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new ue(`Node "${e.label}" is missing coordinates`,"semantic",{type:"wardley"});t.push(e)}return{nodes:t,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}};function oe(t,e){let l=t<=1?t*100:t;if(l<0||l>100)throw new ue(`${e} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${t}`,"semantic",{type:"wardley"});return l}function D(t,e,l){return{x:oe(e,`${l} evolution`),y:oe(t,`${l} visibility`)}}function Ze(t){return t==="+<>"?"bidirectional":t==="+<"?"backward":t==="+>"?"forward":void 0}function Ot(t){if(!(t!=null&&t.startsWith("+")))return{};let e=t.indexOf("'",2),l=t[1]==="'"&&e!==-1?t.slice(2,e):void 0;return t.includes("<>")?{flow:"bidirectional",label:l}:t.includes("<")?{flow:"backward",label:l}:t.includes(">")?{flow:"forward",label:l}:{label:l}}function Ge(t){return t?[(t.negX?-1:1)*t.offsetX,(t.negY?-1:1)*t.offsetY]:[void 0,void 0]}function zt(t,e){var l;t.size&&e.setSize(t.size.width,t.size.height),t.evolution&&e.setAxes({stages:t.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),stageBoundaries:t.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary)});for(let a of t.anchors){let p=D(a.visibility,a.evolution,`Anchor "${a.name}"`);e.addNode({id:a.name,label:a.name,x:p.x,y:p.y,className:"anchor"})}for(let a of t.components){let p=D(a.visibility,a.evolution,`Component "${a.name}"`),[$,m]=Ge(a.label);e.addNode({id:a.name,label:a.name,x:p.x,y:p.y,className:"component",labelOffsetX:$,labelOffsetY:m,inertia:a.inertia,sourceStrategy:(l=a.decorator)==null?void 0:l.strategy})}for(let a of t.notes){let p=D(a.visibility,a.evolution,`Note "${a.text}"`);e.addNote({text:a.text,x:p.x,y:p.y})}for(let a of t.pipelines){let p=e.getNode(a.parent);if(!p||typeof p.y!="number")throw new ue(`Pipeline "${a.parent}" must reference an existing component with coordinates.`,"semantic",{type:"wardley"});let $=p.y;e.startPipeline(a.parent);for(let m of a.components){let u=`${a.parent}_${m.name}`,[P,v]=Ge(m.label),_=oe(m.evolution,`Pipeline component "${m.name}" evolution`);e.addNode({id:u,label:m.name,x:_,y:$,className:"pipeline-component",labelOffsetX:P,labelOffsetY:v,inertia:void 0,sourceStrategy:void 0}),e.addPipelineComponent(a.parent,u)}}for(let a of t.links){let p=!!a.arrow&&(a.arrow.includes("-.->")||a.arrow.includes(".-.")),$=Ot(a.arrow),m=Ze(a.fromPort)??Ze(a.toPort)??$.flow;e.addLink({source:e.resolveNodeId(a.from),target:e.resolveNodeId(a.to),dashed:p,label:$.label??a.linkLabel,flow:m})}for(let a of t.evolves){let p=e.getNode(a.component);(p==null?void 0:p.y)!==void 0&&e.addTrend({nodeId:a.component,targetX:oe(a.target,`Evolve target for "${a.component}"`),targetY:p.y})}if(t.annotations.length>0){let a=D(t.annotations[0].x,t.annotations[0].y,"Annotations box");e.setAnnotationsBox(a.x,a.y)}for(let a of t.annotation){let p=D(a.x,a.y,`Annotation ${a.number}`);e.addAnnotation({number:a.number,coordinates:[{x:p.x,y:p.y}],text:a.text})}for(let a of t.accelerators){let p=D(a.x,a.y,`Accelerator "${a.name}"`);e.addAccelerator({name:a.name,x:p.x,y:p.y})}for(let a of t.deaccelerators){let p=D(a.x,a.y,`Deaccelerator "${a.name}"`);e.addDeaccelerator({name:a.name,x:p.x,y:p.y})}}function Lt(t,e){let l=new It;return zt(t,l),{type:"wardley",title:t.title||e,accTitle:t.accTitle?t.accTitle.replace(/^\s+/g,""):void 0,accDescr:t.accDescr?t.accDescr.replace(/\n\s+/g,`
|
|
2
|
+
`):void 0,...l.build()}}function Fe(t,e){let l=e;for(let a=t.charCodeAt(l);a>=48&&a<=57;a=t.charCodeAt(l))l++;return l}function Et(){let t=0,e=0;return(l,a)=>{if((a<t||a>=e)&&(t=a,e=Fe(l,a)),e===a||l.charCodeAt(e)!==46)return-1;let p=Fe(l,e+1);return p>e+1?p:-1}}var je={name:"ARROW",pattern:/->/y,first:"-"},Ue={name:"LINK_ARROW",pattern:/-->|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/y,first:"->+"},O=(t,e)=>({name:t,pattern:new RegExp(e,"y"),first:e[0]}),qe=[{name:"[",pattern:"["},{name:",",pattern:","},{name:"]",pattern:"]"},{name:"@",pattern:"@"},{name:"/",pattern:"/"},{name:"(",pattern:"("},{name:")",pattern:")"},{name:"-",pattern:"-",longer:[je,Ue,Xe]},{name:"{",pattern:"{"},{name:"}",pattern:"}"},{name:"WARDLEY_NUMBER",pattern:/[0-9]+\.[0-9]+/y,first:"0123456789",scanner:Et},je,{name:"LINK_PORT",pattern:/\+<>|\+>|\+</y,first:"+"},Ue,{name:"LINK_LABEL",pattern:/;[^\n\r]+/y,first:";"},{name:"STRATEGY",pattern:/build|buy|outsource|market/y,first:"bom"},O("KW_WARDLEY","wardley-beta"),O("KW_SIZE","size"),O("KW_EVOLUTION","evolution"),O("KW_ANCHOR","anchor"),O("KW_COMPONENT","component"),O("KW_LABEL","label"),O("KW_INERTIA","inertia"),O("KW_EVOLVE","evolve"),O("KW_PIPELINE","pipeline"),O("KW_NOTE","note"),O("KW_ANNOTATIONS","annotations"),O("KW_ANNOTATION","annotation"),O("KW_ACCELERATOR","accelerator"),O("KW_DEACCELERATOR","deaccelerator"),{name:"NAME_WITH_SPACES",pattern:/(?!title\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/y,first:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},{name:"WS",pattern:/[ \t]+/y,hidden:!0,first:" "},ct(),ht,$t,{name:"INT",pattern:/0|[1-9][0-9]*(?!\.)/y,first:"0123456789"},mt,{name:"ID",pattern:/[\w]([-\w]*\w)?/y,first:"_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},yt,ut,Xe,bt,gt];function Tt(t){let e=new pt(ft(t,qe,"wardley"),qe,"wardley"),l={$type:"Wardley",anchors:[],components:[],links:[],evolves:[],pipelines:[],notes:[],annotations:[],annotation:[],accelerators:[],deaccelerators:[]},a=c=>e.kinds[e.i]===c,p=()=>a(36)||a(37)||a(30),$=()=>a(36)?$e(e.take()):a(37)||a(30)?e.take():e.fail("a name"),m=()=>Number(e.expect(10)),u=()=>parseInt(e.expect(35)),P=()=>a(10)?Number(e.take()):parseInt(e.expect(35)),v=()=>{if(!a(-1))for(a(38)||e.fail("a line break or the end of input");a(38);)e.i++},_=c=>{e.expect(0);let x=c();e.expect(1);let k=c();return e.expect(2),[x,k]},N=()=>{e.expect(21),e.expect(0);let c=e.accept(7),x=u();e.expect(1);let k=e.accept(7),T=u();return e.expect(2),{$type:"Label",negX:c,offsetX:x,negY:k,offsetY:T}},F=()=>{let c={$type:"EvolutionStage",name:$()};return e.accept(3)&&(c.boundary=m()),e.accept(4)&&(c.secondName=$()),c};for(;a(38);)e.i++;for(e.expect(16);!a(-1);)switch(e.kind){case 38:e.i++;break;case 32:l.accDescr=vt(e.take()),v();break;case 33:l.accTitle=wt(e.take()),v();break;case 34:l.title=xt(e.take()),v();break;case 17:{e.i++;let[c,x]=_(u);v(),l.size={$type:"Size",width:c,height:x};break}case 18:{e.i++;let c=[F()];for(e.expect(11),c.push(F());e.accept(11);)c.push(F());v(),l.evolution={$type:"Evolution",stages:c};break}case 19:{e.i++;let c=$(),[x,k]=_(m);v(),l.anchors.push({$type:"Anchor",name:c,visibility:x,evolution:k});break}case 20:{e.i++;let c={$type:"Component",name:$(),visibility:0,evolution:0,inertia:!1};[c.visibility,c.evolution]=_(m),a(21)&&(c.label=N()),a(5)&&e.kinds[e.i+1]===15&&(e.i++,c.decorator={$type:"Decorator",strategy:e.take()},e.expect(6)),e.accept(22)?c.inertia=!0:e.accept(5)&&(e.expect(22),e.expect(6),c.inertia=!0),v(),l.components.push(c);break}case 23:{e.i++;let c=$(),x=m();v(),l.evolves.push({$type:"Evolve",component:c,target:x});break}case 24:{e.i++;let c=$();for(e.expect(8),e.expect(38);a(38);)e.i++;let x=[];do{e.expect(20);let k={$type:"PipelineComponent",name:$(),evolution:0};e.expect(0),k.evolution=m(),e.expect(2),a(21)&&(k.label=N()),v(),x.push(k)}while(a(20));e.expect(9),v(),l.pipelines.push({$type:"Pipeline",parent:c,components:x});break}case 25:{e.i++;let c=$e(e.expect(36)),[x,k]=_(m);v(),l.notes.push({$type:"Note",text:c,visibility:x,evolution:k});break}case 26:{e.i++;let[c,x]=_(P);v(),l.annotations.push({$type:"Annotations",x:c,y:x});break}case 27:{e.i++;let c=u();e.expect(1);let[x,k]=_(P),T=$e(e.expect(36));v(),l.annotation.push({$type:"Annotation",number:c,x,y:k,text:T});break}case 28:case 29:{let c=e.kind===29;e.i++;let x=$(),[k,T]=_(m);v(),c?l.deaccelerators.push({$type:"Deaccelerator",name:x,x:k,y:T}):l.accelerators.push({$type:"Accelerator",name:x,x:k,y:T});break}default:{p()||e.fail("a statement");let c={$type:"Link",from:$(),to:""};a(12)&&(c.fromPort=e.take()),(a(13)||a(11))&&(c.arrow=e.take()),c.to=$(),a(12)&&(c.toPort=e.take()),a(14)&&(c.linkLabel=e.take().substring(1).trim()),v(),l.links.push(c)}}return l}var Wt=["Genesis","Custom Built","Product","Commodity"],Ct=48,w=6,K=10,St=8,ie=15,U=60,Yt=30,Qe=20,ye="var(--_c)",L="var(--_l)";function Rt(t,e,l,a,p){var m;let $=(m=t["wardley-beta"])==null?void 0:m[e];return typeof $=="number"&&$>=a&&$<=p?$:l}function G(t,e,l){return t<e?e:t>l?l:t}function Je(t,e,l,a){let p=_t(t),$="",m=l;for(let u of t.lines){let P=!0;for(let v of u){if(v.icon!==void 0)continue;let _=Mt(v.style&~p);$+=`<tspan${P?` x="${n(e)}" y="${n(m)}"`:""}${_}>${Nt(v.text)}</tspan>`,P=!1}m+=t.lineHeight}return $===""?"":`<text${At(a,p)} xml:space="preserve">${$}</text>`}function et(t,e,l,a){let p=typeof e=="number"&&Number.isFinite(e)?e:Rt(t,l,a,1,1e6);return G(p,200,1e4)-2*Ct}function Dt(t,e,l){var p;let a=et(e,(p=t.size)==null?void 0:p.width,"width",900);return dt(l,a,160,($,m)=>Kt(t,e,l,$,a,m))}function Kt(t,e,l,a,p,$){var Ce,Se,Ye;let m=l.fontSize??16,u=Math.round(m*.8125),P=Math.round(m*.6875),v=l.measurer??Pt(l.fontFamily),_=l.padding??8,N=et(e,(Ce=t.size)==null?void 0:Ce.height,"height",600)*Math.max(.75,a/p),F=((Se=e["wardley-beta"])==null?void 0:Se.showGrid)===!0,c=0,x=0,k=a,T=N,C=(i,o,r,s)=>{i<c&&(c=i),o<x&&(x=o),r>k&&(k=r),s>T&&(T=s)},B=(i,o,r,s)=>(C(o-i.width/2,r-i.height/2,o+i.width/2,r+i.height/2),ae(i,o,r,s,l.icons)),le=(i,o,r,s)=>(C(o,r-i.size,o+i.width,r-i.size+i.height+4),Je(i,o,r,s)),E=(i,o,r=$?Math.max(64,Math.min(120,a/2)):4e3,s=0)=>Ve(i,!1,v,o,r,s),X=i=>i/100*a,H=i=>N-i/100*N,q=t.axes.stages&&t.axes.stages.length>0?t.axes.stages:Wt,re=t.axes.stageBoundaries,be=re!==void 0&&re.length===q.length,Q="",ge="",J=N,xe=0;if(q.forEach((i,o)=>{let r=be?xe:o/q.length,s=be?G(re[o],0,1):(o+1)/q.length;xe=s,o>0&&(Q+=`<path class="pele-wardley-stage" d="M${n(r*a)},0V${n(N)}" stroke="var(--_b)" stroke-dasharray="4 4"/>`);let f=E(i,u,Math.max(48,Math.abs(s-r)*a-12));ge+=B(f,(r+s)/2*a,N+8+f.height/2,` class="pele-wardley-stage-label" font-size="${u}" fill="var(--_m)"`),J=Math.max(J,N+8+f.height)}),F)for(let i=1;i<4;i++)Q+=`<path class="pele-wardley-grid" d="M${n(a*i/4)},0V${n(N)}M0,${n(N*i/4)}H${n(a)}" stroke="var(--_b)" stroke-dasharray="2 6"/>`;Q+=`<path class="pele-wardley-axis" d="M0,0V${n(N)}H${n(a)}" stroke="${L}"/>`;let ne=E(t.axes.xLabel??"Evolution",u),we=E(t.axes.yLabel??"Visibility",u),ve=` class="pele-wardley-axis-label" font-size="${u}" font-weight="var(--_hw)"`,tt=B(ne,a/2,J+6+ne.height/2,ve)+ae(we,-16,N/2,`${ve} transform="rotate(-90 -16 ${n(N/2)})"`);C(-16-we.height/2,0,0,0);let at=J+6+ne.height+10,Y=new Map;for(let i of t.nodes)Y.set(i.id,{x:X(i.x),y:H(i.y),node:i});let ke="",_e=new Map;for(let i of t.pipelines){_e.set(i.nodeId,new Set(i.componentIds));let o=[];for(let b of i.componentIds){let y=Y.get(b);y&&o.push(y)}if(o.length===0)continue;o.sort((b,y)=>b.x-y.x);let r=o[0].x,s=o[o.length-1].x,f=o[0].y,h=f-2*w,d=Y.get(i.nodeId);d&&(d.x=(r+s)/2,d.y=h-K/6),C(r-ie,h,s+ie,h+4*w),ke+=`<g class="pele-wardley-pipeline" data-id="${R(i.nodeId)}"><rect x="${n(r-ie)}" y="${n(h)}" width="${n(s-r+2*ie)}" height="${n(4*w)}" rx="${He}" fill="var(--_s)" stroke="var(--_b)"/>`+(o.length>1?`<path d="M${n(r)},${n(f)}H${n(s)}" stroke="${L}" stroke-dasharray="4 4"/>`:"")+"</g>"}let se=new Map,ce=(i,o,r)=>{let s=i.node;if(s.className==="anchor"){let f=se.get(s);return f||se.set(s,f=E(s.label,u,$?Math.max(64,a/2):4e3,1)),1/Math.hypot(o/(f.width/2+5),r/(u*.8))}return s.isPipelineParent?K/Math.SQRT2:s.sourceStrategy?2*w:w},de=new Map,Me=(i,o,r)=>{Math.abs(o)<.25||Math.abs(r)<.25||de.set(i,(de.get(i)??0)|(o>0?r<0?1:2:r<0?4:8))},pe="";for(let i of t.links){let o=Y.get(i.source),r=Y.get(i.target);if(!o||!r||o===r||(Ye=_e.get(i.target))!=null&&Ye.has(i.source))continue;let s=r.x-o.x,f=r.y-o.y,h=Math.hypot(s,f);if(h<.01)continue;let d=s/h,b=f/h,y=ce(o,d,b),M=ce(r,d,b);if(y+M>=h)continue;Me(o,d,b),Me(r,-d,-b);let g=o.x+d*y,I=o.y+b*y,A=r.x-d*M,W=r.y-b*M,S="";(i.flow==="forward"||i.flow==="bidirectional")&&(S+=me("arrow_point",A,W,d,b,L),A-=d*Z("arrow_point"),W-=b*Z("arrow_point")),(i.flow==="backward"||i.flow==="bidirectional")&&(S+=me("arrow_point",g,I,-d,-b,L),g+=d*Z("arrow_point"),I+=b*Z("arrow_point"));let te="";if(i.label){let j=E(i.label,P+1,200),Re=d>=0?1:-1,De=b*Re,Ke=-d*Re,Be=5+Math.abs(De)*j.width/2+Math.abs(Ke)*j.height/2;te=B(j,(o.x+r.x)/2+De*Be,(o.y+r.y)/2+Ke*Be,` class="pele-edge-label" font-size="${P+1}" fill="var(--_m)"`)}pe+=`<g class="pele-edge${i.dashed?" pele-wardley-dashed":""}" data-id="${R(i.source)}-${R(i.target)}"><path d="M${n(g)},${n(I)}L${n(A)},${n(W)}" stroke="${L}"${i.dashed?' stroke-dasharray="6 6"':""}/>`+S+te+"</g>"}let fe="";for(let i of t.trends){let o=Y.get(i.nodeId);if(!o)continue;let r=X(i.targetX),s=H(i.targetY),f=r-o.x,h=s-o.y,d=Math.hypot(f,h),b="",y=d>0?ce(o,f/d,h/d):0;if(d>y+w+4){let M=f/d,g=h/d,I=r-M*(w+2),A=s-g*(w+2);b=`<path d="M${n(o.x+M*y)},${n(o.y+g*y)}L${n(I-M*Z("arrow_point"))},${n(A-g*Z("arrow_point"))}" stroke="${ye}" stroke-dasharray="4 4"/>`+me("arrow_point",I,A,M,g,ye)}C(r-w,s-w,r+w,s+w),fe+=`<g class="pele-wardley-trend" data-id="${R(i.nodeId)}">${b}<circle cx="${n(r)}" cy="${n(s)}" r="${w}" fill="var(--_bg)" stroke="${ye}"/></g>`}let Ne="",ee=1.2*w,it=.7*w;for(let i of Y.values()){let o=i.node,{x:r,y:s}=i,f=o.className==="anchor",h=o.sourceStrategy,d="";if(h){let g=h==="outsource"?"var(--_m)":h==="buy"?"var(--_a)":h==="build"?"var(--_s)":"var(--_bg)";d+=`<circle class="pele-wardley-${h}" cx="${n(r)}" cy="${n(s)}" r="${2*w}" fill="${g}" stroke="${L}"/>`}if(h==="market"){let g=ee*Math.cos(Math.PI/6),I=s+ee*Math.sin(Math.PI/6);d+=`<path d="M${n(r)},${n(s-ee)}L${n(r-g)},${n(I)}H${n(r+g)}Z" fill="none" stroke="${L}"/>`;for(let[A,W]of[[r,s-ee],[r-g,I],[r+g,I]])d+=`<circle cx="${n(A)}" cy="${n(W)}" r="${n(it)}" fill="var(--_bg)" stroke="${L}"/>`}else o.isPipelineParent?d+=`<rect x="${n(r-K/2)}" y="${n(s-K/2)}" width="${K}" height="${K}" fill="var(--_bg)" stroke="${L}"/>`:f||(d+=`<circle cx="${n(r)}" cy="${n(s)}" r="${w}" fill="var(--_bg)" stroke="${L}"/>`);if(o.inertia===!0){let g=(o.isPipelineParent?K/2:w)+10+(h?w+4:0);d+=`<rect class="pele-wardley-inertia" x="${n(r+g)}" y="${n(s-w)}" width="4" height="${2*w}" fill="${L}"/>`}let b=o.labelOffsetX===void 0?void 0:G(o.labelOffsetX,-5e3,5e3),y=o.labelOffsetY===void 0?void 0:G(o.labelOffsetY,-5e3,5e3),M;if(f){let g=se.get(o)??E(o.label,u,$?Math.max(64,a/2):4e3,1);M=B(g,r+(b??0),s+(y??-3),` class="pele-label" font-size="${u}" font-weight="var(--_hw)"`)}else{let g=E(o.label,u),I=` class="pele-label" font-size="${u}"`,A=St+(h?10:0);if(b!==void 0||y!==void 0)M=le(g,r+(b??A),s+(y??-A),I);else if(o.inPipeline)M=B(g,r,s+2*w+4+g.height/2,I);else{let W=de.get(i)??0,S=(W&1)===0?1:(W&2)===0?2:(W&4)===0?4:(W&8)===0?8:1,te=S===1||S===2,j=S===1||S===4;M=le(g,te?r+A:r-A-g.width,j?s-A:s+A+u*.75,I)}}C(r-2*w,s-2*w,r+2*w+20,s+2*w),Ne+=`<g class="pele-node pele-wardley-${f?"anchor":o.isPipelineParent?"pipeline-parent":o.inPipeline?"pipeline-component":"component"}" data-id="${R(o.id)}">${d}${M}</g>`}let he="";for(let i of t.annotations){let o=E(String(i.number),P,4e3,1),r="";for(let s of i.coordinates){let f=X(s.x),h=H(s.y),d=Math.max(10,o.width/2+4);C(f-d,h-d,f+d,h+d),r+=`<circle cx="${n(f)}" cy="${n(h)}" r="${n(d)}" fill="var(--_bg)" stroke="${L}"/>`+ae(o,f,h,` font-size="${P}" font-weight="var(--_hw)"`)}he+=`<g class="pele-wardley-annotation" data-id="${R(String(i.number))}">${r}</g>`}let Ae=t.annotations.filter(i=>i.text).sort((i,o)=>i.number-o.number);if(Ae.length>0){let i=Ae.map(y=>E(`${y.number}. ${y.text}`,u,$?Math.max(80,a-20):320)),o=0,r=0;for(let y of i)o=Math.max(o,y.width),r+=y.height;o+=20,r+=14;let s=t.annotationsBox,f=s?G(X(s.x),0,Math.max(0,a-o)):0,h=s?G(H(s.y),0,Math.max(0,N-r)):at;C(f,h,f+o,h+r);let d="",b=h+7;for(let y of i)d+=Je(y,f+10,b+y.lineHeight/2+u*.35,` font-size="${u}"`),b+=y.height;he+=`<g class="pele-wardley-annotations"><rect x="${n(f)}" y="${n(h)}" width="${n(o)}" height="${n(r)}" rx="${He}" fill="var(--_bg)" stroke="var(--_b)"/>${d}</g>`}let Pe="";for(let i of t.notes)Pe+=le(E(i.text,u,Math.min(360,a*.6),1),X(i.x),H(i.y),` class="pele-wardley-note" font-size="${u}" font-weight="var(--_hw)"`);let Ie="",Oe=(i,o,r,s)=>{let f=X(o),h=H(r),d=Yt/2,b=s?f+U:f,y=s?f:f+U,M=s?f+U-Qe:f+Qe,g=`M${n(y)},${n(h-d)}H${n(M)}V${n(h-d-8)}L${n(b)},${n(h)}L${n(M)},${n(h+d+8)}V${n(h+d)}H${n(y)}Z`;C(f,h-d-8,f+U,h+d+8),Ie+=`<g class="pele-wardley-${s?"accelerator":"deaccelerator"}" data-id="${R(i)}"><path d="${g}" fill="var(--_s)" stroke="${L}"/>`+B(E(i,P+1,160,1),f+U/2,h+d+8+12,` font-size="${P+1}" font-weight="var(--_hw)"`)+"</g>"};for(let i of t.accelerators)Oe(i.name,i.x,i.y,!0);for(let i of t.deaccelerators)Oe(i.name,i.x,i.y,!1);let V=Ve(t.title,!1,v,m,$?Math.max(80,a):4e3,1),ze=V.height>0?V.height+12:0,Le=Math.min(c,a/2-V.width/2),ot=Math.max(k,a/2+V.width/2),Ee=_-Le,lt=_+ze-x,Te=Math.ceil(ot-Le+2*_),We=Math.ceil(T-x+ze+2*_),rt=ae(V,Ee+a/2,_+V.height/2,' class="pele-title" font-weight="var(--_tw)"')+`<g transform="translate(${n(Ee)},${n(lt)})"><g class="pele-wardley-frame" fill="none">${Q}</g>`+ge+tt+ke+(pe?`<g class="pele-edges" fill="none">${pe}</g>`:"")+(fe?`<g class="pele-wardley-trends" fill="none">${fe}</g>`:"")+Ne+he+Pe+Ie+"</g>";return{svg:kt("wardley",Te,We,m,l,t,rt),width:Te,height:We,links:[]}}var Ut={type:"wardley",section:"wardley-beta",parse:(t,e,l)=>Lt(Tt(t),l),render:Dt};export{Ut as wardley};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as g,x as c}from"./RZSVICHU-BiwjruZZ.js";function m(t,r){for(let n=0;n<r.length;n+=3){let e=Math.round(r[n+1]),f=t.get(e);f?f.push(r[n]):t.set(e,[r[n]])}}function w(t,r,n,e){if(r===0)return t.x;let f=t.y-t.h/2,o=t.x-t.w/2,i=r/2,l=[o+e-6+i,t.x,o+t.w-e+6-i],a=n.get(Math.round(f));if(a===void 0)return l[0];let h=l[0],u=-1;for(let d of l){let s=1/0;for(let x of a)x>o&&x<o+t.w&&(s=Math.min(s,Math.abs(x-d)-i));if(s>=6)return d;s>u+.5&&(u=s,h=d)}return h}function M(t,r,n,e){let f=r>0?e.get(Math.round(t.y-t.h/2)):void 0;if(f===void 0)return!1;let o=t.x-t.w/2;for(let i of f)if(i>o&&i<o+t.w&&Math.abs(i-n)<r/2+4)return!0;return!1}function b(t,r,n,e,f,o,i,l){let a=1;for(let u=o[i].parent;u>=0&&a<8;u=o[u].parent)a++;let h=`color-mix(in srgb,var(--_a) ${c(100*(1-.5**a))}%,var(--_bg))`;return`<g class="pele-cluster-title" data-id="${f}">`+g(t,r,n,` fill="none" stroke="${h}" stroke-width="5" stroke-linejoin="round"`,l)+g(t,r,n,e,l)+"</g>"}export{b as C,w as h,m as x,M as y};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{f as ve,h as be}from"./DKTLEL5E-B7ILCVTH.js";import{x as we,M as xe,$ as Me,v as Ie,w as Le,V as Te,W as Ae,G as Ce,O as De,P as Ee,Y as Ne,z as ze,U as _e,D as He,H as Oe,j as Be}from"./VMV7XPHP-6QkisQwm.js";import{x as p,_ as K,y as V,f as X,m as pe,$ as Fe}from"./RZSVICHU-BiwjruZZ.js";import{x as Pe,H as Re}from"./lazy-CKqR1774.js";import"./index-392ivruk.js";var he=32;function ue(t){return new Pe(t,"semantic",{type:"radar"})}function Ue(t,e){let a=t.axes.map(r=>({name:r.name,label:r.label??r.name})),i=t.curves.map(r=>{let c;if(r.entries[0].axis===void 0)c=r.entries.map(s=>s.value);else{if(a.length===0)throw ue("Axes must be populated before curves for reference entries");let s=new Map;for(let h of r.entries)h.axis!==void 0&&!s.has(h.axis.$refText)&&s.set(h.axis.$refText,h.value);c=a.map(h=>{let x=s.get(h.name);if(x===void 0)throw ue("Missing entry for axis "+h.label);return x})}return{name:r.name,label:r.label??r.name,entries:c}}),n={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"};for(let r of t.options)r.name==="showLegend"?n.showLegend=r.value:r.name==="graticule"?n.graticule=r.value:n[r.name]=r.value;return n.ticks>he&&(n.ticks=he),{type:"radar",title:t.title||e,accTitle:t.accTitle?t.accTitle.replace(/^\s+/g,""):void 0,accDescr:t.accDescr?t.accDescr.replace(/\n\s+/g,`
|
|
2
|
+
`):void 0,axes:a,curves:i,options:n}}var q=0,R=0;function fe(t,e){let a=e;for(let i=t.charCodeAt(a);i>=48&&i<=57;i=t.charCodeAt(a))a++;return a}function Ge(t,e){(e<q||e>=R)&&(q=e,R=fe(t,e));let a=R;if(a===e)return-1;let i=t.charCodeAt(a)===46;if(i){let n=fe(t,a+1),r=n-a-1;if(r>0&&t.charCodeAt(n)!==46)return n;if(r>1)return n-1}return t.charCodeAt(e)===48?e+1:i?a-1>e?a-1:-1:a}var J=xe.pattern,Q=/[\t ]*accDescr\s*{/y,U=-2;function Se(t,e){return Q.lastIndex=e,Q.test(t)&&(U===-2&&(U=t.lastIndexOf("}")),Q.lastIndex>U)?-1:(J.lastIndex=e,J.test(t)?J.lastIndex:-1)}var ee={name:"ID",pattern:/[\w]([-\w]*\w)?/y},w=t=>({name:t,pattern:t,longer:[ee]}),M=t=>({name:t,pattern:t}),ge=[M("radar-beta:"),{...Oe("radar-beta"),longer:[ee]},w("showLegend"),w("graticule"),w("curve"),w("ticks"),w("axis"),w("max"),w("min"),M(":"),M(","),M("["),M("]"),M("{"),M("}"),{name:"GRATICULE",pattern:/circle|polygon/y},{name:"BOOLEAN",pattern:/true|false/y},{...xe,match:Se},Me,Ie,{name:"NUMBER",pattern:/(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/y,match:Ge},Le,ee,Te,Ae,Ce,De,Ee];function je(t){return q=R=0,U=-2,He(t,ge,"radar")}function We(t){let e=new we(je(t),ge,"radar"),a={$type:"Radar",axes:[],curves:[],options:[]},i=()=>{for(;e.kind===23;)e.i++},n=()=>{e.kind!==-1&&(e.kind!==23&&e.fail("a line break or the end of input"),i())},r=()=>{if(!e.accept(11))return;let d=Be(e.expect(21));return e.expect(12),d},c=d=>{if(!d)return{$type:"Entry",value:Number(e.expect(20))};let g={$refText:e.expect(22)};return e.accept(9),{$type:"Entry",axis:g,value:Number(e.expect(20))}},s=()=>{let d=e.expect(22),g=r(),u={$type:"Curve",name:d,entries:[]};g!==void 0&&(u.label=g),e.expect(13),i(),e.kind!==20&&e.kind!==22&&e.fail("a number or an axis name");let k=e.kind===22;for(u.entries.push(c(k));e.accept(10);)i(),u.entries.push(c(k));return i(),e.expect(14),u},h=()=>{let d={$type:"Axis",name:e.expect(22)},g=r();return g!==void 0&&(d.label=g),d},x=()=>{let d=e.kind,g=e.take(),u;return d===2?u=e.expect(16)==="true":d===3?u=e.expect(15):u=Number(e.expect(20)),{$type:"Option",name:g,value:u}},_=()=>e.kind===2||e.kind===5||e.kind===7||e.kind===8||e.kind===3;for(i(),e.accept(0)||(e.expect(1),e.accept(9)),i();e.kind!==-1;)switch(e.kind){case 23:e.i++;break;case 17:a.accDescr=_e(e.take()),n();break;case 18:a.accTitle=ze(e.take()),n();break;case 19:a.title=Ne(e.take()),n();break;case 6:e.i++;do a.axes.push(h());while(e.accept(10));break;case 4:e.i++;do a.curves.push(s());while(e.accept(10));break;default:for(_()||e.fail("an axis, a curve, an option, a title, or a line break"),a.options.push(x());e.accept(10);)_()||e.fail("an option"),a.options.push(x())}return a}var T=12,Z=26,me=24;function $(t,e,a,i,n){var c;let r=(c=t.radar)==null?void 0:c[e];return typeof r=="number"&&r>=i?Math.min(r,n):a}function Ye(t,e,a,i){let n=Math.min(Math.max(t,e),a);return i*(n-e)/(a-e)}function Ke(t,e){let a=t.length,i=`M${p(t[0].x)},${p(t[0].y)}`;for(let n=0;n<a;n++){let r=t[(n-1+a)%a],c=t[n],s=t[(n+1)%a],h=t[(n+2)%a];i+=` C${p(c.x+(s.x-r.x)*e)},${p(c.y+(s.y-r.y)*e)} ${p(s.x-(h.x-c.x)*e)},${p(s.y-(h.y-c.y)*e)} ${p(s.x)},${p(s.y)}`}return i+" Z"}function de(t){let e="";for(let a of t)e+=(e?" ":"")+p(a.x)+","+p(a.y);return e}function Ve(t,e,a){let i=$(e,"width",320,1,4e3);return ve(a,i,160,(n,r)=>Xe(t,e,a,n,$(e,"height",320,1,4e3)*n/i,r))}function Xe(t,e,a,i,n,r){let c=a.fontSize??16,s=Math.round(c*.875),h=a.measurer??Re(a.fontFamily),x=a.padding??8,_=$(e,"axisScaleFactor",1,0,10),d=$(e,"axisLabelFactor",1.05,0,10),g=$(e,"curveTension",.17,0,1),u=Math.min(i,n)/2,{axes:k,curves:H}=t,{ticks:te,graticule:ae,min:$e}=t.options,re=k.length,O=k.map((l,o)=>{let m=2*Math.PI*o/re-Math.PI/2;return{x:Math.cos(m),y:Math.sin(m)}}),A=t.options.max;if(A===null){A=-1/0;for(let l of H)for(let o of l.entries)o>A&&(A=o)}let v=-i/2-$(e,"marginLeft",16,0,2e3),y=i/2+$(e,"marginRight",16,0,2e3),I=-n/2-$(e,"marginTop",16,0,2e3),b=n/2+$(e,"marginBottom",16,0,2e3),B="";for(let l=0;l<te;l++){let o=Math.min(u,u*(l+1)/te);ae==="circle"?B+=`<circle r="${p(o)}"/>`:B+=`<polygon points="${de(O.map(m=>({x:m.x*o,y:m.y*o})))}"/>`}let G="",S="";O.forEach((l,o)=>{let m=u*_;G+=`M0,0L${p(l.x*m)},${p(l.y*m)}`;let f=K(k[o].label,!1,h,s,4e3),N=u*d+6,z=l.x*N+(l.x>.01?f.width/2:l.x<-.01?-f.width/2:0),L=l.y*N+(l.y>.01?f.height/2:l.y<-.01?-f.height/2:0);S+=`<g class="pele-axis-label" data-id="${V(k[o].name)}">${X(f,z,L,"")}</g>`,v=Math.min(v,z-f.width/2),y=Math.max(y,z+f.width/2),I=Math.min(I,L-f.height/2),b=Math.max(b,L+f.height/2)});let j="";H.forEach((l,o)=>{if(l.entries.length!==re)return;let m=l.entries.map((z,L)=>{let ce=Ye(z,$e,A,u),oe=Number.isFinite(ce)?ce:0;return{x:O[L].x*oe,y:O[L].y*oe}}),f=pe(o),N=` class="pele-curve" data-id="${V(l.name)}" fill="${f}" stroke="${f}"`;j+=ae==="circle"?`<path${N} d="${Ke(m,g)}"/>`:`<polygon${N} points="${de(m)}"/>`});let C=t.options.showLegend?H.map(l=>K(l.label,!1,h,s,4e3)):[],F=0;for(let l of C)F=Math.max(F,l.width);let P=C.length*Z,D=r?-(T+8+F)/2:y+me,ne=r?b+me/2:-P/2;C.length>0&&r?(v=Math.min(v,D),y=Math.max(y,-D),b=ne+P):C.length>0&&(y=D+T+8+F,I=Math.min(I,-P/2),b=Math.max(b,P/2));let W="";C.forEach((l,o)=>{let m=ne+o*Z+Z/2,f=pe(o);W+=`<g class="pele-legend-item" data-id="${V(H[o].name)}"><rect x="${p(D)}" y="${p(m-T/2)}" width="${T}" height="${T}" rx="2" fill="${f}" fill-opacity="0.4" stroke="${f}"/>`+X(l,D+T+8+l.width/2,m,"")+"</g>"});let E=K(t.title,!1,h,c,be(a),1),ie=E.height>0?E.height+8:0,le=Math.max(y-v,E.width),Y=Math.ceil(le+2*x),se=Math.ceil(b-I+ie+2*x),ye=`translate(${p(x+(le-(y-v))/2-v)},${p(x+ie-I)})`,ke=X(E,Y/2,x+E.height/2,' class="pele-title" font-weight="var(--_tw)"')+`<g transform="${ye}">`+(B?`<g class="pele-graticule" fill="none" stroke="var(--_a)">${B}</g>`:"")+(G?`<path class="pele-axes" d="${G}" fill="none" stroke="var(--_b)"/>`:"")+(j?`<g class="pele-curves" fill-opacity="0.2" stroke-width="1.5" stroke-linejoin="round">${j}</g>`:"")+(S?`<g class="pele-axis-labels" font-size="${s}">${S}</g>`:"")+(W?`<g class="pele-legend" font-size="${s}">${W}</g>`:"")+"</g>";return{svg:Fe("radar",Y,se,c,a,t,ke),width:Y,height:se,links:[]}}var tt={type:"radar",parse:(t,e,a)=>Ue(We(t),a),render:Ve};export{tt as radar};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var ft=Object.defineProperty;var ut=(t,r,a)=>r in t?ft(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a;var P=(t,r,a)=>ut(t,typeof r!="symbol"?r+"":r,a);import{i as ht,a as pt}from"./FTXIJQGB-nrHdCfp7.js";import{q as je,x as me,H as gt,$ as bt,e as le,L as Xe,i as We}from"./lazy-CKqR1774.js";import{h as mt}from"./7WLXJQOR-CHhKreq0.js";import{x as He,h as yt}from"./ELSXBIJH-DG0MW5dC.js";import{b as qe,d as Ce,m as kt,p as wt}from"./FKCDD66M-BPFkyrwI.js";import{A as At,M as vt,L as Tt,O as Ct,N as St}from"./JZWSX6AR-OwVPptYv.js";import{o as xt,i as Et,P as $t,B as Se,E as Lt}from"./URA2L2QI-B8pYKxOk.js";import{m as _t,c as It}from"./DKTLEL5E-B7ILCVTH.js";import{F as Ye,w as xe,L as Mt,D as Nt,S as Rt}from"./HWDLEDTA-C_JcdBMO.js";import{g as Je,_ as ue,h as Ze,y as Ee,a as Qe,x as Z,f as $e,m as Oe,b as Le,$ as Dt}from"./RZSVICHU-BiwjruZZ.js";import"./index-392ivruk.js";var Ot=new Map([["task","roundedRect"],["tool","subroutine"],["input","lean-right"],["decision","diamond"],["refdoc","lin-doc"],["action","hexagon"],["round","rect"]]),Gt=new Set(["doc","stadium","terminal","circle","trapezoid","inv_trapezoid","inv-trapezoid","doublecircle","double-circle","typeDeclaration","procs","lean_left","lean-left","in-out","cylinder","ellipse","odd","tag-rect","tagged-rectangle","delay","half-rounded-rectangle","lin-rect","lined-rectangle","win-pane","window-pane","curv-trap","curved-trapezoid"]),Ut=new Set(["roundedRect","subroutine","subprocess","subproc","framed-rectangle","lean-right","diamond","lin-doc","lined-document","hexagon","hex","connector","collapsedGroup"]),he="roundedRect";function Ae(t){return t&&(Ot.get(t)??t)}function Bt(t){return pt(t)||t==="constructor"}function Pt(t,r){for(let a of t)a.isGroup||((!a.shape||a.shape==="squareRect"||a.shape==="rect")&&(a.shape=he),Gt.has(a.shape)?(r.emitError("SHAPE_REMOVED",`shape "${a.shape}" was removed in v0.8.1, using "${he}"`,{nodeId:a.id}),a.shape=he):Ut.has(a.shape)||(r.emitWarning("SHAPE_UNSUPPORTED",`shape "${a.shape}" is not supported, using "${he}"`,{nodeId:a.id}),a.shape=he))}var Vt=new Set(["shape","view","icon","img","form","pos","w","h","class","style","labelType"]),Kt=new Set(["subroutine","subprocess","subproc","framed-rectangle","tool"]);function Ft(t){return Kt.has(t.type)}function _e(t){return t==="markdown"||t==="string"||t==="text"?t:"markdown"}function et(t){return t.startsWith('"')&&t.endsWith('"')?t.substring(1,t.length-1):t}function Ge(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function zt(t){let r=i=>Array.isArray(i)?[]:Ge(i)?{}:i,a=r(t),d=[[t,a]];for(;d.length>0;){let[i,l]=d.pop();if(Array.isArray(i))for(let h of i){let y=r(h);l.push(y),typeof h=="object"&&h!==null&&d.push([h,y])}else if(Ge(i))for(let h of Object.keys(i)){if(h==="__proto__"||h==="constructor"||h==="prototype")continue;let y=i[h],e=r(y);l[h]=e,typeof y=="object"&&y!==null&&d.push([y,e])}}return a}function ye(t,r){return Object.assign(t??{},r)}var jt=/:\s*[>|][\d+-]*\s*$/,Xt=/,([\t ]*)$/;function Wt(t){let r=!1,a=!1,d=0,i,l=[];for(let h of t.split(`
|
|
2
|
+
`)){if(i!==void 0){let m=h.length-h.trimStart().length;if(h.trim()===""||m>i){l.push(h);continue}i=void 0}let y=-1;for(let m=0;m<h.length;m++){let I=h[m];if(a)I==="\\"?m++:I==='"'&&(a=!1);else if(r)I==="'"&&(r=!1);else if(I==='"')a=!0;else if(I==="'")r=!0;else if(I==="#"&&(m===0||h[m-1]===" "||h[m-1]===" ")){y=m;break}else I==="["||I==="{"?d++:(I==="]"||I==="}")&&(d=Math.max(0,d-1))}if(r||a||d>0){l.push(h);continue}let e=y>=0?h.slice(0,y):h,C=y>=0?h.slice(y):"";if(jt.test(e)){i=h.length-h.trimStart().length,l.push(h);continue}l.push(e.replace(Xt,"$1")+C)}return l.join(`
|
|
3
|
+
`)}function Ht(t,r){if(t==="arrow_point"&&r==="normal")return"sequence";if(t==="arrow_cross"&&r==="normal")return"failure";if(t==="arrow_open"&&r==="dotted")return"reference"}function qt(t){let r=t.trim(),a=r.slice(0,-1),d="arrow_open";switch(r.slice(-1)){case"x":d="arrow_cross";break;case">":d="arrow_point";break;case"-":case".":a=r;break}let i="normal",l=a.length-1,h=0;for(let y=0;y<a.length;y++)a[y]==="."&&h++;return h>0&&(i="dotted",l=h),{type:d,stroke:i,length:l}}function tt(t){if(!t)return;let r={},a=!1;for(let d of Object.keys(t))Vt.has(d)||(r[d]=t[d],a=!0);return a?r:void 0}var Yt=class{constructor(t={}){P(this,"type","agentflow");P(this,"direction");P(this,"nodes",new Map);P(this,"edges",[]);P(this,"subgraphs",[]);P(this,"connectors",new Map);P(this,"classes",new Map);P(this,"tooltips",new Map);P(this,"defaultEdgeStyle");P(this,"defaultInterpolate");P(this,"mappings",[]);P(this,"diagnostics",[]);P(this,"title");P(this,"accTitle");P(this,"accDescr");P(this,"lineOffset");P(this,"subgraphLookup",new Map);P(this,"globalNodes",new Set);P(this,"members",new Set);P(this,"edgeById",new Map);P(this,"pairCount",new Map);P(this,"subCount",0);P(this,"bareMappings",new Set);P(this,"firstMapping",new Map);P(this,"reported",new Map);P(this,"options");this.options=t,this.lineOffset=t.lineOffset??0}metadata(t,r,a){let d=r.includes(`
|
|
4
|
+
`),i;try{i=je(d?r+`
|
|
5
|
+
`:`{
|
|
6
|
+
`+r+`
|
|
7
|
+
}`)}catch(l){let h=d?Wt(r):r,y;if(h!==r)try{y=je(h+`
|
|
8
|
+
`)}catch{y=void 0}if(y===void 0){let e=a?` (${a.first_line+this.lineOffset}:${a.first_column+1})`:"";throw new me(`Metadata of "${t}" is not valid YAML. ${l.message}${e}`,"syntax",{type:"agentflow",line:a?a.first_line+this.lineOffset:0,column:a?a.first_column+1:0})}i=y}return zt(i??{})}shapeError(t,r){return new me(t,"semantic",{type:"agentflow",line:r?r.first_line+this.lineOffset:0,column:r?r.first_column+1:0})}addVertex(t,r,a,d,i,l,h={},y,e){if(!t||t.trim().length===0)return;let C,m,I;y!==void 0&&(C=this.metadata(t,y,e),Ge(C)&&(m=C,typeof C.shape=="string"&&(I=C.shape,C.shape=Ae(C.shape))));let L=this.subgraphLookup.get(t);if(L&&C){L.metadata=ye(L.metadata,C);return}let N=this.connectors.get(t);if(N&&C){N.metadata=ye(N.metadata,C);return}if(t==="connectors")return;let b=this.edgeById.get(t);if(b){(m==null?void 0:m.animate)!==void 0&&(b.animate=m.animate),(m==null?void 0:m.animation)!==void 0&&(b.animation=m.animation),(m==null?void 0:m.curve)!==void 0&&(b.interpolate=m.curve),C&&(b.metadata=ye(b.metadata,C));return}let _=this.nodes.get(t);if(_===void 0&&(_={id:t,labelType:"text",styles:[],classes:[]},this.nodes.set(t,_)),r!==void 0?(_.labelType=r.type,_.text=et(r.text.trim())):_.text===void 0&&(_.text=t),a!==void 0&&(_.type=a),d!=null)for(let G of d)_.styles.push(G);if(i!=null)for(let G of i)_.classes.push(G);if(l!==void 0&&(_.dir=l),_.props===void 0?_.props=h:h!==void 0&&Object.assign(_.props,h),!!C&&(_.metadata=ye(_.metadata,C),m!==void 0)){if(m.shape){let G=I??m.shape;if(typeof G!="string")throw this.shapeError(`No such shape: ${JSON.stringify(G)}.`,e);if(G!==G.toLowerCase()||G.includes("_"))throw this.shapeError(`No such shape: ${G}. Shape names should be lowercase.`,e);let J=m.shape;if(!Bt(J))throw this.shapeError(`No such shape: ${J}.`,e);_.type=J}m.label&&(_.text=String(m.label),_.labelType=_e(m.labelType))}}addSingleLink(t,r,a,d){let i={start:t,end:r,type:void 0,text:"",labelType:"text",classes:[],isUserDefinedId:!1,interpolate:this.defaultInterpolate},l=a==null?void 0:a.text;l!==void 0&&(i.text=et(l.text.trim()),i.labelType=_e(l.type)),a!==void 0&&(i.type=a.type,i.stroke=a.stroke,i.length=a.length>10?10:a.length,a.edgeSemantic&&(i.edgeSemantic=a.edgeSemantic));let h=t+"\0"+r,y=this.pairCount.get(h)??0;d&&!this.edgeById.has(d)?(i.id=d,i.isUserDefinedId=!0):i.id=`L_${t}_${r}_${y===0?0:y+1}`;let e=this.options.maxEdges;if(e!==void 0&&this.edges.length>=e)throw new me(`Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${e}.`,"limit",{type:"agentflow"});this.edges.push(i),this.pairCount.set(h,y+1),this.edgeById.has(i.id)||this.edgeById.set(i.id,i)}addLink(t,r,a){let d=typeof(a==null?void 0:a.id)=="string"?a.id.replace("@",""):void 0,i=t[t.length-1],l=r[0];for(let h of t)for(let y of r)this.addSingleLink(h,y,a,h===i&&y===l?d:void 0)}updateLinkInterpolate(t,r){for(let a of t)a==="default"?this.defaultInterpolate=r:this.edgeAt(a).interpolate=r}updateLink(t,r){for(let a of t){if(a==="default"){this.defaultEdgeStyle=r;continue}let d=this.edgeAt(a);d.style=r,r.length>0&&!r.some(i=>i==null?void 0:i.startsWith("fill"))&&r.push("fill:none")}}edgeAt(t){let r=this.edges[Number(t)];if(r===void 0)throw new me(`The index ${t} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`,"semantic",{type:"agentflow"});return r}addClass(t,r){let a=r.join().replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");for(let d of t.split(",")){let i=this.classes.get(d);i===void 0&&(i={id:d,styles:[],textStyles:[]},this.classes.set(d,i));for(let l of a)l.includes("color")&&i.textStyles.push(l.replace("fill","bgFill")),i.styles.push(l)}}setDirection(t){let r=t.trim();r.includes("<")&&(r="RL"),r.includes("^")&&(r="BT"),r.includes(">")&&(r="LR"),r.includes("v")&&(r="TB"),r==="TD"&&(r="TB"),this.direction=r}setClass(t,r){var a,d,i;for(let l of t.split(","))(a=this.nodes.get(l))==null||a.classes.push(r),(d=this.edgeById.get(l))==null||d.classes.push(r),(i=this.subgraphLookup.get(l))==null||i.classes.push(r)}setTooltip(t,r){if(r!==void 0)for(let a of t.split(","))this.tooltips.set(a,r)}setLink(t,r,a){let d=r.trim();for(let i of t.split(",")){let l=this.nodes.get(i);l!==void 0&&(l.link=d?At(d):void 0,l.linkTarget=a)}this.setClass(t,"clickable")}setClickEvent(t,r,a){this.setClass(t,"clickable")}setAccTitle(t){this.accTitle=t.replace(/^\s+/g,"")}setAccDescription(t){this.accDescr=t.replace(/\n\s+/g,`
|
|
9
|
+
`)}addSubGraph(t,r,a,d){var N;let i=(N=t==null?void 0:t.text)==null?void 0:N.trim(),l=(a==null?void 0:a.text)||"";t!==void 0&&t===a&&/\s/.test(l)&&(i=void 0);let h=new Set,y=[],e;for(let b of r)if(typeof b=="string")b.trim()!==""&&!h.has(b)&&(h.add(b),y.push(b));else if(Array.isArray(b))for(let _ of b)_.trim()!==""&&!h.has(_)&&(h.add(_),y.push(_));else e=b.value;e??(e=this.options.inheritDir?this.direction??this.options.direction:void 0),i??(i="subGraph"+this.subCount),this.subCount++;let C=this.members,m=y.filter(b=>b!==i&&!this.globalNodes.has(b)&&!C.has(b));for(let b of m)C.add(b);let I=this.subgraphLookup.get(i);if(I){for(let b of m)I.nodes.push(b);return l.trim()&&(I.title=l.trim()),e&&(I.dir=e),i}let L={id:i,nodes:m,title:l.trim(),classes:[],dir:e,labelType:_e(a==null?void 0:a.type),type:"flow"};return this.subgraphs.push(L),this.subgraphLookup.set(i,L),i}addGlobal(t){let r=!1,a=d=>{let i=d.trim();i!==""&&(this.globalNodes.add(i),this.members.delete(i)&&(r=!0))};for(let d of t)if(typeof d=="string")a(d);else if(Array.isArray(d))for(let i of d)a(i);if(r)for(let d of this.subgraphs)d.nodes=d.nodes.filter(i=>!this.globalNodes.has(i))}addConnector(t,r){var l,h;let a=(l=t==null?void 0:t.text)==null?void 0:l.trim();if(!a)return"";let d=((h=r==null?void 0:r.text)==null?void 0:h.trim())??"",i=this.connectors.get(a);if(i)d.length>0&&(i.text=d);else{let y={id:a,labelType:"text",styles:[],classes:[],isConnector:!0,text:d.length>0?d:a};this.connectors.set(a,y),this.nodes.set(a,y)}return a}destructLink(t,r){let a=qt(t);return r&&(r.includes(".")?"dotted":"normal")!==a.stroke?{type:"INVALID",stroke:"INVALID"}:{...a,edgeSemantic:Ht(a.type,a.stroke)}}subgraph(t){return this.subgraphLookup.get(t)}vertexKind(t){if(Ft(t))return"tool";let r=Ae(t.type);return r==="hexagon"||r==="hex"?"action":r==="lean-right"||r==="lean_right"?"input":r==="lin-doc"||r==="lined-document"?"refdoc":r==="diamond"?"decision":"task"}semanticModel(){let t=[],r=[];for(let[l,h]of this.nodes){if(this.subgraphLookup.has(l))continue;let y=tt(h.metadata);if(h.isConnector){let m={id:l};h.text!==void 0&&h.text!==l&&(m.title=h.text),y&&(m.metadata=y),r.push(m);continue}let e={id:l};h.text!==void 0&&(e.label=h.text);let C=Ae(h.type);C!==void 0&&(e.shape=C),e.vertexKind=this.vertexKind(h),y&&(e.metadata=y),t.push(e)}let a=this.edges.map(l=>{let h={start:l.start,end:l.end};return l.id!==void 0&&(h.id=l.id),l.text.length>0&&(h.label=l.text),l.type!==void 0&&(h.type=l.type),l.stroke!==void 0&&(h.stroke=l.stroke),l.edgeSemantic!==void 0&&(h.edgeSemantic=l.edgeSemantic),l.length!==void 0&&(h.length=l.length),l.metadata&&Object.keys(l.metadata).length>0&&(h.metadata={...l.metadata}),h}),d=this.subgraphs.map(l=>{let h={id:l.id,nodes:[...l.nodes],type:l.type,title:l.title};l.dir!==void 0&&(h.direction=l.dir);let y=tt(l.metadata);return y&&(h.metadata=y),h}),i={vertices:t,edges:a,subGraphs:d,connectors:r,diagnostics:this.diagnostics};return this.direction!==void 0&&(i.direction=this.direction),i}position(t){let r=(t==null?void 0:t.first_line)??0,a=(t==null?void 0:t.first_column)??0;return{startLine:r+this.lineOffset,startColumn:a,endLine:((t==null?void 0:t.last_line)??r)+this.lineOffset,endColumn:(t==null?void 0:t.last_column)??a,startIndex:0,endIndex:0}}pushMapping(t,r,a){let d={id:t,type:r,position:a};return this.mappings.push(d),this.firstMapping.has(t)||this.firstMapping.set(t,d),d}addVertexMapping(t,r,a,d){if(!t)return;let i=this.pushMapping(t,"vertex",this.position(d));a==null&&this.bareMappings.add(i)}extendVertexMapping(t,r){if(!t||!r)return;let a=this.position(r);for(let d=this.mappings.length-1;d>=0;d--){let i=this.mappings[d];if(i.type!=="vertex"||i.id!==t)continue;this.bareMappings.delete(i)&&(i.type="attachment");let l=i.position;(a.endLine>l.endLine||a.endLine===l.endLine&&a.endColumn>l.endColumn)&&(l.endLine=a.endLine,l.endColumn=a.endColumn);return}this.pushMapping(t,"attachment",a)}addEdgeMapping(t,r,a,d){let i=Array.isArray(r)?r.filter(l=>typeof l=="string"&&l!==""):[];this.pushMapping(i.length>0?i.join(">"):"edge","edge",this.position(d))}blockMapping(t,r,a,d){if(!t)return;let i=this.position(a),l=d?this.position(d):i;this.pushMapping(t,r,{startLine:i.startLine,startColumn:i.startColumn,endLine:l.endLine,endColumn:l.endColumn,startIndex:0,endIndex:0})}addSubgraphMapping(t,r,a,d){let i=typeof t=="string"?t:t==null?void 0:t.text;this.blockMapping(i??"","subgraph",a,d)}addConnectorMapping(t,r,a,d){var i;this.blockMapping(((i=t==null?void 0:t.text)==null?void 0:i.trim())??"","connector",a,d)}emit(t,r,a,d){var C,m;let i=(d==null?void 0:d.nodeId)??(d==null?void 0:d.edgeId),l={id:t,severity:r,message:a};d!=null&&d.nodeId?l.nodeId=d.nodeId:d!=null&&d.edgeId&&(l.edgeId=d.edgeId);let h=i?this.firstMapping.get(i):void 0;h&&(l.position=h.position);let y=i??"",e=this.reported.get(y);if(e===void 0)this.reported.set(y,[l]);else{for(let I of e)if(I.id===t&&I.severity===r&&I.message===a&&I.nodeId===l.nodeId&&I.edgeId===l.edgeId)return;e.push(l)}this.diagnostics.push(l),(m=(C=this.options).log)==null||m.call(C,r,`agentflow[${t}]: ${a}`)}emitWarning(t,r,a){this.emit(t,"warning",r,a)}emitError(t,r,a){this.emit(t,"error",r,a)}},rt=["$end","INVALID","acc_title","acc_title_value","acc_descr","acc_descr_value","acc_descr_multiline_value","SHAPE_DATA","CALLBACKNAME","CALLBACKARGS","MD_STR","STR","STYLE","DEFAULT","LINKSTYLE","INTERPOLATE","CLASSDEF","CLASS","HREF","CLICK","GRAPH","flow","connector","global","end","LINK_TARGET","NODIR","DIR","direction_tb","direction_bt","direction_rl","direction_lr","direction_td","LINK_ID","NUM","BRKT","STYLE_SEPARATOR","COLON","AMP","SEMI","COMMA","MULT","LINK","START_LINK","EDGE_TEXT","-)","TEXT","(-","STADIUMEND","STADIUMSTART","SUBROUTINEEND","SUBROUTINESTART","VERTEX_WITH_PROPS_START","TAGEND","CYLINDEREND","CYLINDERSTART","DOUBLECIRCLEEND","DOUBLECIRCLESTART","TRAPEND","INVTRAPEND","TRAPSTART","INVTRAPSTART","TAGSTART","UP","SEP","DOWN","COMMENT","NODE_STRING","MINUS","UNICODE_TEXT","PIPE","PE","PS","SQE","SQS","DIAMOND_STOP","DIAMOND_START","NEWLINE","SPACE","EOF"],nt=new Uint8Array(128);for(let t of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'*+.`?\\_/")nt[t.charCodeAt(0)]=1;var Jt=/accTitle\s*:\s*/y,Zt=/accDescr\s*:\s*/y,Qt=/accDescr\s*\{\s*/y,er=/call\s+/y,tr=/click\s+/y,rr=/(?:\r?\n)*\s*\n/y,sr=/\s*(?:LR|RL|TB|BT|TD|BR)\b/y,ir=/\s*[<>^]/y,ar=/\s*v\b/y,lr=[/.*direction\s+TB[^\n]*/y,/.*direction\s+BT[^\n]*/y,/.*direction\s+RL[^\n]*/y,/.*direction\s+LR[^\n]*/y,/.*direction\s+TD[^\n]*/y],Ie=/[\n\r\u2028\u2029]/g,or=/\(\s*\)/y,nr=/\n\s*/g;function dr(t){let r=t.length,a=[],d=[],i=[],l=[],h=[],y=0,e=0,C=1,m=0,I=!0,L=t.indexOf("direction"),N=t.indexOf("@"),b=-1,_=0,G=0,J=-1,U=-1,B=-1,p=-1,A=-1,x=-1,S=-1,$=n=>{let u=-1;for(let s=e;s<n;s++){let o=t.charCodeAt(s);o===10?(C++,u=s):o===13&&(s+1<n&&t.charCodeAt(s+1)===10&&s++,C++,u=s)}if(u<0)m+=n-e;else{let s=u+1;for(;s<n;){let o=t.charCodeAt(s);if(o===8232||o===8233)break;s++}m=s-u-1}e=n},M=(n,u)=>{a.push(n),d.push(t.slice(e,u)),i.push(e),l.push(C,m),$(u),l.push(C,m)},k=(n,u)=>{a.push(n),d.push(t.slice(e,u)),i.push(e),l.push(C,m),m+=u-e,e=u,l.push(C,m)},se=(n,u)=>{a.push(n),d.push(t.slice(e,u)),i.push(e),l.push(C,m);for(let s=e;s<u;s++){let o=t.charCodeAt(s);o===10||o===13?(C++,m=0):m++}e=u,l.push(C,m)},ne=(n,u,s)=>{a.push(n),d.push(u),i.push(e),l.push(C,m),$(s),l.push(C,m)},R=n=>{h.push(y),y=n},D=()=>{h.length>0&&(y=h.pop())},W=(n,u)=>(n.lastIndex=u,n.test(t)?n.lastIndex:-1),j=n=>t.startsWith(n,e)&&!We(t.charCodeAt(e+n.length)),ee=n=>{if(n>=U&&n<=B)return B;let u=n;for(;u<r&&le(t.charCodeAt(u));)u++;return U=n,B=u,u},oe=n=>{if(n>=p&&n<=A)return A;let u=n;for(;u<r;){let s=t.charCodeAt(u);if(s!==32&&s!==9)break;u++}return p=n,A=u,u},ie=n=>{let u=ee(n);if(u===S||t.charCodeAt(u)!==45||t.charCodeAt(u+1)!==45)return-1;let s=u+2;for(;t.charCodeAt(s)===45;)s++;let o=t.charCodeAt(s);return o===120||o===62?ee(s+1):(S=u,-1)},de=()=>{let n=ee(e);if(n===x||t.charCodeAt(n)!==45)return!1;let u=t.charCodeAt(n+1),s=n+2;if(u===45){for(;t.charCodeAt(s)===45;)s++;let o=t.charCodeAt(s);return o===120||o===62?M(42,ee(s+1)):(R(10),M(43,ee(n+2))),!0}if(u===46){for(;t.charCodeAt(s)===46;)s++;if(t.charCodeAt(s)===45)return M(42,ee(s+1)),!0}return x=n,!1},re=n=>{if(t.charCodeAt(n)!==37||t.charCodeAt(n+1)!==37||t.charCodeAt(n+2)===123)return-1;let u=t.indexOf(`
|
|
10
|
+
`,n+2);return u===-1?r:u},f=()=>{t.charCodeAt(e+1)===96?(R(2),$(e+2)):(R(1),$(e+1))},c=n=>{let u=t.charCodeAt(e+1);return n===40?(u===45?(R(8),k(47,e+2)):u===91?(R(7),k(49,e+2)):u===40&&t.charCodeAt(e+2)===40?(R(7),k(57,e+3)):(R(7),k(72,e+1)),!0):n===91?(u===91?(R(7),k(51,e+2)):u===40?(R(7),k(55,e+2)):u===47?(R(9),k(60,e+2)):u===92?(R(9),k(61,e+2)):(R(7),k(74,e+1)),!0):n===124?(R(7),k(70,e+1),!0):n===123?(R(7),k(76,e+1),!0):!1},w=()=>{let n=e;for(;n<r;){let u=t.charCodeAt(n);if(u<128&&nt[u]===1)n++;else if(u===45&&n+1<r){let s=t.charCodeAt(n+1);if(s===62||s===45||s===46)break;n++}else break}return n===e?!1:(k(67,n),!0)},v=n=>{let u=n;for(;u<r;){let s=t.charCodeAt(u);if(s!==32&&s!==9)break;u++}return u},E=n=>{let u;switch(n){case 97:if(t.startsWith("acc",e)){if((u=W(Jt,e))>=0)return R(3),M(2,u),!0;if((u=W(Zt,e))>=0)return R(4),M(4,u),!0;if((u=W(Qt,e))>=0)return R(5),$(u),!0}if(j("agentflow-beta"))return I&&(I=!1,R(6)),k(20,e+14),!0;break;case 64:if(t.charCodeAt(e+1)===123)return R(14),ne(7,"",e+2),!0;break;case 99:if((u=W(er,e))>=0)return R(12),$(u),!0;if(j("classDef"))return k(16,e+8),!0;if(j("class"))return k(17,e+5),!0;if((u=W(tr,e))>=0)return R(11),$(u),!0;if(j("connector"))return k(22,e+9),!0;break;case 34:return f(),!0;case 115:if(j("style"))return k(12,e+5),!0;break;case 100:if(j("default"))return k(13,e+7),!0;break;case 108:if(j("linkStyle"))return k(14,e+9),!0;break;case 105:if(j("interpolate"))return k(15,e+11),!0;break;case 104:if(t.startsWith("href",e)&&le(t.charCodeAt(e+4)))return M(18,e+5),!0;break;case 102:if(j("flow"))return k(21,e+4),!0;break;case 103:if(j("global"))return k(23,v(e+6)),!0;break;case 101:if(j("end"))return k(24,v(e+3)),!0;break;case 95:if(j("_self"))return k(25,e+5),!0;if(j("_blank"))return k(25,e+6),!0;if(j("_parent"))return k(25,e+7),!0;if(j("_top"))return k(25,e+4),!0;break}if(L!==-1&&e>=_&&(L<e&&(L=t.indexOf("direction",e)),L!==-1&&(b<e&&(Ie.lastIndex=e,b=Ie.test(t)?Ie.lastIndex-1:r),L<b))){for(let s=0;s<5;s++)if((u=W(lr[s],e))>=0)return M(28+s,u),!0;_=b}if(N!==-1&&n!==34&&!le(n)){if(e>=G){N<e&&(N=t.indexOf("@",e));let s=e;for(;s<r;){let o=t.charCodeAt(s);if(o===34||le(o))break;s++}if(G=s,J=-1,N!==-1&&N<s)for(let o=Math.min(s,r-1)-1;o>=N;o--){if(t.charCodeAt(o)!==64)continue;let g=t.charCodeAt(o+1);if(g!==123&&g!==34){J=o;break}}}if(J>e)return k(33,J+1),!0}if(n>=48&&n<=57){let s=e+1;for(;s<r;){let o=t.charCodeAt(s);if(o<48||o>57)break;s++}return k(34,s),!0}switch(n){case 35:return k(35,e+1),!0;case 58:return t.charCodeAt(e+1)===58&&t.charCodeAt(e+2)===58?k(36,e+3):k(37,e+1),!0;case 38:return k(38,e+1),!0;case 59:return k(39,e+1),!0;case 44:return k(40,e+1),!0;case 42:return k(41,e+1),!0;case 60:return k(62,e+1),!0;case 45:return de()||w()||k(68,e+1),!0;case 40:return c(n);case 91:return t.charCodeAt(e+1)===124?(k(52,e+2),!0):c(n);case 124:case 123:return c(n);case 62:return R(7),k(53,e+1),!0;case 94:return k(63,e+1),!0;case 92:return t.charCodeAt(e+1)===124?(k(64,e+2),!0):w();case 118:return We(t.charCodeAt(e+1))?w():(k(65,e+1),!0);case 37:return(u=re(e))>=0?(M(66,u),!0):w()}if(le(n)){if(de())return!0;if((n===32||n===9)&&(u=re(oe(e)))>=0)return M(66,u),!0;for(u=e;;){let s=t.charCodeAt(u);if(s===10)u++;else if(s===13&&t.charCodeAt(u+1)===10)u+=2;else break}return u>e?M(77,u):M(78,e+1),!0}return n<128?w():mt(n)?(k(69,e+1),!0):!1};e:for(;;){if(e>=r){let s=-1;switch(y){case 0:s=79;break;case 3:s=3;break;case 4:s=5;break;case 5:s=6;break;case 11:s=19;break;case 12:s=8;break;case 13:s=9;break}s!==-1&&k(s,r);break}let n=t.charCodeAt(e),u=!0;switch(y){case 0:u=E(n);break;case 1:if(n===34)t.charCodeAt(e+1)===96?(R(2),$(e+2)):(D(),$(e+1));else{let s=t.indexOf('"',e);M(11,s===-1?r:s)}break;case 2:if(n===96)t.charCodeAt(e+1)===34?(D(),$(e+2)):u=!1;else if(n===34)f();else{let s=e+1;for(;s<r;){let o=t.charCodeAt(s);if(o===96||o===34)break;s++}M(10,s)}break;case 3:case 4:{let s=t.indexOf(`
|
|
11
|
+
`,e);s===-1&&(s=r);let o=y===3?3:5;D(),M(o,s);break}case 5:if(n===125)D(),$(e+1);else{let s=t.indexOf("}",e);s===-1&&(s=r),M(6,s)}break;case 6:{let s;n===34?f():(s=W(rr,e))>=0?(D(),M(26,s)):(s=W(sr,e))>=0||(s=W(ir,e))>=0||(s=W(ar,e))>=0?(D(),M(27,s)):u=c(n);break}case 7:{let s=t.charCodeAt(e+1);switch(n){case 34:f();break;case 40:case 91:case 123:c(n);break;case 93:D(),s===41?k(48,e+2):s===93?k(50,e+2):k(73,e+1);break;case 41:D(),s===93?k(54,e+2):s===41&&t.charCodeAt(e+2)===41?k(56,e+3):k(71,e+1);break;case 124:D(),k(70,e+1);break;case 125:D(),k(75,e+1);break;case 37:{let o=re(e);o>=0?$(o):u=!1;break}default:{let o=e+1;for(;o<r;){let g=t.charCodeAt(o);if(g===91||g===93||g===40||g===41||g===123||g===125||g===124||g===34||g===37)break;o++}M(46,o)}}break}case 8:{let s=t.charCodeAt(e+1),o;if(n===34)f();else if(n===37&&(o=re(e))>=0)$(o);else if((n===45||n===47||n===41)&&s===41)D(),k(45,e+2);else if(n===40||n===91||n===123)c(n);else if(n===41||n===93||n===125)u=!1;else{let g=e+1;for(;g<r;){let T=t.charCodeAt(g);if(T===34||T===40||T===41||T===91||T===93||T===123||T===125||(T===45||T===47)&&t.charCodeAt(g+1)===41||T===37&&t.charCodeAt(g+1)===37&&t.charCodeAt(g+2)!==123)break;g++}se(46,g)}break}case 9:{let s=t.charCodeAt(e+1);if(n===34){f();break}switch(n){case 40:s===45||s===91||s===40&&t.charCodeAt(e+2)===40?c(n):s===93?(D(),k(58,e+2)):c(n);break;case 91:case 123:c(n);break;case 92:s===93?(D(),k(58,e+2)):k(46,e+1);break;case 47:s===93?(D(),k(59,e+2)):k(46,e+1);break;case 93:case 41:s===93?(D(),k(58,e+2)):u=!1;break;case 125:u=!1;break;case 37:{let o=re(e);o>=0?$(o):u=!1;break}default:{if((n===63||n===61)&&s===93){D(),k(58,e+2);break}let o=e+1;for(;o<r;){let g=t.charCodeAt(o);if(g===92||g===91||g===93||g===40||g===41||g===123||g===125||g===47||g===37)break;o++}M(46,o)}}break}case 10:{if(n===34){f();break}let s=ie(e);if(s>=0){D(),M(42,s);break}if(n===45&&t.charCodeAt(e+1)===45){u=!1;break}let o=e+1;for(;o<r;){let g=t.charCodeAt(o);if(g===34)break;if(g===45){if(t.charCodeAt(o+1)===45)break}else if(le(g)&&ie(o)>=0)break;o++}se(44,o);break}case 11:if(n===34)f();else if(le(n))D(),$(e+1);else{let s=e+1;for(;s<r&&!le(t.charCodeAt(s));)s++;k(19,s)}break;case 12:if(n===40){let s=W(or,e);D(),s>=0?$(s):(R(13),$(e+1))}else{let s=t.indexOf("(",e);s===-1&&(s=r),M(8,s)}break;case 13:if(n===41)D(),$(e+1);else{let s=t.indexOf(")",e);s===-1&&(s=r),M(9,s)}break;case 14:if(n===34)R(15),k(7,e+1);else if(n===125)D(),$(e+1);else if(n===94)u=!1;else{let s=e+1;for(;s<r;){let o=t.charCodeAt(s);if(o===125||o===94||o===34)break;s++}M(7,s)}break;case 15:if(n===34)D(),k(7,e+1);else{let s=t.indexOf('"',e);s===-1&&(s=r),ne(7,t.slice(e,s).replace(nr,"<br/>"),s)}break}if(!u)return a.push(1),d.push(""),i.push(e),l.push(C,m,C,m),{types:a,texts:d,starts:i,locs:l};continue e}return a.push(0),d.push(""),i.push(r),l.push(C,m,C,m),{types:a,texts:d,starts:i,locs:l}}var ve=new Uint8Array(80);for(let t of[34,67,65,68,13,40,37,38,35,41,69])ve[t]=1;var Ue=new Uint8Array(80);for(let t of[34,69,67,27,65,68,40,37,38,35,41])Ue[t]=1;var Be=new Uint8Array(80);for(let t of[34,67,78,68,38,69,37,41,35,12,14,16,17,19,20,27,21,22,23,24,65,63,43])Be[t]=1;var Pe=new Uint8Array(80);for(let t of[34,67,37,78,35,12])Pe[t]=1;var Te=new Uint8Array(80);for(let t of[77,39,79,66])Te[t]=1;var st="'UNICODE_TEXT', 'TEXT', 'TAGSTART'",Me="'COMMENT', 'SEMI', 'NEWLINE', 'EOF'",pe=[],cr=/}[^\S\n]*\n/g;function fr(t,r,a=!1){let d=!a&&t.includes("}")?t.replace(cr,`}
|
|
12
|
+
`):t,{types:i,texts:l,starts:h,locs:y}=dr(d),e=0,C,m=0,I=0,L=f=>{let c=i[e];throw c===1?Xe("agentflow",d,h[e],"",!0):Xe("agentflow",d,h[e],`Expecting ${f}, got '${rt[c]}'`)},N=(f,c)=>({first_line:y[4*f],first_column:y[4*f+1],last_line:y[4*c+2],last_column:y[4*c+3]}),b=(f,c="")=>(i[e]!==f&&L(`'${rt[f]}'${c?", "+c:""}`),l[e++]),_=()=>{Te[i[e]]===0&&L(Me),e++},G=()=>{ve[i[e]]===0&&L("'NODE_STRING'");let f=l[e++];for(;ve[i[e]]===1;)f+=l[e++];return f},J=()=>{Ue[i[e]]===0&&L("'NODE_STRING'");let f=l[e++];for(;Ue[i[e]]===1;)f+=l[e++];return f},U=()=>{let f=i[e],c;if(f===11)c="string";else if(f===10)c="markdown";else if(f===46||f===62||f===53||f===69)c="text";else return L(`${st}, 'TAGEND', 'STR', 'MD_STR'`);let w=l[e++];for(;;){let v=i[e];if(v!==46&&v!==62&&v!==53&&v!==69)break;w+=l[e++]}return{text:w,type:c}},B=f=>{b(f,st)},p=()=>{let f=i[e],c;if(f===11)c="string";else if(f===10)c="markdown";else if(f===44||f===69)c="text";else return L("'EDGE_TEXT', 'STR', 'MD_STR'");let w=l[e++];for(;i[e]===44||i[e]===69;)w+=l[e++];return{text:w,type:c}},A=()=>{let f=i[e],c;if(f===11)c="text";else if(f===10)c="markdown";else if(Be[f]===1)c="text";else return L("'NODE_STRING', 'STR', 'MD_STR'");let w=l[e++];for(;Be[i[e]]===1;)w+=l[e++];return{text:w,type:c}},x=()=>{m=e;let f=l[e++];for(;i[e]===7;)f+=l[e++];return I=e-1,f},S=(f,c,w,v)=>{let E=N(w,v);r.addVertex(f,void 0,void 0,void 0,void 0,void 0,void 0,c,E),r.extendVertexMapping(f,E)},$=(f,c)=>{c.data!==void 0&&r.addVertex(f,void 0,void 0,void 0,void 0,void 0,void 0,c.data,N(c.dataFrom,c.dataTo))},M=()=>{let f=e,c=G(),w,v,E;switch(i[e]){case 74:e++,w=U(),B(73),v="square";break;case 57:e++,w=U(),B(56),v="doublecircle";break;case 72:e++,i[e]===72?(e++,w=U(),B(71),b(71),v="circle"):(w=U(),B(71),v="round");break;case 47:e++,w=U(),B(45),v="ellipse";break;case 49:e++,w=U(),B(48),v="stadium";break;case 51:e++,w=U(),B(50),v="subroutine";break;case 52:{e++;let n=b(67);b(37);let u=b(67);b(70),w=U(),B(73),v="rect",E={[n]:u};break}case 55:e++,w=U(),B(54),v="cylinder";break;case 76:e++,i[e]===76?(e++,w=U(),B(75),b(75),v="hexagon"):(w=U(),B(75),v="diamond");break;case 53:e++,w=U(),B(73),v="odd";break;case 60:e++,w=U(),i[e]===59?(e++,v="lean_right"):(B(58),v="trapezoid");break;case 61:e++,w=U(),i[e]===58?(e++,v="lean_left"):(B(59),v="inv_trapezoid");break}return E!==void 0?r.addVertex(c,w,v,void 0,void 0,void 0,E):v!==void 0?r.addVertex(c,w,v):r.addVertex(c),r.addVertexMapping(c,w,v,N(f,e-1)),c},k=()=>{let f=M();return i[e]===36&&(e++,r.setClass(f,G())),f},se=()=>{let f=[k()];for(C=void 0;;){let c=i[e]===7?x():void 0,w=m,v=I;if(i[e]!==78)return C=c,f;do e++;while(i[e]===78);if(i[e]!==38)return c!==void 0&&L("'AMP'"),f;e++,i[e]!==78&&L("'SPACE'");do e++;while(i[e]===78);let E=k();c!==void 0&&S(f[f.length-1],c,w,v),f.push(E)}},ne=()=>{let f;if(i[e]===33&&(f=l[e++]),i[e]===42){let c=r.destructLink(l[e++]);return f!==void 0&&(c.id=f),i[e]===70&&(e++,c.text=U(),B(70),i[e]===78&&e++),c}if(i[e]===43){let c=l[e++],w=p(),v=b(42,"'EDGE_TEXT'"),E=r.destructLink(v,c);return E.text=w,f!==void 0&&(E.id=f),E}return L("'LINK', 'START_LINK'")},R=()=>{let f=e,c=se();C!==void 0&&S(c[c.length-1],C,m,I);let w=c;for(;;){let v=i[e];if(v!==42&&v!==43&&v!==33)return w;let E=ne(),n=se();C!==void 0&&S(n[n.length-1],C,m,I),r.addLink(c,n,E),r.addEdgeMapping(c,n,E,N(f,e-1)),w=n.concat(w),c=n}},D=()=>{Pe[i[e]]===0&&L("'NODE_STRING', 'NUM', 'COLON', 'BRKT'");let f=l[e++];for(;Pe[i[e]]===1;)f+=l[e++];return f},W=()=>{let f=[D()];for(;i[e]===40;)e++,f.push(D());return f},j=()=>{e++,b(78);let f;if(i[e]===13)f=[l[e++]];else for(f=[b(34,"'DEFAULT'")];i[e]===40;)e++,f.push(b(34));if(b(78),i[e]!==15){r.updateLink(f,W());return}e++,b(78);let c=J();if(i[e]===78){e++;let w=W();r.updateLinkInterpolate(f,c),r.updateLink(f,w)}else r.updateLinkInterpolate(f,c)},ee=(f,c)=>{if(i[e]!==78){r.setLink(f,c);return}if(e++,i[e]===25){r.setLink(f,c,l[e++]);return}let w=b(11,"'LINK_TARGET'");i[e]===78?(e++,r.setLink(f,c,b(25))):r.setLink(f,c),r.setTooltip(f,w)},oe=()=>{let f=l[e++];switch(i[e]){case 8:{let c=l[e++],w=i[e]===9,v=w?l[e++]:void 0,E;i[e]===78&&(e++,E=b(11)),w?r.setClickEvent(f,c,v):r.setClickEvent(f,c),E!==void 0&&r.setTooltip(f,E);return}case 18:e++,ee(f,b(11));return;case 11:ee(f,l[e++]);return;default:{let c=J();if(i[e]===78){e++;let w=b(11);r.setClickEvent(f,c),r.setTooltip(f,w)}else r.setClickEvent(f,c)}}},ie=f=>{b(78,Me);let c=A(),w={text:"",type:"text"};i[e]===74&&(e++,w=U(),B(73));let v=i[e]===7?x():void 0;return Te[i[e]]===0&&L(`${Me}, 'SHAPE_DATA'`),{global:!1,at:f,id:c,title:w,data:v,dataFrom:m,dataTo:I,list:[],collect:!1}},de=()=>{let f=i[e];switch(f){case 12:{e++,b(78);let c=G();return b(78),r.addVertex(c,void 0,void 0,W()),_(),pe}case 14:return j(),_(),pe;case 16:{e++,b(78);let c=G();return b(78),r.addClass(c,W()),_(),pe}case 17:{e++,b(78);let c=G();return b(78),r.setClass(c,G()),_(),pe}case 19:return oe(),_(),pe;case 22:{let c=ie(e++),w=e++,v=r.addConnector(c.id,c.title);return $(v,c),r.addConnectorMapping(c.id,c.title,N(c.at,c.at),N(w,w)),v}case 28:case 29:case 30:case 31:case 32:return e++,{stmt:"dir",value:ur[f-28]};case 2:{e++;let c=b(3).trim();return r.setAccTitle(c),c}case 4:{e++;let c=b(5).trim();return r.setAccDescription(c),c}case 6:{let c=l[e++].trim();return r.setAccDescription(c),c}default:{ve[f]===0&&L(it);let c=R();return _(),c}}},re=()=>{let f=[],c=[],w=!1;for(;;){let v=i[e];if(v===0)break;if(v===24){let E=f.pop();if(E===void 0)break;let n=e++;if(E.global){r.addGlobal(c),c=E.list,w=E.collect;continue}let u=r.addSubGraph(E.id,c,E.title,"flow");$(u,E),r.addSubgraphMapping(E.id,E.title,N(E.at,E.at),N(n,n)),c=E.list,w=E.collect,w&&c.push(u)}else if(v===39||v===77||v===78||v===79)w&&c.push(l[e]),e++;else if(v===66)e++;else if(v===21||v===23){let E=e++,n;v===23||Te[i[e]]===1?(n={global:v===23,at:E,id:void 0,title:void 0,data:void 0,dataFrom:0,dataTo:0,list:c,collect:w},_()):(n=ie(E),n.list=c,n.collect=w,e++),f.push(n),c=[],w=!0}else{let E=de();w&&(!Array.isArray(E)||E.length>0)&&c.push(E)}}f.length>0&&L("'end'")};for(;i[e]===78||i[e]===77||i[e]===66;)e++;if(b(20,"'SPACE', 'NEWLINE', 'COMMENT'"),i[e]===26)e++,r.setDirection("TB");else{let f=b(27,"'NODIR'"),c=i[e];if(c===78){do e++;while(i[e]===78);c=i[e],c!==77&&L("'NEWLINE', 'SPACE'")}else c!==39&&c!==77&&c!==66&&L("'COMMENT', 'SEMI', 'NEWLINE', 'SPACE'");e++,r.setDirection(f)}re(),i[e]!==0&&L(it)}var ur=["TB","BT","RL","LR","TD"],it="'COMMENT', 'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'flow', 'global', 'connector', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'STYLE', 'LINKSTYLE', 'CLASSDEF', 'CLASS', 'CLICK', 'NODE_STRING'",fe=new Map([["tool",0],["task",1],["decision",2],["input",3],["refdoc",4],["connector",5],["action",6]]),dt=fe.size,hr=t=>Math.max(1,t-dt),pr=(t,r)=>{let a=dt+t%hr(r);return r>0?a%r:a};function gr(t,r,a,d){let i=a.size;for(let l of t){if(l.isGroup||l.shape==="collapsedGroup"){l.colorIndex=pr(a.get(l.id)??i++,d);continue}let h=r(l.id);h&&fe.has(h)&&(l.kind=h)}}function br(t,r,a){var J,U,B;let d=[],i=[],l=t.subgraphs,h=p=>{let A=[];for(let x of p){let S=t.classes.get(x);S!=null&&S.styles&&(A=[...A,...S.styles].map($=>$.trim())),S!=null&&S.textStyles&&(A=[...A,...S.textStyles].map($=>$.trim()))}return A},y=new Set,e=new Map,C=new Set;for(let p of l){if(((J=p.metadata)==null?void 0:J.view)!=="collapsed"||y.has(p.id))continue;let A=[p.id];for(;A.length>0;){let x=(U=t.subgraph(A.pop()))==null?void 0:U.nodes;if(x!==void 0)for(let S of x)S===p.id||y.has(S)||(y.add(S),e.set(S,p.id),C.has(S)||A.push(S))}C.add(p.id)}let m=new Map;for(let p of y){let A=[p],x=e.get(p);for(;;){let S=m.get(x),$=S??e.get(x);if($===void 0||(S===void 0&&A.push(x),x=$,S!==void 0))break}for(let S of A)m.set(S,x)}let I=new Map;l.forEach((p,A)=>I.set(p.id,A));let L=new Map,N=(p,A,x)=>{let S=I.get(p);if(S===void 0||S<x)return!1;let $=A;for(let M=0;$!==void 0&&M<=l.length;M++){if($===p)return!0;$=L.get($)}return!1};for(let p=l.length-1;p>=0;p--){let A=l[p];if(!y.has(A.id))for(let x of A.nodes){if(N(x,A.id,p)){t.emitWarning("CONTAINMENT_VIOLATION",`Container "${A.id}" cannot contain "${x}" because "${x}" already contains it. The nesting that would close the loop is dropped.`,{nodeId:x});continue}L.set(x,A.id)}}let b=new Map;for(let p=l.length-1;p>=0;p--){let A=l[p];if(y.has(A.id))continue;let x=((B=A.metadata)==null?void 0:B.view)==="collapsed",S={id:A.id,label:A.title,labelType:A.labelType,parentId:L.get(A.id),cssStyles:[],cssCompiledStyles:h(A.classes),cssClasses:A.classes.join(" "),shape:x?"collapsedGroup":"flowGroup",dir:A.dir,isGroup:!x,metadata:x?{...A.metadata,containerType:A.type}:A.metadata};d.push(S),b.set(A.id,S)}for(let p of t.nodes.values()){if(y.has(p.id))continue;let A=b.get(p.id);if(A){A.cssStyles=p.styles,A.cssCompiledStyles=h(p.classes),A.cssClasses=p.classes.join(" ");continue}let x=Ae(p.type),S={id:p.id,label:p.text,labelType:p.labelType,parentId:L.get(p.id),cssStyles:p.styles,cssCompiledStyles:h(["default","node",...p.classes]),cssClasses:"default "+p.classes.join(" "),dir:p.dir,link:p.link,linkTarget:p.linkTarget,tooltip:t.tooltips.get(p.id),metadata:p.metadata,isGroup:!1,shape:x==="square"||x===void 0?"squareRect":x};d.push(S),b.set(p.id,S)}t.edges.forEach((p,A)=>{let x=m.get(p.start)??p.start,S=m.get(p.end)??p.end;if(x===S&&p.start!==p.end)return;let $=[...t.defaultEdgeStyle??[]];p.style&&$.push(...p.style);let M=p.type==="arrow_open"?"none":p.type==="arrow_cross"||p.type==="arrow_point"?p.type:"arrow_point";i.push({id:p.id||`L_${x}_${S}_${A}`,isUserDefinedId:p.isUserDefinedId,start:x,end:S,type:p.type??"normal",label:p.text,labelType:p.labelType,thickness:p.stroke,pattern:p.stroke,minlen:p.length,classes:"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:"none",arrowTypeEnd:M,cssCompiledStyles:h(p.classes),style:$,animate:p.animate,animation:p.animation,curve:p.interpolate||t.defaultInterpolate||a,metadata:p.metadata})}),Pt(d,t);let _=new Map;for(let p of l){let A=L.get(p.id);if(A===void 0)continue;let x=_.get(A);x?x.push(p.id):_.set(A,[p.id])}let G=new Map;for(let p of l){if(L.get(p.id)!==void 0)continue;let A=[p.id];for(;A.length>0;){let x=A.pop();if(G.has(x))continue;G.set(x,G.size);let S=_.get(x);if(S)for(let $=S.length-1;$>=0;$--)A.push(S[$])}}return gr(d,p=>{if(t.connectors.has(p))return"connector";let A=t.nodes.get(p);return A?t.vertexKind(A):void 0},G,r),{nodes:d,edges:i}}var mr=8,yr=40,kr=16,wr=48,ge=20,Ne=26,ke=14,at="collapsed",Ar={TB:2,RL:3,BT:0,LR:1},lt=new WeakMap;function ct(t,r){var d;let a=lt.get(t);if(a===void 0){let i=(d=r.flowchart)==null?void 0:d.curve;a=br(t,mr,typeof i=="string"?i:void 0),lt.set(t,a)}return a}function we(t,r,a){var i;let d=(i=t.agentflow)==null?void 0:i[r];return typeof d=="number"&&d>0?Math.min(d,2e3):a}var vr=/[";]fill:/;function Re(t,r,a){let d=Oe(t);return` fill="${d}"${vr.test(a.shape)?"":` fill-opacity="${r}"`} stroke="${d}"`}function Tr(t,r,a){return _t(t.direction)?It(a,d=>ot(t,r,a,d)):ot(t,r,a,!1)}function ot(t,r,a,d){let i=ct(t,r),l=a.fontSize??16,h=Math.round(l*.875),y=a.measurer??gt(a.fontFamily),e=we(r,"wrappingWidth",120),C=we(r,"minNodeWidth",120),m=a.padding??8,I=a.icons,L=new Map,N=[],b=[];i.nodes.forEach((s,o)=>L.set(s.id,o));for(let s of i.nodes){let o=s.cssStyles.length>0?s.cssCompiledStyles.concat(s.cssStyles):s.cssCompiledStyles,g=Je(o),T=(g.bold?1:0)|(g.italic?2:0),q=s.labelType==="markdown",V=g.fontSize??l,F,O;if(s.isGroup){let z=ue(s.label,q,y,V,4e3,T);F={node:s,style:g,label:z,shape:"group",w:0,h:0,dy:0,loops:0},O=Ce(0,0),O.isGroup=!0,O.dir=s.dir?qe(s.dir):void 0,O.padX=ge,O.padTop=z.height>0?z.height+16:ge,O.padBottom=ge,O.minW=z.width+2*ge-12}else if(s.shape==="collapsedGroup"){let z=ue(s.label,q,y,V,e,T),H=Math.max(z.width,C)+2*xt,Q=z.height+2*Et+ke;F={node:s,style:g,label:z,shape:at,w:H,h:Q,dy:-ke/2,loops:0},O=Ce(H,Q)}else{let z=ht(s.shape),H=ue(s.label,q,y,V,e,T),Q=$t(z,z==="diam"?H.width:Math.max(H.width,C),H.height);F={node:s,style:g,label:H,shape:z,w:Q.w,h:Q.h,dy:Q.dy,loops:0},O=Ce(Q.w,Q.h)}O.seq=N.length,N.push(F),b.push(O)}i.nodes.forEach((s,o)=>{b[o].parent=s.parentId!==void 0?L.get(s.parentId)??-1:-1});let _=d?"TB":qe(t.direction),G=s=>{let o;for(let g=b[s].parent,T=0;g>=0&&o===void 0&&T<1e4;g=b[g].parent,T++)o=b[g].dir;return o??_},J=s=>{let o=G(s);return o==="LR"||o==="RL"},U=new Int32Array(b.length).fill(-1);for(let s=0;s<b.length;s++){let o=[],g=s;for(;g>=0&&U[g]<0&&o.length<=b.length;)o.push(g),g=b[g].parent;let T=g>=0?U[g]+1:0;for(let q=o.length-1;q>=0;q--)U[o[q]]=T++}let B=(s,o)=>{let g=o;for(let T=U[o];T>U[s];T--)g=b[g].parent;return g===s&&o!==s},p=[],A=[],x=[],S=[];for(let s of i.edges){let o=L.get(s.start),g=L.get(s.end);if(o===void 0||g===void 0)continue;let T=ue(s.label,s.labelType==="markdown",y,h,e);if(B(o,g)||B(g,o)){S.push({edge:s,label:T,src:o,dst:g});continue}o===g&&(N[o].loops++,J(o)?b[o].h+=2*(Ne+(T.height>0?T.height+8:0)):b[o].w+=2*(Ne+(T.width>0?T.width+12:0))),x.push(s),A.push(T),p.push({src:o,dst:g,minlen:s.minlen??1,labelW:T.width>0?T.width+12:0,labelH:T.height>0?T.height+4:0,route:[],labelX:0,labelY:0})}let $=kt(b,p,_,{nodeSep:we(r,"nodeSpacing",yr),edgeSep:kr,rankSep:we(r,"rankSpacing",wr),portSep:20}),M=ue(t.title,!1,y,l,4e3,1),k=M.height>0?M.height+12:0,se=Math.max($.width,M.width),ne=m+(se-$.width)/2,R=m+k;wt(b,p,ne,R);let D=Math.ceil(se+2*m),W=Math.ceil($.height+k+2*m),j=[],ee=[],oe=[],ie=[],de=S.length*b.length<2e6;for(let{edge:s,src:o,dst:g}of S){let T=B(g,o),q=T?g:o,V=T?o:g,F=b[q],O=b[V],z=Ar[F.dir??G(q)],H=T?z:z+2&3,Q=K=>{let Y=(K&1)===0,X=K===0||K===3?-1:1,Ve=Y?O.x:O.x+X*O.w/2,Ke=Y?O.y+X*O.h/2:O.y,Fe=Y?O.x:F.x+X*F.w/2,ze=Y?F.y+X*F.h/2:O.y,be=Y?0:1;return T?[Ve,Ke,be,Fe,ze,be]:[Fe,ze,be,Ve,Ke,be]},ce=K=>{for(let Y=0;Y<b.length;Y++){let X=b[Y];if(Y!==V&&!X.isGroup&&X.x+X.w/2>Math.min(K[0],K[3])-1&&X.x-X.w/2<Math.max(K[0],K[3])+1&&X.y+X.h/2>Math.min(K[1],K[4])-1&&X.y-X.h/2<Math.max(K[1],K[4])+1)return!0}return!1},te=Q(H);if(de&&ce(te))for(let K of[H+1&3,H+3&3,H+2&3]){let Y=Q(K);if(!ce(Y)){te=Y;break}}ie.push(te),oe.push((te[0]+te[3])/2,(te[1]+te[4])/2);let ae=te.slice();Se(ae,T?0:3,N[V],O),ee.push(Ye(ae,"linear",0,xe(s.arrowTypeEnd)))}let re=new Map,f=!1;for(let s of b)s.isGroup&&(f=!0);if(f){for(let s of p)He(re,s.route);for(let s of ie)He(re,s)}let c="",w="";for(let s=0;s<N.length;s++){let o=N[s],g=b[s],T=o.node,q=g.x,V=g.y,F=Ze(T.cssClasses.replace(/^default\s?/,"")),O=Ee(T.id);if(g.isGroup){let K=yt(g,o.label.width,re,ge);c+=`<g class="pele-cluster pele-flow${F}" data-id="${O}"><rect x="${Z(q-g.w/2)}" y="${Z(V-g.h/2)}" width="${Z(g.w)}" height="${Z(g.h)}" rx="${Qe}"${Re(T.colorIndex??fe.size,"0.06",o.style)}${o.style.shape}/>`+$e(o.label,K,V-g.h/2+8+o.label.height/2,` class="pele-cluster-label" fill="var(--_m)"${o.style.text}`,I)+"</g>";continue}let z=o.w,H=o.h,Q="",ce;if(o.shape===at){let K=Oe(T.colorIndex??fe.size),Y=H/2-ke-2,X=Y+(ke+2)/2;ce=`<rect x="${Z(-z/2)}" y="${Z(-H/2)}" width="${Z(z)}" height="${Z(H)}" rx="${Qe}"${Re(T.colorIndex??fe.size,"0.06",o.style)}${o.style.shape}/><path d="M${Z(-z/2+10)},${Z(Y)}H${Z(z/2-10)}" fill="none" stroke="${K}" stroke-dasharray="3 3"${o.style.line}/><path class="pele-collapsed-mark" d="${De(-9,X)}${De(0,X)}${De(9,X)}" fill="${K}" stroke="none"/>`}else{let K=fe.get(T.kind??"task")??1;Q=` pele-kind-${T.kind??"task"}`,ce=Lt(o.shape,z,H,Re(K,"0.14",o.style)+o.style.shape,` stroke="${Oe(K)}"`+o.style.line)}let te=$e(o.label,0,o.dy,` class="pele-label"${o.style.text}`,I);if(/ internal-link(?: |$)/.test(F+" ")&&T.label&&a.links!==!1){let K=bt(T.label),Y=vt(Tt(K),a)!==void 0,X=Le(K);te=`<a class="internal-link"${Y?` href="${X}"${Ct(a)}`:""} data-href="${X}">${te}</a>`,j.push({id:T.id,href:K,internal:!0})}let ae=ce+te;T.tooltip&&(ae=`<title>${Ee(T.tooltip)}</title>`+ae),T.link&&(ae=St(ae,T.link,T.id,j,a,T.linkTarget?` target="${Le(T.linkTarget)}"`:"")),w+=`<g class="pele-node pele-shape-${o.shape}${Q}${F}" data-id="${O}" transform="translate(${Z(q)},${Z(V)})">${ae}</g>`}let v="",E="",n=(s,o,g,T,q)=>{let V=s.style.length>0||s.cssCompiledStyles.length>0?Je(s.cssCompiledStyles.concat(s.style)):void 0,F=s.arrowTypeEnd,O=V!=null&&V.stroke?Le(V.stroke):"var(--_l)",z=s.thickness==="dotted"?"reference":F==="arrow_cross"?"failure":"sequence",H=Ze(s.classes.replace(/edge-thickness-normal|edge-pattern-solid|flowchart-link/g,""));v+=`<g class="pele-edge pele-edge-${z}${H}" data-id="${Ee(s.id)}"${(V==null?void 0:V.line)??""}><path d="${g.d}"${s.thickness==="dotted"?' stroke-dasharray="3 4"':""}/>`+Nt(F,g.ex,g.ey,g.edx,g.edy,O)+"</g>",o.width>0&&(E+=Rt(s.id,o,T,q,(V==null?void 0:V.text)??"",I))},u=new Map;for(let s=0;s<p.length;s++){let o=p[s],g=x[s],T=A[s],q=g.arrowTypeEnd,V;if(o.src===o.dst){let F=N[o.src],O=u.get(o.src)??0;u.set(o.src,O+1),V=Mt(b[o.src],F.w,F.h,O,J(o.src),Ne,xe(q),o)}else{let F=o.route.slice();Se(F,0,N[o.src],b[o.src]),Se(F,F.length-3,N[o.dst],b[o.dst]),V=Ye(F,g.curve,0,xe(q))}n(g,T,V,o.labelX,o.labelY)}return S.forEach((s,o)=>n(s.edge,s.label,ee[o],oe[2*o],oe[2*o+1])),{svg:Dt("agentflow",D,W,l,a,t,$e(M,D/2,m+M.height/2,' class="pele-title" font-weight="var(--_tw)"')+(c?`<g class="pele-clusters">${c}</g>`:"")+(v?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${v}</g>`:"")+(E?`<g class="pele-edge-labels" font-size="${h}">${E}</g>`:"")+`<g class="pele-nodes">${w}</g>`),width:D,height:W,links:j}}function De(t,r){return`M${Z(t-1.75)},${Z(r)}a1.75,1.75 0 1 0 3.5,0a1.75,1.75 0 1 0 -3.5,0Z`}var Or={type:"agentflow",keepComments:!0,parse(t,r,a,d,i){let l=r.flowchart??{},h=new Yt({inheritDir:l.inheritDir===!0,direction:typeof r.direction=="string"?r.direction:void 0,lineOffset:d,maxEdges:i.maxEdges});return a&&(h.title=a),fr(t,h),ct(h,r),h},render:Tr};export{Or as agentflow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as re,s as ie,I as ae,g as J,E as K}from"./HWDLEDTA-C_JcdBMO.js";function de(o){return o==="BT"||o==="LR"||o==="RL"?o:"TB"}var fe=4e4;function he(o,u,E,X){for(let x of o)x.x+=E,x.y+=X;for(let x of u){for(let b=0;b<x.route.length;b+=3)x.route[b]+=E,x.route[b+1]+=X;x.labelX+=E,x.labelY+=X}}function ue(o,u,E=-1){return{w:o,h:u,parent:E,isGroup:!1,dir:void 0,padX:0,padTop:0,padBottom:0,minW:0,seq:0,span:0,x:0,y:0}}function le(o){return o==="TB"?0:o==="BT"?2:o==="LR"?3:1}function N(o){return o+2&3}function ge(o,u,E,X){let x=o.length,b=new Map,w=[],A=(e,l)=>{let t={id:e,dir:l,items:[],edges:[],ports:[],portOf:new Map,routes:new Map,x:0,y:0};return b.set(e,t),t},H=A(-1,E),W=[];for(let e=0;e<x;e++)W.push([]);let P=[];for(let e=0;e<x;e++){let l=o[e].parent;l>=0&&l<x&&l!==e&&o[l].isGroup?W[l].push(e):(o[e].parent=-1,P.push(e))}H.items=P,w.push(H);let G=new Int32Array(x),U=new Uint8Array(x),Q=e=>{for(let l=e;l<w.length;l++){let t=w[l];for(let s of t.items)if(U[s]=1,G[s]=t.id<0?0:G[t.id]+1,o[s].isGroup){let f=A(s,o[s].dir??t.dir);f.items=W[s],w.push(f)}}};Q(0);for(let e=0;e<x;e++){if(U[e])continue;let l=o[e].parent;if(W[l]=W[l].filter(t=>t!==e),o[e].parent=-1,H.items.push(e),U[e]=1,G[e]=0,o[e].isGroup){let t=w.length,s=A(e,o[e].dir??E);s.items=W[e],w.push(s),Q(t)}}for(let e=w.length-1;e>0;e--){let l=w[e],t=1/0;for(let s of l.items)o[s].seq<t&&(t=o[s].seq);t!==1/0&&(o[l.id].seq=t)}for(let e of w)e.items.sort((l,t)=>o[l].seq-o[t].seq||l-t);let S=0;for(let e of u){let l=e.src,t=e.dst,s=0;for(;G[l]>G[t];s++)l=o[l].parent;for(;G[t]>G[l];s++)t=o[t].parent;for(;l!==t&&o[l].parent!==o[t].parent;s+=2)l=o[l].parent,t=o[t].parent;l!==t&&(S+s>fe?(e.src=l,e.dst=t):S+=s)}let V=[],Z=[];for(let e=0;e<u.length;e++){let l=u[e];if(l.route=[],l.src===l.dst){V.push(e);continue}let t=l.src,s=l.dst,f=[],n=[];for(;G[t]>G[s];)f.push(t),t=o[t].parent;for(;G[s]>G[t];)n.push(s),s=o[s].parent;if(t===s){Z.push(e);continue}for(;o[t].parent!==o[s].parent;)f.push(t),n.push(s),t=o[t].parent,s=o[s].parent;b.get(o[t].parent).edges.push({e,a:t,b:s});for(let[a,c]of[[f,!0],[n,!1]])for(let y of a){let r=b.get(o[y].parent),h={e,inner:y,out:c,side:0,px:0,py:0,route:[]};r.ports.push(h),r.portOf.set(e*2+(c?0:1),h)}}let B=new Int32Array(x),F=(e,l,t)=>(t?l.src:l.dst)!==e,_=(e,l)=>{let t=e.dir==="TB"||e.dir==="BT",s=le(e.dir),f=[],n=[];e.items.forEach((r,h)=>{B[r]=h;let p=o[r],m=l?J(t?p.w:p.h,t?p.h:p.w):J(0,0);m.span=p.isGroup?Math.min(p.span,m.w-2*p.padX):p.span,f.push(m)});let a=(r,h,p)=>o[r].isGroup&&F(r,u[h],p),c=(r,h,p)=>{if(!l||!o[r].isGroup||!F(r,u[h],p))return 0;let m=b.get(r).portOf.get(h*2+(p?0:1));return t?m.px-o[r].w/2:m.py-o[r].h/2};for(let r of e.edges){let h=u[r.e],p=K(B[r.a],B[r.b],h.minlen);l&&(p.labelW=t?h.labelW:h.labelH,p.labelH=t?h.labelH:h.labelW,p.tailDx=c(r.a,r.e,!0),p.headDx=c(r.b,r.e,!1),p.tailFixed=a(r.a,r.e,!0),p.headFixed=a(r.b,r.e,!1)),n.push(p)}let y=new Int32Array(e.ports.length).fill(-1);return e.ports.forEach((r,h)=>{if(r.side===s||r.side===N(s)){let p=f.length;f.push(J(0,0,r.side===s?3:4)),y[h]=p;let m=r.out?K(B[r.inner],p):K(p,B[r.inner]);r.out?(m.tailDx=c(r.inner,r.e,!0),m.tailFixed=a(r.inner,r.e,!0)):(m.headDx=c(r.inner,r.e,!1),m.headFixed=a(r.inner,r.e,!1)),n.push(m)}else f[B[r.inner]].pin=r.side===0||r.side===3?-1:1}),{lnodes:f,ledges:n,dummies:y}};for(let e of w){for(let n of e.ports)o[n.inner].isGroup&&F(n.inner,u[n.e],n.out)&&(b.get(n.inner).portOf.get(n.e*2+(n.out?0:1)).side=n.side);if(e.edges.length===0)continue;let l=!1;for(let n of e.edges){let a=u[n.e];(o[n.a].isGroup&&a.src!==n.a||o[n.b].isGroup&&a.dst!==n.b)&&(l=!0)}if(!l)continue;let{lnodes:t,ledges:s}=_(e,!1);re(t,s),ie(t,s,1);let f=le(e.dir);e.edges.forEach((n,a)=>{let c=u[n.e],y=!s[a].reversed;o[n.a].isGroup&&c.src!==n.a&&(b.get(n.a).portOf.get(n.e*2).side=y?N(f):f),o[n.b].isGroup&&c.dst!==n.b&&(b.get(n.b).portOf.get(n.e*2+1).side=y?f:N(f))})}let $={width:0,height:0};for(let e=w.length-1;e>=0;e--){let l=w[e],t=l.id>=0?o[l.id]:void 0,s=l.dir==="TB"||l.dir==="BT",f=l.dir==="BT"||l.dir==="RL",{lnodes:n,ledges:a,dummies:c}=_(l,!0),y=ae(n,a,X),r=s?y.width:y.height,h=s?y.height:y.width,p=t?t.padX:0,m=t?t.padTop:0,q=Math.max(r+2*p,t?t.minW:0),L=h+m+(t?t.padBottom:0),oe=(q-r)/2,se=m,k=(i,g)=>oe+(s?i:f?y.height-g:g),z=(i,g)=>se+(s?f?y.height-g:g:i),C=s?0:1,ee=i=>{let g=[];for(let d=0;d<i.length;d+=2)g.push(k(i[d],i[d+1]),z(i[d],i[d+1]),C);return g};l.items.forEach((i,g)=>{o[i].x=k(n[g].x,n[g].y),o[i].y=z(n[g].x,n[g].y)}),l.edges.forEach((i,g)=>{let d=a[g];l.routes.set(i.e,ee(d.points));let T=u[i.e];T.labelW>0&&(T.labelX=k(d.labelX,d.labelY),T.labelY=z(d.labelX,d.labelY))});let ne=l.edges.length;l.ports.forEach((i,g)=>{let d=o[i.inner];if(c[g]>=0){let O=ee(a[ne++].points),te=i.out?O.length-3:0,I=O[te],D=O[te+1];i.side===0?D=0:i.side===2?D=L:i.side===3?I=0:I=q,i.out?O.push(I,D,C):O.unshift(I,D,C),i.px=I,i.py=D,i.route=O;return}let T=d.x,M=d.y;if(d.isGroup&&F(i.inner,u[i.e],i.out)){let O=b.get(i.inner).portOf.get(i.e*2+(i.out?0:1));T+=O.px-d.w/2,M+=O.py-d.h/2}else i.side===0?M-=d.h/2:i.side===2?M+=d.h/2:i.side===3?T-=d.w/2:T+=d.w/2;let Y=T,v=M;i.side===0?v=0:i.side===2?v=L:i.side===3?Y=0:Y=q;let R=i.side===0||i.side===2?0:1;i.px=Y,i.py=v,i.route=i.out?[T,M,R,Y,v,R]:[Y,v,R,T,M,R]}),t?(t.w=q,t.h=L):$={width:q,height:L}}for(let e of w){let l=e.x,t=e.y;for(let s of e.items){let f=o[s];if(f.x+=l,f.y+=t,f.isGroup){let n=b.get(s);n.x=f.x-f.w/2,n.y=f.y-f.h/2}}}let j=(e,l,t,s)=>{for(let f=0;f<l.length;f+=3){let n=l[f]+t,a=l[f+1]+s,c=e.length;c>=3&&Math.abs(e[c-3]-n)<.01&&Math.abs(e[c-2]-a)<.01||e.push(n,a,l[f+2])}};for(let e of w)for(let l of e.edges){let t=u[l.e],s=[],f=[];for(let a=t.src;o[a].parent!==e.id;a=o[a].parent)f.push(b.get(o[a].parent));for(let a of f)j(s,a.portOf.get(l.e*2).route,a.x,a.y);j(s,e.routes.get(l.e),e.x,e.y);let n=[];for(let a=t.dst;o[a].parent!==e.id;a=o[a].parent)n.push(b.get(o[a].parent));for(let a=n.length-1;a>=0;a--)j(s,n[a].portOf.get(l.e*2+1).route,n[a].x,n[a].y);t.route=s,t.labelW>0&&(t.labelX+=e.x,t.labelY+=e.y)}for(let e of Z){let l=u[e],t=o[l.src],s=o[l.dst];l.route=[t.x,t.y,0,s.x,s.y,0],l.labelX=(t.x+s.x)/2,l.labelY=(t.y+s.y)/2}for(let e of V){let l=u[e],t=o[l.src];l.labelX=t.x+t.w/2+28+l.labelW/2,l.labelY=t.y}return $}export{de as b,ue as d,ge as m,he as p};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var Qe=Object.defineProperty;var Ue=(e,a,s)=>a in e?Qe(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s;var $=(e,a,s)=>Ue(e,typeof a!="symbol"?a+"":a,s);import{g as Ze,s as P,a as Be,A as Ge}from"./WEVWDWVA-nohBBhTA.js";import{s as Ne,T as B}from"./UEXXS2NB-Dkz_tz-N.js";import{x as Je,H as Xe,i as He,e as G,L as Ye}from"./lazy-CKqR1774.js";import{c as je}from"./DKTLEL5E-B7ILCVTH.js";import{D as Ve,a as J}from"./HWDLEDTA-C_JcdBMO.js";import{x as c,f as X,$ as et,y as We,m as de,a as tt}from"./RZSVICHU-BiwjruZZ.js";import"./index-392ivruk.js";var it=class{constructor(){$(this,"type","timeline");$(this,"title");$(this,"accTitle");$(this,"accDescr");$(this,"direction","LR");$(this,"sections",[]);$(this,"periods",[]);$(this,"currentSection","")}getCommonDb(){return this}setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,"")}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
2
|
+
`)}setDirection(e){this.direction=e}addSection(e){this.currentSection=e,this.sections.push(e)}addTask(e,a,s){this.periods.push({text:e,events:s?[s]:[],section:this.currentSection,sectionIndex:this.sections.length-1})}addEvent(e){let a=this.periods[this.periods.length-1];if(!a)throw new Je("An event needs a time period before it.","semantic",{type:"timeline"});a.events.push(e)}},rt=["$end","EOF","INVALID","NEWLINE","timeline","timeline_lr","timeline_td","title","acc_title","acc_title_value","acc_descr","acc_descr_value","acc_descr_multiline_value","section","period","event"];function at(e){let a=e.length,s=[],d=[],p=[],v={types:s,texts:d,starts:p},r=0,o=(u,i)=>{s.push(u),d.push(e.slice(r,i)),p.push(r),r=i};for(;r=Ze(e,r),!(r>=a);){let u=e.charCodeAt(r),i=r+1;if(u===10){for(;e.charCodeAt(i)===10;)i++;o(3,i);continue}if(P(e,r,"timeline")){for(i=r+8;e.charCodeAt(i)===32||e.charCodeAt(i)===9;)i++;let x=P(e,i,"lr");if(i>r+8&&(x||P(e,i,"td"))&&!He(e.charCodeAt(i+2))){o(x?5:6,i+2);continue}if(!He(e.charCodeAt(r+8))){o(4,r+8);continue}}if(P(e,r,"title")&&G(e.charCodeAt(r+5))&&r+6<a&&e.charCodeAt(r+6)!==10){o(7,Be(e,r+6));continue}if(i=Ge(e,r,v,8),i!==r){r=i;continue}if(P(e,r,"section")&&G(e.charCodeAt(r+7))){for(i=r+8;i<a&&e.charCodeAt(i)!==58&&e.charCodeAt(i)!==10;)i++;if(i>r+8){o(13,i);continue}}if(u!==58){i=r+1;for(let x=e.charCodeAt(i);i<a&&x!==35&&x!==58&&x!==10;x=e.charCodeAt(++i));o(14,i);continue}if(G(e.charCodeAt(r+1))){for(i=r+2;i<a;i++){let x=e.charCodeAt(i);if(x===10||x===58&&G(e.charCodeAt(i+1)))break}if(i>r+2){o(15,i);continue}}o(2,r+1)}return(p.length===0||p[p.length-1]<a)&&o(1,a),o(0,a),v}var st="'EOF', 'SPACE', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'section', 'period', 'event'";function ot(e,a){let{types:s,texts:d,starts:p}=at(e),v=(o,u)=>{let i=s[o]===0?"1":rt[s[o]];throw Ye("timeline",e,p[o],`Expecting ${u}, got '${i}'`)},r=s[0];r!==4&&r!==5&&r!==6&&v(0,"'timeline', 'timeline_lr', 'timeline_td'"),r!==4&&a.setDirection(r===5?"LR":"TD");for(let o=1;;o++){let u=d[o];switch(s[o]){case 3:break;case 7:a.getCommonDb().setDiagramTitle(u.substring(6));break;case 8:a.getCommonDb().setAccTitle(d[++o].trim());break;case 10:a.getCommonDb().setAccDescription(d[++o].trim());break;case 12:a.getCommonDb().setAccDescription(u.trim());break;case 13:a.addSection(u.substring(8));break;case 14:a.addTask(u,0,"");break;case 15:a.addEvent(u.substring(2));break;case 1:return;default:v(o,st)}}}var Y=12,Fe=8,nt=152,lt=216,ct=264,T=20,W=20,j=14,Q=8,me=8,ee=12,Oe=' fill="var(--_bg)"',Re=' fill="none" stroke="var(--_b)"';function fe(e,a,s,d,p){return`<rect x="${c(e)}" y="${c(a)}" width="${c(s)}" height="${c(d)}" rx="${tt}"${p}/>`}function ht(e,a,s){return e.direction==="TD"?qe(e,a,s,!0):je(s,d=>qe(e,a,s,d))}function qe(e,a,s,d){var Te;let p=s.fontSize??16,v=Math.round(p*.875),r=s.measurer??Xe(s.fontFamily),o=s.padding??8,u=((Te=a.timeline)==null?void 0:Te.disableMulticolor)!==!0,i=e.periods,x=e.sections.length>0,C=e.sections.map((t,n)=>({section:n,periods:[]})),te={section:-1,periods:[]};i.forEach((t,n)=>(C[t.sectionIndex]??te).periods.push(n)),te.periods.length>0&&C.unshift(te);let ie=d&&s.maxWidth!==void 0&&s.maxWidth>0?s.maxWidth-2*o:1/0,pe=W+j*2+4*Y,U=Math.min(nt,Math.max(80,Math.round((ie-pe)*.38))),ge=Math.min(ct,Math.max(110,ie-pe-U)),E=U,re=()=>d?ge:E,F=i.map(t=>Ne(t.text,r,p,E)),w=i.map(t=>t.events.map(n=>Ne(n,r,v,re()))),S=0;for(let t of F)S=Math.max(S,t.width);if(!d)for(let t of w)for(let n of t)S=Math.max(S,n.width);let ue=S>E;if(d)for(let t of w)for(let n of t)ue||(ue=n.width>ge);ue&&(E=Math.min(Math.max(Math.ceil(S),U),ie===1/0?lt:U),F=i.map(t=>B(t.text,r,p,E)),w=i.map(t=>t.events.map(n=>B(n,r,v,re()))));let ze=Math.round(p*1.5),D=E+2*Y,ae=re()+2*Y,Z=t=>Math.max(t.height,ze)+2*Fe,xe=t=>Math.max(t.height,Math.round(v*1.5))+2*Fe,Me=(t,n)=>t.section>=0?de(t.section):x?"var(--_m)":de(u?n:0),ve=!1;for(let t of w)t.length>0&&(ve=!0);let se=0;for(let t of C)se+=Math.max(t.periods.length,1);let O=D+T,R=i.length>0,I=d?D+(ve?W+j*2+ae:R?W+ee:0):se>0?se*O-T+(R?ee+J:0):0,q=B(e.title,r,p,Math.max(I,320),1),Ke=q.height>0?q.height+16:0,_e=Math.max(I,q.width),k=o+(_e-I)/2,z=o+Ke,$e=(t,n)=>B(e.sections[t.section],r,p,n-2*Y,1),be=(t,n,m,h,l,g)=>fe(m,h,l,g,` fill="${de(t.section)}"`)+X(n,m+l/2,h+g/2,' font-weight="var(--_hw)"'+Oe),Ae=(t,n,m,h,l)=>fe(m,h,D,l,` fill="${n}"`)+X(F[t],m+D/2,h+l/2,Oe),Ce=(t,n,m,h,l)=>'<g class="pele-node pele-event">'+fe(m,h,ae,l,` fill="${n}" fill-opacity="0.16"`)+X(t,m+ae/2,h+l/2,` font-size="${v}"`)+"</g>",we=(t,n,m)=>`<circle class="pele-dot" cx="${c(t)}" cy="${c(n)}" r="4" fill="${m}" stroke="var(--_bg)" stroke-width="2"/>`,De=t=>t.section>=0?`<g class="pele-cluster pele-section" data-id="${We(e.sections[t.section].trim())}">`:"",ke=t=>`<g class="pele-node pele-period" data-id="${We(i[t].text.trim())}">`,M="",oe;if(d){let t=k+D+W,n=t+j,m=n+j,h=z;for(let l of C){if(M+=De(l),l.section>=0){let g=$e(l,I),_=Z(g);M+=be(l,g,k,h,I,_),h+=_+me+4}for(let g of l.periods){let _=Me(l,g),L=Z(F[g]),f=h+L/2,b=`M${c(k+D)},${c(f)}H${c(t)}`,N="",y=h,H=f;for(let A of w[g]){let K=xe(A);H=y+K/2,b+=`M${c(n)},${c(H)}H${c(m)}`,N+=Ce(A,_,m,y,K),y+=K+Q}N&&(b+=`M${c(t)},${c(f)}H${c(n)}V${c(H)}`),M+=ke(g)+Ae(g,_,k,h,L)+`<path class="pele-edge" d="${b}"${Re}/>`+we(t,f,_)+N+"</g>",h=Math.max(h+L,y-Q)+T}l.periods.length===0&&(h+=T-me-4),l.section>=0&&(M+="</g>")}if(C.length>0&&(h-=T),R){let l=h+ee+J;M=`<path class="pele-axis" d="M${c(t)},${c(z)}V${c(l-J+1)}" fill="none" stroke="var(--_l)"/>`+Ve("arrow_point",t,l,0,1,"var(--_l)")+M,h=l}oe=h+o}else{let t=0,n=C.map(f=>{if(f.section<0)return;let b=$e(f,Math.max(f.periods.length,1)*O-T);return t=Math.max(t,Z(b)),b}),m=0;for(let f of F)m=Math.max(m,Z(f));let h=z+(x?t+me:0),l=h+m+(m>0?W:0),g=l+W,_=R?l+ee:z+t,L=0;if(C.forEach((f,b)=>{let N=Math.max(f.periods.length,1),y=k+L*O;M+=De(f);let H=n[b];H&&(M+=be(f,H,y,z,N*O-T,t)),f.periods.forEach((A,K)=>{let le=Me(f,A),ce=y+K*O,he=ce+D/2,Ee=`M${c(he)},${c(h+m)}V${c(w[A].length>0?g:l)}`,Se="",V=g;for(let Ie of w[A]){let Le=xe(Ie);V>g&&(Ee+=`M${c(he)},${c(V-Q)}V${c(V)}`),Se+=Ce(Ie,le,ce,V,Le),V+=Le+Q}_=Math.max(_,V-Q),M+=ke(A)+Ae(A,le,ce,h,m)+`<path class="pele-edge" d="${Ee}"${Re}/>`+we(he,l,le)+Se+"</g>"}),f.section>=0&&(M+="</g>"),L+=N}),R){let f=k+I;M=`<path class="pele-axis" d="M${c(k)},${c(l)}H${c(f-J+1)}" fill="none" stroke="var(--_l)"/>`+Ve("arrow_point",f,l,1,0,"var(--_l)")+M}oe=_+o}let ne=Math.ceil(_e+2*o),ye=Math.ceil(Math.max(oe,o*2)),Pe=X(q,ne/2,o+q.height/2,' class="pele-title" font-weight="var(--_tw)"')+M;return{svg:et("timeline",ne,ye,p,s,e,Pe),width:ne,height:ye,links:[]}}var vt={type:"timeline",parse(e,a,s){let d=new it;return d.title=s,ot(e,d),d},render:ht};export{vt as timeline};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{i as Le}from"./PUZGS23X-n6IKOr7S.js";import{k as Ne,A as je,H as He}from"./KQOEJWJY-DKTXya68.js";import{c as Ve}from"./DKTLEL5E-B7ILCVTH.js";import{U as Ge,z as Be,Y as Oe,x as Re,D as We,$ as Ke,v as Ye,G as Ue,O as Ze,P as qe,H as Je}from"./VMV7XPHP-6QkisQwm.js";import{w as $e,D as oe}from"./HWDLEDTA-C_JcdBMO.js";import{_ as U,a as ie,y as B,x as o,f as q,m as se,$ as ke,b as Ie,p as Se}from"./RZSVICHU-BiwjruZZ.js";import{C as Xe,x as Pe,H as De,$ as Ce}from"./lazy-CKqR1774.js";import"./index-392ivruk.js";var Qe=new Map([["ui","ui"],["pcr","processor"],["processor","processor"],["rmo","readmodel"],["readmodel","readmodel"],["cmd","command"],["command","command"],["evt","event"],["event","event"]]),et=new Map([["trigger",[0,"UI/Automation","UI/A: "]],["state",[100,"Command/Read Model","C/RM: "]],["stream",[200,"Events","Stream: "]]]);function tt(a){return a==="ui"||a==="processor"?"trigger":a==="event"?"stream":"state"}function pe(a){let t=a.indexOf("{"),s=a.lastIndexOf("}"),h=(t!==-1&&s>t?a.slice(t+1,s):t===-1&&a.length>=2?a.slice(1,-1):"").replace(/\r/g,"").split(`
|
|
2
|
+
`);for(;h.length>0&&h[0].trim()==="";)h.shift();for(;h.length>0&&h[h.length-1].trim()==="";)h.pop();let $=1/0;for(let m of h)m.trim()!==""&&($=Math.min($,m.length-m.trimStart().length));return h.map(m=>m.slice(Math.min($,m.length)).trimEnd()).join(`
|
|
3
|
+
`)}function at(a,t){let s=new Set;for(let l of a.frames){if(s.has(l.name)){let v=Xe(a.$source,l.$offset).line;throw new Pe(`Duplicate event modeling frame ID "${l.name}" on line ${v}`,"semantic",{type:"eventmodeling",line:v})}s.add(l.name)}let h=new Map;for(let l of a.dataEntities)h.has(l.name)||h.set(l.name,l.dataBlockValue);let $=new Map,m=new Map,x=(l,v)=>{let M=tt(l),A=v===void 0?M:`${M} ${v}`,z=$.get(A);if(!z){let[F,y,T]=et.get(M),S=F;v!==void 0&&(S=m.get(M)??F+1,m.set(M,S+1)),z={index:S,label:v===void 0?y:T+v,group:M,namespace:v},$.set(A,z)}return z},C=[],c=new Map,p=[];a.frames.forEach((l,v)=>{let M=l.entityIdentifier.split("."),A=M.length===2?M[0]:void 0,z=Qe.get(l.modelEntityType)??"event",F=l.dataInlineValue===void 0?void 0:pe(l.dataInlineValue);if(l.dataReference){let T=h.get(l.dataReference.$refText);T!==void 0&&(F=pe(T))}let y={id:l.name,kind:z,entity:l.entityIdentifier,name:M.length===2?M[1]:l.entityIdentifier,namespace:A,reset:l.$type==="EmResetFrame",lane:x(z,A),data:F,dataType:l.dataType};if(C.push(y),c.set(y.id,y),l.sourceFrames.length>0){let T=new Set(l.sourceFrames.map(S=>S.$refText));for(let S of C)T.has(S.id)&&p.push({source:S,target:y})}else if(v>0&&!y.reset){for(let T=v-1;T>=0;T--)if(C[T].lane!==y.lane){p.push({source:C[T],target:y});break}}});let E=l=>l.map(v=>v.entityIdentifier.$refText);return{type:"eventmodeling",title:a.title&&Oe(a.title)||t,accTitle:a.accTitle?Be(a.accTitle).replace(/^\s+/g,""):void 0,accDescr:a.accDescr?Ge(a.accDescr).replace(/\n\s+/g,`
|
|
4
|
+
`):void 0,boxes:C,lanes:[...$.values()].sort((l,v)=>l.index-v.index),relations:p,notes:a.noteEntities.map(l=>({frame:l.sourceFrame.$refText,text:pe(l.dataBlockValue),dataType:l.dataType})),specifications:a.gwtEntities.map(l=>({frame:l.sourceFrame.$refText,given:E(l.givenStatements),when:E(l.whenStatements),then:E(l.thenStatements)})),entities:a.modelEntities.map(l=>l.name)}}var xe={name:"EM_ID",pattern:/[_a-zA-Z][\w_]*/y},Q=a=>({name:a,pattern:a,longer:[xe]}),ae=a=>({name:a,pattern:a}),it=["resetframe","readmodel","processor","timeframe","command","entity","event","jsobj","figma","given","json","salt","html","text","data","note","when","then","rmo","cmd","evt","pcr","uri"],we=[{...Je("eventmodeling"),longer:[xe]},...it.map(Q),ae("->>"),Q("gwt"),Q("ui"),Q("md"),Q("tf"),ae("[["),ae("]]"),Q("rf"),ae("`"),ae("."),xe,{name:"EM_FID",pattern:/\d{1,3}/y},{name:"EM_DATA_INLINE",pattern:/\{(.*)\}|"(.*)"|'(.*)'/y},{name:"EM_DATA_BLOCK",pattern:/\{[\t ]*\r?\n(?:[\S\s]*?\r?\n)?\}(?:\r?\n|(?!\S))/y},Le("EM_ACC_DESCR"),{...Ke,name:"EM_ACC_TITLE"},{...Ye,name:"EM_TITLE"},{name:"EM_WS",pattern:/\s+/y,hidden:!0},{...Ue,name:"EM_YAML"},{...Ze,name:"EM_DIRECTIVE"},{...qe,name:"EM_SINGLE_LINE_COMMENT"},{name:"EM_ML_COMMENT",pattern:/\/\*[\s\S]*?\*\//y,hidden:!0},{name:"EM_SL_COMMENT",pattern:/\/\/[^\n\r]*/y,hidden:!0}],k=a=>we.findIndex(t=>t.name===a),me=a=>new Set(a.map(k)),g={keyword:0,arrow:k("->>"),open:k("[["),close:k("]]"),tick:k("`"),dot:k("."),id:k("EM_ID"),frameId:k("EM_FID"),inline:k("EM_DATA_INLINE"),block:k("EM_DATA_BLOCK"),accDescr:k("EM_ACC_DESCR"),accTitle:k("EM_ACC_TITLE"),title:k("EM_TITLE"),entity:k("entity"),data:k("data"),note:k("note"),gwt:k("gwt"),given:k("given"),when:k("when"),then:k("then")},Me=me(["tf","timeframe"]),nt=me(["rf","resetframe"]),ce=me(["rmo","readmodel","ui","cmd","command","evt","event","pcr","processor"]),lt=me(["json","jsobj","figma","salt","uri","md","html","text"]);function rt(a){let t=new Re(We(a,we,"eventmodeling"),we,"eventmodeling"),s={$type:"EventModel",modelEntities:[],frames:[],dataEntities:[],noteEntities:[],gwtEntities:[],$source:a},h=c=>t.kinds[t.i]===c,$=(c,p)=>c.has(t.kinds[t.i])?t.take():t.fail(p),m=()=>{let c=t.expect(g.id);for(;t.accept(g.dot);)c+="."+t.expect(g.id);return c},x=()=>{if(!t.accept(g.tick))return;let c=$(lt,"a data type");return t.expect(g.tick),c},C=()=>{let c=[];do $(ce,"an entity type"),c.push({$type:"EmGwtStatement",entityIdentifier:{$refText:t.expect(g.id)}});while(ce.has(t.kinds[t.i]));return c};for(t.expect(g.keyword);!h(-1);){let c=t.kinds[t.i];if(c===g.accDescr)s.accDescr=t.take();else if(c===g.accTitle)s.accTitle=t.take();else if(c===g.title)s.title=t.take();else if(c===g.entity)t.i++,s.modelEntities.push({$type:"EmModelEntity",name:m()});else if(Me.has(c)||nt.has(c)){let p={$type:Me.has(c)?"EmTimeFrame":"EmResetFrame",name:"",modelEntityType:"",entityIdentifier:"",sourceFrames:[],$offset:t.tokens.starts[t.i]};for(t.i++,p.name=t.expect(g.frameId),p.modelEntityType=$(ce,"an entity type"),p.entityIdentifier=m();t.accept(g.arrow);)p.sourceFrames.push({$refText:t.expect(g.frameId)});if(t.accept(g.open)&&(p.dataReference={$refText:t.expect(g.id)},t.expect(g.close)),h(g.tick)||h(g.inline)){let E=x();E!==void 0&&(p.dataType=E),p.dataInlineValue=t.expect(g.inline)}s.frames.push(p)}else if(c===g.data){t.i++;let p={$type:"EmDataEntity",name:t.expect(g.id),dataBlockValue:""},E=x();E!==void 0&&(p.dataType=E),p.dataBlockValue=t.expect(g.block),s.dataEntities.push(p)}else if(c===g.note){t.i++;let p={$type:"EmNoteEntity",sourceFrame:{$refText:t.expect(g.frameId)},dataBlockValue:""},E=x();E!==void 0&&(p.dataType=E),p.dataBlockValue=t.expect(g.block),s.noteEntities.push(p)}else if(c===g.gwt){t.i++;let p={$type:"EmGwt",sourceFrame:{$refText:t.expect(g.frameId)},givenStatements:[],whenStatements:[],thenStatements:[]};t.expect(g.given),p.givenStatements=C(),t.accept(g.when)&&(p.whenStatements=C()),t.expect(g.then),p.thenStatements=C(),s.gwtEntities.push(p)}else t.fail("a frame, an entity, a data block, a note, or a specification")}return s}var ze=new Map([["command",0],["event",1],["readmodel",2],["processor",6]]),D=12,V=10,ot=96,_e=16,st=80,re=12,Ee=8,ht=48,Te=80,Ae=8;function ge(a,t){let s=[];for(let h of Ce(a).split(`
|
|
5
|
+
`)){if(h.length<=t){s.push(h);continue}for(let $=0;$<h.length;$+=t)s.push(h.slice($,$+t))}return s}function he(a,t,s,h,$){let m="";for(let x=0;x<a.length;x++)a[x]!==""&&(m+=`<tspan x="${o(t)}" y="${o(s+x*h)}">${Ie(a[x])}</tspan>`);return m===""?"":`<text${$} xml:space="preserve">${m}</text>`}function mt(a,t,s){return Ve(s,h=>dt(a,t,s,h))}function dt(a,t,s,h){if(h)return ct(a,s);let $=s.fontSize??16,m=Math.round($*.875),x=Math.round($*.8125),C=Math.round($*.75),c=Math.round(C*1.4),p=Math.round(x*1.5),E=s.measurer??De(s.fontFamily,s.fontFamilyMono),l=s.padding??8,v=(e,i,n)=>{let u=0;for(let I of e)u=Math.max(u,E.width(I,i,n));return u},M=new Map,A=0;for(let e of a.lanes){let i=U(e.label,!1,E,x,4e3,1);A=Math.max(A,i.width),M.set(e,{lane:e,label:i,right:-1/0,y:0,h:0})}A+=2*re;let z=[],F=new Map,y;for(let e of a.boxes){let i=M.get(e.lane),n=U(e.name,!1,E,m,4e3,1),u=e.data?ge(e.data,ht):[],I=Math.max(ot,Math.max(n.width,v(u,C,4))+2*D),L=2*V+n.height+(u.length>0?6+u.length*c:0),j=0;if(y){let K=y.x+Math.max(y.w/2,y.w-st);j=y.box.lane===e.lane?i.right+_e:Math.max(K,i.right+_e)}let N={box:e,name:n,data:u,x:j,y:0,w:I,h:L};i.right=j+I,i.h=Math.max(i.h,L),z.push(N),F.set(e,N),y=N}let T=0;for(let e of z)T=Math.max(T,e.x+e.w);let S=A+T+re,R=U(a.title,!1,E,$,4e3,1),ne=R.height>0?R.height+12:0,O=l,J=l+ne,W=J,ee="";for(let e of M.values())e.y=W,e.h+=2*re,ee+=`<g class="pele-cluster pele-em-lane" data-id="${B(e.lane.label)}"><rect x="${o(O)}" y="${o(W)}" width="${o(S)}" height="${o(e.h)}" rx="${ie}" fill="var(--_s)"/>`+q(e.label,O+re+e.label.width/2,W+e.h/2,` class="pele-cluster-label" font-size="${x}" font-weight="var(--_hw)" fill="var(--_m)"`)+"</g>",W+=e.h+Ee;let X=M.size>0?W-Ee:J,P="";for(let e of z){let i=M.get(e.box.lane);e.x+=O+A,e.y=i.y+(i.h-e.h)/2;let n=ze.get(e.box.kind),u=`x="${o(e.x)}" y="${o(e.y)}" width="${o(e.w)}" height="${o(e.h)}" rx="${ie}"`,I=n===void 0?`<rect ${u} fill="var(--_bg)" stroke="var(--_b)"/>`:`<rect ${u} fill="var(--_bg)"/><rect ${u} fill="${se(n)}" fill-opacity="0.22" stroke="${se(n)}"/>`,L=e.y+V+e.name.height/2,j=q(e.name,e.x+e.w/2,L,` class="pele-label" font-size="${m}" font-weight="var(--_hw)"`)+he(e.data,e.x+D,e.y+V+e.name.height+6+c/2+C*.35,c,` class="pele-em-data" font-family="${Se}" font-size="${C}"`);P+=`<g class="pele-node pele-em-${e.box.kind}${e.box.reset?" pele-em-reset":""}" data-id="${B(e.box.id)}">${I}${j}</g>`}let te="",le=$e("arrow_point");for(let e of a.relations){let i=F.get(e.source),n=F.get(e.target);if(!i||!n||i===n)continue;let u,I;if(i.box.lane===n.box.lane){let L=n.x>=i.x,j=L?i.x+i.w:i.x,N=L?n.x:n.x+n.w,K=i.y+i.h/2,Y=n.y+n.h/2,Z=N>=j?1:-1;u=`M${o(j)},${o(K)}L${o(N-Z*le)},${o(Y)}`,I=oe("arrow_point",N,Y,Z,0,"var(--_l)")}else{let L=n.y>i.y,j=Math.max(i.x,n.x),N=Math.min(i.x+i.w,n.x+n.w),K=Fe=>Math.min(24,Fe/4),Y=N-j>=16?(j+N)/2:n.x>i.x?i.x+i.w-K(i.w):i.x+K(i.w),Z=N-j>=16?Y:n.x>i.x?n.x+K(n.w):n.x+n.w-K(n.w),de=L?i.y+i.h:i.y,ue=L?n.y:n.y+n.h,ye=L?1:-1,fe=ue-ye*le,ve=(de+fe)/2;u=Y===Z?`M${o(Y)},${o(de)}V${o(fe)}`:`M${o(Y)},${o(de)}C${o(Y)},${o(ve)} ${o(Z)},${o(ve)} ${o(Z)},${o(fe)}`,I=oe("arrow_point",Z,ue,0,ye,"var(--_l)")}te+=`<g class="pele-edge" data-id="${B(e.source.id)}-${B(e.target.id)}"><path d="${u}" fill="none" stroke="var(--_l)"/>${I}</g>`}let r=new Map;for(let e of a.boxes)r.set(e.id,e.name);let d="",f=0,w=(e,i,n,u)=>{let I=U(`${i} · ${n}${r.has(n)?" "+r.get(n):""}`,!1,E,x,4e3,1),L=Math.max(I.width,v(u,x,0))+2*D,j=2*V+I.height+u.length*p,N=X+(d===""&&M.size===0?0:Ae);d+=`<g class="pele-em-${e}" data-id="${B(n)}"><rect x="${o(O)}" y="${o(N)}" width="${o(L)}" height="${o(j)}" rx="${ie}" fill="var(--_bg)" stroke="var(--_b)"/>`+q(I,O+D+I.width/2,N+V+I.height/2,` font-size="${x}" font-weight="var(--_hw)"`)+he(u,O+D,N+V+I.height+p/2+x*.35,p,` font-size="${x}"`)+"</g>",X=N+j,f=Math.max(f,L)};for(let e of a.notes)w("note","Note",e.frame,ge(e.text,Te));for(let e of a.specifications){let i=[`Given ${e.given.join(", ")}`];e.when.length>0&&i.push(`When ${e.when.join(", ")}`),i.push(`Then ${e.then.join(", ")}`),w("specification","Given / When / Then",e.frame,i.flatMap(n=>ge(n,Te)))}let _=Math.max(M.size>0?S:0,f,R.width),b=Math.ceil(_+2*l),H=Math.ceil(X+l),G=q(R,b/2,l+R.height/2,' class="pele-title" font-weight="var(--_tw)"')+ee+te+P+d;return{svg:ke("eventmodeling",b,H,$,s,a,G),width:b,height:H,links:[]}}var be=8,ft=120,pt=20;function ct(a,t){let s=t.fontSize??16,h=Math.round(s*.875),$=Math.round(s*.75),m=t.padding??8,x=t.measurer??De(t.fontFamily,t.fontFamilyMono),C=Math.max(160,(t.maxWidth??320)-2*m),c=new Map(a.boxes.map((r,d)=>[r,d])),p=new Map,E=new Set;for(let r of a.relations){let d=c.get(r.source),f=c.get(r.target);if(d===void 0||f===void 0||d===f)continue;if(Math.abs(d-f)<2){E.add(a.boxes[Math.max(d,f)]);continue}let w=p.get(r.target);w?(w[0]=Math.min(w[0],d),w[1]=Math.max(w[1],d)):p.set(r.target,[Math.min(d,f),Math.max(d,f)])}let l=new Map,v=[];for(let[r,[d,f]]of[...p].sort((w,_)=>w[1][0]-_[1][0])){let w=v.findIndex(_=>_<d);w<0&&(w=v.length),v[w]=f,l.set(r,w)}let M=24+be*Math.max(0,v.length-1),A=Math.max(ft,C-M),z=A-2*D,F=U(a.title,!1,x,s,C,1),y=m+(F.height?F.height+12:0),T=m+F.height,S=Math.max(F.width,A+M),R="",ne="",O="",J=new Map,W=(r,d,f=0)=>He(Ce(r),x,d,z,f);a.boxes.forEach((r,d)=>{let f=E.has(r)?z-pt:z,w=Ne(U(r.lane.label,!1,x,h,f,1),x,f),_=U(r.name,!1,x,h,z-36,1),b=r.data?W(r.data,$,4):void 0,H=Math.max(A,w.width+2*D,_.width+2*D+36,((b==null?void 0:b.width)??0)+2*D),G=w.height+12,e=2*V+_.height+(b?b.height+6:0),i=ze.get(r.kind),n=y+G,u=`x="${o(m)}" y="${o(n)}" width="${o(H)}" height="${o(e)}" rx="${ie}"`;R+=`<g class="pele-cluster pele-em-lane" data-id="${B(r.lane.label)}">`+je(w,m+D,y,` class="pele-cluster-label" font-size="${h}" font-weight="var(--_hw)" fill="var(--_m)"`)+`<g class="pele-node pele-em-${r.kind}${r.reset?" pele-em-reset":""}" data-id="${B(r.id)}"><rect ${u} fill="var(--_bg)" stroke="var(--_b)"/>`+(i===void 0?"":`<rect ${u} fill="${se(i)}" fill-opacity="0.22" stroke="${se(i)}"/>`)+q(_,m+D+_.width/2,n+V+_.height/2,` class="pele-label" font-size="${h}" font-weight="var(--_hw)"`)+`<text class="pele-em-frame" x="${o(m+H-D)}" y="${o(n+V+h)}" text-anchor="end" font-size="${$}" fill="var(--_m)">${Ie(r.id)}</text>`+(b?he(b.lines.map(I=>I.map(L=>L.text).join("")),m+D,n+V+_.height+6+b.lineHeight/2+$*.35,b.lineHeight,` class="pele-em-data" font-family="${Se}" font-size="${$}"`):"")+"</g></g>",J.set(r,{y:n,h:e,w:H,index:d,lane:w.width}),S=Math.max(S,H+M),T=n+e,y=T+28});for(let r of a.relations){let d=J.get(r.source),f=J.get(r.target);if(!d||!f||d===f)continue;let w=f.y>d.y,_=w?1:-1,b=w?d.y+d.h:d.y,H=w?f.y:f.y+f.h,G,e;if(Math.abs(d.index-f.index)===1){let i=m+Math.max(Math.min(d.w,f.w)/2,D+(w?f:d).lane+16);G=`M${o(i)},${o(b)}V${o(H-_*$e("arrow_point"))}`,e=oe("arrow_point",i,H,0,_,"var(--_l)")}else{let i=m+S-M+12+be*(l.get(r.target)??0),n=d.y+d.h/2-5,u=f.y+f.h/2+5;G=`M${o(m+d.w)},${o(n)}H${o(i)}V${o(u)}H${o(m+f.w+$e("arrow_point"))}`,e=oe("arrow_point",m+f.w,u,-1,0,"var(--_l)")}ne+=`<g class="pele-edge" data-id="${B(r.source.id)}-${B(r.target.id)}"><path d="${G}" fill="none" stroke="var(--_l)"/>${e}</g>`}let ee=new Map(a.boxes.map(r=>[r.id,r.name])),X=(r,d,f,w)=>{let _=U(`${d} · ${f}${ee.has(f)?" "+ee.get(f):""}`,!1,x,h,z,1),b=W(w,h),H=Math.max(A,_.width+2*D,b.width+2*D),G=2*V+_.height+b.height;O+=`<g class="pele-em-${r}" data-id="${B(f)}"><rect x="${o(m)}" y="${o(y)}" width="${o(H)}" height="${o(G)}" rx="${ie}" fill="var(--_bg)" stroke="var(--_b)"/>`+q(_,m+D+_.width/2,y+V+_.height/2,` font-size="${h}" font-weight="var(--_hw)"`)+he(b.lines.map(e=>e.map(i=>i.text).join("")),m+D,y+V+_.height+b.lineHeight/2+h*.35,b.lineHeight,` font-size="${h}"`)+"</g>",T=y+G,y=T+Ae,S=Math.max(S,H)};for(let r of a.notes)X("note","Note",r.frame,r.text);for(let r of a.specifications){let d=[`Given ${r.given.join(", ")}`];r.when.length&&d.push(`When ${r.when.join(", ")}`),d.push(`Then ${r.then.join(", ")}`),X("specification","Given / When / Then",r.frame,d.join(`
|
|
6
|
+
`))}let P=Math.ceil(S+2*m),te=Math.ceil(T+m),le=q(F,P/2,m+F.height/2,' class="pele-title" font-weight="var(--_tw)"')+ne+R+O;return{svg:ke("eventmodeling",P,te,s,t,a,le),width:P,height:te,links:[]}}var _t={type:"eventmodeling",keepComments:!0,parse:(a,t,s)=>at(rt(a),s),render:mt};export{_t as eventmodeling};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=[["rect","proc","process","rectangle","squareRect"],["rounded","event","roundedRect"],["stadium","terminal","pill"],["fr-rect","subprocess","subproc","framed-rectangle","subroutine"],["cyl","db","database","cylinder"],["datastore","data-store"],["folder","directory"],["bucket"],["console"],["browser"],["person"],["circle","circ"],["bang"],["cloud"],["diam","decision","diamond","question"],["hex","hexagon","prepare"],["lean-r","lean-right","in-out","lean_right"],["lean-l","lean-left","out-in","lean_left"],["trap-b","priority","trapezoid-bottom","trapezoid"],["trap-t","manual","trapezoid-top","inv-trapezoid","inv_trapezoid"],["dbl-circ","double-circle","doublecircle"],["text"],["notch-rect","card","notched-rectangle"],["lin-rect","lined-rectangle","lined-process","lin-proc","shaded-process"],["sm-circ","start","small-circle","stateStart"],["fr-circ","stop","framed-circle","stateEnd"],["fork","join","forkJoin"],["hourglass","collate"],["brace","comment","brace-l"],["brace-r"],["braces"],["bolt","com-link","lightning-bolt"],["doc","document"],["delay","half-rounded-rectangle"],["h-cyl","das","horizontal-cylinder"],["lin-cyl","disk","lined-cylinder"],["curv-trap","curved-trapezoid","display"],["div-rect","div-proc","divided-rectangle","divided-process"],["tri","extract","triangle"],["win-pane","internal-storage","window-pane"],["f-circ","junction","filled-circle"],["notch-pent","loop-limit","notched-pentagon"],["flip-tri","manual-file","flipped-triangle"],["sl-rect","manual-input","sloped-rectangle"],["docs","documents","st-doc","stacked-document"],["st-rect","procs","processes","stacked-rectangle"],["bow-rect","stored-data","bow-tie-rectangle"],["cross-circ","summary","crossed-circle"],["tag-doc","tagged-document"],["tag-rect","tagged-rectangle","tag-proc","tagged-process"],["flag","paper-tape"],["odd","rect_left_inv_arrow"],["lin-doc","lined-document"]],o=["state","choice","note","composite","rectWithTitle","labelRect","block_arrow","collapsedGroup","iconSquare","iconCircle","icon","iconRounded","imageSquare","anchor","kanbanItem","mindmapCircle","defaultMindmapNode","classBox","erBox","requirementBox","usecaseActor","usecaseActorHollow","usecaseActorAwesome","usecaseActorIcon","usecaseBusiness","usecaseEllipse","usecaseJsonTable"],a=new Map([["square","rect"],["round","rounded"],["ellipse","ellipse"],["hexagon","hex"],["diamond","diam"]]),r=new Map;for(let e of c)for(let t of e)r.set(t,e[0]);for(let e of o)r.set(e,e);function n(e){return r.has(e)}function i(e){return e===void 0?"rect":a.get(e)??r.get(e)??"rect"}export{n as a,i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function f(n){let e=0;for(let l=n.indexOf("~");l!==-1;l=n.indexOf("~",l+1))e++;return e}function r(n){let e=f(n);if(e<=1)return n;let l=e%2!==0&&n.startsWith("~"),t=n.split(""),i=[];for(let o=l?1:0;o<t.length;o++)t[o]==="~"&&i.push(o);for(let o=0,u=i.length-1;o<u;o++,u--)t[i[o]]="<",t[i[u]]=">";return t.join("")}function s(n){if(!n.includes("~"))return n;let e=n.split(/(,)/),l=[];for(let t=0;t<e.length;t++){let i=e[t];i===","&&t>0&&t+1<e.length&&f(e[t-1])===1&&f(e[t+1])===1&&(i=e[t-1]+","+e[t+1],t++,l.pop()),l.push(r(i))}return l.join("")}export{s as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{s as J}from"./5THPTBWS-D57irc_4.js";import{l as le,h as ie}from"./DKTLEL5E-B7ILCVTH.js";import{x as ne,D as re,M as oe,$ as se,v as ce,U as pe,z as de,Y as he}from"./VMV7XPHP-6QkisQwm.js";import{_ as fe,g as me,m as ue,y as $e,a as ve,x as $,b as C,h as Q,f as xe,$ as ge}from"./RZSVICHU-BiwjruZZ.js";import{H as ye,$ as Me}from"./lazy-CKqR1774.js";import"./index-392ivruk.js";function we(l){let t=[],a=[];for(let n of l){let i=n.type==="Leaf",e={name:n.name,children:i?void 0:[]};for(e.classSelector=n.classSelector,n.cssCompiledStyles&&(e.cssCompiledStyles=n.cssCompiledStyles),i&&n.value!==void 0&&(e.value=n.value);a.length>0&&a[a.length-1].level>=n.level;)a.pop();a.length===0?t.push(e):a[a.length-1].node.children.push(e),i||a.push({node:e,level:n.level})}return t}function Se(l,t){let a=new Map;for(let i of l.TreemapRows){if(i.$type!=="ClassDefStatement")continue;let e=a.get(i.className);e||a.set(i.className,e=[]);let o=(i.styleText??"").replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",");for(let f of o.split(";"))e.push(f)}let n=[];for(let i of l.TreemapRows){if(i.$type!=="TreemapRow")continue;let e=i.item,o=e.classSelector?a.get(e.classSelector):void 0;n.push({level:i.indent??0,name:e.name,type:e.$type,value:e.$type==="Leaf"?e.value:void 0,classSelector:e.classSelector,cssCompiledStyles:o&&o.length>0?o:void 0})}return{type:"treemap",title:l.title||t,accTitle:l.accTitle?l.accTitle.replace(/^\s+/g,""):void 0,accDescr:l.accDescr?l.accDescr.replace(/\n\s+/g,`
|
|
2
|
+
`):void 0,roots:we(n),classes:a}}var X=[oe,se,ce,{name:"TREEMAP_KEYWORD",pattern:/treemap-beta|treemap/y},{name:"CLASS_DEF",pattern:/classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/y},{name:"STYLE_SEPARATOR",pattern:/:::/y},{name:"SEPARATOR",pattern:/:/y},{name:"COMMA",pattern:/,/y},{name:"INDENTATION",pattern:/[ \t]{1,}/y},{name:"WS",pattern:/[ \t]+/y,hidden:!0},{name:"ML_COMMENT",pattern:/\%\%[^\n]*/y,hidden:!0},{name:"NL",pattern:/\r?\n/y,hidden:!0},{name:"ID2",pattern:/[a-zA-Z_][a-zA-Z0-9_]*/y},{name:"NUMBER2",pattern:/[0-9_\.\,]+/y},{name:"STRING2",pattern:/"[^"]*"|'[^']*'/y}],Te=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/;function ze(l){let t=new ne(re(l,X,"treemap"),X,"treemap"),a=t.kinds,n={$type:"Treemap",TreemapRows:[]},i=()=>t.accept(5)?t.expect(12):void 0;for(t.expect(3);t.kind!==-1;){let e=t.kind;if(e===0){n.accDescr=pe(t.take());continue}if(e===1){n.accTitle=de(t.take());continue}if(e===2){n.title=he(t.take());continue}e!==8&&e!==14&&e!==4&&t.fail("a node, a class definition, or a title");let o=e===8?t.take().length:void 0;if(t.kind===4){let c=Te.exec(t.take()),g={$type:"ClassDefStatement",className:c[1]};c[2]&&(g.styleText=c[2]),o!==void 0&&(g.indent=o),n.TreemapRows.push(g);continue}let f=t.expect(14).slice(1,-1),r=a[t.i]===8?t.i+1:t.i,h;a[r]===6||a[r]===7?(t.i=r+1,t.accept(8),h={$type:"Leaf",name:f,value:parseFloat(t.expect(13).replace(/,/g,""))}):h={$type:"Section",name:f};let p=i();p!==void 0&&(h.classSelector=p);let s={$type:"TreemapRow",item:h};o!==void 0&&(s.indent=o),n.TreemapRows.push(s)}return n}var ee=/^(?:.?[<>=^])?([-+( ])?(\$)?0?\d*(,)?(?:\.(\d+))?(~)?([a-zA-Z%])?$/;function te(l){let t="";for(let a=l.length;a>0;a-=3)t=l.slice(Math.max(0,a-3),a)+(t?","+t:"");return t}function _e(l){let t=ee.exec(l==="$0,0"?"$,":l)??ee.exec(","),a=t[1]==="+",n=t[3]!==void 0,i=t[4]===void 0?void 0:Math.min(Number(t[4]),20),e=t[6]??"";return o=>{let f=Math.abs(o),r,h="";if(e==="f"?r=f.toFixed(i??6):e==="%"?(r=(f*100).toFixed(i??6),h="%"):e==="d"?r=Math.round(f).toFixed(0):e==="e"?r=f.toExponential(i??6):r=String(Number(f.toPrecision(Math.max(1,i??12)))),t[5]&&r.includes(".")&&!r.includes("e")&&(r=r.replace(/\.?0+$/,"")),n&&!r.includes("e")){let p=r.indexOf(".");r=p===-1?te(r):te(r.slice(0,p))+r.slice(p)}return(o<0?"-":a?"+":"")+(t[2]??"")+r+h}}function ae(l,t,a){let n=l.children===void 0&&Number.isFinite(l.value)&&l.value>0?l.value:0;return{node:l,parent:t,series:a,value:n,children:[],x:0,y:0,w:0,h:0}}function Re(l,t,a,n,i,e,o){let f=t,r=0;for(;r<l.length;){let h=i*e/f,p=Math.min(i,e),s=l[r].value*h,c=s,g=Math.max(p*p*c/(s*s),s*s/(p*p*c)),v=r+1;for(;v<l.length;){let x=l[v].value*h,d=s+x,M=Math.max(p*p*c/(d*d),d*d/(p*p*x));if(M>g)break;g=M,s=d,v++}let m=s/p,y=0;for(let x=r;x<v;x++){let d=l[x],M=x===v-1?p-y:d.value*h/m,R=i>=e?a:a+y,A=i>=e?n+y:n,b=Math.round(R+o/2),E=Math.round(A+o/2);d.x=b,d.y=E,d.w=Math.round(R+(i>=e?m:M)-o/2)-b,d.h=Math.round(A+(i>=e?M:m)-o/2)-E,y+=M,f-=d.value}i>=e?(a+=m,i-=m):(n+=m,e-=m),r=v}}function Ae(l,t,a,n){let i=l.map((s,c)=>ae(s,void 0,c)),e=i.slice();for(let s=0;s<e.length;s++){let c=e[s];for(let g of c.node.children??[]){let v=ae(g,c,c.series);c.children.push(v),e.push(v)}}for(let s=e.length-1;s>=0;s--){let c=e[s];c.parent&&(c.parent.value+=c.value)}let{gap:o,header:f,side:r}=n,h=[],p=(s,c,g,v,m)=>{if(v<=0||m<=0)return;let y=s.filter(d=>d.value>0).sort((d,M)=>M.value-d.value),x=0;for(let d of y)x+=d.value;if(!(y.length===0||!Number.isFinite(x))){Re(y,x,c-o/2,g-o/2,v+o,m+o,o);for(let d of y)d.w>0&&d.h>0&&h.push(d)}};p(i,0,0,t,a);for(let s=0;s<h.length;s++){let c=h[s];c.children.length>0&&p(c.children,c.x+r,c.y+f,c.w-2*r,c.h-f-r)}return h}var B=28,I=6,P=1.25;function Z(l,t,a,n,i){var o;let e=(o=l.treemap)==null?void 0:o[t];return typeof e=="number"&&e>=n?Math.min(e,i):a}function De(l,t,a){let n=a.fontSize??16,i=Math.round(n*.875),e=Math.round(n*.75),o=Math.round(n*.5625),f=a.measurer??ye(a.fontFamily),r=t.treemap??{},h=a.padding??Z(t,"diagramPadding",8,0,2e3),p=Math.round(le(a,Z(t,"nodeWidth",64,1,400)*10,200,2*h)),s=Math.round(Z(t,"nodeHeight",40,1,400)*10),c=r.showValues!==!1,g=_e(typeof r.valueFormat=="string"?r.valueFormat:","),v=Ae(l.roots,p,s,{gap:Z(t,"padding",4,0,200),header:B,side:I}),m=fe(l.title,!1,f,n,ie(a),1),y=m.height>0?m.height+8:0,x=h+Math.max(0,(m.width-p)/2),d=h+y,M="",R="";for(let u of v){let D=u.node,T=me(D.cssCompiledStyles??[]),G=ue(u.series),F=x+u.x,H=d+u.y,U=Me(D.name).trim(),N=c?g(u.value):"",W=`data-id="${$e(D.name)}">`,K=`<rect x="${$(F)}" y="${$(H)}" width="${$(u.w)}" height="${$(u.h)}" rx="${ve}" fill="${G}"`;if(D.children!==void 0){let z="";if(u.h>=B){let S=u.w-2*I-4,_=N?f.width(N,e,0):0,L=_>0&&S-_-12>=3*i,O=J(U,L?S-_-12:S,i,i,f,1),q=H+B/2+1;O&&(z+=`<text x="${$(F+I+2)}" y="${$(q+i*.35)}" font-weight="var(--_hw)"${T.text}>${C(O.text)}</text>`),L&&(z+=`<text class="pele-value" x="${$(F+u.w-I-2)}" y="${$(q+e*.35)}" font-size="${e}" text-anchor="end" fill="var(--_m)"${T.text}>${C(N)}</text>`)}let k=/[";]fill:/.test(T.shape)?"":' fill-opacity="0.12"';M+=`<g class="pele-node pele-section${Q(D.classSelector??"")}" ${W}${K}${k} stroke="${G}"${T.shape}/>${z}</g>`;continue}let Y="",V=u.w-8,j=Math.min(n,Math.floor((u.h-4)/P)),w=j>=o?J(U,V,j,o,f):void 0;if(w){let z=$(F+u.w/2),k=H+u.h/2,S=Math.max(o,Math.round(w.size*.8)),_=(w.size+S)*P;if(N&&_<=u.h-4&&f.width(N,S,0)<=V){let L=k-_/2+w.size*P/2,O=k+_/2-S*P/2;Y=`<text x="${z}" y="${$(L+w.size*.35)}" font-size="${$(w.size)}"${T.text}>${C(w.text)}</text><text class="pele-value" x="${z}" y="${$(O+S*.35)}" font-size="${$(S)}"${T.text}>${C(N)}</text>`}else Y=`<text x="${z}" y="${$(k+w.size*.35)}" font-size="${$(w.size)}"${T.text}>${C(w.text)}</text>`}R+=`<g class="pele-node pele-leaf${Q(D.classSelector??"")}" ${W}${K}${T.shape}/>${Y}</g>`}let A=Math.ceil(Math.max(p,m.width)+2*h),b=Math.ceil(s+y+2*h),E=xe(m,A/2,h+m.height/2,' class="pele-title" font-weight="var(--_tw)"')+(M?`<g class="pele-sections" font-size="${i}">${M}</g>`:"")+(R?`<g class="pele-leaves" text-anchor="middle" fill="var(--_bg)">${R}</g>`:"");return{svg:ge("treemap",A,b,n,a,l,E),width:A,height:b,links:[]}}var Le={type:"treemap",parse:(l,t,a)=>Se(ze(l),a),render:De};export{Le as treemap};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as xe,y as we}from"./NV4XNBIS-nS8wAx3h.js";import{g as Ae,E as ve,o as Ie,s as $e}from"./HWDLEDTA-C_JcdBMO.js";import{f as Fe,x as ot}from"./RZSVICHU-BiwjruZZ.js";import"./FTXIJQGB-nrHdCfp7.js";import"./lazy-CKqR1774.js";import"./index-392ivruk.js";import"./7WLXJQOR-CHhKreq0.js";import"./ELSXBIJH-DG0MW5dC.js";import"./FKCDD66M-BPFkyrwI.js";import"./JZWSX6AR-OwVPptYv.js";import"./URA2L2QI-B8pYKxOk.js";import"./DKTLEL5E-B7ILCVTH.js";var ke=34,Te=24,We=8,He=2e4,oe=1e4,Qt=2e6,he=4,Ge=3,fe=8,jt=20,ie=20,pe=14,_e=3;function Se(n,y,A,Y,N=Te){let G=n.length;if(G===0)return{width:0,height:0};let k=A==="LR"||A==="RL",mt=A==="BT"||A==="RL",X=[];for(let p=G-1;p>=0;p--)n[p].parent<0&&n[p].isGroup&&X.push(p);let C=Math.max(1,X.length),lt=new Int32Array(G).fill(-1);X.forEach((p,T)=>lt[p]=T);let vt=new Uint8Array(G);for(let p=0;p<G;p++)n[p].parent>=0&&(vt[n[p].parent]=1);let dt=new Float64Array(C).fill(N),Ft=N,me=p=>{let T=p,c=N;for(let j=0;n[T].parent>=0&&j<oe;j++)T=n[T].parent,lt[T]<0&&(c+=Math.max(n[T].padX,n[T].padTop,n[T].padBottom));let _=Math.max(0,lt[T]);return c>dt[_]&&(dt[_]=c),c>Ft&&(Ft=c),_},kt=new Int32Array(G).fill(-1),O=[];for(let p=0;p<G;p++)lt[p]>=0||(!n[p].isGroup||!vt[p])&&(kt[p]=O.length,O.push(p));let de=p=>k?p.w:p.h,be=p=>k?p.h:p.w,bt=O.map(p=>Ae(be(n[p]),de(n[p]))),rt=[],St=[],Mt=1;{let p=new Set;for(let T=0;T<y.length;T++){let c=y[T],_=kt[c.src],j=kt[c.dst];if(_<0||j<0||_===j)continue;let q=Math.min(_,j)*O.length+Math.max(_,j);(c.labelW>0||p.has(q))&&(Mt=2),p.add(q),rt.push(ve(_,j,c.minlen,k?c.labelH:c.labelW,k?c.labelW:c.labelH)),St.push(T)}}Ie(bt,rt),$e(bt,rt,Mt);let Q=rt.length,Me=Int32Array.from(O,me),Ut=(p,T)=>{let c=dt.map((t,e)=>T[e]?Math.max(t,ie):t),_=new Uint8Array(C),j=0,q=new Int32Array(Q);for(let t=0;t<Q;t++)q[t]=Math.abs(bt[rt[t].head].rank-bt[rt[t].tail].rank),p[t]||(j+=q[t]-1);let qt=j>He,E=O.length+(qt?0:j),x=new Int32Array(E),v=new Int32Array(E),U=new Float64Array(E),tt=new Float64Array(E),Lt=new Uint8Array(E),B=0;for(let t=0;t<O.length;t++)x[t]=bt[t].rank,v[t]=Me[t],U[t]=bt[t].w,tt[t]=bt[t].h,x[t]>B&&(B=x[t]);let Yt=new Int32Array(Q).fill(-1),zt=new Int32Array(Q).fill(-1),V=[];{let t=O.length;for(let e=0;e<Q;e++){let l=rt[e],o=l.reversed?l.head:l.tail,s=l.reversed?l.tail:l.head;if(qt||q[e]<2||p[e]){V.push(o,s);continue}let u=x[o],i=x[s],r=-1;l.labelW>0&&(r=u+(i-u>>1),Mt===2&&(r&1)===0&&r--),Yt[e]=t;let m=o;for(let a=u+1;a<i;a++){let b=t++;x[b]=a,v[b]=v[o]+Math.round((v[s]-v[o])*(a-u)/(i-u)),Lt[b]=1,a===r&&(U[b]=l.labelW,tt[b]=l.labelH,zt[e]=b),V.push(m,b),m=b}V.push(m,s)}}let yt=new Int32Array(E+1),ct=new Int32Array(E+1);for(let t=0;t<V.length;t+=2)ct[V[t]+1]++,yt[V[t+1]+1]++;for(let t=0;t<E;t++)yt[t+1]+=yt[t],ct[t+1]+=ct[t];let Et=new Int32Array(V.length/2),Rt=new Int32Array(V.length/2);{let t=yt.slice(0,E),e=ct.slice(0,E);for(let l=0;l<V.length;l+=2)Rt[e[V[l]]++]=V[l+1],Et[t[V[l+1]]++]=V[l]}let it=[];for(let t=0;t<=B;t++)it.push([]);for(let t=0;t<E;t++)it[x[t]].push(t);let Xt=new Float64Array(E),Wt=new Float64Array(E),Pt=t=>{t.sort((e,l)=>v[e]-v[l]||Wt[e]-Wt[l]||e-l);for(let e=0;e<t.length;e++)Xt[t[e]]=e};for(let t of it){for(let e=0;e<t.length;e++)Wt[t[e]]=e;Pt(t)}for(let t=0;t<We&&B>0;t++){let e=(t&1)===0;for(let l=1;l<=B;l++){let o=it[e?l:B-l],s=e?yt:ct,u=e?Et:Rt;for(let i of o){let r=0,m=s[i+1]-s[i];for(let a=s[i];a<s[i+1];a++)r+=Xt[u[a]];Wt[i]=m>0?r/m:Xt[i]}Pt(o)}}let Ht=(t,e)=>Lt[t]||Lt[e]?Y.edgeSep:Y.nodeSep,Ct=(t,e)=>{let l=0;for(;l<t.length;){let o=l;for(;o+1<t.length&&v[t[o+1]]===v[t[l]];)o++;e(t,l,o),l=o+1}},Zt=(t,e,l)=>{let o=U[t[e]];for(let s=e;s<l;s++)o+=Ht(t[s],t[s+1])+U[t[s+1]];return o},Gt=new Float64Array(C),It=X.length>0?ke:0;for(let t=0;t<X.length;t++){let e=n[X[t]];Gt[t]=Math.max(0,e.minW-2*c[t]),e.padTop>It&&(It=e.padTop)}for(let t of it)Ct(t,(e,l,o)=>{let s=Zt(t,l,o);s>Gt[v[t[l]]]&&(Gt[v[t[l]]]=s)});let K=new Float64Array(C+1);for(let t=0;t<C;t++)K[t+1]=K[t]+Gt[t]+2*c[t];let I=new Float64Array(E),Jt=new Float64Array(E),ge=(t,e,l)=>{let o=v[t[e]],s=(K[o]+c[o]+(K[o+1]-c[o])-Zt(t,e,l))/2;for(let u=e;u<=l;u++)I[t[u]]=s+U[t[u]]/2,u<l&&(s+=U[t[u]]+Ht(t[u],t[u+1]))},ye=(t,e,l)=>{let o=v[t[e]],s=K[o]+c[o];for(let i=e;i<=l;i++){let r=t[i];I[r]=Math.max(Jt[r],s+U[r]/2),i<l&&(s=I[r]+U[r]/2+Ht(r,t[i+1]))}let u=K[o+1]-c[o];for(let i=l;i>=e;i--){let r=t[i];I[r]=Math.min(I[r],u-U[r]/2),i>e&&(u=I[r]-U[r]/2-Ht(t[i-1],r))}};for(let t of it)Ct(t,ge);for(let t=0;t<4&&B>0;t++){let e=(t&1)===0;for(let l=1;l<=B;l++){let o=it[e?l:B-l],s=e?yt:ct,u=e?Et:Rt;for(let i of o){let r=0,m=0;for(let a=s[i];a<s[i+1];a++)v[u[a]]===v[i]&&(r+=I[u[a]],m++);Jt[i]=m>0?r/m:I[i]}Ct(o,ye)}}let ht=new Float64Array(B+1),ft=new Float64Array(B+1),xt=new Float64Array(B+1).fill(Y.rankSep/Mt);if(p.some(t=>t===1)){let t=Y.rankSep/Mt;xt.fill(t/_e);for(let e=0;e<Q;e++){let l=rt[e],o=l.reversed?l.head:l.tail,s=l.reversed?l.tail:l.head;if(p[e]){if(l.labelH<=0||q[e]>Mt)continue;let i=Math.min(t,(l.labelH+2*jt-Math.min(tt[o],tt[s])/2)/q[e]);for(let r=x[o];r<x[s];r++)i>xt[r]&&(xt[r]=i);continue}let u=Yt[e];if(u<0||q[e]<=Mt*l.minlen){for(let i=x[o];i<x[s];i++)xt[i]=t;continue}for(let i=u-1;i<u+q[e]-1;i++){let r=i<u?o:i,m=i+1<u+q[e]-1?i+1:s;(v[r]!==v[m]||Math.abs(I[r]-I[m])>=.5)&&(xt[x[r]]=t)}}}let _t=It+Ft;for(let t=0;t<=B;t++){let e=0;for(let l of it[t])tt[l]>e&&(e=tt[l]);ht[t]=_t,ft[t]=_t+e,_t+=e+(t===B?0:xt[t])}let pt=_t+Ft,Bt=K[C],Dt=t=>mt?It+pt-t:t,z=(t,e)=>k?Dt(e):t,P=(t,e)=>k?t:Dt(e),Nt=k?1:0;for(let t=0;t<O.length;t++){let e=n[O[t]],l=(ht[x[t]]+ft[x[t]])/2;e.x=z(I[t],l),e.y=P(I[t],l)}for(let t=0;t<X.length;t++){let e=n[X[t]],l=(K[t]+K[t+1])/2,o=K[t+1]-K[t];e.x=k?pt/2:l,e.y=k?l:pt/2,e.w=k?pt:o,e.h=k?o:pt,e.padTop=It}let Ot=new Int32Array(G),Vt=[];for(let t=0;t<G;t++){if(!n[t].isGroup||lt[t]>=0||kt[t]>=0)continue;let e=0;for(let l=n[t].parent;l>=0&&e<oe;l=n[l].parent)e++;Ot[t]=e,Vt.push(t)}Vt.sort((t,e)=>Ot[e]-Ot[t]||t-e);let H=new Float64Array(G*4);for(let t=0;t<G;t++)H[t*4]=1/0,H[t*4+1]=1/0,H[t*4+2]=-1/0,H[t*4+3]=-1/0;let te=(t,e)=>{e.x-e.w/2<H[t*4]&&(H[t*4]=e.x-e.w/2),e.y-e.h/2<H[t*4+1]&&(H[t*4+1]=e.y-e.h/2),e.x+e.w/2>H[t*4+2]&&(H[t*4+2]=e.x+e.w/2),e.y+e.h/2>H[t*4+3]&&(H[t*4+3]=e.y+e.h/2)};for(let t of O)n[t].parent>=0&<[n[t].parent]<0&&te(n[t].parent,n[t]);for(let t of Vt){let e=n[t];if(H[t*4]===1/0)continue;let l=Math.max(H[t*4+2]-H[t*4]+2*e.padX,e.minW);e.x=(H[t*4]+H[t*4+2])/2,e.w=l,e.y=(H[t*4+1]-e.padTop+H[t*4+3]+e.padBottom)/2,e.h=H[t*4+3]-H[t*4+1]+e.padTop+e.padBottom,e.parent>=0&<[e.parent]<0&&te(e.parent,e)}for(let t of y)t.route=[];for(let t=0;t<Q;t++){let e=rt[t],l=y[St[t]],o=e.reversed?e.head:e.tail,s=e.reversed?e.tail:e.head,u=[I[o],ft[x[o]]-(ft[x[o]]-ht[x[o]]-tt[o])/2],i=Yt[t];if(i>=0)for(let a=i;a<i+q[t]-1;a++)u.push(I[a],ht[x[a]]),ft[x[a]]>ht[x[a]]&&u.push(I[a],ft[x[a]]);u.push(I[s],ht[x[s]]+(ft[x[s]]-ht[x[s]]-tt[s])/2);let r=[];for(let a=0;a<u.length;a+=2)r.push(z(u[a],u[a+1]),P(u[a],u[a+1]),Nt);if(e.reversed)for(let a=0,b=r.length-3;a<b;a+=3,b-=3)for(let g=0;g<2;g++){let M=r[a+g];r[a+g]=r[b+g],r[b+g]=M}l.route=r;let m=zt[t];if(m>=0){let a=(ht[x[m]]+ft[x[m]])/2;l.labelX=z(I[m],a),l.labelY=P(I[m],a)}else l.labelX=(r[0]+r[r.length-3])/2,l.labelY=(r[1]+r[r.length-2])/2}for(let t of y){if(t.route.length>0||t.src===t.dst)continue;let e=n[t.src],l=n[t.dst],[o,s]=se(e,l),[u,i]=se(l,e),r=Math.abs(u-o)>Math.abs(i-s)?1:0;t.route=[o,s,r,u,i,r],t.labelX=(o+u)/2,t.labelY=(s+i)/2}let ee=new Uint8Array(Q),ce=y.reduce((t,e)=>t+e.route.length/3,0),Kt=Q*(O.length+y.length+ce);if(Kt<=Qt){let t=r=>(ht[x[r]]+ft[x[r]])/2,e=y.map(r=>[k?r.labelY:r.labelX,Dt(k?r.labelX:r.labelY)]),l=(r,m,a,b,g,M,W,d)=>a>g-W/2&&r<g+W/2&&b>M-d/2&&m<M+d/2,o=(r,m,a,b,g,M,W)=>{for(let d=0;d<O.length;d++)if(d!==g&&d!==M&&l(r,m,a,b,I[d],t(d),U[d]+8,tt[d]+8))return!1;for(let d=0;d<y.length;d++){let w=y[d];if(d!==W&&w.labelW>0&&w.src!==w.dst&&l(r,m,a,b,e[d][0],e[d][1],k?w.labelH:w.labelW,k?w.labelW:w.labelH))return!1}return!0},s=(r,m,a,b,g)=>{let M=0;for(let W=0;W<y.length;W++){if(W===g)continue;let d=y[W].route;for(let w=3;w<d.length;w+=3)if(Math.max(d[w-3],d[w])>r&&Math.min(d[w-3],d[w])<a&&Math.max(d[w-2],d[w+1])>m&&Math.min(d[w-2],d[w+1])<b){M++;break}}return M},u=(r,m,a)=>{let b=0;for(let g=0;g<y.length;g++){let M=y[g].route;if(g===a||M.length===0)continue;let W=M.length-3;(Math.abs(M[0]-r)<1&&Math.abs(M[1]-m)<1||Math.abs(M[W]-r)<1&&Math.abs(M[W+1]-m)<1)&&b++}return b},i=(r,m,a,b,g)=>{let M=Math.abs(a-r)<.5,W=M?Math.min(m,b):Math.min(r,a),d=M?Math.max(m,b):Math.max(r,a),w=M?r:m;for(let et=0;et<y.length;et++){let wt=y[et];if(et===g||wt.src===y[g].src||wt.dst===y[g].dst)continue;let st=wt.route;for(let nt=3;nt<st.length;nt+=3){let $t=st[nt-3+(M?0:1)],h=st[nt+(M?0:1)];if(Math.abs($t-w)>=he||Math.abs(h-w)>=he)continue;let Z=st[nt-3+(M?1:0)],D=st[nt+(M?1:0)];if(Math.min(d,Math.max(Z,D))-Math.max(W,Math.min(Z,D))>1)return!0}}return!1};for(let r=0;r<Q;r++){let m=rt[r],a=St[r],b=y[a],g=m.tail,M=m.head;if(v[g]===v[M]||Math.abs(I[M]-I[g])<1)continue;let W=I[g],d=I[M],w=t(g),et=t(M),wt=Math.sign(d-W),st=Math.sign(et-w),nt=(h,Z)=>{for(let f=2;f<h.length;f+=2)if(!o(Math.min(h[f-2],h[f])-Z,Math.min(h[f-1],h[f+1])-Z,Math.max(h[f-2],h[f])+Z,Math.max(h[f-1],h[f+1])+Z,g,M,a)||i(z(h[f-2],h[f-1]),P(h[f-2],h[f-1]),z(h[f],h[f+1]),P(h[f],h[f+1]),a))return!1;let D=0,$=0,At=-1;if(b.labelW>0){let f=m.labelW,R=m.labelH;for(let S=2;S<h.length;S+=2){let L=(h[S-2]+h[S])/2,J=(h[S-1]+h[S+1])/2,ut=Math.abs(h[S]-h[S-2]),le=Math.abs(h[S+1]-h[S-1]),re=ut+le;if(re<=At||(ut>0?ut<f+8:le<R+8)||L-f/2<0||L+f/2>Bt||J-R/2<0||J+R/2>pt||!o(L-f/2,J-R/2,L+f/2,J+R/2,-1,-1,a))continue;let ae=z(L,J),ne=P(L,J);s(ae-b.labelW/2,ne-b.labelH/2,ae+b.labelW/2,ne+b.labelH/2,a)>0||(D=L,$=J,At=re)}if(At<0)return!1}let F=[h[0],h[1]];for(let f=2;f<h.length;f+=2){let R=h[f]-h[f-2],S=h[f+1]-h[f-1],L=Math.abs(R)+Math.abs(S),J=f>2?jt:0,ut=f+2<h.length?jt:0;L>J+ut+1&&(J&&F.push(h[f-2]+R/L*J,h[f-1]+S/L*J),ut&&F.push(h[f]-R/L*ut,h[f+1]-S/L*ut)),F.push(h[f],h[f+1])}b.route=[];for(let f=0;f<F.length;f+=2){let R=f===0?F[0]!==F[2]:F[f]!==F[f-2];b.route.push(z(F[f],F[f+1]),P(F[f],F[f+1]),R?1-Nt:Nt)}return b.labelW>0&&(b.labelX=z(D,$),b.labelY=P(D,$),e[a]=[D,$]),ee[r]=1,!0};if(nt([W+wt*U[g]/2,w,d,w,d,et-st*tt[M]/2],2)||nt([W,w+st*tt[g]/2,W,et,d-wt*U[M]/2,et],2)||Kt>Qt/fe)continue;let $t=[];for(let h of v[g]<v[M]?[v[M],v[g]]:[v[g],v[M]]){let Z=Math.max(c[h]-pe,Math.min(c[h]/2,ie-pe));for(let D of[K[h]+Z,K[h+1]-Z]){if(Math.abs(D-W)<U[g]/2+4||Math.abs(D-d)<U[M]/2+4)continue;let $=[W+Math.sign(D-W)*U[g]/2,w,D,w,D,et,d+Math.sign(D-d)*U[M]/2,et],At=(u(z($[0],$[1]),P($[0],$[1]),a)+u(z($[6],$[7]),P($[6],$[7]),a))*1e6;for(let F=2;F<$.length;F+=2){let f=z($[F-2],$[F-1]),R=P($[F-2],$[F-1]),S=z($[F],$[F+1]),L=P($[F],$[F+1]);At+=s(Math.min(f,S),Math.min(R,L),Math.max(f,S),Math.max(R,L),a)*1e6+Math.abs(S-f)+Math.abs(L-R)}$t.push({pts:$,cost:At,lane:h})}}$t.sort((h,Z)=>h.cost-Z.cost);for(let h of $t)if(nt(h.pts,1)){_[h.lane]=1;break}}}return{width:k?pt:Bt,height:k?Bt:pt,routed:ee,margins:_,work:Kt}},gt=new Uint8Array(Q),Tt=new Uint8Array(C),at=Ut(gt,Tt);for(let p=0;p<Ge&&at.work<=Qt/fe;p++){let T=p===0?at.routed:gt.map((c,_)=>c&at.routed[_]);if(T.every((c,_)=>c===gt[_])&&at.margins.every((c,_)=>c===Tt[_]))break;gt=T,Tt=at.margins,at=Ut(gt,Tt)}return gt.some((p,T)=>p&&!at.routed[T])&&(at=Ut(new Uint8Array(Q),new Uint8Array(C))),{width:at.width,height:at.height}}function se(n,y){let A=y.x-n.x,Y=y.y-n.y,N=Math.max(n.w/2,.5),G=Math.max(n.h/2,.5);if(Math.abs(A)<N&&Math.abs(Y)<G){let mt=N-Math.abs(A),X=G-Math.abs(Y);return mt<X?[n.x+(A<0?-N:N),y.y]:[y.x,n.y+(Y<0?-G:G)]}let k=Math.min(A!==0?N/Math.abs(A):1/0,Y!==0?G/Math.abs(Y):1/0);return[n.x+A*k,n.y+Y*k]}var ue="__swimlane_default__";function Ue(n){let y=!1;for(let A of n.nodes)A.isGroup?A.dir=void 0:A.parentId===void 0&&(y=!0);if(y){for(let A of n.nodes)!A.isGroup&&A.parentId===void 0&&(A.parentId=ue);n.nodes.push({id:ue,label:void 0,labelType:"text",shape:"rect",isGroup:!0,parentId:void 0,cssStyles:[],cssCompiledStyles:[],cssClasses:"",dir:void 0})}}function Le(n,y,A,Y,N,G,k){let mt=n.x-n.w/2,X=n.y-n.h/2,C=G==="LR"||G==="RL",lt=C?mt+n.padTop/2:n.x,vt=C?n.y:X+n.padTop/2,dt=Fe(y,lt,vt,` class="pele-cluster-label" fill="var(--_m)"${A.text}`,k);return`<g class="pele-cluster pele-lane${Y}" data-id="${N}"><rect x="${ot(mt)}" y="${ot(X)}" width="${ot(n.w)}" height="${ot(n.h)}" fill="none" stroke="var(--_b)"/><rect x="${ot(mt)}" y="${ot(X)}" width="${ot(C?n.padTop:n.w)}" height="${ot(C?n.h:n.padTop)}" fill="var(--_a)" stroke="var(--_b)"${A.shape}/>`+(C&&dt?`<g transform="rotate(-90 ${ot(lt)} ${ot(vt)})">${dt}</g>`:dt)+"</g>"}var Ye={type:"swimlane",prepare:Ue,layout:(n,y,A,Y,N)=>Se(n,y,A,Y,N?12:void 0),drawGroup:Le},qe={type:"swimlane",parse:xe.parse,render:(n,y,A)=>we(n,y,A,Ye)};export{qe as swimlane};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{x as O,y as Yt,f as qt}from"./RZSVICHU-BiwjruZZ.js";function xe(i,m,r=0){return{w:i,h:m,kind:r,pin:0,span:0,x:0,y:0,rank:0}}function ke(i,m,r=1,x=0,c=0){return{tail:i,head:m,minlen:r,labelW:x,labelH:c,tailDx:0,headDx:0,tailFixed:!1,headFixed:!1,reversed:!1,points:[],labelX:0,labelY:0}}var Ct=24,Rt=2e4,Nt=16,Wt=8,Jt=.125,Kt=3,Lt=18,Zt=10,Pt=14,Ot=2,Qt=28,Xt=12,te=12,ee=8,re=4,_t=.5,gt=.5,Ht=12,le=40,jt=400;function St(i){return i===1||i===2}function Bt(i,m,r,x){for(let c=m+1;c<r;c++){let $=i[c],k=x[$],R=c-1;for(;R>=m&&(x[i[R]]>k||x[i[R]]===k&&i[R]>$);)i[R+1]=i[R],R--;i[R+1]=$}}function Ee(i,m,r){let x=i.length;if(x===0)return{width:0,height:0};let c=m.length,$=1;if(c>0){let e=new Set;for(let h of m){let S=Math.min(h.tail,h.head),C=Math.max(h.tail,h.head),q=S*x+C;if(h.labelW>0||e.has(q)){$=2;break}e.add(q)}}ne(i,m),ae(i,m,$);let k=new Int32Array(c),R=0;for(let e=0;e<c;e++){let h=m[e];k[e]=Math.abs(i[h.head].rank-i[h.tail].rank),k[e]>1&&(R+=k[e]-1)}let w=new Uint8Array(c);if(R>Rt){let e=[];for(let h=0;h<c;h++)k[h]>1&&e.push(h);e.sort((h,S)=>k[S]-k[h]||h-S);for(let h of e){if(R<=Rt)break;w[h]=1,R-=k[h]-1}}let a=x+R,g=new Float64Array(a),Y=new Float64Array(a),y=new Uint8Array(a),D=new Int32Array(a),u=0;for(let e=0;e<x;e++){let h=i[e];g[e]=h.w,Y[e]=h.h,y[e]=h.kind,D[e]=h.rank,h.rank>u&&(u=h.rank)}let A=0;for(let e=0;e<c;e++)w[e]||(A+=k[e]);let _=new Int32Array(A),Z=new Int32Array(A),L=new Float64Array(A),M=new Float64Array(A),H=new Int32Array(c).fill(-1),U=new Uint8Array(u+1),E=new Int32Array(c).fill(-1),J=!1;for(let e=0;e<x;e++)i[e].span>0&&i[e].kind===0&&(J=!0);let K=J?new Uint8Array(A):void 0,V=J?new Uint8Array(A):void 0,o=new Int32Array(c).fill(-1),F=new Int32Array(c).fill(-1),l=!1;{let e=x,h=0;for(let S=0;S<c;S++){if(w[S])continue;let C=m[S],q=C.reversed?C.head:C.tail,rt=C.reversed?C.tail:C.head,ht=C.reversed?C.headDx:C.tailDx,et=C.reversed?C.tailDx:C.headDx;(ht!==0||et!==0)&&(l=!0);let st=D[q],yt=D[rt],Mt=-1;C.labelW>0&&(Mt=st+(yt-st>>1),$===2&&yt-st>=4?(Mt&1)===1&&(Mt+=C.reversed?1:-1):$===2&&(Mt&1)===0&&(Mt+=C.reversed?1:-1));let It=q;yt-st>1&&(H[S]=e),o[S]=h,K&&!(C.reversed?C.headFixed:C.tailFixed)&&(K[h]=C.reversed?2:1);for(let At=st+1;At<yt;At++){let bt=e++;D[bt]=At,At===Mt?(g[bt]=C.labelW,Y[bt]=C.labelH,y[bt]=2,E[S]=bt,U[At]|=C.reversed?2:1):y[bt]=1,_[h]=It,Z[h]=bt,L[h]=It===q?ht:0,h++,It=bt}_[h]=It,Z[h]=rt,L[h]=It===q?ht:0,M[h]=et,V&&!(C.reversed?C.tailFixed:C.headFixed)&&(V[h]=C.reversed?1:2),F[S]=h,h++}}let f=new Int32Array(a+1),T=new Int32Array(a+1);for(let e=0;e<A;e++)f[_[e]+1]++,T[Z[e]+1]++;for(let e=0;e<a;e++)f[e+1]+=f[e],T[e+1]+=T[e];let v=new Int32Array(A),N=new Int32Array(A);{let e=f.slice(0,a),h=T.slice(0,a);for(let S=0;S<A;S++)v[e[_[S]]++]=S,N[h[Z[S]]++]=S}let j=new Int32Array(u+2);for(let e=0;e<a;e++)j[D[e]+1]++;for(let e=0;e<=u;e++)j[e+1]+=j[e];let n=new Int32Array(a),W=new Int32Array(a);{let e=new Int32Array(a),h=j.slice(0,u+1);for(let q=0;q<a;q++)e[h[D[q]]++]=q;h.set(j.subarray(0,u+1));let S=new Uint8Array(a),C=[];for(let q=0;q<a;q++)if(!S[e[q]])for(C.push(e[q]);C.length>0;){let rt=C.pop();if(!S[rt]){S[rt]=1,n[h[D[rt]]++]=rt;for(let ht=f[rt+1]-1;ht>=f[rt];ht--){let et=Z[v[ht]];S[et]||C.push(et)}}}}let I=!1;for(let e=0;e<x;e++)i[e].pin!==0&&(I=!0);if(I)for(let e=0;e<=u;e++){let h=Array.from(n.subarray(j[e],j[e+1])),S=new Map;h.forEach((q,rt)=>S.set(q,rt));let C=q=>q<x?i[q].pin:0;h.sort((q,rt)=>C(q)-C(rt)||S.get(q)-S.get(rt)),n.set(h,j[e])}let z=()=>{for(let e=0;e<=u;e++){let h=j[e];for(let S=h,C=j[e+1];S<C;S++)W[n[S]]=S-h}};z();let t={n:a,real:x,maxRank:u,W:g,KIND:y,RANK:D,EF:_,ET:Z,EFD:L,ETD:M,succStart:f,succE:v,predStart:T,predE:N,layerStart:j,order:n,pos:W,offsets:l};A>0&&u>0&&(de(t,i),z()),K&&V&&fe(t,i,K,V);let s=we(t,r),p=ue(t);if(K&&V){let e=oe(t,K,V);ie(t,i,s,e,r,p),se(t,i,s,K,V,e,p),he(t,s,p,r);for(let h=0;h<c;h++){if(w[h])continue;let S=m[h],C=L[o[h]],q=M[F[h]];S.tailDx=S.reversed?q:C,S.headDx=S.reversed?C:q}}let X=new Uint8Array(a);p&&!r.tracks&&ce(t,s,p,H,k,r.apart?0:r.edgeSep,X),r.tracks||ye(t,s,H,k,r.edgeSep,X);let G=new Int32Array(c+1),d=r.tracks||K&&!r.straight?{from:[],to:[],rank:[],lower:[],track:[],levels:[],wide:[]}:void 0,B=new Int32Array(u+1);if(d){for(let e=0;e<c;e++){if(G[e]=d.from.length,w[e])continue;let h=H[e],S=!1;for(let rt=h,ht=h<0?h:h+k[e]-1;rt<ht;rt++){let et=p!==void 0&&p[D[rt]]===1;!r.tracks&&et!==(X[rt]===1)&&(S=!0)}if(S)continue;let C=s[_[o[e]]]+L[o[e]],q=D[_[o[e]]];for(let rt=h,ht=h<0?h:h+k[e]-1;rt<ht;rt++)p&&p[D[rt]]||(d.from.push(C),d.to.push(s[rt]),d.rank.push(q),d.lower.push(rt),C=s[rt],q=D[rt]);d.from.push(C),d.to.push(s[Z[F[e]]]+M[F[e]]),d.rank.push(q),d.lower.push(-1)}G[c]=d.from.length}let ft=(e,h)=>{let S=!1;for(let C=j[e];C<j[e+1];C++){let q=y[n[C]];if(q===h)S=!0;else if(q!==1)return!1}return S},lt=ft(0,3)?$:0,nt=ft(u,4)?$:0,Q=new Float64Array(u+1);for(let e=0;e<A;e++){let h=Math.abs(s[_[e]]+L[e]-s[Z[e]]-M[e]);h>Q[D[_[e]]]&&(Q[D[_[e]]]=h)}let at=new Float64Array(u+1),b=new Float64Array(u+1),P=e=>(e<lt||e>=u-nt?r.portSep:r.rankSep)/$,tt=new Float64Array(u+1);for(let e=0;e<u;e++)tt[e]=d?P(e):Math.max(P(e),Math.min(Kt*r.rankSep/$,Q[e]*Jt));let ot=new Uint8Array(u+1).fill(1);for(let e=0;e<x;e++)ot[D[e]]=0;for(let e=1;e<u;e++){if(r.tracks||!ot[e]||U[e]!==1&&U[e]!==2)continue;let h=Math.min((r.headRoom??0)/2,tt[U[e]===1?e-1:e]/2);tt[e-1]+=U[e]===1?-h:h,tt[e]+=U[e]===1?h:-h}let it=e=>y[e]===1&&ot[D[e]]&&!r.tracks?(b[D[e]]-at[D[e]])/4:0,ut=r.tracks?Lt:Qt,ct=r.tracks?Zt:Xt,dt=r.tracks?Pt:Xt,wt=new Int32Array(u+1);if(d){let e=new Float64Array(u+1);for(let S=0;S<u;S++){if(p&&p[S])continue;let C=S+1;for(e[S]=tt[S];C<u&&p&&p[C];)e[S]+=tt[C++];wt[S]=C}for(let S=0;S<d.from.length;S++)d.wide.push(Math.abs(d.from[S]-d.to[S])>Ot*e[d.rank[S]]?1:0);let h=new Float64Array(u+1);pe(d,B,!r.tracks,e,h);for(let S=0;S<u;S++)B[S]>0?tt[S]+=Math.max(0,2*ut+(B[S]-1)*ct-e[S]):h[S]>0&&(tt[S]+=Math.max(0,Math.min(Kt*r.rankSep,h[S])-e[S]))}let xt=0;for(let e=0;e<=u;e++){let h=0;for(let S=j[e];S<j[e+1];S++)Y[n[S]]>h&&(h=Y[n[S]]);at[e]=xt,b[e]=xt+h,xt+=h+tt[e]}let vt=xt,$t=(e,h=d.track[e])=>{let S=d.rank[e],C=b[S],q=at[wt[S]],rt=r.tracks?B[S]:d.levels[e],ht=rt>1?Math.min(dt,(q-C-2*ut)/(rt-1)):0;return(C+q)/2+(h-(rt-1)/2)*ht},pt=1/0,kt=-1/0;for(let e=0;e<a;e++){let h=g[e]/2;s[e]-h<pt&&(pt=s[e]-h),s[e]+h>kt&&(kt=s[e]+h)}let Et=new Uint8Array(u+1),mt=new Uint8Array(u+1);for(let e=0;e<x;e++)y[e]!==0||!K||(T[e+1]>T[e]&&(Et[D[e]]=1),f[e+1]>f[e]&&(mt[D[e]]=1));for(let e=0;e<x;e++){let h=i[e],S=h.rank;h.x=s[e]-pt,y[e]===0&&mt[S]&&!Et[S]?h.y=b[S]-h.h/2:y[e]===0&&Et[S]&&!mt[S]?h.y=at[S]+h.h/2:h.y=(at[S]+b[S])/2}for(let e=0;e<c;e++){let h=m[e],S=i[h.reversed?h.head:h.tail],C=i[h.reversed?h.tail:h.head],q=[S.x+(h.reversed?h.headDx:h.tailDx),S.y+S.h/2],rt=H[e];if(d&&G[e+1]>G[e])for(let et=G[e];et<G[e+1];et++){if(d.track[et]>=0&&(r.tracks||d.wide[et]===1)){let yt=$t(et);q.push(d.from[et]-pt,yt,d.to[et]-pt,yt)}else d.track[et]>0&&q.push(d.from[et]-pt,$t(et,d.track[et]-1));let st=d.lower[et];st<0||(q.push(s[st]-pt,at[D[st]]+it(st)),b[D[st]]>at[D[st]]&&q.push(s[st]-pt,b[D[st]]-it(st)))}else if(rt>=0)for(let et=rt,st=rt+k[e]-1;et<st;et++){if(X[et])continue;let yt=s[et]-pt,Mt=at[D[et]],It=b[D[et]];q.push(yt,Mt+it(et)),It>Mt&&q.push(yt,It-it(et))}if(q.push(C.x+(h.reversed?h.tailDx:h.headDx),C.y-C.h/2),h.reversed)for(let et=0,st=q.length-2;et<st;et+=2,st-=2){let yt=q[et],Mt=q[et+1];q[et]=q[st],q[et+1]=q[st+1],q[st]=yt,q[st+1]=Mt}h.points=q;let ht=E[e];ht>=0?(h.labelX=s[ht]-pt,h.labelY=(at[D[ht]]+b[D[ht]])/2):h.labelW>0&&(h.labelX=(q[0]+q[q.length-2])/2,h.labelY=(q[1]+q[q.length-1])/2)}return{width:kt-pt,height:vt}}function ne(i,m){let r=i.length,x=m.length,c=new Int32Array(r+1);for(let a=0;a<x;a++){let g=m[a];g.reversed=i[g.head].kind===3||i[g.tail].kind===4,g.reversed||c[g.tail+1]++}for(let a=0;a<r;a++)c[a+1]+=c[a];let $=new Int32Array(c[r]);{let a=c.slice(0,r);for(let g=0;g<x;g++)m[g].reversed||($[a[m[g].tail]++]=g)}let k=new Uint8Array(r),R=c.slice(0,r),w=[];for(let a=0;a<r;a++)if(k[a]===0)for(w.push(a),k[a]=1;w.length>0;){let g=w[w.length-1];if(R[g]<c[g+1]){let Y=m[$[R[g]++]],y=Y.head;k[y]===1?Y.reversed=!0:k[y]===0&&(k[y]=1,w.push(y))}else k[g]=2,w.pop()}}function ae(i,m,r){let x=i.length,c=m.length,$=new Int32Array(c),k=new Int32Array(c),R=new Int32Array(c),w=new Int32Array(x+1),a=new Int32Array(x+1);for(let M=0;M<c;M++){let H=m[M],U=H.reversed?H.head:H.tail,E=H.reversed?H.tail:H.head;$[M]=U,k[M]=E,R[M]=Math.max(1,H.minlen)*r,w[U+1]++,a[E+1]++}for(let M=0;M<x;M++)w[M+1]+=w[M],a[M+1]+=a[M];let g=new Int32Array(c),Y=new Int32Array(c);{let M=w.slice(0,x),H=a.slice(0,x);for(let U=0;U<c;U++)g[M[$[U]]++]=U,Y[H[k[U]]++]=U}let y=new Int32Array(x),D=new Int32Array(x);for(let M=0;M<x;M++)D[M]=a[M+1]-a[M];let u=new Int32Array(x),A=0;for(let M=0;M<x;M++)D[M]===0&&(u[A++]=M);for(let M=0;M<A;M++){let H=u[M];for(let U=w[H];U<w[H+1];U++){let E=g[U],J=k[E];y[H]+R[E]>y[J]&&(y[J]=y[H]+R[E]),--D[J]===0&&(u[A++]=J)}}for(let M=0;M<8;M++){let H=!1;for(let U=A-1;U>=0;U--){let E=u[U],J=a[E+1]-a[E],K=w[E+1]-w[E];if(J===0&&K===0)continue;let V=-1/0,o=1/0;for(let l=a[E];l<a[E+1];l++){let f=Y[l];V=Math.max(V,y[$[f]]+R[f])}for(let l=w[E];l<w[E+1];l++){let f=g[l];o=Math.min(o,y[k[f]]-R[f])}let F=y[E];K>J&&o!==1/0?F=o:J>K&&V!==-1/0&&(F=V),F!==y[E]&&(y[E]=F,H=!0)}if(!H)break}let _=1/0,Z=-1/0,L=!1;for(let M=0;M<x;M++){let H=i[M].kind;H===3&&(L=!0),!(H===3||H===4)&&(y[M]<_&&(_=y[M]),y[M]>Z&&(Z=y[M]))}_===1/0&&(_=0,Z=0);for(let M=0;M<x;M++)i[M].kind===3?y[M]=_-r:i[M].kind===4&&(y[M]=Z+r);L&&(_-=r);for(let M=0;M<x;M++)i[M].rank=y[M]-_}function Gt(i,m,r,x,c,$,k){let R=r===0?i.predStart:i.succStart,w=r===0?i.predE:i.succE,a=r===0?i.EF:i.ET,g=i.pos;$.length=0;for(let u=R[m];u<R[m+1];u++)c[w[u]]!==0&&$.push(w[u]);if($.length<2)return 0;$.sort((u,A)=>g[a[u]]-g[a[A]]||u-A);let Y=u=>{let A=0;k.length=$.length,k[0]=0;for(let _=1;_<$.length;_++){let Z=c[$[_]]===c[$[_-1]];k[_]=u(Z&&c[$[_]]===1,Z),A+=k[_]}return A},y=Y(()=>1);if(x/y<Wt&&(y=Y(u=>u?.5:1)),x/y<Wt&&(y=Y((u,A)=>A?0:1)),y===0)return 0;let D=Math.min(Nt,x/y);for(let u=1;u<$.length;u++)k[u]*=D;return y*D}function fe(i,m,r,x){let{real:c,W:$,EFD:k,ETD:R}=i,w=[],a=[];for(let g=0;g<c;g++){let Y=Math.min(m[g].span,$[g]);if(!(Y<=0||m[g].kind!==0))for(let y=0;y<2;y++){let D=Gt(i,g,y,Y,y===0?x:r,w,a);if(D===0)continue;let u=y===0?R:k,A=-D/2;for(let _=0;_<w.length;_++)A+=a[_],u[w[_]]=A}}}function Ut(i,m,r,x){if(!m)return r;let{KIND:c,RANK:$,EF:k,ET:R,succStart:w,succE:a,predStart:g,predE:Y}=i;for(let y=0;y<1e5;y++){let D=x===0?k[r]:R[r];if(c[D]!==1||!m[$[D]])break;r=x===0?Y[g[D]]:a[w[D]]}return r}function oe(i,m,r){let x=[new Int32Array(i.n),new Int32Array(i.n)];for(let c=0;c<i.EF.length;c++)r[c]!==0&&x[0][i.ET[c]]++,m[c]!==0&&x[1][i.EF[c]]++;return x}function Vt(i,m){return Math.max(.25,Math.min(.5,4*Math.abs(m)/(Math.abs(i)||1)))}function ie(i,m,r,x,c,$){let k=c.edgeSep,{n:R,real:w,maxRank:a,KIND:g,RANK:Y,W:y,EF:D,ET:u,EFD:A,ETD:_,succStart:Z,succE:L,predStart:M,predE:H,layerStart:U,order:E,pos:J}=i,K=T=>g[T]===2||g[T]===1&&!($!==void 0&&$[Y[T]]===1),V=(T,v)=>{let N=v===0?D[T]:u[T];return[v===0?r[N]+A[T]:r[N]+_[T],N<w&&m[N].kind===0?x[1-v][N]:0]},o=T=>{let v=U[Y[T]],N=v+J[T],j=n=>y[n]/2+y[T]/2+(g[n]===0?c.nodeSep/2+k/2:g[n]===g[T]?k:k/2);return[N>v?r[E[N-1]]+j(E[N-1]):-1/0,N+1<U[Y[T]+1]?r[E[N+1]]-j(E[N+1]):1/0]},F=(T,v,N,j,n)=>{let W=(v[1]!==N[1]?v[1]<N[1]:Math.abs(v[0]-T)<=Math.abs(N[0]-T))?[v[0],N[0]]:[N[0],v[0]];return W.find(I=>I>=j&&I<=n)??Math.max(j,Math.min(n,W[0]))},l=new Uint8Array(R),f=[];for(let T=1;T<a;T++)for(let v=U[T];v<U[T+1];v++){if(!K(E[v])||l[E[v]])continue;let N=E[v];for(;St(g[D[H[M[N]]]]);)N=D[H[M[N]]];let j=N,n=-1/0,W=1/0;f.length=0;for(let I=N;St(g[I]);I=u[L[Z[I]]]){if(j=I,!K(I))continue;l[I]=1,f.push(I);let[z,t]=o(I);z>n&&(n=z),t<W&&(W=t)}if(n<=W){let I=F(r[f[0]],V(H[M[N]],0),V(L[Z[j]],1),n,W);for(let z of f)r[z]=I;continue}for(let I of f){let[z,t]=o(I);z>t||(r[I]=F(r[I],V(Ut(i,$,H[M[I]],0),0),V(Ut(i,$,L[Z[I]],1),1),z,t))}}}function se(i,m,r,x,c,$,k){let{real:R,W:w,EF:a,ET:g,EFD:Y,ETD:y,succStart:D,succE:u,predStart:A,predE:_,pos:Z}=i,L=[],M=[],H=[],U=[],E=[],J=(K,V,o,F,l)=>{if($[V][o]<2)return 0;K=Ut(i,k,K,V);let f=V===0?a[K]:g[K],T=V===0?r[f]+Y[K]:r[f]+y[K];if(l&&Math.abs(T-r[o])<=F/2+gt)return Math.max(-F/2,Math.min(F/2,T-r[o]));let v=T,N=0;f<R&&m[f].kind===0&&(V===0?x:c)[K]!==0&&$[1-V][f]>=2&&(N=Math.max(0,Math.min(m[f].span,w[f])),N>0&&(v=r[f]));let j=Math.max(r[o]-F/2,v-N/2),n=Math.min(r[o]+F/2,v+N/2);if(j>n+gt){let I=Math.max(0,F/2-le);return Math.max(-I,Math.min(I,T-r[o]))}let W=(r[o]*N+v*F)/(N+F);return Math.max(j,Math.min(n,W))-r[o]};for(let K=0,V=!0;V&&K<6;K++){V=!1;for(let o=0;o<R;o++){let F=Math.min(m[o].span,w[o]);if(!(F<=0||m[o].kind!==0))for(let l=0;l<2;l++){let f=l===0?c:x,T=l===0?y:Y,v=l===0?a:g,N=l===0?A:D,j=l===0?_:u;if(Gt(i,o,l,F,f,L,M),L.length===0)continue;L.length===1&&(M[0]=0),H.length=0;for(let I=N[o];I<N[o+1];I++)H.push(j[I]);H.sort((I,z)=>Z[v[I]]-Z[v[z]]||I-z);let n=0,W=-F/2;for(let I=0;I<=H.length;I++){let z=I<H.length&&f[H[I]]===0;if(I<H.length&&!z)continue;let t=0;for(let p=I-1;p>=0&&f[H[p]]!==0;p--)t++;let s=z?T[H[I]]-Nt:F/2;if(t>0){U.length=0,E.length=0;let p=0;for(let d=0;d<t;d++){d>0&&(p+=M[n+d]),U.push(J(L[n+d],l,o,F,K>0)-p),E.push(1);let B=d>0&&M[n+d]===0;for(;U.length>1&&(B||U[U.length-2]/E[E.length-2]>U[U.length-1]/E[E.length-1]);){B=!1;let ft=U.pop(),lt=E.pop();U[U.length-1]+=ft,E[E.length-1]+=lt}}let X=p,G=0;p=0;for(let d=0;d<U.length;d++){let B=s-X<W?(W+s-X)/2:Math.max(W,Math.min(s-X,U[d]/E[d]));for(let ft=0;ft<E[d];ft++,G++)G>0&&(p+=M[n+G]),Math.abs(T[L[n+G]]-B-p)>.01&&(V=!0),T[L[n+G]]=B+p}n+=t}z&&(W=T[H[I]]+Nt)}}}}}function he(i,m,r,x){let{n:c,KIND:$,RANK:k,EF:R,ET:w,EFD:a,ETD:g,layerStart:Y,order:y,pos:D}=i,u=o=>r!==void 0&&$[o]===1&&r[k[o]]===1,A=[],_=[],Z=[],L=[];for(let o=0;o<R.length;o++){if(u(R[o]))continue;let F=Ut(i,r,o,1);A.push(R[o]),_.push(w[F]),Z.push(a[o]),L.push(g[F])}let M=o=>m[_[o]]+L[o]-m[A[o]]-Z[o],H=new Int32Array(c),U=[];for(let o=0;o<c;o++)H[o]=o,U.push([o]);let E=(o,F)=>{let l=H[o],f=H[F];if(l!==f){U[l].length<U[f].length&&([l,f]=[f,l]);for(let T of U[f])H[T]=l,U[l].push(T);U[f]=[]}},J=[];for(let o=0;o<A.length;o++){let F=Math.abs(M(o));F<.01?E(A[o],_[o]):F<=Ht&&J.push(o)}if(J.length===0)return;J.sort((o,F)=>Math.abs(M(o))-Math.abs(M(F))||o-F);let K=o=>zt(i,x,o),V=(o,F)=>{for(let l of U[o]){let f=Y[k[l]],T=Y[k[l]+1],v=f+D[l];if(v>f&&H[y[v-1]]!==o&&m[l]+F-m[y[v-1]]<K(l)+K(y[v-1])-.01||v+1<T&&H[y[v+1]]!==o&&m[y[v+1]]-m[l]-F<K(l)+K(y[v+1])-.01)return!1}return!0};for(let o of J){let F=M(o);if(Math.abs(F)<.01){E(A[o],_[o]);continue}if(Math.abs(F)>Ht||H[A[o]]===H[_[o]])continue;let l=H[A[o]],f=H[_[o]],T=U[l].length<=U[f].length?l:f;for(let v of[T,T===l?f:l]){let N=v===l?F:-F;if(V(v,N)){for(let j of U[v])m[j]+=N;E(A[o],_[o]);break}}}}function ue(i){let{maxRank:m,KIND:r,layerStart:x,order:c}=i,$=new Uint8Array(m+1),k=!1;for(let R=1;R<m;R++){let w=x[R+1]>x[R];for(let a=x[R];w&&a<x[R+1];a++)r[c[a]]!==1&&(w=!1);w&&($[R]=1,k=!0)}return k?$:void 0}function pe(i,m,r,x,c){let{from:$,to:k,rank:R,track:w,levels:a,wide:g}=i,Y=$.length,y=new Map;for(let l=0;l<Y;l++){if(w.push(-1),a.push(0),Math.abs($[l]-k[l])<gt)continue;let f=y.get(R[l]);f?f.push(l):y.set(R[l],[l])}let D=new Float64Array(Y),u=new Float64Array(Y);for(let l=0;l<Y;l++)D[l]=Math.min($[l],k[l]),u[l]=Math.max($[l],k[l]);let A=(l,f)=>l>=D[f]-gt&&l<=u[f]+gt?1:0,_=(l,f)=>Math.abs($[l]-$[f])<gt||Math.abs(k[l]-k[f])<gt,Z=(l,f)=>D[l]<u[f]-gt&&D[f]<u[l]-gt,L=(l,f)=>Z(l,f)&&!_(l,f),M=(l,f)=>Z(l,f)||A(k[l],f)+A($[f],l)+A(k[f],l)+A($[l],f)>0,H=(l,f)=>A(k[l],f)+A($[f],l),U=l=>{l.sort((t,s)=>u[s]-D[s]-(u[t]-D[t])||D[t]-D[s]||t-s);let f=l.length,T=[],v=l.map((t,s)=>s),N=t=>{for(;v[t]!==t;)t=v[t]=v[v[t]];return t},j=l;if(f<=jt){let t=new Int32Array(f),s=[];for(let G=0;G<f;G++)T.push([]),s.push([]);for(let G=0;G<f;G++)for(let d=G+1;d<f;d++){let B=l[G],ft=l[d];if(!M(B,ft))continue;v[N(G)]=N(d);let lt=H(B,ft),nt=H(ft,B);if(lt===nt)continue;let Q=lt<nt?G:d,at=lt<nt?d:G;T[at].push(Q),s[Q].push(at),t[at]++}let p=new Uint8Array(f),X=[];for(let G=0;G<f;G++){let d=-1;for(let B=0;B<f&&!(!p[B]&&((d<0||t[B]<t[d])&&(d=B),t[B]===0));B++);p[d]=1,X.push(d);for(let B of s[d])t[B]--}j=X.map(G=>l[G])}let n=new Map;l.forEach((t,s)=>n.set(t,s));let W=[];for(let t of j){let s=0;for(let p of T[n.get(t)]??[])w[l[p]]>=s&&(s=w[l[p]]+1);for(;;s++){let p=W[s]??(W[s]=[]),X=!0;for(let G of p)L(t,G)&&(X=!1);if(X){p.push(t);break}}w[t]=s}let I=new Map,z=new Map;return l.forEach((t,s)=>{let p=N(s);I.set(p,Math.min(I.get(p)??1/0,w[t])),z.set(p,Math.max(z.get(p)??-1/0,w[t]))}),l.forEach((t,s)=>{let p=N(s);a[t]=z.get(p)-I.get(p)+1,r&&(w[t]-=I.get(p))}),W.length},E=16,J=(l,f,T)=>{let v=Vt(k[l]-$[l],f);for(let N=0;N<=E;N++){let j=N/E,n=1-j;T[2*N]=$[l]+(k[l]-$[l])*j*j*(3-2*j),T[2*N+1]=f*(3*v*j*n*n+3*(1-v)*j*j*n+j*j*j)}},K=new Float64Array(2*E+2),V=new Float64Array(2*E+2),o=(l,f)=>{let T=1/0;for(let v=0;v<=E;v++){let N=l[2*v],j=l[2*v+1];for(let n=0;n<E;n++){let W=f[2*n+2]-f[2*n],I=f[2*n+3]-f[2*n+1],z=Math.max(0,Math.min(1,((N-f[2*n])*W+(j-f[2*n+1])*I)/(W*W+I*I||1))),t=Math.hypot(N-f[2*n]-z*W,j-f[2*n+1]-z*I);t<T&&(T=t)}}return T},F=(l,f,T)=>{let v=Math.max(T/2,T-2*te);return J(l,v,K),J(f,v,V),Math.min(o(K,V),o(V,K))};for(let[l,f]of y){if(!r){m[l]=U(f);continue}if(f.length>jt)continue;let T=f.filter(t=>g[t]===1);U(T);let v=new Set(T.filter(t=>a[t]>1));for(let t=0;t<f.length;t++)for(let s=t+1;s<f.length;s++){let p=f[t],X=f[s];v.has(p)&&v.has(X)||!L(p,X)||$[p]<k[p]!=$[X]<k[X]||F(p,X,x[l])<(g[p]===1||g[X]===1?ee:re)&&v.add(p).add(X)}for(let t of T)w[t]=-1,a[t]=0;if(v.size===0)continue;let N=0,j=0,n=[...v];for(let t=0;t<n.length;t++)for(let s=t+1;s<n.length;s++){let p=n[t],X=n[s];Z(p,X)&&($[p]<k[p]!=$[X]<k[X]?N++:_(p,X)||j++)}if(N>j){for(let t of f)(u[t]-D[t])*_t>c[l]&&(c[l]=(u[t]-D[t])*_t);continue}let W=t=>{for(let s of v)if(M(t,s))return!0;return!1},I=f.filter(t=>v.has(t)||g[t]!==1&&W(t));U(I);let z=0;for(let t of I)a[t]>z&&(z=a[t]);m[l]=z}}function ce(i,m,r,x,c,$,k){let{maxRank:R,EF:w,ET:a,EFD:g,ETD:Y,succStart:y,succE:D,predStart:u,predE:A,layerStart:_,order:Z}=i,L=new Float64Array(m.length),M=new Float64Array(m.length),H=new Float64Array(m.length);for(let E=0;E<x.length;E++){let J=x[E];if(J<0)continue;let K=J+c[E]-1,V=i.RANK[J];for(let o=J;o<K;o++){if(!r[V+o-J])continue;let F=o;for(;F+1<K&&r[V+F+1-J];)F++;let l=A[u[o]],f=D[y[F]],T=m[w[l]]+g[l],v=m[a[f]]+Y[f],N=F-o+2;for(let j=o;j<=F;j++)L[j]=T+(v-T)*(j-o+1)/N,M[j]=T,H[j]=v;o=F}}let U=[];for(let E=1;E<R;E++){if(!r[E])continue;let J=_[E],K=_[E+1],V=Array.from(Z.subarray(J,K)).sort((o,F)=>M[o]-M[F]||H[o]-H[F]||o-F);for(let o=0;o<V.length;){U.length=0;let F=o;for(;F<V.length&&Math.abs(M[V[F]]-M[V[o]])<1&&Math.abs(H[V[F]]-H[V[o]])<1;F++)U.push(V[F]);U.sort((l,f)=>i.pos[l]-i.pos[f]);for(let l=0;l<U.length;l++){let f=U[l];m[f]=L[f]+(l-(U.length-1)/2)*$,(U.length===1||$===0)&&(k[f]=1)}o=F}}}function ye(i,m,r,x,c,$){let{maxRank:k,W:R,KIND:w,RANK:a,EF:g,ET:Y,EFD:y,ETD:D,succStart:u,succE:A,predStart:_,predE:Z,layerStart:L,order:M}=i,H=new Uint8Array(k+1),U=!1;for(let E=1;E<k;E++){let J=!1,K=!1;for(let V=L[E];V<L[E+1];V++){let o=w[M[V]];o===2?J=!0:o!==1&&(K=!0)}J&&!K&&(H[E]=1,U=!0)}if(U)for(let E=0;E<r.length;E++){let J=r[E];if(!(J<0))for(let K=J,V=J+x[E]-1;K<V;K++){if(w[K]!==1||!H[a[K]])continue;let o=K,F=K;for(;o>J&&$[o-1];)o--;for(;F+1<V&&$[F+1];)F++;let l=Z[_[o]],f=A[u[F]],T=m[g[l]]+y[l],v=m[Y[f]]+D[f],N=Math.min(T,v)-c,j=Math.max(T,v)+c,n=!0,W=a[K];for(let z=L[W];n&&z<L[W+1];z++){let t=M[z];w[t]===2&&m[t]+R[t]/2>N&&m[t]-R[t]/2<j&&(n=!1)}if(!n)continue;$[K]=1;let I=F-o+2;for(let z=o;z<=F;z++)m[z]=T+(v-T)*(z-o+1)/I}}}function de(i,m){let{n:r,real:x,maxRank:c,W:$,EF:k,ET:R,EFD:w,ETD:a,succStart:g,succE:Y,predStart:y,predE:D,layerStart:u,order:A,pos:_,offsets:Z}=i,L=0;for(let t=0;t<=c;t++)L=Math.max(L,u[t+1]-u[t]);let M=Z?new Int32Array(k.length):void 0,H=1;for(;H<(M?L+k.length:L);)H<<=1;let U=new Int32Array(2*H),E=new Int32Array(k.length),J=()=>{let t=0;for(let s=0;s<c;s++){let p=u[s+2]-u[s+1];if(M){let d=0;for(let B=u[s+1];B<u[s+2];B++){let ft=y[A[B]],lt=y[A[B]+1],nt=!1;for(let Q=ft+1;Q<lt;Q++)a[D[Q]]!==a[D[ft]]&&(nt=!0);if(nt){let Q=Array.from(D.subarray(ft,lt));Q.sort((at,b)=>a[at]-a[b]);for(let at=0;at<Q.length;at++)at>0&&a[Q[at]]!==a[Q[at-1]]&&d++,M[Q[at]]=d}else for(let Q=ft;Q<lt;Q++)M[D[Q]]=d;d++}p=d}if(p<2)continue;let X=0;for(let d=u[s];d<u[s+1];d++){let B=A[d],ft=g[B],lt=g[B+1],nt=X;for(let b=ft;b<lt;b++)E[X++]=M?M[Y[b]]:_[R[Y[b]]];let Q=X-nt;if(Q<2)continue;let at=!1;if(M)for(let b=ft+1;b<lt;b++)w[Y[b]]!==w[Y[ft]]&&(at=!0);if(M&&at){let b=Array.from(Y.subarray(ft,lt));b.sort((P,tt)=>w[P]-w[tt]||M[P]-M[tt]);for(let P=0;P<Q;P++)E[nt+P]=M[b[P]]}else if(Q<=12)for(let b=nt+1;b<X;b++){let P=E[b],tt=b-1;for(;tt>=nt&&E[tt]>P;)E[tt+1]=E[tt],tt--;E[tt+1]=P}else E.subarray(nt,X).sort()}if(X<2)continue;let G=1;for(;G<p;)G<<=1;U.fill(0,0,2*G);for(let d=0;d<X;d++){let B=E[d]+G;for(U[B]++;B>1;)(B&1)===0&&(t+=U[B+1]),B>>=1,U[B]++}}return t},K=J();if(K===0)return;let V=A.slice(),o=new Float64Array(r),F=new Int32Array(L),l=(t,s)=>o[t]-o[s]||_[t]-_[s],f=(t,s)=>o[t]-o[s]||_[s]-_[t],T=(t,s)=>{let p=t?y:g,X=t?D:Y,G=t?k:R,d=t?w:a;for(let B=1;B<=c;B++){let ft=t?B:c-B,lt=u[ft],nt=u[ft+1],Q=0;for(let b=lt;b<nt;b++){let P=A[b],tt=P<x?m[P].pin:0;if(tt!==0){o[P]=tt*1e9,F[Q++]=P;continue}let ot=p[P],it=p[P+1];if(ot===it){o[P]=-1;continue}let ut=0;for(let ct=ot;ct<it;ct++){let dt=G[X[ct]];ut+=_[dt],Z&&$[dt]>0&&(ut+=d[X[ct]]/$[dt])}o[P]=ut/(it-ot),F[Q++]=P}if(Q<2)continue;F.subarray(0,Q).sort(s?f:l);let at=0;for(let b=lt;b<nt;b++)o[A[b]]!==-1&&(A[b]=F[at++]);for(let b=lt;b<nt;b++)_[A[b]]=b-lt}},v=()=>{let t=0;for(let s=0;s<=c;s++)for(let p=u[s];p<u[s+1];p++)if(!(A[p]>=x))for(let X=p+1;X<u[s+1];X++)A[X]<A[p]&&t++;return t},N=()=>{for(let t=0;t<=c;t++)for(let s=u[t];s<u[t+1];s++)_[A[s]]=s-u[t]},j=A.slice(),n=K,W=r<=600,I=V,z=1/0;for(let t=0;t<(W?2:1);t++){t>0&&(A.set(j),N());let s=n,p=j.slice();for(let G=0,d=0;d<4&&G<Ct;G++,d++){T((G+t)%2===0,G%4>=2);let B=J();if(B<s&&(s=B,p.set(A),d=0,B===0))break}A.set(p);let X=W?v():0;(t===0||s<K||s===K&&X<z)&&(K=s,I=p,z=X)}if(A.set(I),N(),V.set(I),!!W){for(let t=0;t<x;t++)if(m[t].pin!==0)return;if(z!==0){for(let t=0;t<=c;t++)A.subarray(u[t],u[t+1]).reverse();N(),(J()>K||v()>=z)&&A.set(V)}}}function zt(i,m,r){return i.W[r]/2+(i.KIND[r]===0?m.nodeSep:m.edgeSep)/2}function we(i,m){let{n:r,maxRank:x,W:c,KIND:$,EF:k,ET:R,EFD:w,ETD:a,succStart:g,succE:Y,predStart:y,predE:D,layerStart:u,order:A,pos:_}=i,Z=k.length,L=new Float64Array(r);for(let t=0;t<r;t++)L[t]=zt(i,m,t);let M=new Int32Array(Z);for(let t=0;t<Z;t++)M[t]=_[R[t]];for(let t=0;t<r;t++)g[t+1]-g[t]>1&&Bt(Y,g[t],g[t+1],M);for(let t=0;t<Z;t++)M[t]=_[k[t]];for(let t=0;t<r;t++)y[t+1]-y[t]>1&&Bt(D,y[t],y[t+1],M);let H=new Uint8Array(Z);for(let t=1;t<=x;t++){let s=u[t]-u[t-1],p=u[t],X=u[t+1],G=0,d=p;for(let B=p;B<X;B++){let ft=A[B],lt=-1;if(St($[ft])){let Q=k[D[y[ft]]];St($[Q])&&(lt=Q)}let nt=lt>=0?_[lt]:s;if(lt>=0||B===X-1){for(let Q=d;Q<=B;Q++){let at=A[Q],b=St($[at]);for(let P=y[at];P<y[at+1];P++){let tt=D[P],ot=_[k[tt]];(ot<G||nt<ot)&&!(b&&St($[k[tt]]))&&(H[tt]=1)}}d=B+1,G=nt}}}let U=[],E=new Int32Array(r),J=new Int32Array(r),K=new Float64Array(r),V=new Int32Array(r),o=new Int32Array(r),F=new Float64Array(r),l=new Int32Array(r),f=new Int32Array(r+1),T=new Int32Array(r),v=new Int32Array(r),N=new Int32Array(r);for(let t=0;t<4;t++){let s=t<2,p=(t&1)===1,X=s?y:g,G=s?D:Y,d=s?k:R,B=s?a:w,ft=s?w:a;for(let b=0;b<r;b++)E[b]=b,J[b]=b,K[b]=0;for(let b=0;b<=x;b++){let P=s?b:x-b,tt=u[P],ot=u[P+1],it=s?P-1:P+1,ut=it>=0&&it<=x?u[it+1]-u[it]-1:0,ct=-1;for(let dt=p?ot-1:tt;p?dt>=tt:dt<ot;p?dt--:dt++){let wt=A[dt],xt=X[wt],vt=X[wt+1]-xt;if(vt===0)continue;let $t=xt+(vt-1>>1),pt=xt+(vt>>1);for(let kt=0;kt<2&&!(kt===1&&$t===pt);kt++){let Et=G[kt===0!==p?$t:pt],mt=d[Et],e=p?ut-_[mt]:_[mt];J[wt]===wt&&ct<e&&H[Et]===0&&(J[mt]=wt,J[wt]=E[wt]=E[mt],K[wt]=K[mt]+ft[Et]-B[Et],ct=e)}}}let lt=0;l.fill(0),f.fill(0);for(let b=0;b<=x;b++){let P=u[b],tt=u[b+1];for(let ot=P+1;ot<tt;ot++){let it=p?A[ot]:A[ot-1],ut=p?A[ot-1]:A[ot],ct=L[it]+L[ut];V[lt]=E[it],o[lt]=E[ut],F[lt]=p?ct-K[it]+K[ut]:ct+K[it]-K[ut],l[E[ut]]++,f[E[it]+1]++,lt++}}for(let b=0;b<r;b++)f[b+1]+=f[b];v.set(f.subarray(0,r));for(let b=0;b<lt;b++)T[v[V[b]]++]=b;let nt=new Float64Array(r),Q=0;for(let b=0;b<r;b++)E[b]===b&&l[b]===0&&(N[Q++]=b);for(let b=0;b<Q;b++){let P=N[b];for(let tt=f[P];tt<f[P+1];tt++){let ot=T[tt],it=o[ot];nt[P]+F[ot]>nt[it]&&(nt[it]=nt[P]+F[ot]),--l[it]===0&&(N[Q++]=it)}}for(let b=Q-1;b>=0;b--){let P=N[b],tt=1/0;for(let ot=f[P];ot<f[P+1];ot++){let it=T[ot],ut=nt[o[it]]-F[it];ut<tt&&(tt=ut)}tt!==1/0&&tt>nt[P]&&(nt[P]=tt)}let at=new Float64Array(r);for(let b=0;b<r;b++)at[b]=(p?-nt[E[b]]:nt[E[b]])+K[b];U.push(at)}let j=0,n=1/0,W=[],I=[];for(let t=0;t<4;t++){let s=1/0,p=-1/0,X=U[t];for(let G=0;G<r;G++){let d=c[G]/2;X[G]-d<s&&(s=X[G]-d),X[G]+d>p&&(p=X[G]+d)}W.push(s),I.push(p),p-s<n&&(n=p-s,j=t)}for(let t=0;t<4;t++){let s=(t&1)===0?W[j]-W[t]:I[j]-I[t];if(s!==0){let p=U[t];for(let X=0;X<r;X++)p[X]+=s}}let z=new Float64Array(r);for(let t=0;t<r;t++){let s=U[0][t],p=U[1][t],X=U[2][t],G=U[3][t],d;s>p&&(d=s,s=p,p=d),X>G&&(d=X,X=G,G=d),s>X&&(d=s,s=X,X=d),p>G&&(d=p,p=G,G=d),p>X&&(d=p,p=X,X=d),z[t]=(p+X)/2}return z}var Dt=8,Me=12,Tt=.62,Ft=6;function Ie(){let i=new Map;return{add(m,r,x){let c=me(x);r>=0&&c>0&&c+Ft>(i.get(m*4+r)??0)&&i.set(m*4+r,c+Ft)},of:(m,r)=>r>=0?i.get(m*4+r)??0:0}}function be(i,m,r,x,c=r>0?r+Ft:0,$=x>0?x+Ft:0){let k=m==="linear",R=m==="step"||m==="stepBefore"||m==="stepAfter",w=[],a=[],g=[],Y=(n,W,I,z)=>Math.abs(n-I)<.01&&Math.abs(W-z)<.01;for(let n=0;n<i.length;n+=3){let W=i[n],I=i[n+1],z=i[n+2],t=w.length-1;if(R&&t>=0&&Math.abs(W-w[t])>=.01&&Math.abs(I-a[t])>=.01){let s=w[t],p=a[t],X=m==="stepBefore"?p:m==="stepAfter"?I:(p+I)/2,G=m==="stepBefore"?s:m==="stepAfter"?W:(s+W)/2,d=z===0?[s,X,W,X]:[G,p,G,I];for(let B=0;B<4;B+=2)Y(d[B],d[B+1],s,p)||Y(d[B],d[B+1],W,I)||(w.push(d[B]),a.push(d[B+1]),g.push(z))}w.push(W),a.push(I),g.push(z)}let y=w.length-1,D=n=>Math.abs(w[n]-w[n-1])<.01||Math.abs(a[n]-a[n-1])<.01,u=n=>k||D(n),A=(n,W,I)=>{if(!u(Math.max(n,W)))return I===0?[0,Math.sign(a[W]-a[n])||1]:[Math.sign(w[W]-w[n])||1,0];let z=w[W]-w[n],t=a[W]-a[n],s=Math.hypot(z,t)||1;return[z/s,t/s]},[_,Z]=A(0,1,g[1]),[L,M]=A(y-1,y,g[y]),H=w[0],U=a[0],E=w[y],J=a[y];w[0]+=_*r,a[0]+=Z*r,w[y]-=L*x,a[y]-=M*x;let K=n=>Math.abs(w[n]-w[n-1])+Math.abs(a[n]-a[n-1]),V=n=>!k&&n>0&&n<y&&D(n)&&D(n+1)&&K(n)>=.01&&K(n+1)>=.01&&Math.abs(w[n]-w[n-1])<.01!=Math.abs(w[n+1]-w[n])<.01,o=(n,W,I)=>Math.abs(w[n]-w[n-1])*Math.abs(W)+Math.abs(a[n]-a[n-1])*Math.abs(I),F=(n,W,I)=>{let z=Math.min(Math.max(0,n-Ft-W),I/4);return z+Math.min(n-W-z,(I-z)/4)},l=$>x&&(!u(y)||V(y-1))?F($,x,o(y,L,M)):0,f=c>r&&(!u(1)||V(1))?F(c,r,o(1,_,Z)):0;l>=1&&(w.splice(y,0,w[y]-L*l),a.splice(y,0,a[y]-M*l),g.splice(y,0,g[y]),y++),f>=1&&(w.splice(1,0,w[0]+_*f),a.splice(1,0,a[0]+Z*f),g.splice(1,0,g[1]),y++);let T=`M${O(w[0])},${O(a[0])}`,v=w[0],N=a[0],j=(n,W)=>{Y(n,W,v,N)||(T+=`L${O(n)},${O(W)}`,v=n,N=W)};for(let n=1;n<=y;n++){let W=w[n],I=a[n];if(!u(n)){let d=g[n]===0,B=d?I-N:W-v,ft=Math.abs(B)*Vt(d?W-v:I-N,B),lt=d?0:Math.sign(B)*ft,nt=d?Math.sign(B)*ft:0;T+=`C${O(v+lt)},${O(N+nt)} ${O(W-lt)},${O(I-nt)} ${O(W)},${O(I)}`,v=W,N=I;continue}if(!V(n)){if(n<y&&D(n)&&D(n+1)&&(W-w[n-1])*(w[n+1]-W)+(I-a[n-1])*(a[n+1]-I)>0)continue;j(W,I);continue}let z=V(n-1)?K(n)/2:K(n),t=V(n+1)?K(n+1)/2:K(n+1);R&&(z=t=Math.min(Me,z,t));let[s,p]=A(n-1,n,g[n]),[X,G]=A(n,n+1,g[n+1]);j(W-s*z,I-p*z),v=W+X*t,N=I+G*t,R?T+=`Q${O(W)},${O(I)} ${O(v)},${O(N)}`:T+=`C${O(W-s*z*(1-Tt))},${O(I-p*z*(1-Tt))} ${O(W+X*t*(1-Tt))},${O(I+G*t*(1-Tt))} ${O(v)},${O(N)}`}return{d:T,sx:H,sy:U,sdx:-_,sdy:-Z,ex:E,ey:J,edx:L,edy:M}}function me(i){return i==="arrow_point"?Dt-1:i==="arrow_circle"?Dt:i==="arrow_cross"?4:0}function Se(i,m,r,x,c,$){let k=-c,R=x;if(i==="arrow_point"){let w=m-x*Dt,a=r-c*Dt,g=Dt*.42;return`<path class="pele-marker" d="M${O(m)},${O(r)}L${O(w+k*g)},${O(a+R*g)}L${O(w-k*g)},${O(a-R*g)}Z" fill="${$}" stroke="none"/>`}if(i==="arrow_circle")return`<circle class="pele-marker" cx="${O(m-x*4)}" cy="${O(r-c*4)}" r="3.5" fill="${$}" stroke="none"/>`;if(i==="arrow_cross"){let w=m-x*4,a=r-c*4,g=3.5,Y=(x+k)*g,y=(c+R)*g,D=(x-k)*g,u=(c-R)*g;return`<path class="pele-marker" d="M${O(w-Y)},${O(a-y)}L${O(w+Y)},${O(a+y)}M${O(w-D)},${O(a-u)}L${O(w+D)},${O(a+u)}"/>`}return""}function ve(i,m,r,x,c,$){let k=m.width+8,R=m.height;return`<g class="pele-edge-label" data-id="${Yt(i)}"><rect x="${O(r-k/2)}" y="${O(x-R/2)}" width="${O(k)}" height="${O(R)}" rx="3" fill="var(--_bg)"/>`+qt(m,r,x,c,$)+"</g>"}function $e(i,m,r,x,c,$,k,R){let w=(c?m:r)/2,a=Math.min(w-4,8+x*6),g=$+x*8,Y=Math.hypot(g,a)||1,y=(A,_)=>c?`${O(i.x+_)},${O(i.y+r/2+A)}`:`${O(i.x+m/2+A)},${O(i.y+_)}`,D=g/Y*k,u=a/Y*k;return c?(R.labelX=i.x,R.labelY=i.y+r/2+g+4+R.labelH/2):(R.labelX=i.x+m/2+g+4+R.labelW/2,R.labelY=i.y),{d:`M${y(0,-a)}C${y(g,-a*2)} ${y(g,a*2)} ${y(D,a+u)}`,sx:c?i.x-a:i.x+m/2,sy:c?i.y+r/2:i.y-a,sdx:c?0:-1,sdy:c?-1:0,ex:c?i.x+a:i.x+m/2,ey:c?i.y+r/2:i.y+a,edx:c?-a/Y:-g/Y,edy:c?-g/Y:-a/Y}}export{Se as D,ke as E,be as F,Ee as I,$e as L,ve as S,Dt as a,xe as g,ne as o,ae as s,Ie as v,me as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as d}from"./RZSVICHU-BiwjruZZ.js";import{$ as C}from"./lazy-CKqR1774.js";var a="about:blank",v=/^([^\w]*)(javascript|data|vbscript)/im,f=/&#(\w+)(^\w|;)?/g,h=/&(newline|tab);/gi,m=/[\u0000-\u001F\u007F-\u009F -]/gim,L=/^.+(:|:)/gim,s=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;function p(e){try{return decodeURIComponent(e)}catch{return e}}function S(e){if(!e)return a;let t=p(e.trim()),n,l=0;do{if(++l>32)return a;t=t.replace(m,"").replace(f,(i,w)=>String.fromCharCode(w)).replace(h,"").replace(m,"").replace(s,"").trim(),t=p(t),n=t.match(m)||t.match(f)||t.match(h)||t.match(s)}while(n&&n.length>0);if(!t)return a;if(t[0]==="."||t[0]==="/")return t;let o=t.trimStart(),c=o.match(L);if(!c)return t;let r=c[0].toLowerCase().trim();if(v.test(r))return a;let u=o.replace(/\\/g,"/");if(r==="mailto:"||r.includes("://"))return u;if(r==="http:"||r==="https:"){let i;try{i=new URL(u)}catch{return a}return i.protocol=i.protocol.toLowerCase(),i.hostname=i.hostname.toLowerCase(),i.toString()}return u}function E(e){return S(C(e))}var $=["http","https","mailto","tel"],b=["http","https"],k=/^([a-z][a-z0-9+.-]*):/i,F=/^[\\/]{2}/;function g(e,t){if(F.test(e))return;let n=k.exec(e);return!n||t.includes(n[1].toLowerCase())?e:void 0}function R(e,t){return t.links===!1?void 0:g(e,t.linkSchemes??$)}function I(e,t){return t.images===!1?void 0:g(e,t.imageSchemes??b)}function U(e,t,n,l,o,c=""){let r=R(t,o);return r===void 0?e:(l.push({id:n,href:r,internal:!1}),`<a href="${d(r)}"${c}${x(o)}>${e}</a>`)}function x(e){let t=e.linkRel??"noopener";return t?` rel="${d(t)}"`:""}export{E as A,I as H,S as L,R as M,U as N,x as O};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Y as H,q as M,f as b,T as z,b as v,x as $}from"./RZSVICHU-BiwjruZZ.js";var m=/\s/;function j(i,p,f,g,u=0){let n=[];for(let o of i.split(`
|
|
2
|
+
`)){let e=Array.from(o);e.length===0&&n.push("");let t=0;for(;t<e.length;){let s=d=>p.width(e.slice(t,t+d).join(""),f,u)<=g,w=1;for(;w<e.length-t&&s(w);)w=Math.min(e.length-t,w*2);let a=1;for(;a<w;){let d=Math.ceil((a+w)/2);s(d)?a=d:w=d-1}let c=a,x=t+c<e.length;if(x&&!m.test(e[t+c])){for(let d=c-1;d>0;d--)if(m.test(e[t+d])){c=d+1;break}}let y=e.slice(t,t+c).join("");for(n.push(x&&y.trimEnd()||y),t+=c;x&&t<e.length&&m.test(e[t]);)t++}}i===""&&(n.length=0);let h=n.map(o=>p.width(o,f,u)),l=0;for(let o of h)l=Math.max(l,o);let r=Math.round(f*1.5);return{lines:n.map((o,e)=>[{text:o,style:u,width:h[e]}]),widths:h,width:l,height:n.length*r,size:f,lineHeight:r}}function k(i,p,f){if(i.width<=f)return i;let g=[],u=[];for(let h=0;h<i.lines.length;h++){if(i.widths[h]<=f){g.push(i.lines[h]),u.push(i.widths[h]);continue}let l=[],r=0,o=()=>{g.push(l),u.push(r),l=[],r=0};for(let e of i.lines[h]){if(e.icon!==void 0){l.length&&r+e.width>f&&o(),l.push(e),r+=e.width;continue}for(let t of Array.from(e.text)){let s=l[l.length-1],w=s&&s.icon===void 0&&s.style===e.style,a=p.width(w?s.text+t:t,i.size,e.style)-(w?s.width:0);l.length&&r+a>f&&(o(),s=void 0,a=p.width(t,i.size,e.style)),s&&s.icon===void 0&&s.style===e.style?(s.text+=t,s.width+=a):l.push({text:t,style:e.style,width:a}),r+=a}}(l.length||!i.lines[h].length)&&o()}let n=0;for(let h of u)n=Math.max(n,h);return{...i,lines:g,widths:u,width:n,height:g.length*i.lineHeight}}function q(i,p,f,g){let u=H(i),n="<text"+M(g,u),h="";for(let l=0;l<i.lines.length;l++){let r=i.lines[l],o=f+(l+.5)*i.lineHeight;if(r.some(t=>t.icon!==void 0)){let t=i.widths[l];h+=b({...i,lines:[r],widths:[t],height:i.lineHeight},p+t/2,o,g);continue}let e="";for(let t of r){let s=z(t.style&~u);e+=s?`<tspan${s}>${v(t.text)}</tspan>`:v(t.text)}e!==""&&(h+=`${n} x="${$(p)}" y="${$(o+i.size*.35)}" text-anchor="start" xml:space="preserve">${e}</text>`)}return h}export{q as A,j as H,k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Lt=Object.defineProperty;var zt=(n,s,i)=>s in n?Lt(n,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[s]=i;var I=(n,s,i)=>zt(n,typeof s!="symbol"?s+"":s,i);import{W as Nt,Y as St,X as Tt}from"./N6DAJLIZ-BsZQKTyT.js";import{P as Vt,V as rt,E as yt}from"./URA2L2QI-B8pYKxOk.js";import{c as Xt,h as Ct}from"./DKTLEL5E-B7ILCVTH.js";import{_ as ut,m as Mt,x as h,h as Et,y as Qt,f as et,$ as Rt}from"./RZSVICHU-BiwjruZZ.js";import{x as Ut,H as Yt,W as qt}from"./lazy-CKqR1774.js";import"./index-392ivruk.js";var Bt=11,Dt=class{constructor(){I(this,"type","mindmap");I(this,"title");I(this,"nodes",[]);I(this,"getType",Nt);I(this,"baseLevel",0);I(this,"open",[])}addNode(n,s,i,f){let M=this.nodes.length===0;M&&(this.baseLevel=n),n-=this.baseLevel;let u=this.open,g=u.length;for(;g>0&&u[g-1].level>=n;)g--;let x=u[g-1];if(!x&&!M)throw new Ut(`There can be only one root. No parent could be found for ("${i}")`,"semantic",{type:"mindmap"});let b={id:this.nodes.length,nodeId:s,level:n,descr:i,type:f,children:[],isRoot:M};x&&(b.section=x.isRoot?x.children.length%Bt:x.section,x.children.push(b)),u.length=g,u.push(b),this.nodes.push(b)}decorateNode(n){let s=this.nodes[this.nodes.length-1];!n||!s||(n.icon&&(s.icon=n.icon),n.class&&(s.class=n.class))}};function Gt(n,s){St(n,s,!1)}var Jt=["","rounded","rect","circle","cloud","bang","hex"],xt="stadium",Kt=36,Pt=8,Zt=18,jt=52,At=28,bt=6,Ot=12,te=.22,at=6,ot=28,vt=12,Ft=8,kt=10;function ee(n,s,i,f){if(n.lines.length<2)return et(n,s+n.width/2,i,' class="pele-label"',f);let M="";for(let u=0;u<n.lines.length;u++){let g=n.widths[u],x={lines:[n.lines[u]],widths:[g],height:n.lineHeight,size:n.size,lineHeight:n.lineHeight};M+=et(x,s+g/2,i+(u-(n.lines.length-1)/2)*n.lineHeight,' class="pele-label"',f)}return M}function le(n,s,i){return Xt(i,f=>ne(n,s,i,f))}function ne(n,s,i,f){var gt;let M=i.fontSize??16,u=i.measurer??Yt(i.fontFamily),g=i.padding??8,x=i.icons,b=(gt=s.mindmap)==null?void 0:gt.maxNodeWidth,Ht=typeof b=="number"&&b>0?Math.min(b,2e3):200,X=M*1.25,v=n.nodes,r=v.length,W=new Int32Array(r),B=new Int32Array(r);for(let e=0;e<r;e++)for(let t of v[e].children)W[t.id]=e,B[t.id]=B[e]+1;let Wt=f&&i.maxWidth!==void 0&&i.maxWidth>0?i.maxWidth-2*g:1/0,ht=new Array(r),D=new Array(r),c=new Float64Array(r),$=new Float64Array(r),G=new Float64Array(r),F=new Float64Array(r),J=new Uint8Array(r);for(let e=0;e<r;e++){let t=v[e];J[e]=t.icon!==void 0&&qt(t.icon)!==""?1:0;let d=Math.min(Ht,Math.max(72,Wt-B[e]*ot-2*bt-(J[e]?X+at:0))),a=ht[e]=ut(t.descr,!0,u,M,d),w=a.width+(J[e]?X+(a.width>0?at:0):0),y=Math.max(a.height,Math.round(M*1.5)),l=Jt[t.type]||(e===0?xt:"");if(f&&e===0&&l!=="rect"&&l!=="rounded"&&(l=xt),D[e]=l,l===""){let o=t.children.length>0;c[e]=w+2*(o?Ot:bt),$[e]=y+(o?6:0),F[e]=$[e]/2}else{let o=Vt(l,w,y);c[e]=o.w,$[e]=o.h,G[e]=o.dy,F[e]=o.h/2}}let C=new Float64Array(r),E=new Float64Array(r),K=new Float64Array(r),st=new Float64Array(r),dt=0,ct=(e,t,d,a)=>{let w=0,y=0;for(let m=t;m<d;m++){let A=e[m].id;E[A]=w,y=e[m].children.length>0||m+1<d&&e[m+1].children.length>0?Math.max(a,Zt):a,w+=C[A]+y}dt=w-y;let l=e[t].id,o=e[d-1].id;return(E[l]+K[l]+F[l]+E[o]+K[o]+F[o])/2};for(let e=r-1;e>0;e--){let t=v[e].children;if(t.length===0){C[e]=$[e];continue}let d=ct(t,0,t.length,Pt)-F[e],a=Math.min(0,d);C[e]=Math.max(dt,d+$[e])-a,K[e]=d-a,st[e]=-a}let L=new Float64Array(r),z=new Float64Array(r),P=new Float64Array(r),Q=new Int8Array(r),$t=new Float64Array(r);if(f){let e=0;for(let t=0;t<r;t++)t>0&&W[t]===0&&(e+=kt),L[t]=B[t]*ot+c[t]/2,z[t]=e,e+=$[t]+kt}else if(r>0){let e=v[0].children,t=e.length,d=0;for(let l of e)d+=C[l.id];let a=t,w=1/0,y=0;for(let l=1;l<t;l++){y+=C[e[l-1].id];let o=Math.abs(2*y-d+(2*l-t)*At);o<w&&(w=o,a=l)}for(let l=0,o=a,m=1;l<t;l=o,o=t,m=-1){let A=ct(e,l,o,At);for(let k=l;k<o;k++){let S=e[k].id;P[S]=E[S]-A,Q[S]=m}}z[0]=-$[0]/2;for(let l=0;l<r;l++){l>0&&(z[l]=P[l]+K[l]);for(let o of v[l].children){let m=o.id;l>0&&(Q[m]=Q[l],P[m]=P[l]+st[l]+E[m]),L[m]=L[l]+Q[m]*(c[l]/2+(l>0?Kt:jt)+c[m]/2)}}}let R=0,Z=0,j=0,lt=0,nt="",O="",tt="",N="",_t=e=>{tt!==""&&(nt+=`<g class="pele-branch pele-section-${e??0}"><g class="pele-edges" fill="none" stroke="${N}" stroke-width="1.5">${O}</g>${tt}</g>`,O=tt="")};for(let e=1;e<=r;e++){let t=e%r,d=v[t],a=D[t],w=ht[t],y=L[t],l=z[t];if(R=Math.min(R,y-c[t]/2),Z=Math.max(Z,y+c[t]/2),j=Math.min(j,l),lt=Math.max(lt,l+$[t]),(t===0||W[t]===0)&&_t(v[e-1].section),t>0&&f){W[t]===0&&(N=Mt(d.section??0));let p=W[t],T=p===0?Math.min(Math.max(vt,$[0]/2),ot-Ft):vt,_=L[p]-c[p]/2+Math.min(T,c[p]/2),Y=$t[p]||z[p]+$[p],q=y-c[t]/2+(a?rt(a,c[t],$[t],3):0),H=l+F[t],V=Math.max(0,Math.min(Ft,q-_,H-Y));$t[p]=H-V,O+=`<path class="pele-edge" d="M${h(_)},${h(Y)}V${h(H-V)}Q${h(_)},${h(H)} ${h(_+V)},${h(H)}H${h(q)}"/>`}else if(t>0){W[t]===0&&(N=Mt(d.section??0));let p=W[t],T=Q[t],_=T>0?1:3,Y=L[p]+T*(c[p]/2-(D[p]?rt(D[p],c[p],$[p],_):0)),q=z[p]+F[p],H=y-T*c[t]/2+(a?T*rt(a,c[t],$[t],4-_):0),V=l+F[t],wt=h((Y+H)/2);O+=`<path class="pele-edge" d="M${h(Y)},${h(q)}C${wt},${h(q)} ${wt},${h(V)} ${h(H)},${h(V)}"/>`}let o=!a&&d.children.length>0,m=` fill="${N}" fill-opacity="${te}" stroke="${N}"`,A="";a?A=t>0?yt(a,c[t],$[t],m,` stroke="${N}"`):yt(a,c[t],$[t],' fill="var(--_s)" stroke="var(--_b)"',' stroke="var(--_b)"'):o&&(A=`<rect x="${h(-c[t]/2)}" y="${h(-$[t]/2)}" width="${h(c[t])}" height="${h($[t])}" rx="${h($[t]/2)}"${m}/>`);let k=0;d.icon&&J[t]&&(k=(X+(w.width>0?at:0))/2,A+=Tt(d.icon,-k-w.width/2,G[t]-X/2,X,x));let S=`<g class="pele-node pele-shape-${a||(o?"branch":"text")}${t>0?"":" pele-root"}${Et(d.class??"")}" data-id="${Qt(d.nodeId)}" transform="translate(${h(y)},${h(l+$[t]/2)})">`+A+(f&&!a?ee(w,k-w.width/2,G[t],x):et(w,k,G[t],' class="pele-label"',x))+"</g>";t>0?tt+=S:nt+=S}let U=ut(n.title,!1,u,M,Ct(i),1),mt=U.height>0?U.height+16:0,pt=Math.max(Z-R,U.width),it=Math.ceil(pt+2*g),ft=Math.ceil(lt-j+mt+2*g),It=et(U,it/2,g+U.height/2,' class="pele-title" font-weight="var(--_tw)"')+`<g transform="translate(${h(g-R+(pt-Z+R)/2)},${h(g+mt-j)})">${nt}</g>`;return{svg:Rt("mindmap",it,ft,M,i,{},It),width:it,height:ft,links:[]}}var ce={type:"mindmap",parse(n,s,i){let f=new Dt;return f.title=i,Gt(n,f),f},render:le};export{ce as mindmap};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var dt=Object.defineProperty;var ut=(t,l,e)=>l in t?dt(t,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[l]=e;var E=(t,l,e)=>ut(t,typeof l!="symbol"?l+"":l,e);import{H as Mt,x as J,L as st,i as it,e as B,t as D,a as xt}from"./lazy-CKqR1774.js";import{_ as F,m as gt,y as W,x as q,f as nt,$ as yt,g as ft}from"./RZSVICHU-BiwjruZZ.js";import"./index-392ivruk.js";function z(t){let l=t.trim();return l.length>=2&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}function j(t){return t.map(z).sort()}var pt=class{constructor(){E(this,"type","venn");E(this,"title");E(this,"subsets",[]);E(this,"textNodes",[]);E(this,"styles",[]);E(this,"known",new Set);E(this,"current");E(this,"indent",!1)}setDiagramTitle(t){this.title=t}addSubsetData(t,l,e){let r=j(t);this.current=r,r.length===1&&this.known.add(r[0]),this.subsets.push({sets:r,size:e??10/t.length**2,label:l?z(l):void 0})}addTextData(t,l,e){this.textNodes.push({sets:j(t),id:z(l),label:e?z(e):void 0})}addStyleData(t,l){let e=new Map;for(let[r,s]of l)e.set(r,s&&z(s));this.styles.push({targets:j(t),styles:e})}validateUnionIdentifiers(t){let l=t.map(z).filter(e=>!this.known.has(e));if(l.length>0)throw new J(`unknown set identifier: ${l.join(", ")}`,"semantic",{type:"venn"})}getCurrentSets(){return this.current}getIndentMode(){return this.indent}setIndentMode(t){this.indent=t}},at=["$end","INVALID","EOF","NEWLINE","VENN","TITLE","SET","UNION","TEXT","INDENT_TEXT","STYLE","BRACKET_LABEL","NUMERIC","HEXCOLOR","RGBCOLOR","RGBACOLOR","IDENTIFIER","STRING","COMMA","COLON"],ct=[["venn-beta",4],["set",6],["union",7],["text",8],["style",10]],mt=class{constructor(t,l){E(this,"src");E(this,"host");E(this,"text","");E(this,"start",0);E(this,"at",0);E(this,"lineStart",!1);E(this,"ended",!1);this.src=t,this.host=l}word(t,l){let e=this.src;for(let r=0;r<l.length;r++){let s=e.charCodeAt(t+r),d=l.charCodeAt(r);if(s!==d&&(s+32!==d||s<65||s>90))return!1}return!0}keyword(t,l){return this.word(t,l)&&!it(this.src.charCodeAt(t+l.length))}color(t,l){let e=this.src,r=t+1;for(let s=0;s<l;s++){for(;B(e.charCodeAt(r));)r++;let d=r;for(;D(e.charCodeAt(r))||e.charCodeAt(r)===46;)r++;if(r===d)return-1;for(;B(e.charCodeAt(r));)r++;if(e.charCodeAt(r)!==(s===l-1?41:44))return-1;r++}return r}lineEnd(t){let l=this.src.indexOf(`
|
|
2
|
+
`,t);return l===-1?this.src.length:l}next(){let t=this.src,l=t.length;for(;;){let e=this.at;if(this.start=e,this.text="",e>=l)return this.ended?0:(this.ended=!0,2);let r=t.charCodeAt(e);if(r===37&&t.charCodeAt(e+1)===37&&t.charCodeAt(e+2)!==123||r!==125&&t.charCodeAt(e+1)===37&&t.charCodeAt(e+2)===37){this.at=this.lineEnd(e+2);continue}if(this.lineStart){if(r===32||r===9){let s=e+1;for(;t.charCodeAt(s)===32||t.charCodeAt(s)===9;)s++;if(this.at=s,this.keyword(s,"text")&&this.host.getIndentMode())return this.at=s+4,this.lineStart=!1,this.text=t.slice(e,s),9;continue}r!==10&&r!==13&&(this.host.setIndentMode(!1),this.lineStart=!1)}if(r===10||r===13){for(e++;t.charCodeAt(e)===10||t.charCodeAt(e)===13;)e++;return this.lineStart=!0,this.token(3,e)}if(r===37&&t.charCodeAt(e+1)===37){this.at=this.lineEnd(e);continue}if(r===32||r===9){for(e++;t.charCodeAt(e)===32||t.charCodeAt(e)===9;)e++;this.at=e;continue}if((r|32)>=97&&(r|32)<=122||r===95){if(this.word(e,"title")&&B(t.charCodeAt(e+5))){let s=e+6;for(;s<l;){let d=t.charCodeAt(s);if(d===35||d===10||d===59)break;s++}if(s>e+6)return this.token(5,s)}for(let[s,d]of ct)if(this.keyword(e,s))return this.token(d,e+s.length);if(this.word(e,"rgb")){let s=(t.charCodeAt(e+3)|32)===97,d=e+(s?4:3),h=t.charCodeAt(d)===40?this.color(d,s?4:3):-1;if(h!==-1)return this.token(s?15:14,h)}for(e++;it(t.charCodeAt(e))||t.charCodeAt(e)===45;)e++;return this.token(16,e)}if(r===91){if(t.charCodeAt(e+1)===34){let d=t.indexOf('"',e+2);return d===-1||t.charCodeAt(d+1)!==93?1:(this.at=d+2,this.text=t.slice(e+2,d),11)}let s=e+1;for(;s<l&&t.charCodeAt(s)!==93&&t.charCodeAt(s)!==34;)s++;return s===e+1||t.charCodeAt(s)!==93?1:(this.at=s+1,this.text=t.slice(e+1,s).trim(),11)}if(D(r)||r===46||r===43||r===45){(r===43||r===45)&&e++;let s=e;for(;D(t.charCodeAt(e));)e++;if(e>s){if(t.charCodeAt(e)===46&&D(t.charCodeAt(e+1)))for(e+=2;D(t.charCodeAt(e));)e++}else if(t.charCodeAt(e)===46&&D(t.charCodeAt(e+1)))for(e+=2;D(t.charCodeAt(e));)e++;else return 1;return this.token(12,e)}if(r===35){let s=e+1;for(;s<e+9&&xt(t.charCodeAt(s));)s++;return s>=e+4?this.token(13,s):1}if(r===34){let s=t.indexOf('"',e+1);return s===-1?1:this.token(17,s+1)}return r===44?this.token(18,e+1):r===58?this.token(19,e+1):1}}token(t,l){return this.text=this.src.slice(this.at,l),this.at=l,t}},Ct="'EOF', 'NEWLINE', 'TITLE', 'SET', 'UNION', 'TEXT', 'INDENT_TEXT', 'STYLE'",$t="'NUMERIC', 'IDENTIFIER', 'STRING', 'HEXCOLOR', 'RGBCOLOR', 'RGBACOLOR'";function At(t,l){let e=new mt(t,l),r=-1,s=()=>r===-1?r=e.next():r,d=x=>{throw s()===1?st("venn",t,e.start,"",!0):st("venn",t,e.start,`Expecting ${x}, got '${at[r]}'`)},h=()=>(r=-1,e.text),C=x=>(s()!==x&&d(`'${at[x]}'`),h()),i=()=>(s()!==16&&r!==17&&d("'IDENTIFIER', 'STRING'"),h()),M=()=>{let x=[i()];for(;s()===18;)h(),x.push(i());return x},u=(x,f)=>{let y=s()===11?h():void 0,n;if(s()===19&&(h(),n=parseFloat(C(12))),f){if(x.length<2)throw new J("union requires multiple identifiers","semantic",{type:"venn"});l.validateUnionIdentifiers(x)}l.addSubsetData(x,y,n),l.setIndentMode(!0)},g=x=>{let f=s();f!==16&&f!==17&&f!==12&&d("'NUMERIC', 'IDENTIFIER', 'STRING'");let y=h(),n=f!==12&&s()===11?h():void 0;l.addTextData(x(),y,n)},m=()=>{let x=M(),f=[];for(;;){let y=C(16);C(19);let n;if(s()===17)n=h();else{let o=[];for(;s()===16||r>=12&&r<=15;)o.push(h());o.length===0&&d($t),n=o.join(" ")}if(f.push([y,n]),s()!==18)break;h()}l.addStyleData(x,f)};for(;s()===3;)h();for(C(4);;){let x=s();if(x===2)return;if((x<3||x>10||x===4)&&d(Ct),h(),x===5)l.setDiagramTitle(e.text.slice(6));else if(x===6)u([i()],!1);else if(x===7)u(M(),!0);else if(x===8){let f=M();g(()=>f)}else x===9?g(()=>{let f=l.getCurrentSets();if(!f)throw new J("text requires set","semantic",{type:"venn"});return f}):x===10&&m()}}var G=Math.PI*2;function wt(t){let l=new Set,e=new Map;for(let s of t)l.add(JSON.stringify([...s.sets].sort())),s.sets.length===1&&e.set(s.sets[0],s.size);let r=[];for(let s of t){if(s.sets.length<3)continue;let d=[...s.sets].sort();for(let h=0;h<d.length-1;h++)for(let C=h+1;C<d.length;C++){let i=[d[h],d[C]],M=JSON.stringify(i);if(l.has(M))continue;l.add(M);let u=e.get(i[0]),g=e.get(i[1]);r.push({sets:i,size:u!==void 0&&g!==void 0?Math.min(u,g)/4:2.5,label:""})}}return r.length>0?[...t,...r]:t}function bt(t,l,e){if(e>=t+l)return 0;let r=Math.min(t,l);if(e<=Math.abs(t-l))return Math.PI*r*r;let s=t*t*Math.acos((e*e+t*t-l*l)/(2*e*t)),d=l*l*Math.acos((e*e+l*l-t*t)/(2*e*l)),h=.5*Math.sqrt(Math.max((-e+t+l)*(e+t-l)*(e-t+l)*(e+t+l),0));return s+d-h}function Et(t,l,e){let r=Math.abs(t-l),s=t+l;if(!(e>0))return s;if(e>=Math.PI*Math.min(t,l)**2)return r;for(let d=0;d<48;d++){let h=(r+s)/2;bt(t,l,h)>e?r=h:s=h}return(r+s)/2}function ot(t,l,e,r,s,d){let h=1/0;for(let C of l){let i=t[C],M=r-i.x,u=s-i.y,g=i.r-Math.sqrt(M*M+u*u);if(g<h){if(g<d)return g;h=g}}for(let C of e){let i=t[C],M=r-i.x,u=s-i.y,g=Math.sqrt(M*M+u*u)-i.r;if(g<h){if(g<d)return g;h=g}}return h}function Y(t,l,e){let r=0,s=0,d=t[l[0]];for(let f of l){let y=t[f];r+=y.x/l.length,s+=y.y/l.length,y.r<d.r&&(d=y)}let h=d.r,C=r,i=s,M=ot(t,l,e,C,i,-1/0),u=0,g=(f,y)=>{let n=ot(t,l,e,f,y,M-h*1e-9);if(!(n>M-h*1e-9))return!1;let o=Math.hypot(f-r,y-s);return n>M+h*1e-9||o<u-h*1e-9?(M=n,u=o,C=f,i=y,!0):!1},m=10;for(let f=-m;f<=m;f++)for(let y=-m;y<=m;y++)y*y+f*f<=m*m&&g(d.x+y*h/m,d.y+f*h/m);let x=h/m;for(let f=0;f<40&&x>h*1e-6;f++){let y=!1;for(let n=0;n<8;n++){let o=n*G/8;g(C+Math.cos(o)*x,i+Math.sin(o)*x)&&(y=!0)}y||(x/=2)}return{x:C,y:i,margin:M}}function It(t){let l=new Map;for(let n of t)for(let o of n.sets)l.has(o)||l.set(o,10);for(let n of t)n.sets.length===1&&l.set(n.sets[0],n.size);let e=new Map,r=[],s=0;for(let n of l.values())Number.isFinite(n)&&n>s&&(s=n);s===0&&(s=10);let d=Math.sqrt(s/Math.PI);for(let[n,o]of l){e.set(n,r.length);let p=Number.isFinite(o)&&o>0?Math.sqrt(o/Math.PI):0;r.push({id:n,x:0,y:0,r:Math.max(p,d*.3)})}let h=r.length;if(h<2)return r;let C=new Map;for(let n of wt(t)){if(n.sets.length!==2)continue;let o=e.get(n.sets[0]),p=e.get(n.sets[1]);o!==p&&C.set(Math.min(o,p)*h+Math.max(o,p),n.size)}let i=new Map;for(let[n,o]of C)i.set(n,Et(r[Math.floor(n/h)].r,r[n%h].r,o));let M=d*.15,u=(n,o)=>i.get(n*h+o)??r[n].r+r[o].r+M;if(h===2)return r[1].x=u(0,1),r;if(h===3){let n=u(0,1),o=u(0,2),p=u(1,2),A=t.some(I=>new Set(I.sets).size===3);for(let I=0;I<40;I++){let v=n>0?(n*n+o*o-p*p)/(2*n):0;if(r[1].x=n,r[2].x=Math.max(-o,Math.min(o,v)),r[2].y=Math.sqrt(Math.max(o*o-v*v,0)),!A||Y(r,[0,1,2],[]).margin>d*.12)break;n*=.94,o*=.94,p*=.94}return r}let g=0;for(let n of r)g+=2*n.r+M;let m=Math.min(300,Math.floor(3e6/(h*h)));if(h<=64){let n=g/G;r.forEach((o,p)=>{let A=p*G/h-Math.PI/2;o.x=Math.cos(A)*n,o.y=Math.sin(A)*n})}else{let n=Math.ceil(Math.sqrt(h)),o=2*d+M;r.forEach((p,A)=>{p.x=A%n*o,p.y=Math.floor(A/n)*o})}let x=new Float64Array(h),f=new Float64Array(h),y=new Int32Array(h);for(let n=0;n<m;n++){x.fill(0),f.fill(0),y.fill(0);for(let o=0;o<h;o++)for(let p=o+1;p<h;p++){let A=i.get(o*h+p),I=r[o].r+r[p].r+M,v=r[p].x-r[o].x,T=r[p].y-r[o].y,R=Math.hypot(v,T);if(A===void 0&&R>=I)continue;R<1e-9&&(v=Math.cos(o+p),T=Math.sin(o+p),R=1);let k=(R-(A??I))/2/R;x[o]+=v*k,f[o]+=T*k,x[p]-=v*k,f[p]-=T*k,y[o]++,y[p]++}for(let o=0;o<h;o++)y[o]!==0&&(r[o].x+=x[o]/y[o],r[o].y+=f[o]/y[o])}return r}function vt(t,l){let e=i=>`M${l(i.x-i.r)},${l(i.y)}A${l(i.r)},${l(i.r)} 0 1 1 ${l(i.x+i.r)},${l(i.y)}A${l(i.r)},${l(i.r)} 0 1 1 ${l(i.x-i.r)},${l(i.y)}Z`;if(t.length===1)return e(t[0]);let r=(i,M,u,g)=>{for(let m of t)if(m!==u&&m!==g&&Math.hypot(i-m.x,M-m.y)>m.r*(1+1e-9))return!1;return!0},s=[];for(let i=0;i<t.length;i++)for(let M=i+1;M<t.length;M++){let u=t[i],g=t[M],m=Math.hypot(g.x-u.x,g.y-u.y);if(m>=u.r+g.r||m<=Math.abs(u.r-g.r)||m===0)continue;let x=(u.r*u.r-g.r*g.r+m*m)/(2*m),f=Math.sqrt(Math.max(u.r*u.r-x*x,0)),y=u.x+(g.x-u.x)*x/m,n=u.y+(g.y-u.y)*x/m;for(let o of[1,-1]){let p=y+o*f*(g.y-u.y)/m,A=n-o*f*(g.x-u.x)/m;r(p,A,u,g)&&s.push({x:p,y:A,a:u,b:g})}}if(s.length<2){let i=t[0];for(let M of t)M.r<i.r&&(i=M);for(let M of t)if(M!==i&&Math.hypot(M.x-i.x,M.y-i.y)+i.r>M.r*(1+1e-9))return"";return e(i)}let d=0,h=0;for(let i of s)d+=i.x/s.length,h+=i.y/s.length;s.sort((i,M)=>Math.atan2(i.y-h,i.x-d)-Math.atan2(M.y-h,M.x-d));let C="";for(let i=0;i<s.length;i++){let M=s[i],u=s[(i+1)%s.length];i===0&&(C=`M${l(M.x)},${l(M.y)}`);let g,m=0,x=1/0;for(let f of[M.a,M.b]){if(f!==u.a&&f!==u.b)continue;let y=Math.atan2(M.y-f.y,M.x-f.x),n=Math.atan2(u.y-f.y,u.x-f.x)-y;n<=0&&(n+=G);let o=f.x+f.r*Math.cos(y+n/2),p=f.y+f.r*Math.sin(y+n/2),A=Math.hypot(o-(M.x+u.x)/2,p-(M.y+u.y)/2);A<x&&(x=A,g=f,m=n>Math.PI?1:0)}g===void 0?C+=`L${l(u.x)},${l(u.y)}`:C+=`A${l(g.r)},${l(g.r)} 0 ${m} 1 ${l(u.x)},${l(u.y)}`}return C+"Z"}var Nt=100,Tt=1.6,ht=ft([]);function H(t){return t.length===1?t[0]:JSON.stringify(t)}function St(t,l,e){var et;let r=e.fontSize??16,s=Math.round(r*.875),d=Math.round(r*.8125),h=e.measurer??Mt(e.fontFamily),C=e.padding??8,i=It(t.subsets),M=new Map;i.forEach((a,c)=>M.set(a.id,c));let u=new Map;for(let{targets:a,styles:c}of t.styles){let $=H(a),w=u.get($);w||u.set($,w=new Map);for(let[N,S]of c)w.set(N,S)}let g=a=>{let c=u.get(a);if(!c)return ht;let $=[];for(let[w,N]of c)$.push(`${w}:${N}`);return ft($)},m=i.map(()=>[]);for(let a=0;a<i.length;a++)for(let c=a+1;c<i.length;c++)Math.hypot(i[a].x-i[c].x,i[a].y-i[c].y)<i[a].r+i[c].r&&(m[a].push(c),m[c].push(a));let x=new Map;for(let a of t.subsets)x.set(H(a.sets),a);let f=new Map;for(let[a,c]of x){let $=[...new Set(c.sets)],w=$.map(O=>M.get(O)),N=new Set(w),S=w[0];for(let O of w)i[O].r<i[S].r&&(S=O);let b=g(a),L=c.label??(c.sets.length===1?c.sets[0]:void 0),rt=(b.bold?1:0)|(b.italic?2:0),X=Y(i,w,m[S].filter(O=>!N.has(O)));X.margin<i[S].r*.2&&(X=Y(i,w,[]));let lt={sets:$,inside:w,spot:X,lines:[],style:b};if(L){let O=$.length===1?r:s;lt.lines.push({id:void 0,raw:L,size:O,base:rt,label:F(L,!1,h,O,4e3,rt)})}f.set(a,lt)}for(let a of t.textNodes){let c=a.label??a.id;(et=f.get(H(a.sets)))==null||et.lines.push({id:a.id,raw:c,size:d,base:0,label:F(c,!1,h,d,4e3)})}let y=0;for(let a of i)a.r>y&&(y=a.r);let n=y>0?Nt/y:1,o=1;for(let a of f.values()){if(a.spot.margin<=0)continue;let c=0,$=0;for(let N of a.lines)c=Math.max(c,N.label.width),$+=N.label.height;let w=Math.hypot(c,$)/2+4;o=Math.max(o,Math.min(w/(a.spot.margin*n),Tt))}n*=o;for(let a of f.values()){let c=Math.max(a.spot.margin*n*1.8,72);for(let $ of a.lines)$.label.width>c&&($.label=F($.raw,!1,h,$.size,c,$.base))}let p=1/0,A=1/0,I=-1/0,v=-1/0;for(let a of i)p=Math.min(p,(a.x-a.r)*n),A=Math.min(A,(a.y-a.r)*n),I=Math.max(I,(a.x+a.r)*n),v=Math.max(v,(a.y+a.r)*n);for(let a of f.values()){let c=0,$=0;for(let w of a.lines)c=Math.max(c,w.label.width),$+=w.label.height;p=Math.min(p,a.spot.x*n-c/2),I=Math.max(I,a.spot.x*n+c/2),A=Math.min(A,a.spot.y*n-$/2),v=Math.max(v,a.spot.y*n+$/2)}i.length===0&&(p=A=I=v=0);let T=F(t.title&&z(t.title),!1,h,r,4e3,1),R=T.height>0?T.height+12:0,k=Math.max(I-p,T.width),V=C+(k-(I-p))/2-p,Z=C+R-A,P=Math.ceil(k+2*C),K=Math.ceil(v-A+R+2*C),Q=i.map(a=>({id:a.id,x:a.x*n+V,y:a.y*n+Z,r:a.r*n})),tt="";Q.forEach((a,c)=>{var N;let $=gt(c),w=((N=f.get(a.id))==null?void 0:N.style)??ht;tt+=`<circle class="pele-venn-set" data-id="${W(a.id)}" cx="${q(a.x)}" cy="${q(a.y)}" r="${q(a.r)}" fill="${$}" fill-opacity="0.2" stroke="${$}"${w.shape}/>`});let U="",_="";for(let a of f.values()){let c=W(a.sets.join("|"));if(a.sets.length>1&&a.style.shape!==""){let b=vt(a.inside.map(L=>Q[L]),q);b!==""&&(U+=`<path class="pele-venn-overlap" data-id="${c}" d="${b}" fill="none"${a.style.shape}/>`)}let $=0;for(let b of a.lines)$+=b.label.height;if($===0)continue;let w=a.spot.x*n+V,N=a.spot.y*n+Z-$/2,S="";for(let b of a.lines){let L=b.id===void 0?` class="pele-label"${b.size===r?"":` font-size="${b.size}"`}${a.style.text}`:` class="pele-venn-text" data-id="${W(b.id)}" font-size="${d}" fill="var(--_m)"${g(b.id).text}`;S+=nt(b.label,w,N+b.label.height/2,L),N+=b.label.height}_+=`<g class="pele-venn-region" data-id="${c}">${S}</g>`}return{svg:yt("venn",P,K,r,e,{},nt(T,P/2,C+T.height/2,' class="pele-title" font-weight="var(--_tw)"')+`<g class="pele-venn-sets">${tt}</g>`+(U?`<g class="pele-venn-overlaps">${U}</g>`:"")+(_?`<g class="pele-venn-labels">${_}</g>`:"")),width:P,height:K,links:[]}}var Dt={type:"venn",parse(t,l,e){let r=new pt;return e&&(r.title=e),At(t,r),r},render:St};export{Dt as venn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as o,f as s,x as f}from"./RZSVICHU-BiwjruZZ.js";function m(g,l,c,i,e,a,r){let t=o(g,!1,l,c,4e3,1);if(t.height===0)return{width:e,height:a,content:r};let n=t.height+12,h=Math.max(e,Math.ceil(t.width+2*i));return{width:h,height:Math.ceil(a+n),content:s(t,h/2,i+t.height/2,' class="pele-title" font-weight="var(--_tw)"')+`<g transform="translate(${f((h-e)/2)},${f(n)})">${r}</g>`}}export{m as c};
|