@hardikg/mdview 0.10.0 → 0.11.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 +63 -0
- package/README.md +52 -10
- package/bin/chunk-RBYD2HWV.mjs +196 -0
- package/bin/chunk-WWM6JNAS.mjs +209 -0
- package/bin/chunk-XFRQFZZ4.mjs +20 -0
- package/bin/mdview.mjs +521 -1323
- package/bin/regex-worker.mjs +52 -0
- package/bin/server-KALIU7HM.mjs +1854 -0
- package/bin/shiki-5SFVA32N.mjs +13 -0
- package/dist/client/assets/23I4SOAX-BN9xvzna.js +2 -0
- package/dist/client/assets/26H2HVXD-Cu1OTMxT.js +2 -0
- package/dist/client/assets/2IZ5MNOH-DMjMO3_9.js +1 -0
- package/dist/client/assets/2P3CZEXH-D-4BP7dg.js +2 -0
- package/dist/client/assets/3E5HRNYT-DUYblpdl.js +5 -0
- package/dist/client/assets/3JIRLDUO-C1CwW1Ha.js +1 -0
- package/dist/client/assets/5MJ3UKSG-DtT76qKq.js +2 -0
- package/dist/client/assets/5THPTBWS-Ce_hS451.js +1 -0
- package/dist/client/assets/7WLXJQOR-D6QVYUu9.js +1 -0
- package/dist/client/assets/A255FCTW-woaH7Mj_.js +1 -0
- package/dist/client/assets/AM43MQ64-CsWC_OQH.js +2 -0
- package/dist/client/assets/AOZTNTMC-BIehUQHD.js +5 -0
- package/dist/client/assets/AQNLM6KG-DIUuJgPm.js +4 -0
- package/dist/client/assets/BNU2RHQB-DeXpwU5k.js +2 -0
- package/dist/client/assets/C5HTQT3I-7U13x70S.js +4 -0
- package/dist/client/assets/CPKRWH5G-CRxaqyOs.js +12 -0
- package/dist/client/assets/CUVCMPQX-JTGMOfG2.js +1 -0
- package/dist/client/assets/D4V2MWCI-CytzCr6g.js +1 -0
- package/dist/client/assets/DHKBVIA3-CVnlqiEq.js +1 -0
- package/dist/client/assets/DKTLEL5E-DciMwFJ1.js +1 -0
- package/dist/client/assets/DUZNPW7S-D3pifVNb.js +2 -0
- package/dist/client/assets/E3FWOBN4-D5m5o2g0.js +4 -0
- package/dist/client/assets/E65FQMJL-Bg5F0Zo8.js +1 -0
- package/dist/client/assets/FTXIJQGB-CggtIYAM.js +1 -0
- package/dist/client/assets/G3MDBVQH-BZmnMkFw.js +1 -0
- package/dist/client/assets/G3OATVW2-VpVvT5i2.js +8 -0
- package/dist/client/assets/IV52FOAS-DgPxxRI4.js +5 -0
- package/dist/client/assets/JTJEEBDN-Bl0iUT_r.js +2 -0
- package/dist/client/assets/K7FUICZ3-DgoihkiR.js +2 -0
- package/dist/client/assets/LHH2HHRB-BXHTnBD0.js +2 -0
- package/dist/client/assets/MSPQPZZY-DQg7F6a8.js +4 -0
- package/dist/client/assets/OB6ZFVKF-UHmC8m-y.js +2 -0
- package/dist/client/assets/PLTZDMI2-C1ZAoc-e.js +1 -0
- package/dist/client/assets/R7EPXMMD-ChI1SqjJ.js +5 -0
- package/dist/client/assets/RVARI57O-CgA1WoRv.js +1 -0
- package/dist/client/assets/SPBWZ4VS-EqfCsJ5V.js +1 -0
- package/dist/client/assets/SR7OOV3Q-CFnFs0kL.js +4 -0
- package/dist/client/assets/STAXBNH4-D4c13Xlj.js +2 -0
- package/dist/client/assets/SXFARSFO-CkFSkgdi.js +1 -0
- package/dist/client/assets/TC77ISAL--WP0GBo0.js +2 -0
- package/dist/client/assets/TYIQQHVC-B67pCpxM.js +13 -0
- package/dist/client/assets/TZUXETIT-BFD9W5hl.js +2 -0
- package/dist/client/assets/U7N72BGE-Do3829la.js +6 -0
- package/dist/client/assets/UFPIB6EZ-DTs_MyQv.js +3 -0
- package/dist/client/assets/UO52YEYL-DN1qbGwF.js +3 -0
- package/dist/client/assets/VIK3ONSK-DC8mR2sZ.js +2 -0
- package/dist/client/assets/VVVO4ZVP-DAtGLbxR.js +2 -0
- package/dist/client/assets/WRGXZO53-D30IuREw.js +3 -0
- package/dist/client/assets/X5SG7MGC-CdjdoL_s.js +2 -0
- package/dist/client/assets/XLHPVVFU-BFP9ID9p.js +2 -0
- package/dist/client/assets/XXYPNCD5-DqCewu_S.js +5 -0
- package/dist/client/assets/Z6WRYFJC-BEt1KCoU.js +7 -0
- package/dist/client/assets/ZI2QNEGF-VzC4uHcW.js +8 -0
- package/dist/client/assets/index-B96jWJTi.css +1 -0
- package/dist/client/assets/index-DCU09WmS.js +2 -0
- package/dist/client/assets/katex-C0xaXAD4.js +257 -0
- package/dist/client/assets/katex.min-3X1qOa03.js +1 -0
- package/dist/client/assets/katex.min-DMey5pMQ.css +1 -0
- package/dist/client/assets/lazy-DaMZI1F7.js +45 -0
- package/dist/client/index.html +2 -2
- package/package.json +32 -27
- package/dist/client/assets/2DXBBFLN-BxPqHNSN.js +0 -5
- package/dist/client/assets/46IJ22JX-u_jvQJNg.js +0 -2
- package/dist/client/assets/4TTDE5I4-BgbNAVNj.js +0 -3
- package/dist/client/assets/4UF3HTLV-DNbPxlOE.js +0 -2
- package/dist/client/assets/5THPTBWS-D57irc_4.js +0 -1
- package/dist/client/assets/7WLXJQOR-CHhKreq0.js +0 -1
- package/dist/client/assets/AAXQQPKT-CsAJqrOC.js +0 -5
- package/dist/client/assets/AKE5O7KZ-MSuBOjCG.js +0 -2
- package/dist/client/assets/BNMLP6AG-Ca3zyKQY.js +0 -3
- package/dist/client/assets/DKTLEL5E-B7ILCVTH.js +0 -1
- package/dist/client/assets/DR6PKOQU-Bw7cHvYp.js +0 -2
- package/dist/client/assets/E4RJ7UJB-CYB5C4K7.js +0 -2
- package/dist/client/assets/ELSXBIJH-DG0MW5dC.js +0 -1
- package/dist/client/assets/ERTIBQVS-BMWumWfk.js +0 -2
- package/dist/client/assets/F653G4FO-FI8M9Mc0.js +0 -12
- package/dist/client/assets/FKCDD66M-BPFkyrwI.js +0 -1
- package/dist/client/assets/FP7KDXVC-BLEBNkCO.js +0 -2
- package/dist/client/assets/FT5I3RHX-j5YoMicq.js +0 -6
- package/dist/client/assets/FTXIJQGB-nrHdCfp7.js +0 -1
- package/dist/client/assets/G3MDBVQH-EkdejvdW.js +0 -1
- package/dist/client/assets/GY35JXOZ-3ovTGxgz.js +0 -2
- package/dist/client/assets/H5EEJPP2-CNVQBEB3.js +0 -1
- package/dist/client/assets/HWDLEDTA-C_JcdBMO.js +0 -1
- package/dist/client/assets/JZWSX6AR-OwVPptYv.js +0 -1
- package/dist/client/assets/KQOEJWJY-DKTXya68.js +0 -2
- package/dist/client/assets/KS3BB3KE-QkpqVdmA.js +0 -1
- package/dist/client/assets/KXJRRZHI-BQRjeGWj.js +0 -2
- package/dist/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/client/assets/MFVI5XKI-DrRaRE9X.js +0 -1
- package/dist/client/assets/MWY2J62P-AbEgJnzK.js +0 -12
- package/dist/client/assets/MXGNCBL2-DG3CZR8g.js +0 -2
- package/dist/client/assets/N6DAJLIZ-BsZQKTyT.js +0 -3
- package/dist/client/assets/NU5M23IW-CvtpIovv.js +0 -2
- package/dist/client/assets/NV4XNBIS-nS8wAx3h.js +0 -8
- package/dist/client/assets/OGLU4SIR-DoTUWhkz.js +0 -2
- package/dist/client/assets/OUNS5N76-BwVLonT4.js +0 -8
- package/dist/client/assets/PU4ISKXV-BYX7eA_r.js +0 -2
- package/dist/client/assets/PUZGS23X-n6IKOr7S.js +0 -1
- package/dist/client/assets/Q3IYVLG5-hWt1rVyh.js +0 -4
- package/dist/client/assets/QYHQDLKZ-CjGeJM7R.js +0 -4
- package/dist/client/assets/RVARI57O-CXmrUIiS.js +0 -1
- package/dist/client/assets/RZSVICHU-BiwjruZZ.js +0 -4
- package/dist/client/assets/UEXXS2NB-Dkz_tz-N.js +0 -2
- package/dist/client/assets/UHTQJXKL-lvl-7QeT.js +0 -5
- package/dist/client/assets/URA2L2QI-B8pYKxOk.js +0 -1
- package/dist/client/assets/UXCHDUKG-BGy3ZRLM.js +0 -2
- package/dist/client/assets/VKNV3BUX-DZnoX4IV.js +0 -5
- package/dist/client/assets/VMV7XPHP-6QkisQwm.js +0 -4
- package/dist/client/assets/WEVWDWVA-nohBBhTA.js +0 -2
- package/dist/client/assets/XRRJ35LF-BE7gSN1k.js +0 -2
- package/dist/client/assets/YFKBLVVN-CVTPpei6.js +0 -6
- package/dist/client/assets/YHRE5QGZ-Bs7dUKjj.js +0 -4
- package/dist/client/assets/ZF3OVT4B-6LaC6iLs.js +0 -3
- package/dist/client/assets/index-392ivruk.js +0 -2
- package/dist/client/assets/index-CGQuEJ_w.css +0 -1
- package/dist/client/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dist/client/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
- package/dist/client/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dist/client/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
- package/dist/client/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dist/client/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
- package/dist/client/assets/katex-C5jXJg4s.js +0 -257
- package/dist/client/assets/katex.min-BYZTj3zW.css +0 -1
- package/dist/client/assets/katex.min-DXaO1tdm.js +0 -1
- package/dist/client/assets/lazy-CKqR1774.js +0 -43
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{_ as e,a as t,b as n,c as r,d as i,i as a,m as o,o as s,p as c,s as l,t as u,u as d,v as f,x as p,y as m}from"./E3FWOBN4-D5m5o2g0.js";import{a as h,t as g}from"./DKTLEL5E-DciMwFJ1.js";import{i as _,l as v}from"./CUVCMPQX-JTGMOfG2.js";import{t as y}from"./E65FQMJL-Bg5F0Zo8.js";import{i as b,r as x,t as ee}from"./3JIRLDUO-C1CwW1Ha.js";import{PeleError as S,_ as C,g as w,h as T,s as E,u as te}from"./lazy-DaMZI1F7.js";var D={REQUIREMENT:`Requirement`,FUNCTIONAL_REQUIREMENT:`Functional Requirement`,INTERFACE_REQUIREMENT:`Interface Requirement`,PERFORMANCE_REQUIREMENT:`Performance Requirement`,PHYSICAL_REQUIREMENT:`Physical Requirement`,DESIGN_CONSTRAINT:`Design Constraint`},O={LOW_RISK:`Low`,MED_RISK:`Medium`,HIGH_RISK:`High`},k={VERIFY_ANALYSIS:`Analysis`,VERIFY_DEMONSTRATION:`Demonstration`,VERIFY_INSPECTION:`Inspection`,VERIFY_TEST:`Test`},A={CONTAINS:`contains`,COPIES:`copies`,DERIVES:`derives`,SATISFIES:`satisfies`,VERIFIES:`verifies`,REFINES:`refines`,TRACES:`traces`},j=1e6,M=class{type=`requirement`;direction=`TB`;requirements=new Map;elements=new Map;relations=[];classes=new Map;title;accTitle;accDescr;newId=``;newText=``;newRisk=``;newVerifyMethod=``;newElementType=``;newDocRef=``;styleCopies=0;copy(e,t){if(this.styleCopies+=t.length,this.styleCopies>j)throw new S(`Requirement diagram applies too many style declarations.`,`limit`,{type:`requirement`});for(let n of t)e.push(n)}setDirection(e){this.direction=e}addRequirement(e,t){let n=this.requirements.get(e);return n===void 0&&(n={name:e,type:t,requirementId:this.newId,text:this.newText,risk:this.newRisk,verifyMethod:this.newVerifyMethod,cssStyles:[],classes:[`default`]},this.requirements.set(e,n)),this.newId=this.newText=this.newRisk=this.newVerifyMethod=``,n}setNewReqId(e){this.newId=e}setNewReqText(e){this.newText=e}setNewReqRisk(e){this.newRisk=e}setNewReqVerifyMethod(e){this.newVerifyMethod=e}addElement(e){let t=this.elements.get(e);return t===void 0&&(t={name:e,type:this.newElementType,docRef:this.newDocRef,cssStyles:[],classes:[`default`]},this.elements.set(e,t)),this.newElementType=this.newDocRef=``,t}setNewElementType(e){this.newElementType=e}setNewElementDocRef(e){this.newDocRef=e}addRelationship(e,t,n){this.relations.push({type:e,src:t,dst:n})}node(e){return this.requirements.get(e)??this.elements.get(e)}setCssStyle(e,t){for(let n of e){let e=this.node(n);if(!t||!e)return;for(let n of t)this.copy(e.cssStyles,n.includes(`,`)?n.split(`,`):[n])}}setClass(e,t){for(let n of e){let e=this.node(n);if(e)for(let n of t){e.classes.push(n);let t=this.classes.get(n)?.styles;t&&this.copy(e.cssStyles,t)}}}defineClass(e,t){for(let n of e){let e=this.classes.get(n);e===void 0&&(e={id:n,styles:[],textStyles:[]},this.classes.set(n,e));for(let n of t)n.includes(`color`)&&e.textStyles.push(n.replace(`fill`,`bgFill`)),e.styles.push(n);let r=t.flatMap(e=>e.split(`,`));for(let e of this.requirements.values())e.classes.includes(n)&&this.copy(e.cssStyles,r);for(let e of this.elements.values())e.classes.includes(n)&&this.copy(e.cssStyles,r)}}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
2
|
+
`)}},N=`$end.INVALID.title.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.direction_tb.direction_bt.direction_rl.direction_lr.NEWLINE.EOF.RD.STRUCT_START.STRUCT_STOP.STYLE_SEPARATOR.COLONSEP.ID.TEXT.RISK.VERIFYMTHD.REQUIREMENT.FUNCTIONAL_REQUIREMENT.INTERFACE_REQUIREMENT.PERFORMANCE_REQUIREMENT.PHYSICAL_REQUIREMENT.DESIGN_CONSTRAINT.LOW_RISK.MED_RISK.HIGH_RISK.VERIFY_ANALYSIS.VERIFY_DEMONSTRATION.VERIFY_INSPECTION.VERIFY_TEST.ELEMENT.CONTAINS.COPIES.DERIVES.SATISFIES.VERIFIES.REFINES.TRACES.TYPE.DOCREF.STYLE.CLASSDEF.CLASS.ALPHA.COLON.SEMICOLON.PERCENT.MINUS.BRKT.END_ARROW_L.END_ARROW_R.LINE.qString.unqString.COMMA`.split(`.`),P=new Map([[`requirementdiagram`,14],[`id`,19],[`text`,20],[`risk`,21],[`verifymethod`,22],[`requirement`,23],[`functionalrequirement`,24],[`interfacerequirement`,25],[`performancerequirement`,26],[`physicalrequirement`,27],[`designconstraint`,28],[`low`,29],[`medium`,30],[`high`,31],[`analysis`,32],[`demonstration`,33],[`inspection`,34],[`test`,35],[`element`,36],[`contains`,37],[`copies`,38],[`derives`,39],[`satisfies`,40],[`verifies`,41],[`refines`,42],[`traces`,43],[`type`,44],[`docref`,45],[`style`,46],[`classdef`,47],[`class`,48]]),F=/accTitle\s*:\s*/iy,I=/accDescr\s*:\s*/iy,L=/accDescr\s*\{\s*/iy,R=/direction\s+(?:(TB)|(BT)|(RL)|LR)/gi,z=/[\n\r\u2028\u2029]/g,B=22,V=new Uint8Array(128);for(let e of`:,\r
|
|
3
|
+
{<>-=`)V[e.charCodeAt(0)]=1;function ne(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=[[],[],[],[]],l=[[],[],[],[]],u=[0,0,0,0],d=!1,f=-1;R.lastIndex=0;for(let t=R.exec(e);t!==null;t=R.exec(e)){let e=t[1]===void 0?t[2]===void 0?t[3]===void 0?3:2:1:0;c[e].push(t.index),l[e].push(R.lastIndex),d=!0}let p=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},m=e=>{a.push(o),o=e},h=()=>{a.length>0&&(o=a.pop())},g=(t,n)=>(t.lastIndex=n,t.test(e)?t.lastIndex:-1),_=n=>{let r=e.indexOf(`
|
|
4
|
+
`,n);return r===-1?t:r},v=()=>{if(f<s){z.lastIndex=s,f=z.test(e)?z.lastIndex-1:t;for(let e=0;e<4;e++){let t=c[e],n=u[e];for(;n<t.length&&t[n]<=f;)n++;u[e]=n}}for(let e=0;e<4;e++){let t=u[e]-1;if(t>=0&&c[e][t]>=s)return p(8+e,s,_(l[e][t])),!0}return!1},y=a=>{let o=a|32;if(o===116&&e.slice(s+1,s+5).toLowerCase()===`itle`&&T(e.charCodeAt(s+5))){let n=s+6;for(;n<t;){let t=e.charCodeAt(n);if(t===35||t===10||t===59)break;n++}if(n>s+6)return p(2,s,n),!0}if(o===97&&(e.charCodeAt(s+1)|32)==99&&(e.charCodeAt(s+2)|32)==99){let e;if((e=g(F,s))>=0)return m(3),p(3,s,e),!0;if((e=g(I,s))>=0)return m(4),p(5,s,e),!0;if((e=g(L,s))>=0)return m(5),s=e,!0}if(d&&!C(a)&&v())return!0;if(a===10||a===13&&e.charCodeAt(s+1)===10){let n=s;for(;n<t;){let t=e.charCodeAt(n);if(t===10)n++;else if(t===13&&e.charCodeAt(n+1)===10)n+=2;else break}return p(12,s,n),!0}if(T(a)){for(s++;s<t&&T(e.charCodeAt(s));)s++;return!0}if(a===35||a===37)return s=_(s),!0;if(w(a)){let a=s+1;for(;a<t&&w(e.charCodeAt(a));)a++;if(a-s<=B){let t=P.get(e.slice(s,a).toLowerCase());if(t!==void 0)return(t===46||t===47||t===48)&&m(2),p(t,s,a),!0}for(;a<t;){let t=e.charCodeAt(a);if(t<128&&V[t]===1)break;a++}return n.push(59),r.push(e.slice(s,a).trim()),i.push(s),s=a,!0}switch(a){case 123:return p(15,s,s+1),!0;case 125:return p(16,s,s+1),!0;case 58:return e.charCodeAt(s+1)===58&&e.charCodeAt(s+2)===58?p(17,s,s+3):p(18,s,s+1),!0;case 60:return e.charCodeAt(s+1)===45&&(p(55,s,s+2),!0);case 45:return e.charCodeAt(s+1)===62?p(56,s,s+2):p(57,s,s+1),!0;case 34:return m(1),s++,!0;case 44:return p(60,s,s+1),!0}return!1},b=n=>{if(w(n)){let n=s+1;for(;n<t&&w(e.charCodeAt(n));)n++;return p(49,s,n),!0}switch(n){case 58:return p(50,s,s+1),!0;case 59:return p(51,s,s+1),!0;case 37:return p(52,s,s+1),!0;case 45:return p(53,s,s+1),!0;case 35:return p(54,s,s+1),!0;case 32:return s++,!0;case 34:return m(1),s++,!0;case 10:return h(),s++,!0;case 44:return p(60,s,s+1),!0}return!1};for(;s<t;){let a=e.charCodeAt(s),c=!0;switch(o){case 0:c=y(a);break;case 2:c=b(a);break;case 1:if(a===34)h(),s++;else{let n=e.indexOf(`"`,s);p(58,s,n===-1?t:n)}break;case 3:h(),p(4,s,_(s));break;case 4:h(),p(6,s,_(s));break;case 5:if(a===125)h(),s++;else{let n=e.indexOf(`}`,s);p(7,s,n===-1?t:n)}}if(!c)return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}}let x=o===0?13:o===1?58:o===3?4:o===4?6:o===5?7:-1;return x!==-1&&p(x,t,t),p(0,t,t),{types:n,texts:r,starts:i}}var re=[D.REQUIREMENT,D.FUNCTIONAL_REQUIREMENT,D.INTERFACE_REQUIREMENT,D.PERFORMANCE_REQUIREMENT,D.PHYSICAL_REQUIREMENT,D.DESIGN_CONSTRAINT,O.LOW_RISK,O.MED_RISK,O.HIGH_RISK,k.VERIFY_ANALYSIS,k.VERIFY_DEMONSTRATION,k.VERIFY_INSPECTION,k.VERIFY_TEST,``,A.CONTAINS,A.COPIES,A.DERIVES,A.SATISFIES,A.VERIFIES,A.REFINES,A.TRACES];function H(e){return e===49||e===50||e===54||e===53||e===51}function ie(e,t){let{types:n,texts:r,starts:i}=ne(e),a=0,o=[],s=[],c=(t,r=t,...o)=>{let s=n[a];if(s===1)throw E(`requirement`,e,i[a],``,!0);for(let e=r;e>=t;e--)o.unshift(e);let c=o.map(e=>`'${N[e]}'`).join(`, `);throw E(`requirement`,e,i[a],`Expecting ${c}, got '${N[s]}'`)},l=e=>(n[a]!==e&&c(e),r[a++]),u=(e,t)=>{let r=n[a];return(r<e||r>t)&&c(e,t),a++,re[r-23]},d=()=>{let e=n[a];return e!==59&&e!==58&&c(58,59),r[a++]},f=()=>{let e=n[a];if(e===3)a++,t.setAccTitle(l(4).trim());else if(e===5)a++,t.setAccDescription(l(6).trim());else if(e===7)t.setAccDescription(r[a++].trim());else return!1;return!0},p=()=>{let e=[];for(;;){let t=n[a];if(t!==49&&t!==59&&t!==58&&c(58,59,49),e.push(r[a++]),n[a]!==60)return e;a++}},m=()=>{let e=[];for(;;){H(n[a])||c(49,51,53,54);let t=r[a++];for(;H(n[a]);)t+=r[a++];if(e.push(t),n[a]!==60)return e;a++}},h=()=>{let e;return n[a]===17?(a++,e=p(),l(15)):n[a]===15?a++:c(15,15,17),l(12),e},g=e=>{for(o.length=0,s.length=0;;){let t=n[a];if(t===16){a++;break}t===12?a++:((e?t<19||t>22:t!==44&&t!==45)&&(e&&c(19,22,12,16),c(44,45,12,16)),a++,l(18),s.push(t===21?u(29,31):t===22?u(32,35):d()),o.push(t),l(12))}for(let e=o.length-1;e>=0;e--){let n=s[e];switch(o[e]){case 19:t.setNewReqId(n);break;case 20:t.setNewReqText(n);break;case 21:t.setNewReqRisk(n);break;case 22:t.setNewReqVerifyMethod(n);break;case 44:t.setNewElementType(n);break;default:t.setNewElementDocRef(n)}}};for(;f();)n[a]===12&&a++;for(n[a]!==14&&c(14,14,3,5,7),a++,l(12);;){let e=n[a];if(e===13)return;if(e===12)a++;else{if(f())continue;if(e>=8&&e<=11)a++,t.setDirection(e===8?`TB`:e===9?`BT`:e===10?`RL`:`LR`);else if(e>=23&&e<=28){let e=u(23,28),n=d(),r=h();g(!0),t.addRequirement(n,e),r&&t.setClass([n],r)}else if(e===36){a++;let e=d(),n=h();g(!1),t.addElement(e),n&&t.setClass([e],n)}else if(e===46){a++;let e=p();t.setCssStyle(e,m())}else if(e===47){a++;let e=p();t.defineClass(e,m())}else if(e===48){a++;let e=p();t.setClass(e,p())}else if(e===59||e===58){let e=r[a++],i=n[a];if(i===17)a++,t.setClass([e],p());else if(i===55||i===57){a++;let n=u(37,43);l(i===57?56:57);let r=d();i===57?t.addRelationship(n,e,r):t.addRelationship(n,r,e)}else c(17,17,55,57)}else c(12,13,3,5,7,8,9,10,11,23,24,25,26,27,28,36,47,48,46,59,58)}}}function ae(e){let t=[];for(let n of e.requirements.values())t.push({id:n.name,requirement:n,element:void 0,cssStyles:n.cssStyles,cssClasses:n.classes.join(` `)});for(let n of e.elements.values())t.push({id:n.name,requirement:void 0,element:n,cssStyles:n.cssStyles,cssClasses:n.classes.join(` `)});let n=t=>e.requirements.has(t)||e.elements.has(t)?t:void 0;return{nodes:t,edges:e.relations.map((e,t)=>({id:`${e.src}-${e.dst}-${t}`,start:n(e.src),end:n(e.dst),type:e.type,contains:e.type===A.CONTAINS})),direction:e.direction}}var oe=40,se=16,ce=56,U=14,W=10,G=2,K=12,le=120,ue=280,de=240,q=26,J=6,Y=9,X=4.5,fe=28,pe=14;function Z(e,t,n){if(t===0||e.lines.length===0)return e;let r=0,i=[],a=e.lines.map(a=>{let o=0,s=a.map(r=>{let i=r.style|t,a=r.icon!==void 0||r.math?r.width:n.width(r.text,e.size,i);return o+=a,{...r,style:i,width:a}});return i.push(o),o>r&&(r=o),s});return{...e,lines:a,widths:i,width:r}}function Q(e,n,i,a){let l=r(e),d=``,h=``;for(let r=0;r<e.lines.length;r++){let u=e.lines[r],g=i+c(e,r);if(f(u)){h+=s(m(e,r),n+e.widths[r]/2,g,a);continue}let _=g+e.size*.35,v=!0;for(let e of u)e.icon!==void 0||e.text===``||(d+=`<tspan${v?` x="${p(n)}" y="${p(_)}"`:``}${o(e.style&~l)}>${t(e.text)}</tspan>`,v=!1)}return(d===``?``:`<text${u(a,l)} text-anchor="start" xml:space="preserve">${d}</text>`)+h}function me(e,t,n,r){let i=J,a=e-n*i,o=t-r*i;return`<circle class="pele-marker" cx="${p(a)}" cy="${p(o)}" r="${i}"/><path class="pele-marker" d="M${p(a-n*i)},${p(o-r*i)}L${p(a+n*i)},${p(o+r*i)}M${p(a+r*i)},${p(o-n*i)}L${p(a-r*i)},${p(o+n*i)}"/>`}function he(e,t,n,r){let i=e-n*Y,a=t-r*Y;return`<path class="pele-marker" d="M${p(i-r*X)},${p(a+n*X)}L${p(e)},${p(t)}L${p(i+r*X)},${p(a-n*X)}" stroke-linejoin="round"/>`}function ge(e,t,n){let r=new Map;for(let n of t){let t=n.route;if(!(n.src===n.dst||t.length<6))for(let i of[0,t.length-3]){let a=i===0?n.src:n.dst,o=e[a],s=t[i]-o.x,c=t[i+1]-o.y,l=i===0?3:i-3,u;if(Math.abs(Math.abs(c)-o.h/2)<.5)u=c<0?0:2;else if(Math.abs(Math.abs(s)-o.w/2)<.5)u=s<0?3:1;else continue;let d=a*4+u,f={route:t,at:i,toward:t[u%2==0?l:l+1]},p=r.get(d);p?p.push(f):r.set(d,[f])}}for(let[t,i]of r){if(i.length<2)continue;let r=t>>2,a=t%2==1,o=(a?n[r].h:n[r].w)-2*pe,s=Math.max(0,Math.min(fe,o/(i.length-1)));i.sort((e,t)=>e.toward-t.toward);for(let t=0;t<i.length;t++){let n=(t-(i.length-1)/2)*s;a?i[t].route[i[t].at+1]=e[r].y+n:i[t].route[i[t].at]=e[r].x+n}}}function _e(e,t,n){return h(e.direction)?g(n,r=>$(e,t,n,r)):$(e,t,n,!1)}function $(t,r,o,c){let u=ae(t),f=o.fontSize??16,m=Math.round(f*.875),h=o.measurer??te(o.fontFamily,o.fontFamilyMono),g=o.padding??8,S=new Map,C=[],w=[];for(let e of u.nodes){let t=l(e.cssStyles),n=+!!t.bold|(t.italic?2:0),r=t.fontSize??f,i=t.fontSize??m,a=e.requirement,o=e.element,s=Z(d(`«${a?a.type:`Element`}»`,!1,h,i,4e3),n,h),c=Z(d(e.id,!0,h,r,ue),n|1,h),u=a?[[`ID`,a.requirementId],[`Text`,a.text],[`Risk`,a.risk],[`Verification`,a.verifyMethod]]:[[`Type`,o.type],[`Doc Ref`,o.docRef]],p=[],g=0,_=0,v=0;for(let[e,t]of u){if(!t)continue;let r=Z(d(e,!1,h,i,4e3),n,h),a=Z(d(t,!0,h,i,de),n,h),o=Math.max(r.height,a.height);p.push({key:r,value:a,height:o}),g=Math.max(g,r.width),_=Math.max(_,a.width),v+=o+G}p.length>0&&(v+=2*W-G);let y=2*W+s.height+c.height,b=Math.max(le,Math.max(s.width,c.width)+2*U,p.length>0?g+K+_+2*U:0);S.has(e.id)||S.set(e.id,C.length);let x=ee(b,y+v);x.seq=C.length,C.push({node:e,style:t,kind:s,name:c,rows:p,keyWidth:g,headHeight:y,w:b,h:y+v}),w.push(x)}let T=c?`TB`:x(u.direction),E=T===`LR`||T===`RL`,D=[],O=[],k=[];for(let e of u.edges){let t=e.start===void 0?void 0:S.get(e.start),n=e.end===void 0?void 0:S.get(e.end);if(t===void 0||n===void 0)continue;let r=d(`«${e.type}»`,!1,h,m,4e3);t===n&&(E?w[t].h+=2*(q+r.height+8):w[t].w+=2*(q+r.width+12)),k.push(e),O.push(r),D.push({src:t,dst:n,minlen:1,labelW:r.width+12,labelH:r.height+4,route:[],labelX:0,labelY:0})}let A=b(w,D,T,{nodeSep:oe,edgeSep:se,rankSep:ce,portSep:20});ge(w,D,C);let j=y(t.title,h,f,4e3),M=j.height>0?j.height+12:0,N=Math.max(A.width,j.width),P=g+(N-A.width)/2,F=g+M,I=Math.ceil(N+2*g),L=Math.ceil(A.height+M+2*g),R=``;for(let e=0;e<C.length;e++){let t=C[e],{w:r,h:o,style:c}=t,l=-r/2,u=-o/2,d=`<rect x="${p(l)}" y="${p(u)}" width="${p(r)}" height="${p(o)}" fill="var(--_s)" stroke="var(--_b)"${i(c.shape)}/>`+s(t.kind,0,u+W+t.kind.height/2,` class="pele-stereotype" font-size="${t.kind.size}" fill="var(--_m)"${c.text}`)+s(t.name,0,u+W+t.kind.height+t.name.height/2,` class="pele-label" font-size="${t.name.size}" font-weight="var(--_hw)"${c.text}`);if(t.rows.length>0){let e=u+t.headHeight;d+=`<path class="pele-divider" d="M${p(l)},${p(e)}H${p(-l)}" stroke="var(--_b)"${c.line}/>`;let n=e+W,r=``;for(let e of t.rows)r+=Q(e.key,l+U,n,` class="pele-field" fill="var(--_m)"${c.text}`)+Q(e.value,l+U+t.keyWidth+K,n,` class="pele-value"${c.text}`),n+=e.height+G;d+=`<g class="pele-fields" font-size="${t.rows[0].key.size}">${r}</g>`}R+=`<g class="pele-node ${t.node.requirement?`pele-requirement`:`pele-element`}${n(t.node.cssClasses.replace(/^default\s?/,``))}" data-id="${a(t.node.id)}" transform="translate(${p(w[e].x+P)},${p(w[e].y+F)})">${d}</g>`}let z=``,B=``,V=new Map;for(let e=0;e<D.length;e++){let t=D[e],n=k[e],r=O[e],i=n.contains?2*J:0,o,s=t.labelX+P,c=t.labelY+F;if(t.src===t.dst){let e=C[t.src],n=w[t.src].x+P,r=w[t.src].y+F,a=V.get(t.src)??0;V.set(t.src,a+1);let l=(E?e.w:e.h)/2,u=Math.min(l-4,12+a*6),d=q+a*8,f=(t,i)=>E?`${p(n+i)},${p(r+e.h/2+t)}`:`${p(n+e.w/2+t)},${p(r+i)}`,m=d/.75;o={d:`M${f(i,-u)}C${f(m,-u)} ${f(m,u)} ${f(0,u)}`,sx:E?n-u:n+e.w/2,sy:E?r+e.h/2:r-u,sdx:E?0:-1,sdy:E?-1:0,ex:E?n+u:n+e.w/2,ey:E?r+e.h/2:r+u,edx:E?0:-1,edy:E?-1:0},E?(s=n,c=r+e.h/2+d+4+t.labelH/2):(s=n+e.w/2+d+4+t.labelW/2,c=r)}else{let e=t.route.slice();for(let t=0;t<e.length;t+=3)e[t]+=P,e[t+1]+=F;o=v(e,void 0,i,0)}z+=`<g class="pele-edge pele-relationship-${n.contains?`contains`:`arrow`}" data-id="${a(n.id)}"><path d="${o.d}"${n.contains?``:` stroke-dasharray="5 4"`}/>`+(n.contains?me(o.sx,o.sy,o.sdx,o.sdy):he(o.ex,o.ey,o.edx,o.edy))+`</g>`,B+=_(n.id,r,s,c,``)}return{svg:e(`requirement`,I,L,f,o,t,s(j,I/2,g+j.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(z?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${z}</g>`:``)+(B?`<g class="pele-edge-labels" font-size="${m}" fill="var(--_m)">${B}</g>`:``)+`<g class="pele-nodes">${R}</g>`),width:I,height:L,links:[]}}var ve={type:`requirement`,math:!0,parse(e,t,n){let r=new M;return n&&(r.title=n),ie(e,r),r},render:_e};export{ve as requirement};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e,i as t,o as n,r,u as i,x as a}from"./E3FWOBN4-D5m5o2g0.js";import{r as o,t as s}from"./DKTLEL5E-DciMwFJ1.js";import{s as c}from"./CUVCMPQX-JTGMOfG2.js";import{r as l}from"./DUZNPW7S-D3pifVNb.js";import{g as u,h as d,s as f,u as p}from"./lazy-DaMZI1F7.js";var m=class{type=`ishikawa`;title;root;stack=[];baseLevel;addNode(e,t){let n={text:t,children:[]};if(!this.root){this.root=n,this.stack=[{level:0,node:n}];return}this.baseLevel??=e;let r=Math.max(e-this.baseLevel+1,1),i=this.stack;for(;i.length>1&&i[i.length-1].level>=r;)i.pop();i[i.length-1].node.children.push(n),i.push({level:r,node:n})}},h=[`$end`,`EOF`,`SPACELINE`,`NL`,`ISHIKAWA`,`SPACELIST`,`TEXT`];function g(e,t){let n=0;for(;n<13;){let r=e.charCodeAt(t+n),i=`ishikawa-beta`.charCodeAt(n);if(r!==i&&(r+32!==i||r<65||r>90))break;n++}return n===13&&!u(e.charCodeAt(t+13))?13:n>=8&&!u(e.charCodeAt(t+8))?8:0}function _(e){let t=[],n=[],r=[],i=e.length,a=0;for(;a<i;){let o=a,s=-1;for(;o<i&&d(e.charCodeAt(o));)e.charCodeAt(o)===10&&(s=o),o++;let c,l;if(e.charCodeAt(o)===37&&e.charCodeAt(o+1)===37)for(c=2,l=o+2;l<i;){let t=e.charCodeAt(l);if(t===10||t===13||t===8232||t===8233)break;l++}else if(o===a){let t=g(e,a);t>0?(c=4,l=a+t):(c=6,l=e.indexOf(`
|
|
2
|
+
`,a),l===-1&&(l=i))}else s>a?(c=2,l=s+1):s===a?(c=3,l=a+1):(c=5,l=o);t.push(c),n.push(a),r.push(l),a=l}return t.push(1,0),n.push(i,i),r.push(i,i),{types:t,starts:n,ends:r}}var v=`'SPACELINE', 'NL', 'EOF'`;function y(e,t){let{types:n,starts:r,ends:i}=_(e),a=0,o=t=>{throw f(`ishikawa`,e,r[a],`Expecting ${t}, got '${h[n[a]]}'`)};if(n[a]===2){for(a++;n[a]===2||n[a]===3;)a++;n[a]!==4&&o(`'SPACELINE', 'NL', 'ISHIKAWA'`)}else n[a]!==4&&o(`'SPACELINE', 'ISHIKAWA'`);for(a++,n[a]===3&&a++;;){let s=n[a];if(s===6||s===5&&n[a+1]===6){let c=s===6?a:a+1;a=c+1,n[a]!==2&&n[a]!==3&&n[a]!==1&&o(v),t.addNode(s===6?0:i[c-1]-r[c-1],e.slice(r[c],i[c]).trim())}else s===2||s===5?(a++,n[a]!==2&&n[a]!==3&&n[a]!==1&&o(s===5?`${v}, 'TEXT'`:v)):o(`'SPACELINE', 'SPACELIST', 'TEXT'`);for(a++;n[a]===3||n[a]===1;)a++;if(n[a]===0)return}}var b=.5,x=Math.hypot(b,1),S=14,C=6,w=8,T=22,E=18,D=5,O=26,k=34,A=28,j=10,M=5;function N(e,t,n,r,a){let o=i(e.text,!1,n,r,180),s=Math.round(a*1.5),c=[],l=[],u=[],d=(e,n,r)=>{let i=e.length;for(let a=i-1;a>=0;a--)u.push({node:e[t?i-1-a:a],depth:n,parent:r,slot:a,bone:-1})};for(d(e.children,2,-1);u.length>0;){let e=u.pop();if(e.bone!==-1){l.push(e.bone);continue}let t=c.length;c.push({label:i(e.node.text,!1,n,a,200),depth:e.depth,parent:e.parent,slot:e.slot,kids:e.node.children.length,rise:0,at:0,textEnd:0}),e.depth%2==0?l.push(t):(e.bone=t,u.push(e)),d(e.node.children,e.depth+1,t)}let f=S;for(let e of l){let t=Math.max(c[e].label.height,s)+C;c[e].rise=f+t/2,f+=t}let p=o.width+2*j,m=p/2;for(let e of c){let t=e.parent===-1?void 0:c[e.parent];e.depth%2==0?(e.at=t?t.at:0,e.textEnd=e.at-(e.kids>0?(e.kids+1)*T:E)-D):(e.at=t.at-(t.kids-e.slot)*T,e.textEnd=e.at-D),m=Math.max(m,e.label.width-e.textEnd)}return{node:e,label:o,boxW:p,boxH:o.height+2*M,bones:c,rise:f+w,reach:m}}function P(e,t,n){return s(n,r=>F(e,t,n,r))}function F(o,s,l,u){let d=l.fontSize??16,f=Math.round(d*.875),m=l.measurer??p(l.fontFamily,l.fontFamilyMono),h=l.padding??8;if(u)return I(o,l);let g=o.root,_=i(o.title,!1,m,d,4e3,1),v=_.height>0?_.height+12:0,y=``,S=0,C=0,w=0,T=0;if(g){let e=i(g.text,!1,m,d,200,1),o=Math.max(e.height+24,48),s=e.width+24+o/2,l=g.children.map((e,t)=>N(e,t%2==0,m,d,f));for(let e of l)e.rise=Math.max(e.rise,o/2+14);let u=[],p=-k;for(let e=0;e<l.length;e+=2){if(e>0){let t=0;for(let n=0;n<2;n++){let r=l[e-2+n],i=l[e+n];r&&(t=Math.max(t,r.reach+(i?i.boxW/2:0)))}p-=t+O}u.push(p,p)}let h=l.length>0?p-A:-k;C=s,S=h,w=-o/2,T=o/2;let _=``;l.forEach((e,i)=>{let o=i%2==0?-1:1,s=u[i],l=(e,t)=>s+e-t*b,d=l(0,e.rise),p=o*e.rise,m=`M${a(s-b/x*7)},${a(o*7/x)}L${a(d)},${a(p)}`,h=``;for(let t of e.bones){let r=o*t.rise;if(t.depth%2==0)m+=`M${a(l(t.at,t.rise))},${a(r)}H${a(l(t.textEnd+D,t.rise))}`;else{let n=e.bones[t.parent].rise;m+=`M${a(l(t.at,n))},${a(o*n)}L${a(l(t.at,t.rise))},${a(r)}`}let i=l(t.textEnd,t.rise);h+=n(t.label,i-t.label.width/2,r,t.depth>2?` fill="var(--_m)"`:``),S=Math.min(S,i-t.label.width)}let g=p+o*(e.boxH/2);S=Math.min(S,d-e.boxW/2),C=Math.max(C,d+e.boxW/2),w=Math.min(w,g-e.boxH/2),T=Math.max(T,g+e.boxH/2),_+=`<g class="pele-ishikawa-category" data-id="${t(e.node.text)}"><path class="pele-ishikawa-bones" d="${m}" fill="none" stroke="var(--_l)"/>`+c(`arrow_point`,s,0,b/x,-o/x,`var(--_l)`)+`<rect x="${a(d-e.boxW/2)}" y="${a(g-e.boxH/2)}" width="${a(e.boxW)}" height="${a(e.boxH)}" fill="var(--_s)" stroke="var(--_b)"${r}/>`+n(e.label,d,g,` class="pele-label"`)+(h?`<g class="pele-ishikawa-causes" font-size="${f}">${h}</g>`:``)+`</g>`});let v=o/2;y=`<path class="pele-ishikawa-spine" d="M${a(h)},0H${a(-7)}" fill="none" stroke="var(--_l)"/>`+c(`arrow_point`,0,0,1,0,`var(--_l)`)+_+`<g class="pele-ishikawa-head" data-id="${t(g.text)}"><path d="M0,${a(-v)}H${a(s-v)}A${a(v)},${a(v)} 0 0 1 ${a(s-v)},${a(v)}H0Z" fill="var(--_s)" stroke="var(--_b)" stroke-linejoin="round"/>`+n(e,12+e.width/2,0,` class="pele-label" font-weight="var(--_hw)"`)+`</g>`}let E=Math.max(C-S,_.width),j=Math.ceil(E+2*h),M=Math.ceil(T-w+v+2*h),P=h+(E-(C-S))/2-S,F=h+v-w;return{svg:e(`ishikawa`,j,M,d,l,{},n(_,j/2,h+_.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(y?`<g transform="translate(${a(P)},${a(F)})">${y}</g>`:``)),width:j,height:M,links:[]}}function I(r,s){let c=s.fontSize??16,u=Math.round(c*.875),d=s.measurer??p(s.fontFamily,s.fontFamilyMono),f=s.padding??8,m=Math.max(140,(s.maxWidth??320)-2*f),h=i(r.title,!1,d,c,o(s),1),g=[],_=r.root?[{node:r.root,depth:0,parent:-1}]:[],v=0;for(;_.length;){let e=_.pop(),t=g.length;g.push({...e,x:0,y:0,w:0,h:0}),v=Math.max(v,e.depth);for(let n=e.node.children.length-1;n>=0;n--)_.push({node:e.node.children[n],depth:e.depth+1,parent:t})}let y=Math.min(20,Math.max(2,(m-120)/Math.max(1,v))),b=f+(h.height?h.height+12:0),x=h.width,S=``,C=``;for(let e of g){e.x=f+e.depth*y;let r=Math.max(60,m-e.depth*y-20);e.label=l(i(e.node.text,!1,d,e.depth<2?c:u,r,+(e.depth<2)),d,r),e.w=e.label.width+20,e.h=e.label.height+12,e.y=b,b+=e.h+12,x=Math.max(x,e.x-f+e.w);let o=e.depth<2;if(S+=`<g class="pele-node ${e.depth===0?`pele-ishikawa-head`:e.depth===1?`pele-ishikawa-category`:`pele-ishikawa-cause`}" data-id="${t(e.node.text)}">`+(o?`<rect x="${a(e.x)}" y="${a(e.y)}" width="${a(e.w)}" height="${a(e.h)}" rx="${e.depth===0?12:4}" fill="var(--_s)" stroke="var(--_b)"/>`:``)+n(e.label,e.x+e.w/2,e.y+e.h/2,` class="pele-label"${e.depth<2?` font-weight="var(--_hw)"`:``}${e.depth>1?` font-size="${u}"`:``}`)+`</g>`,e.parent>=0){let t=g[e.parent],n=t.x+y/2;C+=`<path class="pele-edge" d="M${a(n)},${a(t.y+t.h)}V${a(e.y+e.h/2)}H${a(e.x)}" fill="none" stroke="var(--_b)"/>`}}let w=Math.ceil(x+2*f),T=Math.ceil(Math.max(f+h.height,b-12)+f),E=n(h,w/2,f+h.height/2,` class="pele-title" font-weight="var(--_tw)"`)+C+S;return{svg:e(`ishikawa`,w,T,c,s,{},E),width:w,height:T,links:[]}}var L={type:`ishikawa`,parse(e,t,n){let r=new m;return r.title=n,y(e,r),r},render:P};export{L as ishikawa};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as flowchart}from"./ZI2QNEGF-VzC4uHcW.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{_ as e,a as t,i as n,l as r,o as i,r as a,u as o,x as s}from"./E3FWOBN4-D5m5o2g0.js";import{o as c,r as l}from"./DKTLEL5E-DciMwFJ1.js";import{c as u,d,g as f,h as p,i as m,n as h,o as g,r as _,s as ee}from"./C5HTQT3I-7U13x70S.js";import{PeleError as v,d as y,u as te}from"./lazy-DaMZI1F7.js";function b(e){return e===32||e>=9&&e<=13||e>127&&/\s/.test(String.fromCharCode(e))}function x(){let e=1/0;return(t,n)=>{if(!t.startsWith(`accDescr`,n))return-1;let r=t.length,i=n+8;for(;i<r&&(t.charCodeAt(i)===32||t.charCodeAt(i)===9);)i++;if(t.charCodeAt(i)===58){for(i++;i<r;i++){let e=t.charCodeAt(i);if(e===10||e===13||e===37&&t.charCodeAt(i+1)===37)break}return i}for(;i<r&&b(t.charCodeAt(i));)i++;if(t.charCodeAt(i)!==123||i>=e)return-1;let a=t.indexOf(`}`,i+1);return a===-1&&(e=i),a+1||-1}}var S=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,C={name:`TITLE`,pattern:/title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/y,first:`t`},w={name:`ACC_TITLE`,pattern:/accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/y,first:`a`},T={name:`ACC_DESCR`,pattern:/accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/y,first:`a`,scanner:x};function E(e,t){return{name:e,pattern:e,longer:t}}function D(e,t){return{...m(e),longer:[t]}}function O(e){return{name:e,pattern:/[A-Z_a-z][\w-]*/y,first:S+`_`}}function k(e){return{name:e,pattern:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/y,first:`"'`}}function A(e){return[{name:e+`_WHITESPACE`,pattern:/[\t \r\n]+/y,hidden:!0,first:` \r
|
|
2
|
+
`},{..._,name:e+`_YAML`,first:`-`},{...g,name:e+`_DIRECTIVE`,first:` %`},{...ee,name:e+`_SINGLE_LINE_COMMENT`,first:` %`}]}function j(e){if(!e.includes(`\\`))return e.slice(1,-1);let t=e.length-1,n=``;for(let r=1;r<t;r++){let i=e[r];i===`\\`&&r+1<t?(i=e[++r],n+=i===`n`?`
|
|
3
|
+
`:i===`r`?`\r`:i===`t`?` `:i):n+=i}return n}function M(e,t,n,r,i,a){let o=new p(h(e,t,`railroad`),t,`railroad`),s={$type:n,rules:[]};for(o.expect(0);;){let e=o.kind;if(e===r){let e=d(o.take()),t=e[0];s.title=(t===`"`||t===`'`)&&e.endsWith(t)?i(e):e}else if(e===r+1)s.accTitle=f(o.take());else if(e===r+2)s.accDescr=u(o.take());else break}for(;o.kind!==-1;)s.rules.push(a(o));return s}var ne=[];function N(e){let t=e,n=t.element??t.primary??t.suffix,r=t.alternatives??t.elements??(n?[n]:ne);if(t.base){r=[t.base];for(let e of t.postfixes)e.except&&r.push(e.except)}return r}var P=e=>({type:`terminal`,value:e}),F=e=>({type:`nonterminal`,name:e}),I=e=>({type:`special`,text:e}),L=e=>({type:`optional`,element:e}),R=(e,t,n=1/0)=>({type:`repetition`,element:e,min:t,max:n});function z(e){return e.length===1?e[0]:{type:`sequence`,elements:e}}function B(e){return e.length===1?e[0]:{type:`choice`,alternatives:e}}function V(e,t){return e.rules.map(e=>({name:e.name,definition:H(e.definition,N,t)}))}function H(e,t,n){let r=[e],i=[t(e)],a=[[]];for(;;){let e=r.length-1,o=a[e];if(o.length<i[e].length){let n=i[e][o.length];r.push(n),i.push(t(n)),a.push([])}else{let t=n(r[e],o);if(e===0)return t;r.pop(),i.pop(),a.pop(),a[e-1].push(t)}}}var U=`0123456789`,W={name:`ABNF_RULENAME`,pattern:/[A-Za-z][A-Za-z0-9-]*/y,first:S},G={name:`ABNF_COMMENT`,pattern:/;[^\n\r]*/y,hidden:!0,first:`;`},K=[D(`railroad-abnf-beta`,W),E(`=`),E(`;`,[G]),E(`/`),E(`(`),E(`)`),E(`[`),E(`]`),C,w,T,W,{name:`ABNF_STRING`,pattern:/"[^"]*"/y,first:`"`},{name:`ABNF_NUMVAL`,pattern:/%[xXdDbB][0-9A-Fa-f]+(?:-[0-9A-Fa-f]+|\.[0-9A-Fa-f]+)*/y,first:`%`},{name:`ABNF_REPEAT`,pattern:/[0-9]*\*[0-9]*/y,first:U+`*`},{name:`ABNF_EXACT_REPEAT`,pattern:/[0-9]+/y,first:U},...A(`ABNF`),G];function q(e,t,n,r){let i={$type:`AbnfConcatenation`,elements:[]};return t.alternatives.push(i),{alternation:t,concatenation:i,node:e,close:n,repeat:r}}function re(e){let t=[],n=q(void 0,{$type:`AbnfAlternation`,alternatives:[]},-2,void 0);for(;;){let r=e.kind===14||e.kind===15?e.take():void 0,i,a=e.kind;switch(a){case 12:i={$type:`AbnfStringLiteral`,value:e.take().slice(1,-1)};break;case 13:i={$type:`AbnfNumVal`,value:e.take()};break;case 11:i={$type:`AbnfRuleName`,name:e.take()};break;case 4:case 6:{e.i++;let i={$type:`AbnfAlternation`,alternatives:[]};t.push(n),n=q({$type:a===4?`AbnfGroup`:`AbnfOptionalGroup`,element:i},i,a+1,r);continue}default:e.fail(`a string, a number, a name, or an opening bracket`)}for(;;){n.concatenation.elements.push(r===void 0?{$type:`AbnfElement`,primary:i}:{$type:`AbnfElement`,repeat:r,primary:i});let a=e.kind;if(a===n.close)e.i++,i=n.node,r=n.repeat,n=t.pop();else{if(a===3)e.i++,n.concatenation={$type:`AbnfConcatenation`,elements:[]},n.alternation.alternatives.push(n.concatenation);else if(a!==12&&a!==13&&a!==11&&a!==4&&a!==6&&a!==14&&a!==15){if(t.length===0)return n.alternation;e.fail(`token of type '${K[n.close].name}'`)}break}}}}function ie(e){return M(e,K,`RailroadAbnf`,8,e=>e.slice(1,-1),e=>{let t=e.expect(11);e.expect(1);let n=re(e);return e.expect(2),{$type:`AbnfRule`,name:t,definition:n}})}function ae(e,t){switch(e.$type){case`AbnfAlternation`:return B(t);case`AbnfConcatenation`:return z(t);case`AbnfElement`:{let n=e.repeat;if(!n)return t[0];let r=n.indexOf(`*`),i=r===-1,a=r>0||i?parseInt(n,10):0,o=i?a:r<n.length-1?parseInt(n.slice(r+1),10):1/0;return a===0&&o===1?L(t[0]):R(t[0],a,o)}case`AbnfStringLiteral`:case`AbnfNumVal`:return P(e.value);case`AbnfRuleName`:return F(e.name);case`AbnfGroup`:return t[0];case`AbnfOptionalGroup`:return L(t[0])}}var oe=e=>V(e,ae);function se(e,t){if(e.charCodeAt(t)!==63)return-1;let n=!1;for(let r=t+1;r<e.length;r++){let t=e.charCodeAt(r);if(t===63)return n?r+1:-1;if(t===59)return-1;n||=!b(t)}return-1}var ce=O(`EBNF_ID`),le={name:`EBNF_SPECIAL_SEQUENCE`,pattern:/\?(?=[^?;]*[^?\s;][^?;]*\?)[^?;]*\?/y,first:`?`,scanner:()=>se},ue=A(`EBNF`),de={name:`EBNF_ISO_COMMENT`,pattern:/\(\*[\s\S]*?\*\)/y,hidden:!0,first:`(`,opener:/\(\*/y},fe=[D(`railroad-ebnf-beta`,ce),E(`::=`),E(`=`),E(`;`),E(`|`),E(`,`),E(`(`,[de]),E(`)`),E(`[`),E(`]`),E(`{`),E(`}`),E(`?`,[le]),E(`*`),E(`+`),E(`-`,[ue[1]]),C,w,T,ce,k(`EBNF_STRING`),le,...ue,{name:`EBNF_BLOCK_COMMENT`,pattern:/\/\*[\s\S]*?\*\//y,hidden:!0,first:`/`,opener:/\/\*/y},de];function pe(e,t,n,r){let i={$type:`EbnfSequence`,elements:[]};return t.alternatives.push(i),{choice:t,sequence:i,term:void 0,node:e,close:n,except:r}}var me=[`EbnfGroup`,`EbnfOptional`,`EbnfRepetition`];function he(e){let t=[],n=pe(void 0,{$type:`EbnfChoice`,alternatives:[]},-2,!1),r=!1;for(;;){let i,a=e.kind;switch(a){case 20:i={$type:`EbnfTerminal`,value:j(e.take())};break;case 19:i={$type:`EbnfNonTerminal`,name:e.take()};break;case 21:i={$type:`EbnfSpecial`,text:e.take().slice(1,-1).trim()};break;case 6:case 8:case 10:{e.i++;let i={$type:`EbnfChoice`,alternatives:[]};t.push(n),n=pe({$type:me[a-6>>1],element:i},i,a+1,r),r=!1;continue}default:e.fail(`a terminal, a name, or an opening bracket`)}for(;;){r?(n.term.postfixes.push({$type:`EbnfExceptionPostfix`,except:i}),r=!1):(n.term={$type:`EbnfTerm`,base:i,postfixes:[]},n.sequence.elements.push(n.term));let a=n.term.postfixes;for(;;){let t=e.kind;if(t===12)a.push({$type:`EbnfOptionalPostfix`,operator:e.take()});else if(t===13)a.push({$type:`EbnfZeroOrMorePostfix`,operator:e.take()});else if(t===14)a.push({$type:`EbnfOneOrMorePostfix`,operator:e.take()});else break}let o=e.kind;if(o===n.close)e.i++,i=n.node,r=n.except,n=t.pop();else{if(o===15)e.i++,r=!0;else if(o===5)e.i++;else if(o===4)e.i++,n.sequence={$type:`EbnfSequence`,elements:[]},n.choice.alternatives.push(n.sequence);else if(o!==20&&o!==19&&o!==21&&o!==6&&o!==8&&o!==10){if(t.length===0)return n.choice;e.fail(`token of type '${fe[n.close].name}'`)}break}}}}function ge(e){return M(e,fe,`RailroadEbnf`,16,j,e=>{let t=e.expect(19);e.accept(2)||e.expect(1);let n={$type:`EbnfRule`,name:t,definition:he(e)};return e.expect(3),n})}function _e(e,t){switch(e.$type){case`EbnfChoice`:return B(t);case`EbnfSequence`:return z(t);case`EbnfTerm`:{let n=t[0],r=1;for(let i of e.postfixes)n=i.$type===`EbnfOptionalPostfix`?L(n):i.$type===`EbnfExceptionPostfix`?{type:`sequence`,elements:[n,P(`-`),t[r++]]}:R(n,+(i.$type===`EbnfOneOrMorePostfix`));return n}case`EbnfTerminal`:return P(e.value);case`EbnfNonTerminal`:return F(e.name);case`EbnfSpecial`:return I(e.text);case`EbnfGroup`:return t[0];case`EbnfOptional`:return L(t[0]);case`EbnfRepetition`:return R(t[0],0)}}var ve=e=>V(e,_e),ye=O(`RR_ID`),J=e=>E(e,[ye]),be=[D(`railroad-beta`,ye),J(`nonterminal`),J(`zeroOrMore`),J(`oneOrMore`),J(`sequence`),J(`optional`),J(`terminal`),J(`special`),J(`choice`),E(`=`),E(`;`),E(`(`),E(`,`),E(`)`),C,w,T,ye,k(`RR_STRING`),...A(`RR`),{name:`RR_BLOCK_COMMENT`,pattern:/\/\*[\s\S]*?\*\//y,hidden:!0,first:`/`,opener:/\/\*/y}];function xe(e){e.i++,e.expect(11);let t=j(e.expect(18));return e.expect(13),t}function Se(e){return{$type:e,element:void 0}}function Ce(e){let t=[];for(;;){let n;switch(e.kind){case 6:n={$type:`RailroadTerminalExpr`,value:xe(e)};break;case 1:n={$type:`RailroadNonTerminalExpr`,name:xe(e)};break;case 7:n={$type:`RailroadSpecialExpr`,text:xe(e)};break;case 4:n={$type:`RailroadSequenceExpr`,elements:[]};break;case 8:n={$type:`RailroadChoiceExpr`,alternatives:[]};break;case 5:n=Se(`RailroadOptionalExpr`);break;case 3:n=Se(`RailroadOneOrMoreExpr`);break;case 2:n=Se(`RailroadZeroOrMoreExpr`);break;default:e.fail(`an expression`)}if(`elements`in n||`alternatives`in n||`element`in n)e.i++,e.expect(11),t.push(n);else for(;;){let r=t[t.length-1];if(r===void 0)return n;if(`element`in r)r.element=n;else if((`elements`in r?r.elements:r.alternatives).push(n),e.accept(12))break;e.expect(13),t.pop(),n=r}}}function we(e){return M(e,be,`Railroad`,14,j,e=>{let t=e.expect(17);e.expect(9);let n=Ce(e);return e.expect(10),{$type:`RailroadRule`,name:t,definition:n}})}function Te(e,t){switch(e.$type){case`RailroadTerminalExpr`:return P(e.value);case`RailroadNonTerminalExpr`:return F(e.name);case`RailroadSpecialExpr`:return I(e.text);case`RailroadSequenceExpr`:return z(t);case`RailroadChoiceExpr`:return B(t);case`RailroadOptionalExpr`:return L(t[0]);default:return R(t[0],+(e.$type===`RailroadOneOrMoreExpr`))}}var Ee=e=>V(e,Te),De=O(`PEG_ID`),Oe=[D(`railroad-peg-beta`,De),E(`<-`),E(`;`),E(`/`),E(`&`),E(`!`),E(`?`),E(`*`),E(`+`),E(`(`),E(`)`),E(`.`),C,w,T,De,k(`PEG_STRING`),...A(`PEG`),{name:`PEG_LINE_COMMENT`,pattern:/#[^\n\r]*/y,hidden:!0,first:`#`}];function ke(e,t,n){let r={$type:`PegSequence`,elements:[]};return t.alternatives.push(r),{choice:t,sequence:r,node:e,operator:n}}function Ae(e){let t=[],n=ke(void 0,{$type:`PegOrderedChoice`,alternatives:[]},void 0);for(;;){let r=e.kind===4||e.kind===5?e.take():void 0,i;switch(e.kind){case 16:i={$type:`PegLiteral`,value:j(e.take())};break;case 15:i={$type:`PegIdentifier`,name:e.take()};break;case 11:i={$type:`PegAny`,dot:e.take()};break;case 9:{e.i++;let i={$type:`PegOrderedChoice`,alternatives:[]};t.push(n),n=ke({$type:`PegGroup`,element:i},i,r);continue}default:e.fail(`a literal, a name, a dot, or an opening parenthesis`)}for(;;){let a={$type:`PegSuffix`,primary:i};(e.kind===6||e.kind===7||e.kind===8)&&(a.operator=e.take()),n.sequence.elements.push(r===void 0?{$type:`PegPrefix`,suffix:a}:{$type:`PegPrefix`,operator:r,suffix:a});let o=e.kind;if(o===10&&t.length>0)e.i++,i=n.node,r=n.operator,n=t.pop();else{if(o===3)e.i++,n.sequence={$type:`PegSequence`,elements:[]},n.choice.alternatives.push(n.sequence);else if(o!==4&&o!==5&&o!==16&&o!==15&&o!==11&&o!==9){if(t.length===0)return n.choice;e.fail(`token of type ')'`)}break}}}}function je(e){return M(e,Oe,`RailroadPeg`,12,j,e=>{let t=e.expect(15);e.expect(1);let n={$type:`PegRule`,name:t,definition:Ae(e)};return e.expect(2),n})}function Me(e){switch(e.type){case`terminal`:return`"${e.value}"`;case`nonterminal`:return e.name;case`special`:return e.text;default:return`(...)`}}function Ne(e,t){let n=t[0];switch(e.$type){case`PegOrderedChoice`:return B(t);case`PegSequence`:return z(t);case`PegPrefix`:return e.operator?I(e.operator+Me(n)):n;case`PegSuffix`:return e.operator?e.operator===`?`?L(n):R(n,+(e.operator===`+`)):n;case`PegLiteral`:return P(e.value);case`PegIdentifier`:return F(e.name);case`PegAny`:return I(e.dot);case`PegGroup`:return n}}var Pe=e=>V(e,Ne),Fe=class{type=`railroad`;notation=`railroad`;title;accTitle;accDescr;rules=[];byName=new Map;setTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
4
|
+
`)}addRule(e){this.rules.push(e),this.byName.set(e.name,e)}getRule(e){return this.byName.get(e)}},Ie=/^\s*railroad-(ebnf-|abnf-|peg-)?beta/i;function Le(e){let t=Ie.exec(e);if(t===null)return;let n=t[1]?.toLowerCase();return n===`ebnf-`?`ebnf`:n===`abnf-`?`abnf`:n===`peg-`?`peg`:`railroad`}function Re(e,t){switch(t){case`ebnf`:{let t=ge(e);return[t,ve(t)]}case`abnf`:{let t=ie(e);return[t,oe(t)]}case`peg`:{let t=je(e);return[t,Pe(t)]}default:{let t=we(e);return[t,Ee(t)]}}}function ze(e,t,n){let[r,i]=Re(t,n);e.notation=n,r.accDescr&&e.setAccDescription(r.accDescr),r.accTitle&&e.setAccTitle(r.accTitle),r.title&&e.setTitle(r.title);for(let t of i)e.addRule(t)}function Be(e,t){let n=Le(e);if(n===void 0)throw new v(`No railroad diagram keyword found.`,`syntax`,{type:`railroad`});let r=new Fe;return t&&(r.title=t),ze(r,e,n),r}var Ve=12,He=6,Ue=18,Y=12,X=7;function Z(e,t,n,r){let i=e.railroad?.[t];return typeof i==`number`&&i>=0?Math.min(i,r):n}var We=/[\n\r\t]/g;function Q(e){return(e.includes(`¶ß`)?y(e.replace(/&/g,`&`)):e).replace(We,e=>e===`
|
|
5
|
+
`?`\\n`:e===`\r`?`\\r`:`\\t`)}function $(e,t){for(let n=t,r=e.length-1;n<r;n++,r--){let t=e[n];e[n]=e[r],e[r]=t}}function Ge(e){return Math.ceil(e/2)*2}function Ke(e,t,n,r,i){let a=i.height/2;return{kind:e,width:Math.max(Ge(i.measurer.width(t,i.size,r)+2*i.padding),i.height),up:a,down:a,kids:ne,text:t,id:n,reach:0}}function qe(e,t){if(t===1/0&&e<=1)return``;let n=e=>Number.isFinite(e)?String(e):`∞`;return e===t?n(e)+`×`:t===1/0?`≥`+n(e)+`×`:e===0?`≤`+n(t)+`×`:n(e)+`–`+n(t)+`×`}function Je(e,t,n,r){return Math.max(e+t.down+r.sep+n.up,2*r.arc)}function Ye(e,t){let n=Math.max(e.up+t.sep,2*t.arc);return{kind:5,width:e.width+4*t.arc,up:n,down:e.down,kids:[e],text:``,id:``,reach:n}}function Xe(e,t,n=1/0){let r=new Map,i=[[e,n]];for(let e=0;n!==1/0&&e<i.length;e++){let[n,a]=i[e];r.set(n,a);let o=n.type===`choice`||n.type===`optional`?4*t.arc:n.type===`repetition`?(n.min===0?6:2)*t.arc:n.type===`sequence`?6*t.arc:0;for(let e of N(n))i.push([e,Math.max(40,a-o)])}return H(e,N,(e,n)=>{let i=r.get(e)??1/0;switch(e.type){case`terminal`:{let n=Q(e.value);return Ke(0,/^ +$/.test(n)?`␣`.repeat(n.length):n,``,4,t)}case`nonterminal`:return Ke(1,Q(e.name),e.name,0,t);case`special`:return Ke(2,`? `+Q(e.text)+` ?`,``,2,t);case`sequence`:{let e=Math.max(0,n.length-1)*t.gap,r=0,a=0;for(let t of n)e+=t.width,r=Math.max(r,t.up),a=Math.max(a,t.down);let o={kind:3,width:e,up:r,down:a,kids:n,text:``,id:``,reach:0};if(e<=i||n.length<2)return o;let s=[],c=[],l=0,u=()=>{let e=0,t=0;for(let n of c)e=Math.max(e,n.up),t=Math.max(t,n.down);s.push({kind:3,width:l,up:e,down:t,kids:c,text:``,id:``,reach:0}),c=[],l=0};for(let e of n)c.length&&l+t.gap+e.width>Math.max(40,i-6*t.arc)&&u(),l+=(c.length?t.gap:0)+e.width,c.push(e);if(u(),s.length<2)return o;let d=0,f=0;for(let e=0;e<s.length;e++)d=Math.max(d,s[e].width),e&&(f+=s[e-1].down+Math.max(t.sep,2*t.arc)+s[e].up);return{kind:7,width:d+6*t.arc,up:s[0].up,down:f+s[s.length-1].down,kids:s,text:``,id:``,reach:0}}case`choice`:{let e=0,r=0;for(let i=0;i<n.length;i++)e=Math.max(e,n[i].width),i>0&&(r=Je(r,n[i-1],n[i],t));let i=n[n.length-1];return{kind:4,width:e+4*t.arc,up:n.length>0?n[0].up:0,down:i?r+i.down:0,kids:n,text:``,id:``,reach:0}}case`optional`:return Ye(n[0],t);case`repetition`:{let{min:r,max:i}=e,a=n[0];if(r===1&&i===1)return a;let o=qe(r,i),s=Math.max(a.down+t.sep,2*t.arc),c=o===``?0:Ge(t.measurer.width(o,Y,0)),l={kind:6,width:Math.max(a.width,c)+2*t.arc,up:a.up,down:s+(o===``?X/2+1:Y+6),kids:[a],text:o,id:``,reach:s};return r===0?Ye(l,t):l}}})}function Ze(e,t,n){return c(n,r=>Qe(e,t,n,r))}function Qe(c,u,d,f){let p=d.fontSize??16,m=Z(u,`fontSize`,0,200),h=m||Math.round(p*.875),g=m||p,_=Z(u,`padding`,-1,200),ee=Math.round(h*1.5),v={measurer:d.measurer??te(d.fontFamily,d.fontFamilyMono),size:h,padding:_<0?12:_,height:Ge(ee+(_<0?9:2*_)),gap:Math.min(Z(u,`horizontalSeparation`,16,500),f?12:1/0),sep:Z(u,`verticalSeparation`,10,500),arc:Math.min(Z(u,`arcRadius`,10,200),f?6:1/0)},y=u.railroad?.showMarkers===!1?0:Z(u,`markerRadius`,4,50),b=Z(u,`strokeWidth`,0,20),x=b>0?` stroke-width="${s(b)}"`:``,S=d.padding??8,{arc:C}=v,w=s(C),T=(e,t,n)=>`a${w},${w} 0 0 ${e} ${t}${w},${n}${w}`,E=T(1,``,``),D=T(0,``,``),O=T(0,``,`-`),k=T(1,``,`-`),A=T(0,`-`,``),j=T(0,`-`,`-`),M=o(c.title,!1,v.measurer,p,f?l(d):4e3,1),ne=M.height>0?M.height+16:0,N=Math.round(g*1.5),P=h*.35,F=v.height/2,I=``,L=``,R=``,z=(e,t,n)=>{n>e&&(I+=`M${s(e)},${s(t)}H${s(n)}`)},B=(e,i,o)=>{let c=[e],l=[i,o];for(;c.length>0;){let e=c.pop(),i=l.pop(),o=l.pop(),u=e.kids,d=o+e.width;switch(e.kind){case 3:{let e=d;for(let t=u.length-1;t>=0;t--)e-=u[t].width,c.push(u[t]),l.push(e,i),t>0&&z(e-v.gap,i,e),e-=v.gap;break}case 7:{let e=o+2*C,t=c.length,n=0;z(o,i,e);for(let t=0;t<u.length;t++){let r=u[t],a=i+n;if(c.push(r),l.push(a,e),t+1<u.length){let c=u[t+1],l=n+r.down+Math.max(v.sep,2*C)+c.up,f=i+n+r.down+Math.max(v.sep,2*C)/2;I+=`M${s(e+r.width)},${s(a)}H${s(d-2*C)}V${s(f)}H${s(o+C)}V${s(i+l)}H${s(e)}`,L+=`M${s(e-X)},${s(i+l-X/2)}l${X},${X/2}l${-X},${X/2}z`,n=l}else I+=`M${s(e+r.width)},${s(a)}H${s(d-C)}V${s(i)}H${s(d)}`}$(c,t),$(l,2*t);break}case 4:{let t=e.width-4*C,n=o+C,r=d-C,a=c.length,f=0;for(let e=0;e<u.length;e++){let a=u[e];e>0&&(f=Je(f,u[e-1],a,v));let p=i+f,m=o+2*C+(t-a.width)/2,h=e===u.length-1;e===0?(z(o,i,m),z(m+a.width,i,d)):I+=(h?`M${s(o)},${s(i)}${E}V${s(p-C)}`:`M${s(n)},${s(p-C)}`)+D+(m>n+C?`H${s(m)}`:``)+`M${s(m+a.width)},${s(p)}`+(m>n+C?`H${s(r-C)}`:``)+O+(h?`V${s(i+C)}${k}`:``),c.push(a),l.push(p,m)}$(c,a),$(l,2*a);break}case 5:{let t=u[0],n=o+2*C;z(o,i,n),z(n+t.width,i,d),I+=`M${s(o)},${s(i)}${O}V${s(i-e.reach+C)}${k}H${s(d-2*C)}${E}V${s(i-C)}${D}`,c.push(t),l.push(n,i);break}case 6:{let n=u[0],r=o+(e.width-n.width)/2,a=i+e.reach,f=o+e.width/2;z(o,i,r),z(r+n.width,i,d),I+=`M${s(o+C)},${s(i)}${A}V${s(a-C)}${D}H${s(d-C)}${O}V${s(i+C)}${j}`,L+=`M${s(f-X/2)},${s(a)}l${X},${-X/2}v${X}z`,e.text!==``&&(R+=`<text class="pele-edge-label pele-count" x="${s(f)}" y="${s(a+Y+3)}" font-size="${Y}" fill="var(--_m)">${t(e.text)}</text>`),c.push(n),l.push(r,i);break}default:{let c=e.text,l=c.startsWith(` `)||c.endsWith(` `)||c.includes(` `)?` xml:space="preserve"`:``,u=`<rect x="${s(o)}" y="${s(i-F)}" width="${s(e.width)}" height="${s(v.height)}"`,d=`<text x="${s(o+e.width/2)}" y="${s(i+P)}"${l}`;e.kind===0?R+=`<g class="pele-node pele-terminal">${u} rx="${s(F)}" fill="var(--_s)" stroke="var(--_b)"${x}/>${d} font-family="${r}">${t(c)}</text></g>`:e.kind===1?R+=`<g class="pele-node pele-nonterminal" data-id="${n(e.id)}">${u} fill="var(--_bg)" stroke="var(--_b)"${x}${a}/>${d}>${t(c)}</text></g>`:R+=`<g class="pele-node pele-special">${u} fill="var(--_bg)" stroke="var(--_b)" stroke-dasharray="4 3"${x}${a}/>${d} font-style="italic"><tspan fill="var(--_m)">? </tspan>${t(c.slice(2,-2))}<tspan fill="var(--_m)"> ?</tspan></text></g>`}}}},V=``,H=M.width,U=S+ne,W=S+M.height;for(let e of c.rules){let r=Xe(e.definition,v,f?Math.max(80,(d.maxWidth??320)-2*S-4*y-2*Ve-1):1/0),i=Q(e.name),a=U+N+He+r.up,o=S+2*y,c=o+Ve,l=c+r.width+Ve;I=``,L=``,R=``,z(o,a,c),z(c+r.width,a,l),B(r,c,a);let u=y>0?`<circle class="pele-marker pele-start" cx="${s(S+y)}" cy="${s(a)}" r="${s(y)}" fill="var(--_l)"/><circle class="pele-marker pele-end" cx="${s(l+y)}" cy="${s(a)}" r="${s(y)}" fill="var(--_l)"/>`:``;V+=`<g class="pele-rule" data-id="${n(e.name)}"><text class="pele-rule-name" x="${s(S)}" y="${s(U+N/2+g*.35)}" font-size="${s(g)}" font-weight="var(--_hw)" text-anchor="start">${t(i)}</text><path class="pele-edge pele-track" d="${I}" fill="none" stroke="var(--_l)"${x}/>`+(L?`<path class="pele-marker" d="${L}" fill="var(--_l)"/>`:``)+u+R+`</g>`,H=Math.max(H,l+2*y-S,v.measurer.width(i,g,1)),W=a+r.down,U=W+v.sep+Ue}let G=Math.ceil(H+2*S),K=Math.ceil(W+S),q=i(M,G/2,S+M.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(V?`<g class="pele-rules" transform="translate(0.5,0.5)" font-size="${s(h)}" text-anchor="middle">${V}</g>`:``);return{svg:e(`railroad`,G,K,p,d,c,q),width:G,height:K,links:[]}}var $e={type:`railroad`,parse:(e,t,n)=>Be(e,n),render:Ze};export{$e as railroad};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t,n){for(let r=0;r<n.length;r++){let i=e.charCodeAt(t+r),a=n.charCodeAt(r);if(i!==a&&!(a>=97&&a<=122&&i===a-32))return!1}return!0}export{e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t}from"./E3FWOBN4-D5m5o2g0.js";import{d as n}from"./lazy-DaMZI1F7.js";var r=`about:blank`,i=/^([^\w]*)(javascript|data|vbscript)/im,a=/&#(\w+)(^\w|;)?/g,o=/&(newline|tab);/gi,s=/[\u0000-\u001F\u007F-\u009F -\uD800-\uDFFF\uFFFE\uFFFF]/gimu,c=/^.+(:|:)/gim,l=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;function u(e){try{return decodeURIComponent(e)}catch{return e}}function d(e){if(!e)return r;let t=u(e.trim()),n,d=0;do{if(++d>32)return r;t=t.replace(s,``).replace(a,(e,t)=>String.fromCharCode(t)).replace(o,``).replace(s,``).replace(l,``).trim(),t=u(t),n=t.match(s)||t.match(a)||t.match(o)||t.match(l)}while(n&&n.length>0);if(!t)return r;if(t[0]===`.`||t[0]===`/`)return t;let f=t.trimStart(),p=f.match(c);if(!p)return t;let m=p[0].toLowerCase().trim();if(i.test(m))return r;let h=f.replace(/\\/g,`/`);if(m===`mailto:`||m.includes(`://`))return h;if(m===`http:`||m===`https:`){let e;try{e=new URL(h)}catch{return r}return e.protocol=e.protocol.toLowerCase(),e.hostname=e.hostname.toLowerCase(),e.toString()}return h}function f(e){return d(n(e))}var p=[`http`,`https`,`mailto`,`tel`],m=[`http`,`https`],h=/^([a-z][a-z0-9+.-]*):/i,g=/^[\\/]{2}/;function _(e,t){if(g.test(e))return;let n=h.exec(e);return!n||t.includes(n[1].toLowerCase())?e:void 0}function v(e,t){return t.links===!1?void 0:_(e,t.linkSchemes??p)}function y(e,t){return t.images===!1?void 0:_(e,t.imageSchemes??m)}var b=new RegExp(t.source,`gu`);function x(e,t){let n=d(e);return n===r||v(n,t)===void 0?!1:v(e.replace(b,``).replace(/[\t\n\r]/g,``).replace(/^[\x00-\x20]+/,``),t)!==void 0}function S(t,n,r,i,a,o=``){let s=v(n,a);return s===void 0?t:(i.push({id:r,href:s,internal:!1}),`<a href="${e(s)}"${o}${C(a)}>${t}</a>`)}function C(t){let n=t.linkRel??`noopener`;return n?` rel="${e(n)}"`:``}export{x as a,f as i,y as n,d as o,C as r,v as s,S as t};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{_ as e,a as t,d as n,i as r,o as i,s as a,u as o,x as s}from"./E3FWOBN4-D5m5o2g0.js";import{o as c,r as l}from"./DKTLEL5E-DciMwFJ1.js";import{a as u,s as d}from"./CUVCMPQX-JTGMOfG2.js";import{a as f}from"./A255FCTW-woaH7Mj_.js";import{o as p,t as m}from"./SPBWZ4VS-EqfCsJ5V.js";import{n as h}from"./DUZNPW7S-D3pifVNb.js";import{PeleError as g,g as _,h as v,s as y,u as b}from"./lazy-DaMZI1F7.js";var x=new Set([`label`,`type`,`descr`,`techn`,`sprite`,`tags`,`link`,`bgColor`,`fontColor`,`borderColor`,`shadowing`,`shape`,`legendText`,`legendSprite`]),S=new Set([`label`,`descr`,`techn`,`sprite`,`tags`,`link`,`textColor`,`lineColor`]);function C(e,t){let{key:n,value:r}=t;`from`in e&&(n===`offsetX`||n===`offsetY`)?e[n]=parseInt(r):(`from`in e?S:x).has(n)?e[n]=r:(e.extra??=new Map).set(n,r)}function w(e,t,n){n!==void 0&&(typeof n==`string`?e[t]=n:C(e,n))}function T(e,t,n){n===void 0?e[t]??=``:w(e,t,n)}function E(e,t){e.labelAttr=void 0,typeof t==`object`?(e.label=``,e.labelAttr=t,C(e,t)):e.label=t??``}var D=class{type=`c4`;c4Type;title;accTitle;accDescr;shapes=[];boundaries=[{alias:`global`,label:`global`,type:`global`,parent:void 0}];rels=[];shapeInRow=4;boundaryInRow=2;shapeIndex=new Map;boundaryIndex=new Map;relIndex=new Map;current=this.boundaries[0];stack=[];setC4Type(e){this.c4Type=e}setTitle(e){this.title=e}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
2
|
+
`)}element(e,t,n,r){let i=typeof n==`string`?t.get(n):void 0;return i===void 0&&(i={alias:``,label:``,parent:void 0},e.push(i),typeof n==`string`?(i.alias=n,t.set(n,i)):(i.aliasAttr=n,C(i,n))),E(i,r),i}addPersonOrSystem(e,t){let n=this.element(this.shapes,this.shapeIndex,t[0],t[1]);T(n,`descr`,t[2]),this.finishShape(n,e,t,3)}addContainer(e,t){let n=this.element(this.shapes,this.shapeIndex,t[0],t[1]);T(n,`techn`,t[2]),T(n,`descr`,t[3]),this.finishShape(n,e,t,4)}addComponent(e,t){this.addContainer(e,t)}finishShape(e,t,n,r){w(e,`sprite`,n[r]),w(e,`tags`,n[r+1]),w(e,`link`,n[r+2]),e.kind=t,e.parent=this.current}boundary(e,t){let n=this.element(this.boundaries,this.boundaryIndex,e[0],e[1]);return e[2]===void 0?n.type=t:w(n,`type`,e[2]),n}open(e){e.parent=this.current,this.stack.push(this.current),this.current=e}addPersonOrSystemBoundary(e,t=`system`){let n=this.boundary(e,t);w(n,`tags`,e[3]),w(n,`link`,e[4]),this.open(n)}addContainerBoundary(e){this.addPersonOrSystemBoundary(e,`container`)}addDeploymentNode(e,t){let n=this.boundary(t,`node`);T(n,`descr`,t[3]),w(n,`sprite`,t[4]),w(n,`tags`,t[5]),w(n,`link`,t[6]),n.nodeType=e,this.open(n)}popBoundaryParseStack(){this.current=this.stack.pop()??this.boundaries[0]}addRel(e,t){let n=t[0],r=t[1];if(n===void 0||r===void 0||t[2]===void 0)return;let i=typeof n==`string`&&typeof r==`string`,a=i?this.relIndex.get(n)?.get(r):void 0;if(a===void 0){if(a={type:e,from:``,to:``,label:``},this.rels.push(a),i){let e=this.relIndex.get(n);e===void 0&&this.relIndex.set(n,e=new Map),e.set(r,a)}typeof n==`string`?a.from=n:a.fromAttr=n,typeof r==`string`?a.to=r:a.toAttr=r}a.type=e,E(a,t[2]),T(a,`techn`,t[3]),T(a,`descr`,t[4]),w(a,`sprite`,t[5]),w(a,`tags`,t[6]),w(a,`link`,t[7])}getC4Shape(e){return this.shapeIndex.get(e)??this.boundaryIndex.get(e)}updateElStyle(e,t){let n=typeof t[0]==`string`?this.getC4Shape(t[0]):void 0;n!==void 0&&(w(n,`bgColor`,t[1]),w(n,`fontColor`,t[2]),w(n,`borderColor`,t[3]),w(n,`shadowing`,t[4]),w(n,`shape`,t[5]),w(n,`sprite`,t[6]),w(n,`techn`,t[7]),w(n,`legendText`,t[8]),w(n,`legendSprite`,t[9]))}updateRelStyle(e,t){let n=t[0],r=t[1],i=typeof n==`string`&&typeof r==`string`?this.relIndex.get(n)?.get(r):void 0;if(i===void 0)return;w(i,`textColor`,t[2]),w(i,`lineColor`,t[3]);let a=t[4],o=t[5];typeof a==`string`?i.offsetX=parseInt(a):a!==void 0&&C(i,a),typeof o==`string`?i.offsetY=parseInt(o):o!==void 0&&C(i,o)}updateLayoutConfig(e,t){let n=e=>e===void 0?NaN:parseInt(typeof e==`string`?e:e.value),r=n(t[0]),i=n(t[1]);r>=1&&(this.shapeInRow=r),i>=1&&(this.boundaryInRow=i)}},O=`$end.INVALID.direction_tb.direction_bt.direction_rl.direction_lr.title.accDescription.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.NEWLINE.C4_CONTEXT.C4_CONTAINER.C4_COMPONENT.C4_DYNAMIC.C4_DEPLOYMENT.PERSON.PERSON_EXT.SYSTEM.SYSTEM_DB.SYSTEM_QUEUE.SYSTEM_EXT.SYSTEM_EXT_DB.SYSTEM_EXT_QUEUE.CONTAINER.CONTAINER_DB.CONTAINER_QUEUE.CONTAINER_EXT.CONTAINER_EXT_DB.CONTAINER_EXT_QUEUE.COMPONENT.COMPONENT_DB.COMPONENT_QUEUE.COMPONENT_EXT.COMPONENT_EXT_DB.COMPONENT_EXT_QUEUE.ENTERPRISE_BOUNDARY.SYSTEM_BOUNDARY.BOUNDARY.CONTAINER_BOUNDARY.NODE.NODE_L.NODE_R.REL.BIREL.REL_U.REL_D.REL_L.REL_R.REL_B.REL_INDEX.UPDATE_EL_STYLE.UPDATE_REL_STYLE.UPDATE_LAYOUT_CONFIG.EOF_IN_STRUCT.ATTRIBUTE_EMPTY.STR.STR_KEY.STR_VALUE.LBRACE.RBRACE.EOF`.split(`.`),k=new Map([[`C4Context`,14],[`C4Container`,15],[`C4Component`,16],[`C4Dynamic`,17],[`C4Deployment`,18],[`Person`,19],[`Person_Ext`,20],[`System`,21],[`SystemDb`,22],[`SystemQueue`,23],[`System_Ext`,24],[`SystemDb_Ext`,25],[`SystemQueue_Ext`,26],[`Container`,27],[`ContainerDb`,28],[`ContainerQueue`,29],[`Container_Ext`,30],[`ContainerDb_Ext`,31],[`ContainerQueue_Ext`,32],[`Component`,33],[`ComponentDb`,34],[`ComponentQueue`,35],[`Component_Ext`,36],[`ComponentDb_Ext`,37],[`ComponentQueue_Ext`,38],[`Enterprise_Boundary`,39],[`System_Boundary`,40],[`Boundary`,41],[`Container_Boundary`,42],[`Deployment_Node`,43],[`Node`,43],[`Node_L`,44],[`Node_R`,45],[`Rel`,46],[`BiRel`,47],[`Rel_Up`,48],[`Rel_U`,48],[`Rel_Down`,49],[`Rel_D`,49],[`Rel_Left`,50],[`Rel_L`,50],[`Rel_Right`,51],[`Rel_R`,51],[`Rel_Back`,52],[`RelIndex`,53],[`UpdateElementStyle`,54],[`UpdateRelStyle`,55],[`UpdateLayoutConfig`,56]]),A=[/.*direction\s+TB[^\n]*/y,/.*direction\s+BT[^\n]*/y,/.*direction\s+RL[^\n]*/y,/.*direction\s+LR[^\n]*/y],j=/[\n\r\u2028\u2029]/g,M=/title[^\S\r\n]*(?=[\r\n]|$)\s*/y;function N(e){let t=e.length,n=[],r=[],i=[],a=0,o=9,s=0,c=!1,l=-2,u=-1,d=0,f=(e,t,a)=>{n.push(e),r.push(t),i.push(a),s=a},p=n=>{for(;n<t&&v(e.charCodeAt(n));)n++;return n},m=(n,r)=>{let i=e.indexOf(n,r);return i===-1?t:i},h=(n,r)=>{let i=s+n.length;if(!e.startsWith(n,s)||!v(e.charCodeAt(i)))return!1;let a=++i;for(;i<t;){let t=e.charCodeAt(i);if(t===35||t===10||t===59)break;i++}return i!==a&&(f(r,s,i),!0)};for(;;){if(c){f(0,t,t);break}s>=t&&(c=!0);let n=e.charCodeAt(s);if(a===0){if(s>=t){f(64,t,t);continue}if(l!==-1&&s>=d&&(l<s&&(l=e.indexOf(`direction`,s)),l!==-1&&(u<s&&(j.lastIndex=s,u=j.test(e)?j.lastIndex-1:t),l<u))){let t=!1;for(let n=0;n<4&&!t;n++)A[n].lastIndex=s,A[n].test(e)&&(f(2+n,s,A[n].lastIndex),t=!0);if(t)continue;d=u}if(n===116){if(M.lastIndex=s,M.test(e)){s=M.lastIndex;continue}if(h(`title`,6))continue}if(n===97){if(h(`accDescription`,7))continue;let t=e.startsWith(`accTitle`,s);if(t||e.startsWith(`accDescr`,s)){let n=p(s+8),r=e.charCodeAt(n);if(r===58){f(t?8:10,s,p(n+1)),o=t?9:11,a=7;continue}if(r===123&&!t){s=p(n+1),a=8;continue}}}if(n===37&&e.charCodeAt(s+1)===37){let n=m(`
|
|
3
|
+
`,s+2);for(;n<t&&(e.charCodeAt(n)===10||e.charCodeAt(n)===13);)n++;s=n;continue}if(v(n)){let n=s,r=-1;for(;n<t;){let t=e.charCodeAt(n);if(!v(t))break;t===10&&(r=n),n++}r===-1?s=n:f(13,s,r+1);continue}if(n===123){f(62,s,s+1);continue}if(n===125){f(63,s,s+1);continue}if(_(n)){let n=s+1;for(;n<t&&_(e.charCodeAt(n));)n++;let r=n-s<=19?k.get(e.slice(s,n)):void 0;if(r!==void 0){r>18&&(a=1),f(r,s,n);continue}}f(1,s,s);break}if(a===1){if(s>=t)f(57,t,t);else if(n===40){let t=s+1;for(;e.charCodeAt(t)===32;)t++;e.charCodeAt(t)===44?f(58,s,t+1):s++,a=2}else if(n===41)s++,a=0;else{f(1,s,s);break}}else if(a===2){if(s>=t)continue;if(n===41)s++,a=0;else if(n===44)e.charCodeAt(s+1)===44?f(58,s,s+2):s++;else{let t=s;for(;e.charCodeAt(t)===32;)t++;let n=e.charCodeAt(t);n===34?e.charCodeAt(t+1)===34?f(58,s,t+2):(s=t+1,a=3):n===36?(s=t+1,a=4):f(59,s,m(`,`,s))}}else if(a===3)n===34?(s++,a=2):f(59,s,m(`"`,s));else if(a===4)f(60,s,m(`=`,s)),a=5;else if(a===5){if(s>=t)continue;let r=s+1;if(n===61)for(;e.charCodeAt(r)===32;)r++;if(n!==61||e.charCodeAt(r)!==34){f(1,s,s);break}s=r+1,a=6}else if(a===6){if(s>=t)continue;n===34?(s++,a=2):f(61,s,m(`"`,s))}else a===7?(f(o,s,m(`
|
|
4
|
+
`,s)),a=0):n===125?(s++,a=0):f(12,s,m(`}`,s))}return{types:n,starts:r,ends:i}}var P=[`person`,`external_person`,`system`,`system_db`,`system_queue`,`external_system`,`external_system_db`,`external_system_queue`,`container`,`container_db`,`container_queue`,`external_container`,`external_container_db`,`external_container_queue`,`component`,`component_db`,`component_queue`,`external_component`,`external_component_db`,`external_component_queue`],F=[`rel`,`birel`,`rel_u`,`rel_d`,`rel_l`,`rel_r`,`rel_b`,`rel`],I=[`node`,`nodeL`,`nodeR`],ee=`'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'C4_CONTEXT', 'C4_CONTAINER', 'C4_COMPONENT', 'C4_DYNAMIC', 'C4_DEPLOYMENT'`,te=`'STR', 'STR_KEY', 'ATTRIBUTE', 'ATTRIBUTE_EMPTY'`;function L(e){return e===6||e===7||e===8||e===10||e===12}function ne(e){return e>=19&&e<=56}function R(e,t){let{types:n,starts:r,ends:i}=N(e),a=0,o=t=>e.slice(r[t],i[t]),s=t=>{let i=n[a];throw i===1?y(`c4`,e,r[a],``,!0):y(`c4`,e,r[a],`Expecting ${t}, got '${O[i]}'`)},c=e=>{n[a]!==e&&s(`'${O[e]}'`),a++},l=()=>{let e=[];for(;;){let t=n[a];if(t===59)e.push(o(a++).trim());else if(t===58)e.push(``),a++;else if(t===60)a++,n[a]!==61&&s(`'STR_VALUE'`),e.push({key:o(a-1).trim(),value:o(a).trim()}),a++;else break}return e.length===0&&s(te),e},u=e=>{e===6?t.setTitle(o(a++).substring(6)):e===7?t.setAccDescription(o(a++).substring(15)):e===12?t.setAccDescription(o(a++).trim()):(a++,e===8?(n[a]!==9&&s(`'acc_title_value'`),t.setTitle(o(a++).trim())):(n[a]!==11&&s(`'acc_descr_value'`),t.setAccDescription(o(a++).trim())))},d=e=>{a++;let r=l();if(e<=26)t.addPersonOrSystem(P[e-19],r);else if(e<=32)t.addContainer(P[e-19],r);else if(e<=38)t.addComponent(P[e-19],r);else{if(e<=45)return e===39?r.splice(2,0,`ENTERPRISE`):e===40?r.splice(2,0,`SYSTEM`):e===42&&r.splice(2,0,`CONTAINER`),e>=43?t.addDeploymentNode(I[e-43],r):e===42?t.addContainerBoundary(r):t.addPersonOrSystemBoundary(r),n[a]===62?(a++,c(13)):n[a]===13?(a++,c(62),n[a]===13&&a++):s(`'NEWLINE', 'LBRACE'`),!0;e<=53?(e===53&&r.splice(0,1),t.addRel(F[e-46],r)):e===54?t.updateElStyle(`update_el_style`,r):e===55?t.updateRelStyle(`update_rel_style`,r):t.updateLayoutConfig(`update_layout_config`,r)}return!1},f=n[a];(f<14||f>18)&&s(ee),a++,c(13);let p=0,m=0;for(;;){let e=n[a];if(m===3||m===4){if(e===13){a++,m=2;continue}if(m===3&&ne(e)){m=1;continue}}else if(ne(e)){d(e)?(p++,m=1):m=4;continue}else if(L(e)&&m!==1){u(e),m=3;continue}else m!==2&&s(`'title', 'accDescription', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'PERSON', 'REL'`);if(p>0)e!==63&&s(`'NEWLINE', 'RBRACE'`),a++,t.popBoundaryParseStack(),p--,m=4;else{e!==64&&s(`'NEWLINE', 'EOF'`),a++,c(0),t.setC4Type(o(0));return}}}var z=28,B=20,V=7,H=8,U=30,W=88,G=160,re=8,ie=26,ae=e=>Math.min(12,Math.max(6,e/14)),oe=e=>Math.min(12,e/4);function K(e,t,n,r,i,a,o,s){let c=0,l=1;if(o===0){if(i<e||i>n)return 1/0}else{let t=(e-i)/o,r=(n-i)/o;c=Math.max(c,Math.min(t,r)),l=Math.min(l,Math.max(t,r))}if(s===0){if(a<t||a>r)return 1/0}else{let e=(t-a)/s,n=(r-a)/s;c=Math.max(c,Math.min(e,n)),l=Math.min(l,Math.max(e,n))}return c<=l?c:1/0}function q(e,t,n,r,i,a,o,s){let c=o/n,l=s/r,u=(i-e)/n,d=(a-t)/r,f=c*c+l*l,p=2*(c*u+l*d),m=u*u+d*d-1,h=p*p-4*f*m;if(f===0||h<0)return 1/0;let g=(-p-Math.sqrt(h))/(2*f);return g>=0&&g<=1?g:m<=0?0:1/0}function J(e,t,n,r,i){let{x:a,y:o,w:s,h:c}=e,l=r-t,u=i-n;if(e.form===`person`)return Math.min(K(a,o+ie,a+s,o+c,t,n,l,u),q(a+s/2,o+14,13,13,t,n,l,u));if(e.form===`cyl`){let e=ae(s);return Math.min(K(a,o+e,a+s,o+c-e,t,n,l,u),q(a+s/2,o+e,s/2,e,t,n,l,u),q(a+s/2,o+c-e,s/2,e,t,n,l,u))}if(e.form===`h-cyl`){let e=oe(c);return Math.min(K(a+e,o,a+s-e,o+c,t,n,l,u),q(a+e,o+c/2,e,c/2,t,n,l,u),q(a+s-e,o+c/2,e,c/2,t,n,l,u))}return K(a,o,a+s,o+c,t,n,l,u)}function se(e,t,n,r,i){for(let a=2;a<e.length;a+=2){let o=e[a-2],s=e[a-1];if(K(t,n,r,i,o,s,e[a]-o,e[a+1]-s)<=1)return!0}return!1}function Y(e,t){return e.x<=t.x&&e.y<=t.y&&e.x+e.w>=t.x+t.w&&e.y+e.h>=t.y+t.h}function ce(e,t,n){let r=e.x+e.w/2,i=e.y+e.h/2,a=t.x+t.w/2,o=t.y+t.h/2,s=Y(e,t);if(s||Y(t,e)){let n=s?e:t,r=s?t:e,i=r.x+r.w/2,a=r.y+r.h/2,o=r.x-n.x,c=n.x+n.w-r.x-r.w,l=r.y-n.y,u=n.y+n.h-r.y-r.h,d=Math.min(o,c,l,u),f=d===o?n.x:d===c?n.x+n.w:i,p=d===o||d===c?a:d===u?n.y+n.h:n.y,m=Math.min(J(r,f,p,i,a),1),h=f+(i-f)*m,g=p+(a-p)*m;return s?[f,p,h,g]:[h,g,f,p]}let c=r,l=i,u=a,d=o,f=Math.max(e.x,t.x),p=Math.min(e.x+e.w,t.x+t.w),m=Math.max(e.y,t.y),h=Math.min(e.y+e.h,t.y+t.h);f<p?c=u=(f+p)/2:m<h&&(l=d=(m+h)/2);let g=Math.hypot(u-c,d-l)||1,_=-(d-l)/g*n,v=(u-c)/g*n,y=J(e,u+_,d+v,c+_,l+v),b=J(t,c+_,l+v,u+_,d+v);return y<=1&&b<=1?(c+=_,l+=v,u+=_,d+=v):(c=r,l=i,u=a,d=o,y=Math.min(J(e,u,d,c,l),1),b=Math.min(J(t,c,l,u,d),1)),[u+(c-u)*y,d+(l-d)*y,c+(u-c)*b,l+(d-l)*b]}var le=6,ue=3,de=12,fe=class{upright=[];level=[];frames=[[],[]];taken=new Map;squeezed=0;free(e,t,n,r){let i=Math.min(n,r),a=Math.max(n,r),o=(e,n)=>{for(let r=0;r<e.length;r+=3)if(Math.abs(e[r]-t)<n&&e[r+1]<a&&e[r+2]>i)return!0;return!1};return!o(e?this.upright:this.level,le)&&!o(this.frames[+!e],ue)}crossings(e){let t=0;for(let n=2;n<e.length;n+=2){let r=e[n]===e[n-2],i=r?e[n]:e[n+1],a=Math.min(r?e[n-1]:e[n-2],r?e[n+1]:e[n]),o=Math.max(r?e[n-1]:e[n-2],r?e[n+1]:e[n]),s=r?this.level:this.upright;for(let e=0;e<s.length;e+=3)s[e]>a&&s[e]<o&&s[e+1]<i&&s[e+2]>i&&t++}return t}frame(e){this.frames[0].push(e.x,e.y,e.y+e.h,e.x+e.w,e.y,e.y+e.h),this.frames[1].push(e.y,e.x,e.x+e.w,e.y+e.h,e.x,e.x+e.w)}take(e){for(let t=2;t<e.length;t+=2)e[t]===e[t-2]?this.upright.push(e[t],Math.min(e[t-1],e[t+1]),Math.max(e[t-1],e[t+1])):e[t+1]===e[t-1]&&this.level.push(e[t+1],Math.min(e[t-2],e[t]),Math.max(e[t-2],e[t]))}ports(e,t,n,r,i){let a=this.taken.get(e)??[],o=[];for(let e=0;e<9&&o.length<4;e++){let s=n+(e&1?1:-1)*Math.ceil(e/2)*de;if(s<r||s>i)continue;let c=!0;for(let e=0;e<a.length;e+=2)a[e]===t&&Math.abs(a[e+1]-s)<de&&(c=!1);c&&o.push(s)}return o.length?o:[n]}claim(e,t,n){let r=this.taken.get(e);r?r.push(t,n):this.taken.set(e,[t,n])}};function pe(e,t,n){let r=e.length,i=Math.sign(e[2]-e[0]),a=Math.sign(e[3]-e[1]),o=`M${s(e[0]+i*t)},${s(e[1]+a*t)}`;for(let t=2;t<r-2;t+=2){let n=e[t],r=e[t+1],i=Math.sign(n-e[t-2]),a=Math.sign(r-e[t-1]),c=Math.sign(e[t+2]-n),l=Math.sign(e[t+3]-r),u=Math.min(H,Math.abs(n-e[t-2]+r-e[t-1])/2,Math.abs(e[t+2]-n+e[t+3]-r)/2);o+=`${i?`H`+s(n-i*u):`V`+s(r-a*u)}Q${s(n)},${s(r)} ${s(n+c*u)},${s(r+l*u)}`}let c=Math.sign(e[r-2]-e[r-4]),l=Math.sign(e[r-1]-e[r-3]);return o+(c?`H`+s(e[r-2]-c*n):`V`+s(e[r-1]-l*n))}function me(e,t,n,r){for(let i of t)if(i!==n&&i!==r&&se(e,i.x,i.y,i.x+i.w,i.y+i.h))return!1;return!0}function he(e,t,n,r,i){let a=e.length;return{d:pe(e,n,r),sx:e[0],sy:e[1],sdx:-Math.sign(e[2]-e[0]),sdy:-Math.sign(e[3]-e[1]),ex:e[a-2],ey:e[a-1],edx:Math.sign(e[a-2]-e[a-4]),edy:Math.sign(e[a-1]-e[a-3]),x0:e[t],y0:e[t+1],x1:e[t+2],y1:e[t+3],nx:0,ny:0,lean:0,room:G,...i,points:e}}function ge(e,t){let n=[],r=(e+t)/2,i=Math.max(V,(t-e)/4);for(let a=0;a<9;a++){let o=r+(a&1?1:-1)*Math.ceil(a/2)*i;o>=e+le&&o<=t-le&&n.push(o)}return n}function _e(e,t,n,r,i,a){let o=e.x+e.w/2,s=e.y+e.h/2,c=t.x+t.w/2,l=t.y+t.h/2,u,d=(i,a,o)=>{if(!me(i,n,e,t))return;for(let e=2;e<i.length;e+=2){let t=i[e]===i[e-2];if(!r.free(t,t?i[e]:i[e+1],t?i[e-1]:i[e-2],t?i[e+1]:i[e]))return}let s=r.crossings(i)*1e6;for(let e=2;e<i.length;e+=2)s+=Math.abs(i[e]-i[e-2])+Math.abs(i[e+1]-i[e-1]);(!u||s<u.cost)&&(u={points:i,cost:s,upright:a,sides:o})};if(e.x+e.w<=t.x||t.x+t.w<=e.x){let n=c>o,i=Math.sign(l-s),a=n?[1,0]:[0,1],f=ge(n?e.x+e.w:t.x+t.w,n?t.x:e.x);e:for(let n of r.ports(e,a[0],s+i*e.h/4,e.y+8,e.y+e.h-8))for(let s of r.ports(t,a[1],l-i*t.h/4,t.y+8,t.y+t.h-8))for(let r of f){let i=r+(o-r)*Math.min(J(e,r,n,o,n),1),l=r+(c-r)*Math.min(J(t,r,s,c,s),1),f=u;if(d([i,n,r,n,r,s,l,s],!0,a),u!==f)break e}}if(e.y+e.h<=t.y||t.y+t.h<=e.y){let n=l>s,i=Math.sign(c-o),a=n?[3,2]:[2,3],f=ge(n?e.y+e.h:t.y+t.h,n?t.y:e.y);e:for(let n of r.ports(e,a[0],o+i*e.w/4,e.x+8,e.x+e.w-8))for(let o of r.ports(t,a[1],c-i*t.w/4,t.x+8,t.x+t.w-8))for(let r of f){let i=r+(s-r)*Math.min(J(e,n,r,n,s),1),c=r+(l-r)*Math.min(J(t,o,r,o,l),1),f=u;if(d([n,i,n,r,o,r,o,c],!1,a),u!==f)break e}}if(!u)return;let{points:f,upright:p,sides:m}=u;return r.take(f),r.claim(e,m[0],p?f[1]:f[0]),r.claim(t,m[1],p?f[7]:f[6]),he(f,2,i,a,{room:p?W:G})}function ve(e,t,n,r,i,a,o){if(e===t){let t=Math.min(e.h/2-4,10),n=Math.hypot(z,t),r=e.x+e.w,i=e.y+e.h/2,c=z/n,l=t/n;return{d:`M${s(r+c*a)},${s(i-t-l*a)}C${s(r+z)},${s(i-t*2)} ${s(r+z)},${s(i+t*2)} ${s(r+c*o)},${s(i+t+l*o)}`,sx:r,sy:i-t,sdx:-c,sdy:l,ex:r,ey:i+t,edx:-c,edy:-l,x0:r+z+4,y0:i,x1:r+z+4,y1:i,nx:1,ny:0,lean:0,room:64,points:[]}}let[c,l,u,d]=ce(e,t,n),f=c===u,p=!1;if(r&&!Y(e,t)&&!Y(t,e))for(let n of r)n!==e&&n!==t&&K(n.x,n.y,n.x+n.w,n.y+n.h,c,l,u-c,d-l)<=1&&(p=!0);if(r&&p&&!f&&l!==d){let n=_e(e,t,r,i,a,o);if(n)return n;i.squeezed++}if(r&&p&&(f||l===d)){let n=n=>{let i=n?-1/0:1/0,a=e=>{let t=f?e.x:e.y;i=n?Math.max(i,t+(f?e.w:e.h)):Math.min(i,t)};a(e),a(t);for(let n of r)n!==e&&n!==t&&K(n.x,n.y,n.x+n.w,n.y+n.h,c,l,u-c,d-l)<=1&&a(n);return i},s=f?Math.min(e.y,t.y):Math.min(e.x,t.x),p=f?Math.max(e.y+e.h,t.y+t.h):Math.max(e.x+e.w,t.x+t.w),m=(n,i)=>{for(let a of r){if(a===e||a===t)continue;let r=f?a.y<p&&a.y+a.h>s:a.x<p&&a.x+a.w>s,o=f?a.x:a.y,c=o+(f?a.w:a.h);if(r&&(n?c>i:o<i))return!1}return!0},h=e.x+e.w/2,g=e.y+e.h/2,_=t.x+t.w/2,v=t.y+t.h/2,y=Math.sign(f?v-g:_-h),b=a=>{let o=n(a),s=a?1:-1,c=f?+!!a:a?3:2,l=f?i.ports(e,c,g+y*e.h/4,e.y+8,e.y+e.h-8)[0]:i.ports(e,c,h+y*e.w/4,e.x+8,e.x+e.w-8)[0],u=f?i.ports(t,c,v-y*t.h/4,t.y+8,t.y+t.h-8)[0]:i.ports(t,c,_-y*t.w/4,t.x+8,t.x+t.w-8)[0],d=n=>{if(f){let r=n+(h-n)*Math.min(J(e,n,l,h,l),1),i=n+(_-n)*Math.min(J(t,n,u,_,u),1);return[r,l,n,l,n,u,i,u]}let r=n+(g-n)*Math.min(J(e,l,n,l,g),1),i=n+(v-n)*Math.min(J(t,u,n,u,v),1);return[l,r,l,n,u,n,u,i]},p=d(o+s*B);for(let n=0;n<=4;n++){let a=o+s*(B+n*V),m=d(a);if(me(m,r,e,t)&&(p=m,i.free(f,a,l,u)))return{points:p,side:c,p0:l,p1:u,step:n}}return{points:p,side:c,p0:l,p1:u,step:5}},x=f?d>l:u<c,S=m(x,n(x)),C=m(!x,n(!x)),w=b(x),T=S===C?b(!x):void 0,E=e=>i.crossings(e.points)*8+e.step,D=C&&!S||T&&E(T)<E(w)?!x:x,{points:O,side:k,p0:A,p1:j,step:M}=D===x?w:T??b(!x),N=D?1:-1;return M>4&&i.squeezed++,i.take(O),i.claim(e,k,A),i.claim(t,k,j),he(O,2,a,o,f?{nx:N,lean:U,room:W}:{room:G})}let m=Math.hypot(u-c,d-l)||1,h=(u-c)/m,g=(d-l)/m;return(f||l===d)&&i.take([c,l,u,d]),{d:`M${s(c+h*a)},${s(l+g*a)}L${s(u-h*o)},${s(d-g*o)}`,sx:c,sy:l,sdx:-h,sdy:-g,ex:u,ey:d,edx:h,edy:g,x0:c,y0:l,x1:u,y1:d,nx:n?-g:0,ny:n?h:0,lean:0,room:Math.abs(h)>Math.abs(g)?W:G,points:[c,l,u,d]}}var ye=216,be=64,xe=14,Se=12,Ce=W+re+24,we=88,Te=B+8,X=48,Z=16,Ee=10,De=new Map([[`person`,`person`],[`box`,`rect`],[`rounded`,`rect`],[`component`,`rect`],[`cylinder`,`cyl`],[`database`,`cyl`],[`db`,`cyl`],[`queue`,`h-cyl`],[`pipe`,`h-cyl`]]);function Oe(e){let t=De.get((e.shape??``).toLowerCase())??De.get((e.sprite??``).toLowerCase());if(t)return t;if(e.tags)for(let t of e.tags.split(`,`)){let e=De.get(t.trim().toLowerCase());if(e)return e}let n=e.kind;return n.endsWith(`person`)?`person`:n.endsWith(`_db`)?`cyl`:n.endsWith(`_queue`)?`h-cyl`:`rect`}function ke(e,t,n,r,i=ye){let a=Oe(e),s=a===`h-cyl`?36:0,c=a===`person`?ie:a===`cyl`?24:0,l=i-2*xe-s,u=[o(`«`+e.kind.replace(/_/g,` `)+`»`,!1,t,r-1,l),o(e.label,!1,t,n,l,1),o(e.techn?`[${e.techn}]`:void 0,!1,t,r,l),o(e.descr,!1,t,r,l)],d=0,f=u[3].height>0?4:0;for(let e of u)d=Math.max(d,e.width),f+=e.height;return{shape:e,form:a,labels:u,textH:f,x:0,y:0,w:Math.max(i,d+2*xe+s),h:Math.max(be,f+2*Se+c)}}function Ae(e,t,n,r,i){let a=0,o=0;for(let s=0;s<e.length;s+=t){let c=Math.min(e.length,s+t),l=0,u=0;for(let t=s;t<c;t++)u=Math.max(u,e[t].h);for(let t=s;t<c;t++){let r=e[t];r.x=l,r.y=o,i&&(r.h=u),l+=r.w+n}a=Math.max(a,l-n),o+=u+r}return[a,e.length>0?o-r:0]}function je(e,t,n,r,i,a){let s=i===void 0?Te:12,c=new Map;for(let a of e.boundaries){let e=i===void 0?4e3:Math.max(80,i-2*Z-2*Te*2),l=a.parent?[o(a.label,!1,t,n,e,1),o(a.type?`[${a.type}]`:void 0,!1,t,r,e),o(a.descr,!1,t,r,e)]:[],u=0,d=0;for(let e of l)u+=e.height,d=Math.max(d,e.width);c.set(a,{boundary:a,kids:[],nodes:[],labels:l,head:u>0?u+Ee+6+B:s,headW:d,headX:Z,x:0,y:0,w:0,h:0,form:`rect`})}let l=c.get(e.boundaries[0]);for(let e of c.values()){let t=e.boundary.parent;t&&c.get(t)?.kids.push(e)}let u=[l],d=new Map([[l.boundary,0]]);for(let e=0;e<u.length;e++)for(let t of u[e].kids)d.set(t.boundary,d.get(u[e].boundary)+1),u.push(t);for(let a of e.shapes)if(a.parent){let e=d.get(a.parent)??0,o=i===void 0?ye:Math.max(100,Math.min(ye,i-2*e*s-32));c.get(a.parent)?.nodes.push(ke(a,t,n,r,o))}let f=Math.max(1,e.shapeInRow),p=Math.max(1,e.boundaryInRow),m=new Map;for(let e=u.length-1;e>=0;e--){let t=u[e],n=i===void 0?Ce:a,r=(e,t,n)=>{if(i===void 0)return t;let r=1;for(let t of e)r=Math.max(r,t.w);return Math.max(1,Math.min(t,Math.floor((i+n-2*s)/(r+n))))},[o,c]=Ae(t.nodes,r(t.nodes,f,n),n,we,!0),[d,h]=Ae(t.kids,r(t.kids,p,X),X,X,!1),g=c>0&&h>0?X:0,_=t===l?0:s;m.set(t,c+g),t.w=Math.max(o,d,t.headW+2*Z-2*_)+2*_,t.h=(_&&t.head)+c+g+h+_}let h=new Map;for(let e of u){let t=e.x+(e===l?0:s),n=e.y+(e===l?0:e.head);for(let r of e.nodes)r.x+=t,r.y+=n,h.set(r.shape,r);for(let r of e.kids)r.x+=t,r.y+=n+m.get(e);e!==l&&h.set(e.boundary,e)}return{order:u,boxes:h}}var Me=7,Q=36,Ne=24,Pe=2e3,$=8,Fe=[.5,.4,.6,.3,.7,.2,.8],Ie=2e6;function Le(e,t,n){let r=[];return e&&r.push(`fill:`+e),t&&r.push(`stroke:`+t),n&&r.push(`color:`+n),a(r)}function Re(e,t,n,r,i){return t?m(e,p(t.includes(`¶ß`)?t.replace(/\ufb02\u00b0\u00b0?/g,`#`).replace(/\u00b6\u00df/g,`;`):t),n,r,i):e}function ze(e,t,n){return c(n,r=>{if(!r)return Be(e,t,n,!1)[0];let[i,a]=Be(e,t,n,!0,Q);for(let r=Q+Ne;a>0&&r<=Q+3*Ne;r+=Ne){let[o,s]=Be(e,t,n,!0,r);s<a&&([i,a]=[o,s])}return i})}function Be(a,c,p,m,_=Q){let v=p.fontSize??16,y=Math.round(v*.8125),x=p.measurer??b(p.fontFamily,p.fontFamilyMono),S=p.padding??8,C=[],{order:w,boxes:T}=je(a,x,v,y,m?Math.max(80,(p.maxWidth??320)-2*S):void 0,_),E=w[0],D=0,O=0,k=E.w,A=E.h,j=(e,t,n,r)=>{D=Math.min(D,e),O=Math.min(O,t),k=Math.max(k,n),A=Math.max(A,r)},M=[],N=new Map;for(let e of a.rels){let t=e.fromAttr?void 0:a.getC4Shape(e.from),n=e.toAttr?void 0:a.getC4Shape(e.to),r=t&&T.get(t),i=n&&T.get(n);if(!r||!i)throw new g(`C4 rel "${e.from}" -> "${e.to}" references an unknown shape or boundary`,`semantic`,{type:`c4`});M.push(r,i);let o=N.get(r);o||N.set(r,o=new Set),o.add(i)}let P=[],F=[];for(let e of w)for(let t of e.nodes)P.push(t),F.push(t.x+$,t.y+$,t.x+t.w-$,t.y+t.h-$);let I=a.rels.length*(P.length+w.length+3*a.rels.length)<=Ie,ee=(e,t,n,r)=>{let i=0;for(let a=0;a<F.length;a+=4){let o=Math.min(n,F[a+2])-Math.max(e,F[a]);if(o<=0)continue;let s=Math.min(r,F[a+3])-Math.max(t,F[a+1]);s>0&&(i+=o*s)}return i},te=e=>e?Math.max(-Pe,Math.min(Pe,e)):0,L=``,ne=u(`arrow_point`),R=new fe;for(let e of w)e!==E&&R.frame(e);let z=a.rels.map((e,n)=>{let i=M[n*2],a=M[n*2+1],o=Le(void 0,e.lineColor,void 0),s=o.stroke?t(o.stroke):`var(--_l)`,c=e.type===`birel`||e.type===`rel_b`,l=e.type!==`rel_b`,u=ve(i,a,i!==a&&N.get(a)?.has(i)===!0?Me:0,I?P:void 0,R,c?ne:0,l?ne:0);return j(Math.min(u.x0,u.x1),Math.min(u.y0,u.y1),Math.max(u.x0,u.x1),Math.max(u.y0,u.y1)),c&&I&&F.push(u.sx-8,u.sy-8,u.sx+8,u.sy+8),l&&I&&F.push(u.ex-8,u.ey-8,u.ex+8,u.ey+8),L+=`<g class="pele-edge" data-id="${r(e.from+`-`+e.to)}"${o.line}><path d="${u.d}"/>`+(c?d(`arrow_point`,u.sx,u.sy,u.sdx,u.sdy,s):``)+(l?d(`arrow_point`,u.ex,u.ey,u.edx,u.edy,s):``)+`</g>`,u});for(let e of w){if(!I||e.headW===0)continue;let t=e.y+Ee,n=e.y+e.head-B,r=1/0;for(let i of[Z,(e.w-e.headW)/2,e.w-Z-e.headW]){let a=0;for(let r of z)se(r.points,e.x+i-4,t,e.x+i+e.headW+4,n)&&a++;if(a<r&&(r=a,e.headX=i),a===0)break}F.push(e.x+e.headX-4,t,e.x+e.headX+e.headW+4,n)}let V=``;a.rels.forEach((e,t)=>{let n=z[t],c=e.from+`-`+e.to,l=Le(void 0,void 0,e.textColor),u=(a.c4Type===`C4Dynamic`?t+1+`: `:``)+e.label,d=o(u,!1,x,y,n.room),f=o(e.techn?`[${e.techn}]`:void 0,!1,x,y,n.room,2),h=Math.max(d.width,f.width)+re,g=d.height+f.height;if(g===0)return;let _=Math.abs(n.nx)*(h/2)+Math.abs(n.ny)*(g/2)+2,v=n.lean?Math.max(0,Math.min(n.lean,_-14)):_,b=n.nx*v+(m?0:te(e.offsetX)),S=n.ny*v+(m?0:te(e.offsetY)),w=.5;if(I){let e=1/0,t=b!==n.nx*v||S!==n.ny*v;for(let r=0;r<(t?2:1)&&e>0;r++){let t=r?n.nx*v:b,i=r?n.ny*v:S;for(let r of Fe){let a=n.x0+(n.x1-n.x0)*r+t,o=n.y0+(n.y1-n.y0)*r+i,s=ee(a-h/2,o-g/2,a+h/2,o+g/2);if(s<e&&(e=s,w=r,b=t,S=i),s===0)break}}}let T=n.x0+(n.x1-n.x0)*w+b,E=n.y0+(n.y1-n.y0)*w+S-g/2;I&&F.push(T-h/2,E,T+h/2,E+g),j(T-h/2,E,T+h/2,E+g),V+=`<g class="pele-edge-label" data-id="${r(c)}">`+(e.descr?`<title>${r(e.descr)}</title>`:``)+`<rect x="${s(T-h/2)}" y="${s(E)}" width="${s(h)}" height="${s(g)}" rx="3" fill="var(--_bg)"/>`+Re(i(d,T,E+d.height/2,l.text)+i(f,T,E+d.height+f.height/2,` class="pele-c4-techn" fill="var(--_m)"${l.text}`),e.link,c,C,p)+`</g>`});let H=``,U=``;for(let e of w){if(e!==E){let t=e.boundary,i=Le(t.bgColor,t.borderColor,t.fontColor),a=e.x+e.headX,o=e.y+Ee,c=h(e.labels[0],a,o,` class="pele-cluster-label" font-weight="var(--_hw)"${i.text}`);o+=e.labels[0].height,c+=h(e.labels[1],a,o,` class="pele-c4-type" font-size="${y}" fill="var(--_m)"${i.text}`),o+=e.labels[1].height,c+=h(e.labels[2],a,o,` class="pele-c4-descr" font-size="${y}" fill="var(--_m)"${i.text}`),H+=`<g class="pele-cluster pele-c4-${t.nodeType?`node`:`boundary`}" data-id="${r(t.alias)}"><rect x="${s(e.x)}" y="${s(e.y)}" width="${s(e.w)}" height="${s(e.h)}" fill="none" stroke="var(--_b)"${t.nodeType?``:` stroke-dasharray="6 4"`}${n(i.shape)}/>`+Re(c,t.link,t.alias,C,p)+`</g>`}for(let t of e.nodes){let e=t.shape,n=e.kind.startsWith(`external`),a=Le(e.bgColor,e.borderColor,e.fontColor),o=` stroke="var(--_b)"`+(n?` stroke-dasharray="4 3"`:``),{w:c,h:l,form:u,labels:d}=t,m=u===`h-cyl`?-oe(l)/2:0,h=u===`person`?ie/2:u===`cyl`?ae(c)/2:0,g=` fill="var(--_m)"${a.text}`,_=h-t.textH/2,v=i(d[0],m,_+d[0].height/2,` class="pele-c4-type" font-size="${y-1}"${g}`);_+=d[0].height,v+=i(d[1],m,_+d[1].height/2,` class="pele-label" font-weight="var(--_hw)"${a.text}`),_+=d[1].height,v+=i(d[2],m,_+d[2].height/2,` class="pele-c4-techn" font-size="${y}"${g}`),_+=d[2].height+4,v+=i(d[3],m,_+d[3].height/2,` class="pele-c4-descr" font-size="${y}"${a.text}`),U+=`<g class="pele-node pele-shape-${u} pele-c4-${e.kind}${n?` pele-c4-external`:``}" data-id="${r(e.alias)}" transform="translate(${s(t.x+c/2)},${s(t.y+l/2)})">`+Re(f(u,c,l,` fill="var(${n?`--_bg`:`--_s`})"${o}${a.shape}`,o+a.line)+v,e.link,e.alias,C,p)+`</g>`}}let W=o(a.title,!1,x,v,m?l(p):4e3,1),G=W.height>0?W.height+12:0,K=Math.max(k-D,W.width),q=Math.ceil(K+2*S),J=Math.ceil(A-O+G+2*S),Y=S-D+(K-(k-D))/2,ce=S+G-O;return[{svg:e(`c4`,q,J,v,p,a,i(W,q/2,S+W.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${s(Y)},${s(ce)})">`+(H?`<g class="pele-clusters">${H}</g>`:``)+(L?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${L}</g>`:``)+(U?`<g class="pele-nodes">${U}</g>`:``)+(V?`<g class="pele-edge-labels" font-size="${y}">${V}</g>`:``)+`</g>`),width:q,height:J,links:C},R.squeezed]}var Ve={type:`c4`,parse(e,t,n){let r=new D;return n&&(r.title=n),R(e,r),r},render:ze};export{Ve as c4};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{u as e}from"./E3FWOBN4-D5m5o2g0.js";var t=/<(?!br\s*\/?>)/gi,n=/:fa-/g,r=/<br\s*\/?>|fl°°?\w+¶ß|&#?\w+;|[\ud800-\udbff][\udc00-\udfff]|[\s\S]/gi;function i(r,i,a,o,s=0){let c=r;return c!==void 0&&(c.includes(`<`)&&(c=c.replace(t,`<`)),c.includes(`:fa-`)&&(c=c.replace(n,`:fa-`))),e(c,!1,i,a,o,s)}function a(e,t,n,a,o=0){let s=i(e,t,n,a,o);if(e===void 0||s.width<=a)return s;let c=``,l=0;for(let i of e.match(r)??[]){if(i.trim()===``||i.length>2&&i[0]===`<`)l=0;else{let e=t.width(i.length>2?`x`:i,n,o);l>0&&l+e>a&&(c+=`
|
|
2
|
+
`,l=0),l+=e}c+=i}return i(c,t,n,a,o)}export{i as n,a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,x as t}from"./E3FWOBN4-D5m5o2g0.js";import{f as n,n as r,o as i,t as a}from"./CUVCMPQX-JTGMOfG2.js";import{n as o,t as s}from"./ZI2QNEGF-VzC4uHcW.js";var c=34,l=24,u=8,d=2e4,f=1e4,p=2e6,m=4,h=3,ee=8,g=20,te=20,ne=14,_=3;function v(e,t,o,s,v=l){let b=e.length;if(b===0)return{width:0,height:0};let x=o===`LR`||o===`RL`,re=o===`BT`||o===`RL`,S=[];for(let t=b-1;t>=0;t--)e[t].parent<0&&e[t].isGroup&&S.push(t);let C=Math.max(1,S.length),w=new Int32Array(b).fill(-1);S.forEach((e,t)=>w[e]=t);let T=new Uint8Array(b);for(let t=0;t<b;t++)e[t].parent>=0&&(T[e[t].parent]=1);let ie=new Float64Array(C).fill(v),ae=v,E=t=>{let n=t,r=v;for(let t=0;e[n].parent>=0&&t<f;t++)n=e[n].parent,w[n]<0&&(r+=Math.max(e[n].padX,e[n].padTop,e[n].padBottom));let i=Math.max(0,w[n]);return r>ie[i]&&(ie[i]=r),r>ae&&(ae=r),i},oe=new Int32Array(b).fill(-1),D=[];for(let t=0;t<b;t++)w[t]>=0||e[t].isGroup&&T[t]||(oe[t]=D.length,D.push(t));let O=e=>x?e.w:e.h,k=e=>x?e.h:e.w,A=D.map(t=>i(k(e[t]),O(e[t]))),j=[],se=[],M=1;{let e=new Set;for(let n=0;n<t.length;n++){let r=t[n],i=oe[r.src],o=oe[r.dst];if(i<0||o<0||i===o)continue;let s=Math.min(i,o)*D.length+Math.max(i,o);(r.labelW>0||e.has(s))&&(M=2),e.add(s),j.push(a(i,o,r.minlen,x?r.labelH:r.labelW,x?r.labelW:r.labelH)),se.push(n)}}n(A,j),r(A,j,M);let N=j.length,ce=Int32Array.from(D,E),P=(n,r)=>{let i=ie.map((e,t)=>r[t]?Math.max(e,te):e),a=new Uint8Array(C),o=0,l=new Int32Array(N);for(let e=0;e<N;e++)l[e]=Math.abs(A[j[e].head].rank-A[j[e].tail].rank),n[e]||(o+=l[e]-1);let h=o>d,v=D.length+(h?0:o),T=new Int32Array(v),E=new Int32Array(v),O=new Float64Array(v),k=new Float64Array(v),P=new Uint8Array(v),F=0;for(let e=0;e<D.length;e++)T[e]=A[e].rank,E[e]=ce[e],O[e]=A[e].w,k[e]=A[e].h,T[e]>F&&(F=T[e]);let I=new Int32Array(N).fill(-1),L=new Int32Array(N).fill(-1),R=[];{let e=D.length;for(let t=0;t<N;t++){let r=j[t],i=r.reversed?r.head:r.tail,a=r.reversed?r.tail:r.head;if(h||l[t]<2||n[t]){R.push(i,a);continue}let o=T[i],s=T[a],c=-1;r.labelW>0&&(c=o+(s-o>>1),M===2&&!(c&1)&&c--),I[t]=e;let u=i;for(let n=o+1;n<s;n++){let l=e++;T[l]=n,E[l]=E[i]+Math.round((E[a]-E[i])*(n-o)/(s-o)),P[l]=1,n===c&&(O[l]=r.labelW,k[l]=r.labelH,L[t]=l),R.push(u,l),u=l}R.push(u,a)}}let z=new Int32Array(v+1),B=new Int32Array(v+1);for(let e=0;e<R.length;e+=2)B[R[e]+1]++,z[R[e+1]+1]++;for(let e=0;e<v;e++)z[e+1]+=z[e],B[e+1]+=B[e];let le=new Int32Array(R.length/2),ue=new Int32Array(R.length/2);{let e=z.slice(0,v),t=B.slice(0,v);for(let n=0;n<R.length;n+=2)ue[t[R[n]]++]=R[n+1],le[e[R[n+1]]++]=R[n]}let V=[];for(let e=0;e<=F;e++)V.push([]);for(let e=0;e<v;e++)V[T[e]].push(e);let de=new Float64Array(v),H=new Float64Array(v),fe=e=>{e.sort((e,t)=>E[e]-E[t]||H[e]-H[t]||e-t);for(let t=0;t<e.length;t++)de[e[t]]=t};for(let e of V){for(let t=0;t<e.length;t++)H[e[t]]=t;fe(e)}for(let e=0;e<u&&F>0;e++){let t=!(e&1);for(let e=1;e<=F;e++){let n=V[t?e:F-e],r=t?z:B,i=t?le:ue;for(let e of n){let t=0,n=r[e+1]-r[e];for(let n=r[e];n<r[e+1];n++)t+=de[i[n]];H[e]=n>0?t/n:de[e]}fe(n)}}let U=(e,t)=>P[e]||P[t]?s.edgeSep:s.nodeSep,pe=(e,t)=>{let n=0;for(;n<e.length;){let r=n;for(;r+1<e.length&&E[e[r+1]]===E[e[n]];)r++;t(e,n,r),n=r+1}},me=(e,t,n)=>{let r=O[e[t]];for(let i=t;i<n;i++)r+=U(e[i],e[i+1])+O[e[i+1]];return r},he=new Float64Array(C),W=S.length>0?c:0;for(let t=0;t<S.length;t++){let n=e[S[t]];he[t]=Math.max(0,n.minW-2*i[t]),n.padTop>W&&(W=n.padTop)}for(let e of V)pe(e,(t,n,r)=>{let i=me(e,n,r);i>he[E[e[n]]]&&(he[E[e[n]]]=i)});let G=new Float64Array(C+1);for(let e=0;e<C;e++)G[e+1]=G[e]+he[e]+2*i[e];let K=new Float64Array(v),ge=new Float64Array(v),_e=(e,t,n)=>{let r=E[e[t]],a=(G[r]+i[r]+(G[r+1]-i[r])-me(e,t,n))/2;for(let r=t;r<=n;r++)K[e[r]]=a+O[e[r]]/2,r<n&&(a+=O[e[r]]+U(e[r],e[r+1]))},ve=(e,t,n)=>{let r=E[e[t]],a=G[r]+i[r];for(let r=t;r<=n;r++){let t=e[r];K[t]=Math.max(ge[t],a+O[t]/2),r<n&&(a=K[t]+O[t]/2+U(t,e[r+1]))}let o=G[r+1]-i[r];for(let r=n;r>=t;r--){let n=e[r];K[n]=Math.min(K[n],o-O[n]/2),r>t&&(o=K[n]-O[n]/2-U(e[r-1],n))}};for(let e of V)pe(e,_e);for(let e=0;e<4&&F>0;e++){let t=!(e&1);for(let e=1;e<=F;e++){let n=V[t?e:F-e],r=t?z:B,i=t?le:ue;for(let e of n){let t=0,n=0;for(let a=r[e];a<r[e+1];a++)E[i[a]]===E[e]&&(t+=K[i[a]],n++);ge[e]=n>0?t/n:K[e]}pe(n,ve)}}let q=new Float64Array(F+1),J=new Float64Array(F+1),Y=new Float64Array(F+1).fill(s.rankSep/M);if(n.some(e=>e===1)){let e=s.rankSep/M;Y.fill(e/_);for(let t=0;t<N;t++){let r=j[t],i=r.reversed?r.head:r.tail,a=r.reversed?r.tail:r.head;if(n[t]){if(r.labelH<=0||l[t]>M)continue;let n=Math.min(e,(r.labelH+2*g-Math.min(k[i],k[a])/2)/l[t]);for(let e=T[i];e<T[a];e++)n>Y[e]&&(Y[e]=n);continue}let o=I[t];if(o<0||l[t]<=M*r.minlen)for(let t=T[i];t<T[a];t++)Y[t]=e;else for(let n=o-1;n<o+l[t]-1;n++){let r=n<o?i:n,s=n+1<o+l[t]-1?n+1:a;(E[r]!==E[s]||Math.abs(K[r]-K[s])>=.5)&&(Y[T[r]]=e)}}}let ye=W+ae;for(let e=0;e<=F;e++){let t=0;for(let n of V[e])k[n]>t&&(t=k[n]);q[e]=ye,J[e]=ye+t,ye+=t+(e===F?0:Y[e])}let X=ye+ae,be=G[C],xe=e=>re?W+X-e:e,Z=(e,t)=>x?xe(t):e,Q=(e,t)=>x?e:xe(t),Se=+!!x;for(let t=0;t<D.length;t++){let n=e[D[t]],r=(q[T[t]]+J[T[t]])/2;n.x=Z(K[t],r),n.y=Q(K[t],r)}for(let t=0;t<S.length;t++){let n=e[S[t]],r=(G[t]+G[t+1])/2,i=G[t+1]-G[t];n.x=x?X/2:r,n.y=x?r:X/2,n.w=x?X:i,n.h=x?i:X,n.padTop=W}let Ce=new Int32Array(b),we=[];for(let t=0;t<b;t++){if(!e[t].isGroup||w[t]>=0||oe[t]>=0)continue;let n=0;for(let r=e[t].parent;r>=0&&n<f;r=e[r].parent)n++;Ce[t]=n,we.push(t)}we.sort((e,t)=>Ce[t]-Ce[e]||e-t);let $=new Float64Array(b*4);for(let e=0;e<b;e++)$[e*4]=1/0,$[e*4+1]=1/0,$[e*4+2]=-1/0,$[e*4+3]=-1/0;let Te=(e,t)=>{t.x-t.w/2<$[e*4]&&($[e*4]=t.x-t.w/2),t.y-t.h/2<$[e*4+1]&&($[e*4+1]=t.y-t.h/2),t.x+t.w/2>$[e*4+2]&&($[e*4+2]=t.x+t.w/2),t.y+t.h/2>$[e*4+3]&&($[e*4+3]=t.y+t.h/2)};for(let t of D)e[t].parent>=0&&w[e[t].parent]<0&&Te(e[t].parent,e[t]);for(let t of we){let n=e[t];if($[t*4]===1/0)continue;let r=Math.max($[t*4+2]-$[t*4]+2*n.padX,n.minW);n.x=($[t*4]+$[t*4+2])/2,n.w=r,n.y=($[t*4+1]-n.padTop+$[t*4+3]+n.padBottom)/2,n.h=$[t*4+3]-$[t*4+1]+n.padTop+n.padBottom,n.parent>=0&&w[n.parent]<0&&Te(n.parent,n)}for(let e of t)e.route=[];for(let e=0;e<N;e++){let n=j[e],r=t[se[e]],i=n.reversed?n.head:n.tail,a=n.reversed?n.tail:n.head,o=[K[i],J[T[i]]-(J[T[i]]-q[T[i]]-k[i])/2],s=I[e];if(s>=0)for(let t=s;t<s+l[e]-1;t++)o.push(K[t],q[T[t]]),J[T[t]]>q[T[t]]&&o.push(K[t],J[T[t]]);o.push(K[a],q[T[a]]+(J[T[a]]-q[T[a]]-k[a])/2);let c=[];for(let e=0;e<o.length;e+=2)c.push(Z(o[e],o[e+1]),Q(o[e],o[e+1]),Se);if(n.reversed)for(let e=0,t=c.length-3;e<t;e+=3,t-=3)for(let n=0;n<2;n++){let r=c[e+n];c[e+n]=c[t+n],c[t+n]=r}r.route=c;let u=L[e];if(u>=0){let e=(q[T[u]]+J[T[u]])/2;r.labelX=Z(K[u],e),r.labelY=Q(K[u],e)}else r.labelX=(c[0]+c[c.length-3])/2,r.labelY=(c[1]+c[c.length-2])/2}for(let n of t){if(n.route.length>0||n.src===n.dst)continue;let t=e[n.src],r=e[n.dst],[i,a]=y(t,r),[o,s]=y(r,t),c=+(Math.abs(o-i)>Math.abs(s-a));n.route=[i,a,c,o,s,c],n.labelX=(i+o)/2,n.labelY=(a+s)/2}let Ee=new Uint8Array(N),De=t.reduce((e,t)=>e+t.route.length/3,0),Oe=N*(D.length+t.length+De);if(Oe<=p){let e=e=>(q[T[e]]+J[T[e]])/2,n=t.map(e=>[x?e.labelY:e.labelX,xe(x?e.labelX:e.labelY)]),r=(e,t,n,r,i,a,o,s)=>n>i-o/2&&e<i+o/2&&r>a-s/2&&t<a+s/2,o=(i,a,o,s,c,l,u)=>{for(let t=0;t<D.length;t++)if(t!==c&&t!==l&&r(i,a,o,s,K[t],e(t),O[t]+8,k[t]+8))return!1;for(let e=0;e<t.length;e++){let c=t[e];if(e!==u&&c.labelW>0&&c.src!==c.dst&&r(i,a,o,s,n[e][0],n[e][1],x?c.labelH:c.labelW,x?c.labelW:c.labelH))return!1}return!0},s=(e,n,r,i,a)=>{let o=0;for(let s=0;s<t.length;s++){if(s===a)continue;let c=t[s].route;for(let t=3;t<c.length;t+=3)if(Math.max(c[t-3],c[t])>e&&Math.min(c[t-3],c[t])<r&&Math.max(c[t-2],c[t+1])>n&&Math.min(c[t-2],c[t+1])<i){o++;break}}return o},c=(e,n,r)=>{let i=0;for(let a=0;a<t.length;a++){let o=t[a].route;if(a===r||o.length===0)continue;let s=o.length-3;(Math.abs(o[0]-e)<1&&Math.abs(o[1]-n)<1||Math.abs(o[s]-e)<1&&Math.abs(o[s+1]-n)<1)&&i++}return i},l=(e,n,r,i,a)=>{let o=Math.abs(r-e)<.5,s=o?Math.min(n,i):Math.min(e,r),c=o?Math.max(n,i):Math.max(e,r),l=o?e:n;for(let e=0;e<t.length;e++){let n=t[e];if(e===a||n.src===t[a].src||n.dst===t[a].dst)continue;let r=n.route;for(let e=3;e<r.length;e+=3){let t=r[e-3+ +!o],n=r[e+ +!o];if(Math.abs(t-l)>=m||Math.abs(n-l)>=m)continue;let i=r[e-3+ +!!o],a=r[e+ +!!o];if(Math.min(c,Math.max(i,a))-Math.max(s,Math.min(i,a))>1)return!0}}return!1};for(let r=0;r<N;r++){let u=j[r],d=se[r],f=t[d],m=u.tail,h=u.head;if(E[m]===E[h]||Math.abs(K[h]-K[m])<1)continue;let _=K[m],v=K[h],y=e(m),b=e(h),x=Math.sign(v-_),re=Math.sign(b-y),S=(e,t)=>{for(let n=2;n<e.length;n+=2)if(!o(Math.min(e[n-2],e[n])-t,Math.min(e[n-1],e[n+1])-t,Math.max(e[n-2],e[n])+t,Math.max(e[n-1],e[n+1])+t,m,h,d)||l(Z(e[n-2],e[n-1]),Q(e[n-2],e[n-1]),Z(e[n],e[n+1]),Q(e[n],e[n+1]),d))return!1;let i=0,a=0,c=-1;if(f.labelW>0){let t=u.labelW,n=u.labelH;for(let r=2;r<e.length;r+=2){let l=(e[r-2]+e[r])/2,u=(e[r-1]+e[r+1])/2,p=Math.abs(e[r]-e[r-2]),m=Math.abs(e[r+1]-e[r-1]),h=p+m;if(h<=c||(p>0?p<t+8:m<n+8)||l-t/2<0||l+t/2>be||u-n/2<0||u+n/2>X||!o(l-t/2,u-n/2,l+t/2,u+n/2,-1,-1,d))continue;let ee=Z(l,u),g=Q(l,u);s(ee-f.labelW/2,g-f.labelH/2,ee+f.labelW/2,g+f.labelH/2,d)>0||(i=l,a=u,c=h)}if(c<0)return!1}let p=[e[0],e[1]];for(let t=2;t<e.length;t+=2){let n=e[t]-e[t-2],r=e[t+1]-e[t-1],i=Math.abs(n)+Math.abs(r),a=t>2?g:0,o=t+2<e.length?g:0;i>a+o+1&&(a&&p.push(e[t-2]+n/i*a,e[t-1]+r/i*a),o&&p.push(e[t]-n/i*o,e[t+1]-r/i*o)),p.push(e[t],e[t+1])}f.route=[];for(let e=0;e<p.length;e+=2){let t=e===0?p[0]!==p[2]:p[e]!==p[e-2];f.route.push(Z(p[e],p[e+1]),Q(p[e],p[e+1]),t?1-Se:Se)}return f.labelW>0&&(f.labelX=Z(i,a),f.labelY=Q(i,a),n[d]=[i,a]),Ee[r]=1,!0};if(S([_+x*O[m]/2,y,v,y,v,b-re*k[h]/2],2)||S([_,y+re*k[m]/2,_,b,v-x*O[h]/2,b],2)||Oe>p/ee)continue;let C=[];for(let e of E[m]<E[h]?[E[h],E[m]]:[E[m],E[h]]){let t=Math.max(i[e]-ne,Math.min(i[e]/2,te-ne));for(let n of[G[e]+t,G[e+1]-t]){if(Math.abs(n-_)<O[m]/2+4||Math.abs(n-v)<O[h]/2+4)continue;let t=[_+Math.sign(n-_)*O[m]/2,y,n,y,n,b,v+Math.sign(n-v)*O[h]/2,b],r=(c(Z(t[0],t[1]),Q(t[0],t[1]),d)+c(Z(t[6],t[7]),Q(t[6],t[7]),d))*1e6;for(let e=2;e<t.length;e+=2){let n=Z(t[e-2],t[e-1]),i=Q(t[e-2],t[e-1]),a=Z(t[e],t[e+1]),o=Q(t[e],t[e+1]);r+=s(Math.min(n,a),Math.min(i,o),Math.max(n,a),Math.max(i,o),d)*1e6+Math.abs(a-n)+Math.abs(o-i)}C.push({pts:t,cost:r,lane:e})}}C.sort((e,t)=>e.cost-t.cost);for(let e of C)if(S(e.pts,1)){a[e.lane]=1;break}}}return{width:x?X:be,height:x?be:X,routed:Ee,margins:a,work:Oe}},F=new Uint8Array(N),I=new Uint8Array(C),L=P(F,I);for(let e=0;e<h&&L.work<=p/ee;e++){let t=e===0?L.routed:F.map((e,t)=>e&L.routed[t]);if(t.every((e,t)=>e===F[t])&&L.margins.every((e,t)=>e===I[t]))break;F=t,I=L.margins,L=P(F,I)}return F.some((e,t)=>e&&!L.routed[t])&&(L=P(new Uint8Array(N),new Uint8Array(C))),{width:L.width,height:L.height}}function y(e,t){let n=t.x-e.x,r=t.y-e.y,i=Math.max(e.w/2,.5),a=Math.max(e.h/2,.5);if(Math.abs(n)<i&&Math.abs(r)<a)return i-Math.abs(n)<a-Math.abs(r)?[e.x+(n<0?-i:i),t.y]:[t.x,e.y+(r<0?-a:a)];let o=Math.min(n===0?1/0:i/Math.abs(n),r===0?1/0:a/Math.abs(r));return[e.x+n*o,e.y+r*o]}var b=`__swimlane_default__`;function x(e){let t=!1;for(let n of e.nodes)n.isGroup?n.dir=void 0:n.parentId===void 0&&(t=!0);if(t){for(let t of e.nodes)!t.isGroup&&t.parentId===void 0&&(t.parentId=b);e.nodes.push({id:b,label:void 0,labelType:`text`,shape:`rect`,isGroup:!0,parentId:void 0,cssStyles:[],cssCompiledStyles:[],cssClasses:``,dir:void 0})}}function re(n,r,i,a,o,s,c){let l=n.x-n.w/2,u=n.y-n.h/2,d=s===`LR`||s===`RL`,f=d?l+n.padTop/2:n.x,p=d?n.y:u+n.padTop/2,m=e(r,f,p,` class="pele-cluster-label" fill="var(--_m)"${i.text}`,c);return`<g class="pele-cluster pele-lane${a}" data-id="${o}"><rect x="${t(l)}" y="${t(u)}" width="${t(n.w)}" height="${t(n.h)}" fill="none" stroke="var(--_b)"/><rect x="${t(l)}" y="${t(u)}" width="${t(d?n.padTop:n.w)}" height="${t(d?n.h:n.padTop)}" fill="var(--_a)" stroke="var(--_b)"${i.shape}/>`+(d&&m?`<g transform="rotate(-90 ${t(f)} ${t(p)})">${m}</g>`:m)+`</g>`}var S={type:`swimlane`,prepare:x,layout:(e,t,n,r,i)=>v(e,t,n,r,i?12:void 0),drawGroup:re},C={type:`swimlane`,math:!0,parse:s.parse,render:(e,t,n)=>o(e,t,n,S)};export{C as swimlane};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e,b as t,d as n,i as r,o as i,s as a,u as o,x as s}from"./E3FWOBN4-D5m5o2g0.js";import{o as c,r as l}from"./DKTLEL5E-DciMwFJ1.js";import{a as u,i as d,s as f}from"./CUVCMPQX-JTGMOfG2.js";import{t as p}from"./E65FQMJL-Bg5F0Zo8.js";import{a as m,i as h,o as g}from"./A255FCTW-woaH7Mj_.js";import{PeleError as _,g as v,h as y,s as b,u as x}from"./lazy-DaMZI1F7.js";var S=1e5;function C(e){switch(e){case`[]`:return`square`;case`()`:return`round`;case`(())`:return`circle`;case`>]`:return`rect_left_inv_arrow`;case`{}`:return`diamond`;case`{{}}`:return`hexagon`;case`([])`:return`stadium`;case`[[]]`:return`subroutine`;case`[()]`:return`cylinder`;case`((()))`:return`doublecircle`;case`[//]`:return`lean_right`;case`[\\\\]`:return`lean_left`;case`[/\\]`:return`trapezoid`;case`[\\/]`:return`inv_trapezoid`;case`<[]>`:return`block_arrow`;default:return`na`}}function w(e){switch(e.trim().slice(-1)){case`x`:return`arrow_cross`;case`o`:return`arrow_circle`;case`>`:return`arrow_point`;default:return``}}function T(e){switch(e.trim().charAt(0)){case`x`:return`arrow_cross`;case`o`:return`arrow_circle`;case`<`:return`arrow_point`;default:return`arrow_open`}}function E(e){return e.includes(`==`)?`thick`:`normal`}function D(e){return e.includes(`.-`)?`dotted`:`solid`}function O(e,t){let n=e.flat(),r=-1;for(let e of n)if(e.type===`column-setting`){r=e.columns??-1;break}return{list:n,at:0,parent:t,children:[],columns:r}}var k=class{type=`block`;title;root={id:`root`,type:`composite`,children:[],columns:-1};blocks=[];edges=[];classes=new Map;byId=new Map;typeStr2Type=C;edgeStrToEdgeData=w;edgeStrToEdgeStartData=T;edgeStrToThickness=E;edgeStrToPattern=D;warn;pending=new Set;edgeCount=new Map;ids=0;colors=0;spaces=0;constructor(e={}){this.warn=e.warn}generateId(){return`id-`+ ++this.ids}addStyleClass(e,t=``){let n=this.classes.get(e);n||(n={id:e,styles:[],textStyles:[]},this.classes.set(e,n));for(let e of t.split(`,`)){let t=e.indexOf(`;`),r=(t===-1?e:e.slice(0,t)+e.slice(t+1)).trim();e.includes(`color`)&&n.textStyles.push(r.replace(`fill`,`bgFill`).replace(`color`,`fill`)),n.styles.push(r)}}addStyle2Node(e,t=``){this.named(e).styles=t.split(`,`)}setCssClass(e,t){for(let n of e.split(`,`))(this.named(n.trim()).classes??=[]).push(t)}named(e){let t=this.byId.get(e);return t===void 0&&(t={id:e,type:`na`,children:[]},this.byId.set(e,t),this.pending.add(e)),t}setHierarchy(e){let t=[O(e,this.root)];for(;t.length>0;){let e=t[t.length-1];if(e.at===e.list.length){e.parent.children=e.children,t.pop();continue}let n=e.list[e.at++];switch(e.columns>0&&n.type!==`column-setting`&&typeof n.widthInColumns==`number`&&n.widthInColumns>e.columns&&this.warn?.(`Block ${n.id} width ${n.widthInColumns} exceeds configured column width ${e.columns}`),n.type){case`classDef`:this.addStyleClass(n.id,n.css);continue;case`applyClass`:this.setCssClass(n.id,n.styleClass??``);continue;case`applyStyles`:n.stylesStr&&this.addStyle2Node(n.id,n.stylesStr);continue;case`column-setting`:e.parent.columns=n.columns??-1;continue;case`edge`:{let e=(this.edgeCount.get(n.id)??0)+1;this.edgeCount.set(n.id,e),n.id=e+`-`+n.id,this.edges.push(n);continue}}n.id??=this.generateId(),n.label||=n.type===`composite`?``:n.id;let r=this.byId.get(n.id),i=r===void 0||this.pending.delete(n.id);i?(r&&(n.classes=r.classes,n.styles=r.styles),n.type===`composite`&&(n.colorIndex=this.colors++),this.byId.set(n.id,n)):(n.type!==`na`&&(r.type=n.type),n.label!==n.id&&(r.label=n.label));let a=n.children;if(n.children=[],n.type===`space`){let t=n.width??1;if(!(t<=S-this.spaces))throw new _(`A block diagram can hold at most ${S} space blocks.`,`limit`,{type:`block`});this.spaces+=Math.max(t,0);for(let r=0;r<t;r++){let t={...n,id:n.id+`-`+r,children:[]};this.byId.set(t.id,t),e.children.push(t)}}else i&&e.children.push(n);a&&a.length>0&&t.push(O(a,n))}this.blocks=this.root.children??[]}},A=`$end.INVALID.BLOCK_DIAGRAM_KEY.id-block.COLUMNS.MD_STR.STR.SPACE_BLOCK.DEFAULT.LINKSTYLE.INTERPOLATE.classDef.DEFAULT_CLASSDEF_ID.CLASSDEF_ID.CLASSDEF_STYLEOPTS.class.CLASSENTITY_IDS.STYLECLASS.style.STYLE_ENTITY_IDS.STYLE_DEFINITION_DATA.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.end.NODE_DSTART.NODE_DEND.BLOCK_ARROW_START.BLOCK_ARROW_END.DIR.NODE_ID.LINK.START_LINK.LINK_LABEL.SIZE.EOF`.split(`.`),j=[`right`,`left`,`x`,`y`,`up`,`down`],M=new Uint8Array(128);for(let e of[9,10,11,12,13,32,40,41,45,58,60,61,62,91,123,125])M[e]=1;function ee(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=(e,t,a)=>(n.push(e),r.push(t),i.push(s),s=a,!0),l=(t,n)=>c(t,e.slice(s,n),n),u=e=>{a.push(o),o=e},d=()=>{a.length>0&&(o=a.pop())},f=n=>{for(;n<t&&y(e.charCodeAt(n));)n++;return n},p=n=>{for(;n<t;){let t=e.charCodeAt(n);if(t<48||t>57)break;n++}return n},m=n=>{for(;n<t&&v(e.charCodeAt(n));)n++;return n},h=t=>e.startsWith(t,s)&&!v(e.charCodeAt(s+t.length)),g=()=>(e.charCodeAt(s+1)===96?(u(2),s+=2):(u(1),s++),!0),_=t=>{if(e.charCodeAt(t)!==46)return-1;do t++;while(e.charCodeAt(t)===46);if(e.charCodeAt(t)!==45)return-1;let n=e.charCodeAt(t+1);return n===120||n===111||n===62?t+2:t+1},b=t=>{let n=e.charCodeAt(t);(n===120||n===111||n===60)&&t++;let r=e.charCodeAt(t);if(r===46)return _(t);if(r!==45&&r!==61)return-1;let i=t+1;for(;e.charCodeAt(i)===r;)i++;if(i-t===1)return r===45?_(i):-1;let a=e.charCodeAt(i);return a===120||a===111||a===62?i+1:i-t>=3?i:-1},x=()=>{let t=b(s);if(t>=0)return l(33,f(t));let n=e.charCodeAt(s)===60?s+1:s,r=e.charCodeAt(n),i=e.charCodeAt(n+1);return r===45&&(i===45||i===46)||r===61&&i===61?(u(6),l(34,f(n+2))):!1},S=n=>{let r=e.indexOf(`
|
|
2
|
+
`,s);return r===-1&&(r=t),d(),l(n,r)},C=(t,n)=>{let r=m(s);if(r===s)return!1;for(;e.charCodeAt(r)===44;){let e=f(r+1),t=m(e);if(t===e)break;r=t}return o=n,l(t,r)},w=n=>{if(y(n))return s=f(s+1),!0;let r;switch(n){case 98:if(e.startsWith(`block`,s)){if(h(`block-beta`))return l(2,s+10);if(e.charCodeAt(s+5)===58)return l(3,s+6);if(!v(e.charCodeAt(s+5)))return l(2,s+5)}break;case 99:if(e.startsWith(`columns`,s)){if(r=f(s+7),r>s+7){if(e.startsWith(`auto`,r)&&!v(e.charCodeAt(r+4)))return c(4,`-1`,r+4);let t=p(r);if(t>r)return c(4,e.slice(r,t),t)}}else if(e.startsWith(`class`,s)){let t=e.startsWith(`Def`,s+5),n=t?s+8:s+5;if(r=f(n),r>n)return u(t?7:9),l(t?11:15,r)}break;case 34:return g();case 115:if(e.startsWith(`space`,s)){if(e.charCodeAt(s+5)===58){let t=p(s+6);if(t>s+6)return c(7,e.slice(s+6,t),t)}if(!v(e.charCodeAt(s+5)))return c(7,`1`,s+5)}else if(e.startsWith(`style`,s)&&(r=f(s+5),r>s+5))return u(11),l(18,r);break;case 100:if(h(`default`))return l(8,s+7);break;case 108:if(h(`linkStyle`))return l(9,s+9);break;case 105:if(h(`interpolate`))return l(10,s+11);break;case 97:if(e.startsWith(`accTitle`,s)){if(r=f(s+8),e.charCodeAt(r)===58)return u(13),l(21,f(r+1))}else if(e.startsWith(`accDescr`,s)){r=f(s+8);let t=e.charCodeAt(r);if(t===58)return u(14),l(23,f(r+1));if(t===123)return u(15),s=f(r+1),!0}break;case 101:if(h(`end`))return l(26,f(s+3));break;case 45:return e.charCodeAt(s+1)===41?(u(3),l(27,s+2)):x();case 61:return x();case 60:return e.charCodeAt(s+1)===91?(u(4),l(29,s+2)):x();case 40:{let t=e.charCodeAt(s+1),n=t===45||t===91?2:t===40?e.charCodeAt(s+2)===40?3:2:1;return u(3),l(27,s+n)}case 41:case 123:return u(3),l(27,e.charCodeAt(s+1)===n?s+2:s+1);case 62:return u(3),l(27,s+1);case 91:{let t=e.charCodeAt(s+1);return u(3),l(27,t===91||t===124||t===40||t===92||t===47?s+2:s+1)}case 58:{let t=p(s+1);return t>s+1&&c(36,e.slice(s+1,t),t)}}for(r=s;r<t;){let t=e.charCodeAt(r);if(t<128?M[t]===1:y(t))break;r++}return r>s&&l(32,r)},T=t=>{let n=e.charCodeAt(s+1),r=0;switch(t){case 34:return g();case 40:r=n===45?2:n===40?e.charCodeAt(s+2)===40?3:2:1;break;case 41:r=n===41?e.charCodeAt(s+2)===41?3:2:n===93?2:1;break;case 125:r=n===125?2:1;break;case 45:r=n===41?2:0;break;case 93:r=n===93||n===41||n===62?2:1;break;case 92:case 47:r=n===93?2:0}return r!==0&&(d(),l(28,s+r))},E=t=>{if(t===41)return d(),d(),c(30,`]>`,f(s+1));let n=f(t===44?s+1:s);for(let r of j)if(e.startsWith(r,n)){let i=f(n+r.length);return c(31,e.slice(t===44?n:s,i),i)}return!1};for(;;){if(s>=t){let e=-1;switch(o){case 0:e=37;break;case 1:e=6;break;case 8:e=14;break;case 10:e=17;break;case 12:e=20;break;case 13:e=22;break;case 14:e=24;break;case 15:e=25}s=t,e!==-1&&c(e,``,t);break}let a=e.charCodeAt(s),p=!0;switch(o){case 0:p=w(a);break;case 1:if(a===34)d(),s++;else{let n=e.indexOf(`"`,s);l(6,n===-1?t:n)}break;case 2:if(a===96)p=e.charCodeAt(s+1)===34,p&&(d(),s+=2);else if(a===34)p=!1;else{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===96||t===34)break;n++}l(5,n)}break;case 3:p=T(a);break;case 4:if(a===34)g();else if(a===93&&e.charCodeAt(s+1)===62){let t=f(s+2);p=e.charCodeAt(t)===40,p&&(u(5),s=t+1)}else p=!1;break;case 5:p=E(a);break;case 6:if(a===34)e.charCodeAt(s+1)===96?g():(l(35,s+1),u(1));else{let e=b(f(s));p=e>=0,p&&(d(),l(33,f(e)))}break;case 7:{let t=12,n=e.startsWith(`DEFAULT`,s)?s+7:s,r=f(n);(n===s||r===n)&&(t=13,n=m(s),r=f(n)),p=n>s&&r>n,p&&(o=8,l(t,r));break}case 8:S(14);break;case 9:p=C(16,10);break;case 10:S(17);break;case 11:p=C(19,12);break;case 12:S(20);break;case 13:S(22);break;case 14:S(24);break;case 15:if(a===125)d(),s++;else{let n=e.indexOf(`}`,s);l(25,n===-1?t:n)}}if(!p)return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}}return n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var N=`'NODE_ID', 'COLUMNS', 'SPACE_BLOCK', 'BLOCK_DIAGRAM_KEY', 'id-block', 'classDef', 'class', 'style'`;function P(e){let t=e[e.length-1];return Array.isArray(t)?(e.pop(),e.concat(t)):e}function te(e,t){let{types:n,texts:r,starts:i}=ee(e),a=0,o=t=>{let r=n[a];throw r===1?b(`block`,e,i[a],``,!0):b(`block`,e,i[a],`Expecting ${t}, got '${A[r]}'`)},s=e=>(n[a]!==e&&o(`'${A[e]}'`),r[a++]),c=()=>{let e=s(32);if(n[a]===27){let t=r[a++];return{id:e,label:s(6),typeStr:t+s(28)}}if(n[a]===29){let t=r[a++],i=s(6),o=[s(31)];for(;n[a]===31;)o.push(r[a++]);return{id:e,label:i,typeStr:t+s(30),directions:o}}return{id:e}},l=()=>{let e=c(),i=n[a]===36?parseInt(r[a++],10):1,o={id:e.id,label:e.label,type:t.typeStr2Type(e.typeStr),directions:e.directions,widthInColumns:i},l;for(;n[a]===33||n[a]===34;){let e=``;n[a++]===34&&(s(35),e=s(6),s(33));let i=r[a-1],u=c(),d=t.edgeStrToEdgeData(i),f=t.edgeStrToEdgeStartData(i),p=t.edgeStrToThickness(i),m=t.edgeStrToPattern(i);l??=[{id:o.id,label:o.label,type:o.type,directions:o.directions}],o={id:u.id,label:u.label,type:t.typeStr2Type(u.typeStr),directions:u.directions},l.push({id:l[l.length-1].id+`-`+u.id,start:l[l.length-1].id,end:u.id,label:e,type:`edge`,thickness:p,pattern:m,directions:u.directions,arrowTypeEnd:d,arrowTypeStart:f},o)}return l??o};s(2);let u=[],d=[];for(;;)switch(n[a]){case 32:d.push(l());break;case 4:d.push({type:`column-setting`,columns:parseInt(r[a++],10)});break;case 7:{let e=parseInt(r[a++],10);d.push({id:t.generateId(),type:`space`,label:``,width:e,children:[]});break}case 2:a++,u.push({list:d,header:void 0}),d=[];break;case 3:a++,n[a]!==32&&o(`'NODE_ID'`),u.push({list:d,header:l()}),d=[];break;case 26:{let e=u.pop();if(e===void 0||d.length===0)return o(N);a++;let n=t.generateId(),r=P(d);d=e.list,d.push(e.header===void 0?{id:n,type:`composite`,label:``,children:r}:{...e.header,type:`composite`,children:r});break}case 11:{a++;let e=s(13).trim();d.push({type:`classDef`,id:e,css:s(14).trim()});break}case 15:{a++;let e=s(16).trim();d.push({type:`applyClass`,id:e,styleClass:s(17).trim()});break}case 18:{a++;let e=s(19).trim();d.push({type:`applyStyles`,id:e,stylesStr:s(20).trim()});break}case 37:u.length>0&&o(N+`, 'end'`),d.length===0&&o(N),t.setHierarchy(P(d));return;default:o(d.length===0?N:N+(u.length>0?`, 'end'`:`, 'EOF'`))}}var F=1,I=2,L=4,R=8,z=7,B=20,V=12;function ne(e){let t=0;if(e)for(let n of e)switch(n.trim()){case`right`:t|=F;break;case`left`:t|=I;break;case`up`:t|=L;break;case`down`:t|=R;break;case`x`:t|=F|I;break;case`y`:t|=L|R}return t}var H=(e,t)=>e&t?1:0;function U(e){return e!==0&&(e&(L|R))===0?`x`:e!==0&&(e&(F|I))===0?`y`:``}function re(e,t,n){let r=U(e),i=H(e,I)-H(e,F),a=H(e,L)-H(e,R);if(r===`x`){let r=Math.max(n+8,14)+2*z,a=Math.min(r/2,B);return{w:Math.max(t+12,16)+a*(e===(F|I)?2:1),h:r,dx:i*a/2,dy:0}}if(r===`y`){let r=Math.max(t+16,14)+2*z,i=Math.min(r/2,B);return{w:r,h:Math.max(n+8,16)+i*(e===(L|R)?2:1),dx:0,dy:a*i/2}}return{w:Math.max(t+16,24)+V*(H(e,I)+H(e,F)),h:Math.max(n+8,24)+V*(H(e,L)+H(e,R)),dx:i*V/2,dy:a*V/2}}function ie(e,t,n,r){let i=U(e),a=t/2,o=n/2,c;if(i===`x`){let t=Math.min(o,B),n=o-z,r=e&I?-a+t:-a,i=e&F?a-t:a;c=[r,-n,i,-n],e&F&&c.push(i,-o,a,0,i,o),c.push(i,n,r,n),e&I&&c.push(r,o,-a,0,r,-o)}else if(i===`y`){let t=Math.min(a,B),n=a-z,r=e&L?-o+t:-o,i=e&R?o-t:o;c=[n,r,n,i],e&R&&c.push(a,i,0,o,-a,i),c.push(-n,i,-n,r),e&L&&c.push(-a,r,0,-o,a,r)}else{let t=e&I?-a+V:-a,n=e&F?a-V:a,r=e&L?-o+V:-o,i=e&R?o-V:o,s=(t+n)/2,l=(r+i)/2,u=Math.min(10,(n-t)/2),d=Math.min(10,(i-r)/2);c=[t,r],e&L&&c.push(s-u,r,s,-o,s+u,r),c.push(n,r),e&F&&c.push(n,l-d,a,l,n,l+d),c.push(n,i),e&R&&c.push(s+u,i,s,o,s-u,i),c.push(t,i),e&I&&c.push(t,l+d,-a,l,t,l-d)}let l=``;for(let e=0;e<c.length;e+=2)l+=(e?` `:``)+s(c[e])+`,`+s(c[e+1]);return`<polygon points="${l}" stroke-linejoin="round"${r}/>`}var ae=1e3;function W(e,t){if(e===0||!Number.isInteger(e))throw new _(`Columns must be an integer !== 0.`,`semantic`,{type:`block`});if(t<0||!Number.isInteger(t))throw new _(`Position must be a non-negative integer.`+t,`semantic`,{type:`block`});return e<0?{px:t,py:0}:{px:t%e,py:Math.floor(t/e)}}function G(e,t,n){let r=e.columns,i=[],a=0,o=0,s=0,c=0;for(let n of e.children){let{px:e,py:l}=W(r,a),u=n.span>=1?Math.min(n.span,ae):1;if(r>0&&u>r-e&&(u=r-e),n.span=u,n.col=e,n.row=l,a+=u,e+u>o&&(o=e+u),l===i.length&&i.push(0),n.children.length===0?i[l]=-1:i[l]>=0&&n.nh>i[l]&&(i[l]=n.nh),n.space)continue;let d=(n.nw-t*(u-1))/u;d>s&&(s=d),n.nh>c&&(c=n.nh)}let l=(i.length-1)*t;for(let e=0;e<i.length;e++)i[e]<0&&(i[e]=c),l+=i[e];e.cols=o,e.heights=i,e.nw=Math.max(e.nw,o*s+(o-1)*t+2*n),e.nh=l+2*n+e.head}function K(e,t,n){let{cols:r,heights:i}=e,a=i.length,o=(e.w-2*n-(r-1)*t)/r,s=e.h-2*n-e.head-(a-1)*t,c=0;for(let e of i)c+=e;let l=c>0?s/c:0,u=c>0?0:s/a,d=e.x-e.w/2+n,f=e.y-e.h/2+n+e.head,p=0;for(let n of e.children){for(;p<n.row;p++)f+=i[p]*l+u+t;n.w=o*n.span+t*(n.span-1),n.h=i[p]*l+u,n.x=d+n.col*(o+t)+n.w/2,n.y=f+n.h/2}}function oe(e,t){let n=[e];for(let e=0;e<n.length;e++)for(let t of n[e].children)n.push(t);for(let e=n.length-1;e>=0;e--){let r=n[e];r.children.length>0&&G(r,t,e===0?0:t)}e.w=e.nw,e.h=e.nh,e.x=e.w/2,e.y=e.h/2;for(let e=0;e<n.length;e++){let r=n[e];r.children.length>0&&K(r,t,e===0?0:t)}return{width:e.w,height:e.h}}var se=12,ce=200,q=8,le=` fill="var(--_s)" stroke="var(--_b)"`,ue=` stroke="var(--_b)"`,de=[],fe=[],pe=[],me=[`default`],he=2e6,ge=new Map([[`square`,`rect`],[`round`,`rounded`],[`circle`,`circle`],[`doublecircle`,`dbl-circ`],[`diamond`,`diam`],[`hexagon`,`hex`],[`stadium`,`stadium`],[`subroutine`,`fr-rect`],[`cylinder`,`cyl`],[`rect_left_inv_arrow`,`odd`],[`lean_right`,`lean-r`],[`lean_left`,`lean-l`],[`trapezoid`,`trap-b`],[`inv_trapezoid`,`trap-t`]]),_e=new Set([`circle`,`dbl-circ`,`diam`]),ve=new Set([`stadium`,`hex`,`odd`,`lean-r`,`lean-l`,`trap-b`,`trap-t`]);function J(e){return e.kind===0&&(e.shape===`circle`||e.shape===`dbl-circ`)}function Y(e,t,n){let r=e.bw/2,i=e.bh/2,a=Math.abs(t-e.x),o=i;return J(e)?o=Math.sqrt(Math.max(r*r-a*a,0)):e.kind===0&&e.shape===`diam`?o=i*Math.max(1-a/r,0):e.kind===0?o=i-g(e.shape,e.bw,e.bh,n>0?2:0):e.kind===1&&U(e.mask)===`x`&&(o=i-z),e.y+n*o}function X(e,t,n){let r=e.bw/2,i=e.bh/2,a=Math.abs(t-e.y),o=r;return J(e)?o=Math.sqrt(Math.max(i*i-a*a,0)):e.kind===0&&e.shape===`diam`?o=r*Math.max(1-a/i,0):e.kind===0?o=r-g(e.shape,e.bw,e.bh,n>0?1:3):e.kind===1&&U(e.mask)===`y`&&(o=r-z),e.x+n*o}function Z(e,t,n,r){let i=t-e.x,a=n-e.y,o=e.bw/2,s=e.bh/2,c;c=J(e)?o/(Math.hypot(i,a)||1):e.kind===0&&e.shape===`diam`?1/(Math.abs(i)/o+Math.abs(a)/s||1):Math.min(i===0?1/0:o/Math.abs(i),a===0?1/0:s/Math.abs(a)),c===1/0&&(c=0),r.push(e.x+i*c,e.y+a*c)}function ye(e,t,n,r,i){let a=i.x-i.bw/2+1,o=i.x+i.bw/2-1,s=i.y-i.bh/2+1,c=i.y+i.bh/2-1;if(e<a&&n<a||e>o&&n>o||t<s&&r<s||t>c&&r>c)return!1;if(e===n||t===r)return!0;let l=n-e,u=r-t,d=(n,r)=>Math.sign(l*(r-t)-u*(n-e)),f=d(a,s);return f===0||d(o,s)!==f||d(o,c)!==f||d(a,c)!==f}function Q(e,t,n,r){let i=0;for(let a of r)if(a!==t&&a!==n){for(let t=0;t+3<e.length;t+=2)if(ye(e[t],e[t+1],e[t+2],e[t+3],a)){i++;break}}return i}function be(e,t,n,r){let i=e.x-e.bw/2,a=e.x+e.bw/2,o=e.y-e.bh/2,s=e.y+e.bh/2,c=t.x-t.bw/2,l=t.x+t.bw/2,u=t.y-t.bh/2,d=t.y+t.bh/2,f=Math.max(i,c),p=Math.min(a,l),m=Math.max(o,u),h=Math.min(s,d),g=p-f>6,_=h-m>6;if(g&&_){let n=e.bw*e.bh<=t.bw*t.bh?e:t,r=n===e?t:e,i=n.y-n.bh/2-(r.y-r.bh/2),a=r.y+r.bh/2-(n.y+n.bh/2),o=n.x-n.bw/2-(r.x-r.bw/2),s=r.x+r.bw/2-(n.x+n.bw/2),c=Math.min(i,a,o,s),l;return l=c===a?[n.x,Y(n,n.x,1),n.x,r.y+r.bh/2]:c===i?[n.x,Y(n,n.x,-1),n.x,r.y-r.bh/2]:c===s?[X(n,n.y,1),n.y,r.x+r.bw/2,n.y]:[X(n,n.y,-1),n.y,r.x-r.bw/2,n.y],n===e?l:[l[2],l[3],l[0],l[1]]}if(g){let r=Math.min(6,(p-f)/2),i=Math.min(Math.max((f+p)/2+n,f+r),p-r),a=t.y>e.y?1:-1;return[i,Y(e,i,a),i,Y(t,i,-a)]}if(_){let r=Math.min(6,(h-m)/2),i=Math.min(Math.max((m+h)/2+n,m+r),h-r),a=t.x>e.x?1:-1;return[X(e,i,a),i,X(t,i,-a),i]}let v=t.x>e.x?1:-1,y=t.y>e.y?1:-1,b=[X(e,e.y,v),e.y,t.x,e.y,t.x,Y(t,t.x,-y)],x=[e.x,Y(e,e.x,y),e.x,t.y,X(t,t.y,-v),t.y],S=Math.abs(t.x-e.x)>=Math.abs(t.y-e.y),C=S?b:x;if(r===void 0)return C;let w=Q(C,e,t,r);if(w===0)return C;let T=S?x:b,E=Q(T,e,t,r);if(E<w&&(C=T,w=E),w===0)return C;let D=[];return Z(e,t.x,t.y,D),Z(t,e.x,e.y,D),Q(D,e,t,r)<w?D:C}function xe(e,t,n){let r=e.length,i=e[0],a=e[1],o=e[r-2],c=e[r-1],l=e[2]-i,u=e[3]-a,d=Math.hypot(l,u);l/=d||1,u/=d||1;let f=o-e[r-4],p=c-e[r-3],m=Math.hypot(f,p);if(f/=m||1,p/=m||1,r===4&&t+n>d){let e=d/(t+n);t*=e,n*=e}t=Math.min(t,d),n=Math.min(n,m);let h=`M${s(i+l*t)},${s(a+u*t)}`;if(r===6){let r=Math.max(0,Math.min(q,d-t,m-n));h+=`L${s(e[2]-l*r)},${s(e[3]-u*r)}Q${s(e[2])},${s(e[3])} ${s(e[2]+f*r)},${s(e[3]+p*r)}`}return h+=`L${s(o-f*n)},${s(c-p*n)}`,{d:h,sx:i,sy:a,sdx:-l,sdy:-u,ex:o,ey:c,edx:f,edy:p}}function Se(e,t){let n=e.bw/2,r=e.bh/2,i=Math.max(1,Math.min(10+5*(t-1),n,r));if(J(e)){let t=e.x+n*Math.SQRT1_2,r=e.y-n*Math.SQRT1_2,a=2*Math.asin(Math.min(1,i/(2*n))),o=i=>Math.atan2(e.y-n*Math.sin(i)-r,e.x+n*Math.cos(i)-t);return[t,r,i,o(Math.PI/4+a),o(Math.PI/4-a)]}if(e.kind===0&&e.shape===`diam`){let t=Math.atan2(r,n);return[e.x+n/2,e.y-r/2,i,t+Math.PI,t]}return[e.x+n,e.y-r,i,Math.PI,Math.PI/2]}function Ce(e,t,n,r){let[i,a,o,c,l]=Se(e,t),u=c+n/o,d=l-r/o,f=(d-u)%(2*Math.PI);f<=0&&(f+=2*Math.PI);let p=i+o*Math.cos(u),m=a+o*Math.sin(u),h=i+o*Math.cos(d),g=a+o*Math.sin(d),_=i+o*Math.cos(c),v=a+o*Math.sin(c),y=i+o*Math.cos(l),b=a+o*Math.sin(l),x=Math.hypot(_-p,v-m),S=Math.hypot(y-h,b-g);return{d:`M${s(p)},${s(m)}A${s(o)},${s(o)} 0 ${+(f>Math.PI)} 1 ${s(h)},${s(g)}`,sx:_,sy:v,sdx:x>0?(_-p)/x:Math.sin(c),sdy:x>0?(v-m)/x:-Math.cos(c),ex:y,ey:b,edx:S>0?(y-h)/S:-Math.sin(l),edy:S>0?(b-g)/S:Math.cos(l)}}var $=[.5,.3,.7,.15,.85];function we(e,t,n,r,i,a,o){if(o===void 0)return .5;for(let s of $){let c=e[t]+(e[t+2]-e[t])*s,l=e[t+1]+(e[t+3]-e[t+1])*s,u=!0;for(let e of o)if(e!==i&&e!==a&&Math.abs(c-e.x)<(n+e.bw)/2&&Math.abs(l-e.y)<(r+e.bh)/2){u=!1;break}if(u)return s}return .5}function Te(e,t,n){return c(n,r=>Ee(e,t,n,r))}function Ee(c,g,_,v){let y=_.fontSize??16,b=Math.round(y*.875),S=_.measurer??x(_.fontFamily,_.fontFamilyMono),C=_.padding??8,w=_.icons,T=g.block?.padding,E=Math.min(typeof T==`number`&&T>=0?Math.min(T,200):se,v?6:1/0),D=v?80:ce,O=e=>{let t=[],n=e=>{for(let n of e)for(let e of n.split(`;`))t.push(e)};for(let t of e.classes&&e.classes.length>0?e.classes:me){let e=c.classes.get(t);e&&n(e.styles)}return e.styles&&n(e.styles),a(t)},k=(e,t)=>{let n=e.type,r=n===`space`?a(de):O(e),i=+!!r.bold|(r.italic?2:0),s=r.fontSize??y,c=0,u=``,d,f=0,p=0,m=0,g=0,b=0,x=0;if(n===`space`)c=3,d=o(void 0,!1,S,s,D);else if(n===`composite`)c=2,d=o(e.label,!1,S,s,v?l(_):4e3,i),m=d.height>0?d.height+4:0,f=d.width+2*E,p=m+2*E;else if(n===`block_arrow`){c=1,d=o(e.label,!1,S,s,D,i);let t=!0;for(let e of d.lines)for(let n of e)(n.icon!==void 0||n.text.trim()!==``)&&(t=!1);g=ne(e.directions);let n=t?re(g,0,0):re(g,d.width,d.height);f=n.w,p=n.h,b=n.dx,x=n.dy}else{u=ge.get(n??``)??`rect`,d=o(e.label,!1,S,s,D,i);let t=h(u,d.width,d.height);f=t.w,p=u===`cyl`?Math.max(t.h,d.height+40):t.h,x=t.dy}return{children:[],columns:c===2?e.columns??-1:-1,span:c===3?1:e.widthInColumns??1,space:c===3,head:m,nw:f,nh:p,col:0,row:0,cols:0,heights:pe,x:0,y:0,w:0,h:0,block:e,kind:c,index:t,shape:u,label:d,style:r,mask:g,dx:b,dy:x,bw:0,bh:0}},A=k(c.root,0);A.nw=0,A.nh=0;let j=[A],M=new Map;for(let e=0;e<j.length;e++){let t=j[e];if(t.kind===2)for(let e of t.block.children??fe){let n=k(e,j.length);t.children.push(n),j.push(n),n.kind!==3&&M.set(e.id,n)}}let ee=oe(A,E),N=[];for(let e of j)e.kind===0&&_e.has(e.shape)?(e.bw=e.nw,e.bh=e.nh):e.kind===1?(e.bw=e.span>1?e.w:e.nw,e.bh=e.nh):(e.bw=e.w,e.bh=e.kind===0&&ve.has(e.shape)?e.nh:e.h),e.kind===0&&e.shape===`cyl`&&(e.dy=Math.min(12,Math.max(6,e.bw/14))/2),(e.kind===0||e.kind===1)&&N.push(e);let P=new Map,te=new Set,F=[],I=[];for(let e of c.edges){let t=M.get(e.start??``),n=M.get(e.end??``);if(t===void 0||n===void 0)continue;let r=Math.min(t.index,n.index)*j.length+Math.max(t.index,n.index);P.set(r,(P.get(r)??0)+1),e.label&&te.add(r),F.push([t,n]),I.push(e)}let L=I.length*N.length<=he?N:void 0,R=new Map,z=[],B=0,V=0,H=ee.width,U=ee.height,ae=(e,t,n,r)=>{e-n/2<B&&(B=e-n/2),e+n/2>H&&(H=e+n/2),t-r/2<V&&(V=t-r/2),t+r/2>U&&(U=t+r/2)};for(let e=0;e<I.length;e++){let[t,n]=F[e],r=Math.min(t.index,n.index)*j.length+Math.max(t.index,n.index),i=P.get(r)??1,a=R.get(r)??0;R.set(r,a+1);let s=o(I[e].label,!1,S,b,ce),c,l,u;if(t===n){let[e,n,r]=Se(t,a+1);c=[],ae(e,n,2*r+2,2*r+2),l=e+r+6+s.width/2,u=n-r/2}else{let e=te.has(r)?Math.round(b*1.5)+2:14;c=be(t,n,(a-(i-1)/2)*e,L);let o=c.length,d=Math.abs(c[2]-c[0])+Math.abs(c[3]-c[1]),f=Math.abs(c[o-2]-c[o-4])+Math.abs(c[o-1]-c[o-3]),p=o===6&&f>d?2:0,m=s.width>0?we(c,p,s.width+8,s.height,t,n,L):.5;l=c[p]+(c[p+2]-c[p])*m,u=c[p+1]+(c[p+3]-c[p+1])*m}s.width>0&&ae(l,u,s.width+8,s.height),z.push({edge:I[e],points:c,loop:t===n?a+1:0,label:s,lx:l,ly:u})}let W=p(c.title,S,y,v?l(_):4e3),G=W.height>0?W.height+12:0,K=Math.max(H-B,W.width),q=C-B+(K-(H-B))/2,J=C+G-V;for(let e of j)e.x+=q,e.y+=J;let Y=Math.ceil(K+2*C),X=Math.ceil(U-V+G+2*C),Z=``,ye=``;for(let e=1;e<j.length;e++){let a=j[e];if(a.kind===3)continue;let o=t((a.block.classes??de).join(` `)),c=r(a.block.id);if(a.kind===2){let e=a.y-a.h/2;Z+=`<g class="pele-cluster${o}" data-id="${c}"><rect x="${s(a.x-a.w/2)}" y="${s(e)}" width="${s(a.w)}" height="${s(a.h)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${n(a.style.shape)}/>`+i(a.label,a.x,e+(a.head+E)/2+2,` class="pele-cluster-label" fill="var(--_m)"${a.style.text}`,w)+`</g>`;continue}let l=a.kind===1;ye+=`<g class="pele-node pele-shape-${l?`block-arrow`:a.shape}${o}" data-id="${c}" transform="translate(${s(a.x)},${s(a.y)})">`+(l?ie(a.mask,a.bw,a.bh,le+a.style.shape):m(a.shape,a.bw,a.bh,le+a.style.shape,ue+a.style.line))+i(a.label,a.dx,a.dy,` class="pele-label"${a.style.text}`,w)+`</g>`}let Q=``,$=``;for(let e=0;e<z.length;e++){let{edge:t,points:n,loop:i,label:a}=z[e],o=t.arrowTypeStart??``,s=t.arrowTypeEnd??``,c;if(i>0)c=Ce(F[e][0],i,u(o),u(s));else{for(let e=0;e<n.length;e+=2)n[e]+=q,n[e+1]+=J;c=xe(n,u(o),u(s))}let l=r(t.id);if(Q+=`<g class="pele-edge" data-id="${l}"><path d="${c.d}"${t.thickness===`thick`?` stroke-width="2.5"`:``}${t.pattern===`dotted`?` stroke-dasharray="3 4"`:``}/>`+f(o,c.sx,c.sy,c.sdx,c.sdy,`var(--_l)`)+f(s,c.ex,c.ey,c.edx,c.edy,`var(--_l)`)+`</g>`,a.width>0){let n=z[e].lx+q,r=z[e].ly+J;$+=d(t.id,a,n,r,``,w)}}return{svg:e(`block`,Y,X,y,_,c,i(W,Y/2,C+W.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(Z?`<g class="pele-clusters">${Z}</g>`:``)+(Q?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${Q}</g>`:``)+`<g class="pele-nodes">${ye}</g>`+($?`<g class="pele-edge-labels" font-size="${b}">${$}</g>`:``)),width:Y,height:X,links:[]}}var De={type:`block`,math:!0,parse(e,t,n){let r=new k;return r.title=n,te(e,r),r},render:Te};export{De as block};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{_ as e,a as t,b as n,d as r,f as i,i as a,o,s,u as c,x as l}from"./E3FWOBN4-D5m5o2g0.js";import{a as u,t as d}from"./DKTLEL5E-DciMwFJ1.js";import{a as f,i as p,l as m,s as h,u as g}from"./CUVCMPQX-JTGMOfG2.js";import{a as _,i as v,t as y}from"./A255FCTW-woaH7Mj_.js";import{a as ee,i as b,r as x,t as S}from"./SPBWZ4VS-EqfCsJ5V.js";import{t as C}from"./7WLXJQOR-D6QVYUu9.js";import{n as w,r as T}from"./DHKBVIA3-CVnlqiEq.js";import{i as E,n as te,r as D,t as O}from"./3JIRLDUO-C1CwW1Ha.js";import{n as k,t as A}from"./FTXIJQGB-CggtIYAM.js";import{PeleError as j,c as M,d as ne,g as N,h as P,i as F,n as I,o as L,s as R,u as z}from"./lazy-DaMZI1F7.js";var B=new Map([[`task`,`roundedRect`],[`tool`,`subroutine`],[`input`,`lean-right`],[`decision`,`diamond`],[`refdoc`,`lin-doc`],[`action`,`hexagon`],[`round`,`rect`]]),V=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`.split(`.`)),re=new Set([`roundedRect`,`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`lean-right`,`diamond`,`lin-doc`,`lined-document`,`hexagon`,`hex`,`connector`,`collapsedGroup`]),H=`roundedRect`;function U(e){return e&&(B.get(e)??e)}function W(e){return A(e)||e===`constructor`}function ie(e,t){for(let n of e)n.isGroup||(n.shape&&n.shape!==`squareRect`&&n.shape!==`rect`||(n.shape=H),V.has(n.shape)?(t.emitError(`SHAPE_REMOVED`,`shape "${n.shape}" was removed in v0.8.1, using "${H}"`,{nodeId:n.id}),n.shape=H):re.has(n.shape)||(t.emitWarning(`SHAPE_UNSUPPORTED`,`shape "${n.shape}" is not supported, using "${H}"`,{nodeId:n.id}),n.shape=H))}var G=new Set([`shape`,`view`,`icon`,`img`,`form`,`pos`,`w`,`h`,`class`,`style`,`labelType`]),ae=new Set([`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`tool`]);function oe(e){return ae.has(e.type)}function K(e){return e===`markdown`||e===`string`||e===`text`?e:`markdown`}function q(e){return e.startsWith(`"`)&&e.endsWith(`"`)?e.substring(1,e.length-1):e}function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function se(e){let t=e=>Array.isArray(e)?[]:J(e)?{}:e,n=t(e),r=[[e,n]];for(;r.length>0;){let[e,n]=r.pop();if(Array.isArray(e))for(let i of e){let e=t(i);n.push(e),typeof i==`object`&&i&&r.push([i,e])}else if(J(e))for(let i of Object.keys(e)){if(i===`__proto__`||i===`constructor`||i===`prototype`)continue;let a=e[i],o=t(a);n[i]=o,typeof a==`object`&&a&&r.push([a,o])}}return n}function Y(e,t){return Object.assign(e??{},t)}var ce=/:\s*[>|][\d+-]*\s*$/,le=/,([\t ]*)$/;function X(e){let t=!1,n=!1,r=0,i,a=[];for(let o of e.split(`
|
|
2
|
+
`)){if(i!==void 0){let e=o.length-o.trimStart().length;if(o.trim()===``||e>i){a.push(o);continue}i=void 0}let e=-1;for(let i=0;i<o.length;i++){let a=o[i];if(n)a===`\\`?i++:a===`"`&&(n=!1);else if(t)a===`'`&&(t=!1);else if(a===`"`)n=!0;else if(a===`'`)t=!0;else if(a===`#`&&(i===0||o[i-1]===` `||o[i-1]===` `)){e=i;break}else a===`[`||a===`{`?r++:(a===`]`||a===`}`)&&(r=Math.max(0,r-1))}if(t||n||r>0){a.push(o);continue}let s=e>=0?o.slice(0,e):o,c=e>=0?o.slice(e):``;ce.test(s)?(i=o.length-o.trimStart().length,a.push(o)):a.push(s.replace(le,`$1`)+c)}return a.join(`
|
|
3
|
+
`)}function ue(e,t){if(e===`arrow_point`&&t===`normal`)return`sequence`;if(e===`arrow_cross`&&t===`normal`)return`failure`;if(e===`arrow_open`&&t===`dotted`)return`reference`}function de(e){let t=e.trim(),n=t.slice(0,-1),r=`arrow_open`;switch(t.slice(-1)){case`x`:r=`arrow_cross`;break;case`>`:r=`arrow_point`;break;case`-`:case`.`:n=t}let i=`normal`,a=n.length-1,o=0;for(let e=0;e<n.length;e++)n[e]===`.`&&o++;return o>0&&(i=`dotted`,a=o),{type:r,stroke:i,length:a}}function fe(e){if(!e)return;let t={},n=!1;for(let r of Object.keys(e))G.has(r)||(t[r]=e[r],n=!0);return n?t:void 0}var pe=class{type=`agentflow`;direction;nodes=new Map;edges=[];subgraphs=[];connectors=new Map;classes=new Map;tooltips=new Map;defaultEdgeStyle;defaultInterpolate;mappings=[];diagnostics=[];title;accTitle;accDescr;lineOffset;subgraphLookup=new Map;globalNodes=new Set;members=new Set;edgeById=new Map;pairCount=new Map;subCount=0;bareMappings=new Set;firstMapping=new Map;reported=new Map;options;constructor(e={}){this.options=e,this.lineOffset=e.lineOffset??0}metadata(e,t,n){let r=t.includes(`
|
|
4
|
+
`),i;try{i=I(r?t+`
|
|
5
|
+
`:`{
|
|
6
|
+
`+t+`
|
|
7
|
+
}`)}catch(a){let o=r?X(t):t,s;if(o!==t)try{s=I(o+`
|
|
8
|
+
`)}catch{s=void 0}if(s===void 0){let{line:t,column:r}=this.errorAt(n),i=n?` (${t}:${r})`:``;throw new j(`Metadata of "${e}" is not valid YAML. ${a.message}${i}`,`syntax`,{type:`agentflow`,line:t,column:r})}i=s}return se(i??{})}errorAt(e){if(e===void 0)return{line:0,column:0};let t=this.options.source;if(t===void 0)return{line:e.first_line+this.lineOffset,column:e.first_column+1};let n=0;for(let r=1;r<e.first_line;r++)n=t.indexOf(`
|
|
9
|
+
`,n)+1;let{line:r,column:i}=L(t,n+e.first_column);return{line:r,column:i}}shapeError(e,t){return new j(e,`semantic`,{type:`agentflow`,...this.errorAt(t)})}addVertex(e,t,n,r,i,a,o={},s,c){if(!e||e.trim().length===0)return;let l,u,d;s!==void 0&&(l=this.metadata(e,s,c),J(l)&&(u=l,typeof l.shape==`string`&&(d=l.shape,l.shape=U(l.shape))));let f=this.subgraphLookup.get(e);if(f&&l){f.metadata=Y(f.metadata,l);return}let p=this.connectors.get(e);if(p&&l){p.metadata=Y(p.metadata,l);return}if(e===`connectors`)return;let m=this.edgeById.get(e);if(m){u?.animate!==void 0&&(m.animate=u.animate),u?.animation!==void 0&&(m.animation=u.animation),u?.curve!==void 0&&(m.interpolate=u.curve),l&&(m.metadata=Y(m.metadata,l));return}let h=this.nodes.get(e);if(h===void 0&&(h={id:e,labelType:`text`,styles:[],classes:[]},this.nodes.set(e,h)),t===void 0?h.text===void 0&&(h.text=e):(h.labelType=t.type,h.text=q(t.text.trim())),n!==void 0&&(h.type=n),r!=null)for(let e of r)h.styles.push(e);if(i!=null)for(let e of i)h.classes.push(e);if(a!==void 0&&(h.dir=a),h.props===void 0?h.props=o:o!==void 0&&Object.assign(h.props,o),l&&(h.metadata=Y(h.metadata,l),u!==void 0)){if(u.shape){let e=d??u.shape;if(typeof e!=`string`)throw this.shapeError(`No such shape: ${JSON.stringify(e)}.`,c);if(e!==e.toLowerCase()||e.includes(`_`))throw this.shapeError(`No such shape: ${e}. Shape names should be lowercase.`,c);let t=u.shape;if(!W(t))throw this.shapeError(`No such shape: ${t}.`,c);h.type=t}u.label&&(h.text=String(u.label),h.labelType=K(u.labelType))}}addSingleLink(e,t,n,r){let i={start:e,end:t,type:void 0,text:``,labelType:`text`,classes:[],isUserDefinedId:!1,interpolate:this.defaultInterpolate},a=n?.text;a!==void 0&&(i.text=q(a.text.trim()),i.labelType=K(a.type)),n!==void 0&&(i.type=n.type,i.stroke=n.stroke,i.length=n.length>10?10:n.length,n.edgeSemantic&&(i.edgeSemantic=n.edgeSemantic));let o=e+`\0`+t,s=this.pairCount.get(o)??0;r&&!this.edgeById.has(r)?(i.id=r,i.isUserDefinedId=!0):i.id=`L_${e}_${t}_${s===0?0:s+1}`;let c=this.options.maxEdges;if(c!==void 0&&this.edges.length>=c)throw new j(`Edge limit exceeded. The limit is ${c}.`,`limit`,{type:`agentflow`});this.edges.push(i),this.pairCount.set(o,s+1),this.edgeById.has(i.id)||this.edgeById.set(i.id,i)}addLink(e,t,n){let r=typeof n?.id==`string`?n.id.replace(`@`,``):void 0,i=e[e.length-1],a=t[0];for(let o of e)for(let e of t)this.addSingleLink(o,e,n,o===i&&e===a?r:void 0)}updateLinkInterpolate(e,t){for(let n of e)n==="default"?this.defaultInterpolate=t:this.edgeAt(n).interpolate=t}updateLink(e,t){for(let n of e){if(n==="default"){this.defaultEdgeStyle=t;continue}let e=this.edgeAt(n);e.style=t,t.length>0&&!t.some(e=>e?.startsWith(`fill`))&&t.push(`fill:none`)}}edgeAt(e){let t=this.edges[Number(e)];if(t===void 0)throw new j(`The index ${e} 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 t}addClass(e,t){let n=t.join().replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);for(let t of e.split(`,`)){let e=this.classes.get(t);e===void 0&&(e={id:t,styles:[],textStyles:[]},this.classes.set(t,e));for(let t of n)t.includes(`color`)&&e.textStyles.push(t.replace(`fill`,`bgFill`)),e.styles.push(t)}}setDirection(e){let t=e.trim();t.includes(`<`)&&(t=`RL`),t.includes(`^`)&&(t=`BT`),t.includes(`>`)&&(t=`LR`),t.includes(`v`)&&(t=`TB`),t===`TD`&&(t=`TB`),this.direction=t}setClass(e,t){for(let n of e.split(`,`))this.nodes.get(n)?.classes.push(t),this.edgeById.get(n)?.classes.push(t),this.subgraphLookup.get(n)?.classes.push(t)}setTooltip(e,t){if(t!==void 0)for(let n of e.split(`,`))this.tooltips.set(n,t)}setLink(e,t,n){let r=t.trim();for(let t of e.split(`,`)){let e=this.nodes.get(t);e!==void 0&&(e.link=r?b(r):void 0,e.linkTarget=n)}this.setClass(e,`clickable`)}setClickEvent(e,t,n){this.setClass(e,`clickable`)}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
10
|
+
`)}addSubGraph(e,t,n,r){let i=e?.text?.trim(),a=n?.text||``;e!==void 0&&e===n&&/\s/.test(a)&&(i=void 0);let o=new Set,s=[],c;for(let e of t)if(typeof e==`string`)e.trim()!==``&&!o.has(e)&&(o.add(e),s.push(e));else if(Array.isArray(e))for(let t of e)t.trim()!==``&&!o.has(t)&&(o.add(t),s.push(t));else c=e.value;c??=this.options.inheritDir?this.direction??this.options.direction:void 0,i??=`subGraph`+this.subCount,this.subCount++;let l=this.members,u=s.filter(e=>e!==i&&!this.globalNodes.has(e)&&!l.has(e));for(let e of u)l.add(e);let d=this.subgraphLookup.get(i);if(d){for(let e of u)d.nodes.push(e);return a.trim()&&(d.title=a.trim()),c&&(d.dir=c),i}let f={id:i,nodes:u,title:a.trim(),classes:[],dir:c,labelType:K(n?.type),type:`flow`};return this.subgraphs.push(f),this.subgraphLookup.set(i,f),i}addGlobal(e){let t=!1,n=e=>{let n=e.trim();n!==``&&(this.globalNodes.add(n),this.members.delete(n)&&(t=!0))};for(let t of e)if(typeof t==`string`)n(t);else if(Array.isArray(t))for(let e of t)n(e);if(t)for(let e of this.subgraphs)e.nodes=e.nodes.filter(e=>!this.globalNodes.has(e))}addConnector(e,t){let n=e?.text?.trim();if(!n)return``;let r=t?.text?.trim()??``,i=this.connectors.get(n);if(i)r.length>0&&(i.text=r);else{let e={id:n,labelType:`text`,styles:[],classes:[],isConnector:!0,text:r.length>0?r:n};this.connectors.set(n,e),this.nodes.set(n,e)}return n}destructLink(e,t){let n=de(e);return t&&(t.includes(`.`)?`dotted`:`normal`)!==n.stroke?{type:`INVALID`,stroke:`INVALID`}:{...n,edgeSemantic:ue(n.type,n.stroke)}}subgraph(e){return this.subgraphLookup.get(e)}vertexKind(e){if(oe(e))return`tool`;let t=U(e.type);return t===`hexagon`||t===`hex`?`action`:t===`lean-right`||t===`lean_right`?`input`:t===`lin-doc`||t===`lined-document`?`refdoc`:t===`diamond`?`decision`:`task`}semanticModel(){let e=[],t=[];for(let[n,r]of this.nodes){if(this.subgraphLookup.has(n))continue;let i=fe(r.metadata);if(r.isConnector){let e={id:n};r.text!==void 0&&r.text!==n&&(e.title=r.text),i&&(e.metadata=i),t.push(e);continue}let a={id:n};r.text!==void 0&&(a.label=r.text);let o=U(r.type);o!==void 0&&(a.shape=o),a.vertexKind=this.vertexKind(r),i&&(a.metadata=i),e.push(a)}let n={vertices:e,edges:this.edges.map(e=>{let t={start:e.start,end:e.end};return e.id!==void 0&&(t.id=e.id),e.text.length>0&&(t.label=e.text),e.type!==void 0&&(t.type=e.type),e.stroke!==void 0&&(t.stroke=e.stroke),e.edgeSemantic!==void 0&&(t.edgeSemantic=e.edgeSemantic),e.length!==void 0&&(t.length=e.length),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata={...e.metadata}),t}),subGraphs:this.subgraphs.map(e=>{let t={id:e.id,nodes:[...e.nodes],type:e.type,title:e.title};e.dir!==void 0&&(t.direction=e.dir);let n=fe(e.metadata);return n&&(t.metadata=n),t}),connectors:t,diagnostics:this.diagnostics};return this.direction!==void 0&&(n.direction=this.direction),n}position(e){let t=e?.first_line??0,n=e?.first_column??0;return{startLine:t+this.lineOffset,startColumn:n,endLine:(e?.last_line??t)+this.lineOffset,endColumn:e?.last_column??n,startIndex:0,endIndex:0}}pushMapping(e,t,n){let r={id:e,type:t,position:n};return this.mappings.push(r),this.firstMapping.has(e)||this.firstMapping.set(e,r),r}addVertexMapping(e,t,n,r){if(!e)return;let i=this.pushMapping(e,`vertex`,this.position(r));n??this.bareMappings.add(i)}extendVertexMapping(e,t){if(!e||!t)return;let n=this.position(t);for(let t=this.mappings.length-1;t>=0;t--){let r=this.mappings[t];if(r.type!==`vertex`||r.id!==e)continue;this.bareMappings.delete(r)&&(r.type=`attachment`);let i=r.position;(n.endLine>i.endLine||n.endLine===i.endLine&&n.endColumn>i.endColumn)&&(i.endLine=n.endLine,i.endColumn=n.endColumn);return}this.pushMapping(e,`attachment`,n)}addEdgeMapping(e,t,n,r){let i=Array.isArray(t)?t.filter(e=>typeof e==`string`&&e!==``):[];this.pushMapping(i.length>0?i.join(`>`):`edge`,`edge`,this.position(r))}blockMapping(e,t,n,r){if(!e)return;let i=this.position(n),a=r?this.position(r):i;this.pushMapping(e,t,{startLine:i.startLine,startColumn:i.startColumn,endLine:a.endLine,endColumn:a.endColumn,startIndex:0,endIndex:0})}addSubgraphMapping(e,t,n,r){let i=typeof e==`string`?e:e?.text;this.blockMapping(i??``,`subgraph`,n,r)}addConnectorMapping(e,t,n,r){this.blockMapping(e?.text?.trim()??``,`connector`,n,r)}emit(e,t,n,r){let i=r?.nodeId??r?.edgeId,a={id:e,severity:t,message:n};r?.nodeId?a.nodeId=r.nodeId:r?.edgeId&&(a.edgeId=r.edgeId);let o=i?this.firstMapping.get(i):void 0;o&&(a.position=o.position);let s=i??``,c=this.reported.get(s);if(c===void 0)this.reported.set(s,[a]);else{for(let r of c)if(r.id===e&&r.severity===t&&r.message===n&&r.nodeId===a.nodeId&&r.edgeId===a.edgeId)return;c.push(a)}this.diagnostics.push(a),this.options.log?.(t,`agentflow[${e}]: ${n}`)}emitWarning(e,t,n){this.emit(e,`warning`,t,n)}emitError(e,t,n){this.emit(e,`error`,t,n)}},me=`$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`.split(`.`),he=new Uint8Array(128);for(let e of`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!"#$%&'*+.\`?\\_/`)he[e.charCodeAt(0)]=1;var ge=/accTitle\s*:\s*/y,_e=/accDescr\s*:\s*/y,ve=/accDescr\s*\{\s*/y,ye=/call\s+/y,be=/click\s+/y,xe=/(?:\r?\n)*\s*\n/y,Se=/\s*(?:LR|RL|TB|BT|TD|BR)\b/y,Ce=/\s*[<>^]/y,we=/\s*v\b/y,Te=[/.*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],Ee=/[\n\r\u2028\u2029]/g,De=/\(\s*\)/y,Oe=/\n\s*/g;function ke(e){let t=e.length,n=[],r=[],i=[],a=[],o=[],s=0,c=0,l=1,u=0,d=!0,f=e.indexOf(`direction`),p=e.indexOf(`@`),m=-1,h=0,g=0,_=-1,v=-1,y=-1,ee=-1,b=-1,x=-1,S=-1,w=t=>{let n=-1;for(let r=c;r<t;r++){let i=e.charCodeAt(r);i===10?(l++,n=r):i===13&&(r+1<t&&e.charCodeAt(r+1)===10&&r++,l++,n=r)}if(n<0)u+=t-c;else{let r=n+1;for(;r<t;){let t=e.charCodeAt(r);if(t===8232||t===8233)break;r++}u=r-n-1}c=t},T=(t,o)=>{n.push(t),r.push(e.slice(c,o)),i.push(c),a.push(l,u),w(o),a.push(l,u)},E=(t,o)=>{n.push(t),r.push(e.slice(c,o)),i.push(c),a.push(l,u),u+=o-c,c=o,a.push(l,u)},te=(t,o)=>{n.push(t),r.push(e.slice(c,o)),i.push(c),a.push(l,u);for(let t=c;t<o;t++){let n=e.charCodeAt(t);n===10||n===13?(l++,u=0):u++}c=o,a.push(l,u)},D=(e,t,o)=>{n.push(e),r.push(t),i.push(c),a.push(l,u),w(o),a.push(l,u)},O=e=>{o.push(s),s=e},k=()=>{o.length>0&&(s=o.pop())},A=(t,n)=>(t.lastIndex=n,t.test(e)?t.lastIndex:-1),j=t=>e.startsWith(t,c)&&!N(e.charCodeAt(c+t.length)),M=n=>{if(n>=v&&n<=y)return y;let r=n;for(;r<t&&P(e.charCodeAt(r));)r++;return v=n,y=r,r},ne=n=>{if(n>=ee&&n<=b)return b;let r=n;for(;r<t;){let t=e.charCodeAt(r);if(t!==32&&t!==9)break;r++}return ee=n,b=r,r},F=t=>{let n=M(t);if(n===S||e.charCodeAt(n)!==45||e.charCodeAt(n+1)!==45)return-1;let r=n+2;for(;e.charCodeAt(r)===45;)r++;let i=e.charCodeAt(r);return i===120||i===62?M(r+1):(S=n,-1)},I=()=>{let t=M(c);if(t===x||e.charCodeAt(t)!==45)return!1;let n=e.charCodeAt(t+1),r=t+2;if(n===45){for(;e.charCodeAt(r)===45;)r++;let n=e.charCodeAt(r);return n===120||n===62?T(42,M(r+1)):(O(10),T(43,M(t+2))),!0}if(n===46){for(;e.charCodeAt(r)===46;)r++;if(e.charCodeAt(r)===45)return T(42,M(r+1)),!0}return x=t,!1},L=n=>{if(e.charCodeAt(n)!==37||e.charCodeAt(n+1)!==37||e.charCodeAt(n+2)===123)return-1;let r=e.indexOf(`
|
|
11
|
+
`,n+2);return r===-1?t:r},R=()=>{e.charCodeAt(c+1)===96?(O(2),w(c+2)):(O(1),w(c+1))},z=t=>{let n=e.charCodeAt(c+1);return t===40?(n===45?(O(8),E(47,c+2)):n===91?(O(7),E(49,c+2)):n===40&&e.charCodeAt(c+2)===40?(O(7),E(57,c+3)):(O(7),E(72,c+1)),!0):t===91?(n===91?(O(7),E(51,c+2)):n===40?(O(7),E(55,c+2)):n===47?(O(9),E(60,c+2)):n===92?(O(9),E(61,c+2)):(O(7),E(74,c+1)),!0):t===124?(O(7),E(70,c+1),!0):t===123&&(O(7),E(76,c+1),!0)},B=()=>{let n=c;for(;n<t;){let r=e.charCodeAt(n);if(r<128&&he[r]===1)n++;else if(r===45&&n+1<t){let t=e.charCodeAt(n+1);if(t===62||t===45||t===46)break;n++}else break}return n!==c&&(E(67,n),!0)},V=n=>{let r=n;for(;r<t;){let t=e.charCodeAt(r);if(t!==32&&t!==9)break;r++}return r},re=n=>{let r;switch(n){case 97:if(e.startsWith(`acc`,c)){if((r=A(ge,c))>=0)return O(3),T(2,r),!0;if((r=A(_e,c))>=0)return O(4),T(4,r),!0;if((r=A(ve,c))>=0)return O(5),w(r),!0}if(j(`agentflow-beta`))return d&&(d=!1,O(6)),E(20,c+14),!0;break;case 64:if(e.charCodeAt(c+1)===123)return O(14),D(7,``,c+2),!0;break;case 99:if((r=A(ye,c))>=0)return O(12),w(r),!0;if(j(`classDef`))return E(16,c+8),!0;if(j(`class`))return E(17,c+5),!0;if((r=A(be,c))>=0)return O(11),w(r),!0;if(j(`connector`))return E(22,c+9),!0;break;case 34:return R(),!0;case 115:if(j(`style`))return E(12,c+5),!0;break;case 100:if(j(`default`))return E(13,c+7),!0;break;case 108:if(j(`linkStyle`))return E(14,c+9),!0;break;case 105:if(j(`interpolate`))return E(15,c+11),!0;break;case 104:if(e.startsWith(`href`,c)&&P(e.charCodeAt(c+4)))return T(18,c+5),!0;break;case 102:if(j(`flow`))return E(21,c+4),!0;break;case 103:if(j(`global`))return E(23,V(c+6)),!0;break;case 101:if(j(`end`))return E(24,V(c+3)),!0;break;case 95:if(j(`_self`))return E(25,c+5),!0;if(j(`_blank`))return E(25,c+6),!0;if(j(`_parent`))return E(25,c+7),!0;if(j(`_top`))return E(25,c+4),!0}if(f!==-1&&c>=h&&(f<c&&(f=e.indexOf(`direction`,c)),f!==-1&&(m<c&&(Ee.lastIndex=c,m=Ee.test(e)?Ee.lastIndex-1:t),f<m))){for(let e=0;e<5;e++)if((r=A(Te[e],c))>=0)return T(28+e,r),!0;h=m}if(p!==-1&&n!==34&&!P(n)){if(c>=g){p<c&&(p=e.indexOf(`@`,c));let n=c;for(;n<t;){let t=e.charCodeAt(n);if(t===34||P(t))break;n++}if(g=n,_=-1,p!==-1&&p<n)for(let r=Math.min(n,t-1)-1;r>=p;r--){if(e.charCodeAt(r)!==64)continue;let t=e.charCodeAt(r+1);if(t!==123&&t!==34){_=r;break}}}if(_>c)return E(33,_+1),!0}if(n>=48&&n<=57){let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t<48||t>57)break;n++}return E(34,n),!0}switch(n){case 35:return E(35,c+1),!0;case 58:return e.charCodeAt(c+1)===58&&e.charCodeAt(c+2)===58?E(36,c+3):E(37,c+1),!0;case 38:return E(38,c+1),!0;case 59:return E(39,c+1),!0;case 44:return E(40,c+1),!0;case 42:return E(41,c+1),!0;case 60:return E(62,c+1),!0;case 45:return I()||B()||E(68,c+1),!0;case 40:return z(n);case 91:return e.charCodeAt(c+1)===124?(E(52,c+2),!0):z(n);case 124:case 123:return z(n);case 62:return O(7),E(53,c+1),!0;case 94:return E(63,c+1),!0;case 92:return e.charCodeAt(c+1)===124?(E(64,c+2),!0):B();case 118:return N(e.charCodeAt(c+1))?B():(E(65,c+1),!0);case 37:return(r=L(c))>=0?(T(66,r),!0):B()}if(P(n)){if(I())return!0;if((n===32||n===9)&&(r=L(ne(c)))>=0)return T(66,r),!0;for(r=c;;){let t=e.charCodeAt(r);if(t===10)r++;else if(t===13&&e.charCodeAt(r+1)===10)r+=2;else break}return r>c?T(77,r):T(78,c+1),!0}return n<128?B():C(n)?(E(69,c+1),!0):!1};e:for(;;){if(c>=t){let e=-1;switch(s){case 0:e=79;break;case 3:e=3;break;case 4:e=5;break;case 5:e=6;break;case 11:e=19;break;case 12:e=8;break;case 13:e=9}e!==-1&&E(e,t);break}let o=e.charCodeAt(c),d=!0;switch(s){case 0:d=re(o);break;case 1:if(o===34)e.charCodeAt(c+1)===96?(O(2),w(c+2)):(k(),w(c+1));else{let n=e.indexOf(`"`,c);T(11,n===-1?t:n)}break;case 2:if(o===96)e.charCodeAt(c+1)===34?(k(),w(c+2)):d=!1;else if(o===34)R();else{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===96||t===34)break;n++}T(10,n)}break;case 3:case 4:{let n=e.indexOf(`
|
|
12
|
+
`,c);n===-1&&(n=t);let r=s===3?3:5;k(),T(r,n);break}case 5:if(o===125)k(),w(c+1);else{let n=e.indexOf(`}`,c);n===-1&&(n=t),T(6,n)}break;case 6:{let e;o===34?R():(e=A(xe,c))>=0?(k(),T(26,e)):(e=A(Se,c))>=0||(e=A(Ce,c))>=0||(e=A(we,c))>=0?(k(),T(27,e)):d=z(o);break}case 7:{let n=e.charCodeAt(c+1);switch(o){case 34:R();break;case 40:case 91:case 123:z(o);break;case 93:k(),n===41?E(48,c+2):n===93?E(50,c+2):E(73,c+1);break;case 41:k(),n===93?E(54,c+2):n===41&&e.charCodeAt(c+2)===41?E(56,c+3):E(71,c+1);break;case 124:k(),E(70,c+1);break;case 125:k(),E(75,c+1);break;case 37:{let e=L(c);e>=0?w(e):d=!1;break}default:{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===91||t===93||t===40||t===41||t===123||t===125||t===124||t===34||t===37)break;n++}T(46,n)}}break}case 8:{let n=e.charCodeAt(c+1),r;if(o===34)R();else if(o===37&&(r=L(c))>=0)w(r);else if((o===45||o===47||o===41)&&n===41)k(),E(45,c+2);else if(o===40||o===91||o===123)z(o);else if(o===41||o===93||o===125)d=!1;else{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===34||t===40||t===41||t===91||t===93||t===123||t===125||(t===45||t===47)&&e.charCodeAt(n+1)===41||t===37&&e.charCodeAt(n+1)===37&&e.charCodeAt(n+2)!==123)break;n++}te(46,n)}break}case 9:{let n=e.charCodeAt(c+1);if(o===34){R();break}switch(o){case 40:n===45||n===91||n===40&&e.charCodeAt(c+2)===40?z(o):n===93?(k(),E(58,c+2)):z(o);break;case 91:case 123:z(o);break;case 92:n===93?(k(),E(58,c+2)):E(46,c+1);break;case 47:n===93?(k(),E(59,c+2)):E(46,c+1);break;case 93:case 41:n===93?(k(),E(58,c+2)):d=!1;break;case 125:d=!1;break;case 37:{let e=L(c);e>=0?w(e):d=!1;break}default:{if((o===63||o===61)&&n===93){k(),E(58,c+2);break}let r=c+1;for(;r<t;){let t=e.charCodeAt(r);if(t===92||t===91||t===93||t===40||t===41||t===123||t===125||t===47||t===37)break;r++}T(46,r)}}break}case 10:{if(o===34){R();break}let n=F(c);if(n>=0){k(),T(42,n);break}if(o===45&&e.charCodeAt(c+1)===45){d=!1;break}let r=c+1;for(;r<t;){let t=e.charCodeAt(r);if(t===34)break;if(t===45){if(e.charCodeAt(r+1)===45)break}else if(P(t)&&F(r)>=0)break;r++}te(44,r);break}case 11:if(o===34)R();else if(P(o))k(),w(c+1);else{let n=c+1;for(;n<t&&!P(e.charCodeAt(n));)n++;E(19,n)}break;case 12:if(o===40){let e=A(De,c);k(),e>=0?w(e):(O(13),w(c+1))}else{let n=e.indexOf(`(`,c);n===-1&&(n=t),T(8,n)}break;case 13:if(o===41)k(),w(c+1);else{let n=e.indexOf(`)`,c);n===-1&&(n=t),T(9,n)}break;case 14:if(o===34)O(15),E(7,c+1);else if(o===125)k(),w(c+1);else if(o===94)d=!1;else{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===125||t===94||t===34)break;n++}T(7,n)}break;case 15:if(o===34)k(),E(7,c+1);else{let n=e.indexOf(`"`,c);n===-1&&(n=t),D(7,e.slice(c,n).replace(Oe,`<br/>`),n)}}if(!d)return n.push(1),r.push(``),i.push(c),a.push(l,u,l,u),{types:n,texts:r,starts:i,locs:a};continue e}return n.push(0),r.push(``),i.push(t),a.push(l,u,l,u),{types:n,texts:r,starts:i,locs:a}}var Ae=new Uint8Array(80);for(let e of[34,67,65,68,13,40,37,38,35,41,69])Ae[e]=1;var je=new Uint8Array(80);for(let e of[34,69,67,27,65,68,40,37,38,35,41])je[e]=1;var Me=new Uint8Array(80);for(let e of[34,67,78,68,38,69,37,41,35,12,14,16,17,19,20,27,21,22,23,24,65,63,43])Me[e]=1;var Ne=new Uint8Array(80);for(let e of[34,67,37,78,35,12])Ne[e]=1;var Pe=new Uint8Array(80);for(let e of[77,39,79,66])Pe[e]=1;var Fe=`'UNICODE_TEXT', 'TEXT', 'TAGSTART'`,Ie=`'COMMENT', 'SEMI', 'NEWLINE', 'EOF'`,Z=[],Le=/}[^\S\n]*\n/g;function Re(e,t,n=!1){let r=!n&&e.includes(`}`)?e.replace(Le,`}
|
|
13
|
+
`):e,{types:i,texts:a,starts:o,locs:s}=ke(r),c=0,l,u=0,d=0,f=t=>{let n=i[c],a=r===e?o[c]:F([M(e,Le,2)],o[c]);throw n===1?R(`agentflow`,e,a,``,!0):R(`agentflow`,e,a,`Expecting ${t}, got '${me[n]}'`)},p=(e,t)=>({first_line:s[4*e],first_column:s[4*e+1],last_line:s[4*t+2],last_column:s[4*t+3]}),m=(e,t=``)=>(i[c]!==e&&f(`'${me[e]}'${t?`, `+t:``}`),a[c++]),h=()=>{Pe[i[c]]===0&&f(Ie),c++},g=()=>{Ae[i[c]]===0&&f(`'NODE_STRING'`);let e=a[c++];for(;Ae[i[c]]===1;)e+=a[c++];return e},_=()=>{je[i[c]]===0&&f(`'NODE_STRING'`);let e=a[c++];for(;je[i[c]]===1;)e+=a[c++];return e},v=()=>{let e=i[c],t;if(e===11)t=`string`;else if(e===10)t=`markdown`;else if(e===46||e===62||e===53||e===69)t=`text`;else return f(`${Fe}, 'TAGEND', 'STR', 'MD_STR'`);let n=a[c++];for(;;){let e=i[c];if(e!==46&&e!==62&&e!==53&&e!==69)break;n+=a[c++]}return{text:n,type:t}},y=e=>{m(e,Fe)},ee=()=>{let e=i[c],t;if(e===11)t=`string`;else if(e===10)t=`markdown`;else if(e===44||e===69)t=`text`;else return f(`'EDGE_TEXT', 'STR', 'MD_STR'`);let n=a[c++];for(;i[c]===44||i[c]===69;)n+=a[c++];return{text:n,type:t}},b=()=>{let e=i[c],t;if(e===11)t=`text`;else if(e===10)t=`markdown`;else if(Me[e]===1)t=`text`;else return f(`'NODE_STRING', 'STR', 'MD_STR'`);let n=a[c++];for(;Me[i[c]]===1;)n+=a[c++];return{text:n,type:t}},x=()=>{u=c;let e=a[c++];for(;i[c]===7;)e+=a[c++];return d=c-1,e},S=(e,n,r,i)=>{let a=p(r,i);t.addVertex(e,void 0,void 0,void 0,void 0,void 0,void 0,n,a),t.extendVertexMapping(e,a)},C=(e,n)=>{n.data!==void 0&&t.addVertex(e,void 0,void 0,void 0,void 0,void 0,void 0,n.data,p(n.dataFrom,n.dataTo))},w=()=>{let e=c,n=g(),r,a,o;switch(i[c]){case 74:c++,r=v(),y(73),a=`square`;break;case 57:c++,r=v(),y(56),a=`doublecircle`;break;case 72:c++,i[c]===72?(c++,r=v(),y(71),m(71),a=`circle`):(r=v(),y(71),a=`round`);break;case 47:c++,r=v(),y(45),a=`ellipse`;break;case 49:c++,r=v(),y(48),a=`stadium`;break;case 51:c++,r=v(),y(50),a=`subroutine`;break;case 52:{c++;let e=m(67);m(37);let t=m(67);m(70),r=v(),y(73),a=`rect`,o={[e]:t};break}case 55:c++,r=v(),y(54),a=`cylinder`;break;case 76:c++,i[c]===76?(c++,r=v(),y(75),m(75),a=`hexagon`):(r=v(),y(75),a=`diamond`);break;case 53:c++,r=v(),y(73),a=`odd`;break;case 60:c++,r=v(),i[c]===59?(c++,a=`lean_right`):(y(58),a=`trapezoid`);break;case 61:c++,r=v(),i[c]===58?(c++,a=`lean_left`):(y(59),a=`inv_trapezoid`)}return o===void 0?a===void 0?t.addVertex(n):t.addVertex(n,r,a):t.addVertex(n,r,a,void 0,void 0,void 0,o),t.addVertexMapping(n,r,a,p(e,c-1)),n},T=()=>{let e=w();return i[c]===36&&(c++,t.setClass(e,g())),e},E=()=>{let e=[T()];for(l=void 0;;){let t=i[c]===7?x():void 0,n=u,r=d;if(i[c]!==78)return l=t,e;do c++;while(i[c]===78);if(i[c]!==38)return t!==void 0&&f(`'AMP'`),e;c++,i[c]!==78&&f(`'SPACE'`);do c++;while(i[c]===78);let a=T();t!==void 0&&S(e[e.length-1],t,n,r),e.push(a)}},te=()=>{let e;if(i[c]===33&&(e=a[c++]),i[c]===42){let n=t.destructLink(a[c++]);return e!==void 0&&(n.id=e),i[c]===70&&(c++,n.text=v(),y(70),i[c]===78&&c++),n}if(i[c]===43){let n=a[c++],r=ee(),i=m(42,`'EDGE_TEXT'`),o=t.destructLink(i,n);return o.text=r,e!==void 0&&(o.id=e),o}return f(`'LINK', 'START_LINK'`)},D=()=>{let e=c,n=E();l!==void 0&&S(n[n.length-1],l,u,d);let r=n;for(;;){let a=i[c];if(a!==42&&a!==43&&a!==33)return r;let o=te(),s=E();l!==void 0&&S(s[s.length-1],l,u,d),t.addLink(n,s,o),t.addEdgeMapping(n,s,o,p(e,c-1)),r=s.concat(r),n=s}},O=()=>{Ne[i[c]]===0&&f(`'NODE_STRING', 'NUM', 'COLON', 'BRKT'`);let e=a[c++];for(;Ne[i[c]]===1;)e+=a[c++];return e},k=()=>{let e=[O()];for(;i[c]===40;)c++,e.push(O());return e},A=()=>{c++,m(78);let e;if(i[c]===13)e=[a[c++]];else for(e=[m(34,`'DEFAULT'`)];i[c]===40;)c++,e.push(m(34));if(m(78),i[c]!==15){t.updateLink(e,k());return}c++,m(78);let n=_();if(i[c]===78){c++;let r=k();t.updateLinkInterpolate(e,n),t.updateLink(e,r)}else t.updateLinkInterpolate(e,n)},j=(e,n)=>{if(i[c]!==78){t.setLink(e,n);return}if(c++,i[c]===25){t.setLink(e,n,a[c++]);return}let r=m(11,`'LINK_TARGET'`);i[c]===78?(c++,t.setLink(e,n,m(25))):t.setLink(e,n),t.setTooltip(e,r)},ne=()=>{let e=a[c++];switch(i[c]){case 8:{let n=a[c++],r=i[c]===9,o=r?a[c++]:void 0,s;i[c]===78&&(c++,s=m(11)),r?t.setClickEvent(e,n,o):t.setClickEvent(e,n),s!==void 0&&t.setTooltip(e,s);return}case 18:c++,j(e,m(11));return;case 11:j(e,a[c++]);return;default:{let n=_();if(i[c]===78){c++;let r=m(11);t.setClickEvent(e,n),t.setTooltip(e,r)}else t.setClickEvent(e,n)}}},N=e=>{m(78,Ie);let t=b(),n={text:``,type:`text`};i[c]===74&&(c++,n=v(),y(73));let r=i[c]===7?x():void 0;return Pe[i[c]]===0&&f(`${Ie}, 'SHAPE_DATA'`),{global:!1,at:e,id:t,title:n,data:r,dataFrom:u,dataTo:d,list:[],collect:!1}},P=()=>{let e=i[c];switch(e){case 12:{c++,m(78);let e=g();return m(78),t.addVertex(e,void 0,void 0,k()),h(),Z}case 14:return A(),h(),Z;case 16:{c++,m(78);let e=g();return m(78),t.addClass(e,k()),h(),Z}case 17:{c++,m(78);let e=g();return m(78),t.setClass(e,g()),h(),Z}case 19:return ne(),h(),Z;case 22:{let e=N(c++),n=c++,r=t.addConnector(e.id,e.title);return C(r,e),t.addConnectorMapping(e.id,e.title,p(e.at,e.at),p(n,n)),r}case 28:case 29:case 30:case 31:case 32:return c++,{stmt:`dir`,value:ze[e-28]};case 2:{c++;let e=m(3).trim();return t.setAccTitle(e),e}case 4:{c++;let e=m(5).trim();return t.setAccDescription(e),e}case 6:{let e=a[c++].trim();return t.setAccDescription(e),e}default:{Ae[e]===0&&f(Be);let t=D();return h(),t}}},I=()=>{let e=[],n=[],r=!1;for(;;){let o=i[c];if(o===0)break;if(o===24){let i=e.pop();if(i===void 0)break;let a=c++;if(i.global){t.addGlobal(n),n=i.list,r=i.collect;continue}let o=t.addSubGraph(i.id,n,i.title,`flow`);C(o,i),t.addSubgraphMapping(i.id,i.title,p(i.at,i.at),p(a,a)),n=i.list,r=i.collect,r&&n.push(o)}else if(o===39||o===77||o===78||o===79)r&&n.push(a[c]),c++;else if(o===66)c++;else if(o===21||o===23){let t=c++,a;o===23||Pe[i[c]]===1?(a={global:o===23,at:t,id:void 0,title:void 0,data:void 0,dataFrom:0,dataTo:0,list:n,collect:r},h()):(a=N(t),a.list=n,a.collect=r,c++),e.push(a),n=[],r=!0}else{let e=P();r&&(!Array.isArray(e)||e.length>0)&&n.push(e)}}e.length>0&&f(`'end'`)};for(;i[c]===78||i[c]===77||i[c]===66;)c++;if(m(20,`'SPACE', 'NEWLINE', 'COMMENT'`),i[c]===26)c++,t.setDirection(`TB`);else{let e=m(27,`'NODIR'`),n=i[c];if(n===78){do c++;while(i[c]===78);n=i[c],n!==77&&f(`'NEWLINE', 'SPACE'`)}else n!==39&&n!==77&&n!==66&&f(`'COMMENT', 'SEMI', 'NEWLINE', 'SPACE'`);c++,t.setDirection(e)}I(),i[c]!==0&&f(Be)}var ze=[`TB`,`BT`,`RL`,`LR`,`TD`],Be=`'COMMENT', 'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'flow', 'global', 'connector', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'STYLE', 'LINKSTYLE', 'CLASSDEF', 'CLASS', 'CLICK', 'NODE_STRING'`,Q=new Map([[`tool`,0],[`task`,1],[`decision`,2],[`input`,3],[`refdoc`,4],[`connector`,5],[`action`,6]]),Ve=Q.size,He=e=>Math.max(1,e-Ve),Ue=(e,t)=>{let n=Ve+e%He(t);return t>0?n%t:n};function We(e,t,n,r){let i=n.size;for(let a of e){if(a.isGroup||a.shape===`collapsedGroup`){a.colorIndex=Ue(n.get(a.id)??i++,r);continue}let e=t(a.id);e&&Q.has(e)&&(a.kind=e)}}function Ge(e,t,n){let r=[],i=[],a=e.subgraphs,o=t=>{let n=[];for(let r of t){let t=e.classes.get(r);t?.styles&&(n=[...n,...t.styles].map(e=>e.trim())),t?.textStyles&&(n=[...n,...t.textStyles].map(e=>e.trim()))}return n},s=new Set,c=new Map,l=new Set;for(let t of a){if(t.metadata?.view!==`collapsed`||s.has(t.id))continue;let n=[t.id];for(;n.length>0;){let r=e.subgraph(n.pop())?.nodes;if(r!==void 0)for(let e of r)e===t.id||s.has(e)||(s.add(e),c.set(e,t.id),l.has(e)||n.push(e))}l.add(t.id)}let u=new Map;for(let e of s){let t=[e],n=c.get(e);for(;;){let e=u.get(n),r=e??c.get(n);if(r===void 0||(e===void 0&&t.push(n),n=r,e!==void 0))break}for(let e of t)u.set(e,n)}let d=new Map;a.forEach((e,t)=>d.set(e.id,t));let f=new Map,p=(e,t,n)=>{let r=d.get(e);if(r===void 0||r<n)return!1;let i=t;for(let t=0;i!==void 0&&t<=a.length;t++){if(i===e)return!0;i=f.get(i)}return!1};for(let t=a.length-1;t>=0;t--){let n=a[t];if(!s.has(n.id))for(let r of n.nodes)p(r,n.id,t)?e.emitWarning(`CONTAINMENT_VIOLATION`,`Container "${n.id}" cannot contain "${r}" because "${r}" already contains it. The nesting that would close the loop is dropped.`,{nodeId:r}):f.set(r,n.id)}let m=new Map;for(let e=a.length-1;e>=0;e--){let t=a[e];if(s.has(t.id))continue;let n=t.metadata?.view===`collapsed`,i={id:t.id,label:t.title,labelType:t.labelType,parentId:f.get(t.id),cssStyles:[],cssCompiledStyles:o(t.classes),cssClasses:t.classes.join(` `),shape:n?`collapsedGroup`:`flowGroup`,dir:t.dir,isGroup:!n,metadata:n?{...t.metadata,containerType:t.type}:t.metadata};r.push(i),m.set(t.id,i)}for(let t of e.nodes.values()){if(s.has(t.id))continue;let n=m.get(t.id);if(n){n.cssStyles=t.styles,n.cssCompiledStyles=o(t.classes),n.cssClasses=t.classes.join(` `);continue}let i=U(t.type),a={id:t.id,label:t.text,labelType:t.labelType,parentId:f.get(t.id),cssStyles:t.styles,cssCompiledStyles:o([`default`,`node`,...t.classes]),cssClasses:`default `+t.classes.join(` `),dir:t.dir,link:t.link,linkTarget:t.linkTarget,tooltip:e.tooltips.get(t.id),metadata:t.metadata,isGroup:!1,shape:i===`square`||i===void 0?`squareRect`:i};r.push(a),m.set(t.id,a)}e.edges.forEach((t,r)=>{let a=u.get(t.start)??t.start,s=u.get(t.end)??t.end;if(a===s&&t.start!==t.end)return;let c=[...e.defaultEdgeStyle??[]];t.style&&c.push(...t.style);let l=t.type===`arrow_open`?`none`:t.type===`arrow_cross`||t.type===`arrow_point`?t.type:`arrow_point`;i.push({id:t.id||`L_${a}_${s}_${r}`,isUserDefinedId:t.isUserDefinedId,start:a,end:s,type:t.type??`normal`,label:t.text,labelType:t.labelType,thickness:t.stroke,pattern:t.stroke,minlen:t.length,classes:`edge-thickness-normal edge-pattern-solid flowchart-link`,arrowTypeStart:`none`,arrowTypeEnd:l,cssCompiledStyles:o(t.classes),style:c,animate:t.animate,animation:t.animation,curve:t.interpolate||e.defaultInterpolate||n,metadata:t.metadata})}),ie(r,e);let h=new Map;for(let e of a){let t=f.get(e.id);if(t===void 0)continue;let n=h.get(t);n?n.push(e.id):h.set(t,[e.id])}let g=new Map;for(let e of a){if(f.get(e.id)!==void 0)continue;let t=[e.id];for(;t.length>0;){let e=t.pop();if(g.has(e))continue;g.set(e,g.size);let n=h.get(e);if(n)for(let e=n.length-1;e>=0;e--)t.push(n[e])}}return We(r,t=>{if(e.connectors.has(t))return`connector`;let n=e.nodes.get(t);return n?e.vertexKind(n):void 0},g,t),{nodes:r,edges:i}}var Ke=8,qe=40,Je=16,Ye=48,$=20,Xe=26,Ze=14,Qe=`collapsed`,$e={TB:2,RL:3,BT:0,LR:1},et=new WeakMap;function tt(e,t){let n=et.get(e);if(n===void 0){let r=t.flowchart?.curve;n=Ge(e,Ke,typeof r==`string`?r:void 0),et.set(e,n)}return n}function nt(e,t,n){let r=e.agentflow?.[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}var rt=/[";]fill:/;function it(e,t,n){let r=i(e);return` fill="${r}"${rt.test(n.shape)?``:` fill-opacity="${t}"`} stroke="${r}"`}function at(e,t,n){return u(e.direction)?d(n,r=>ot(e,t,n,r)):ot(e,t,n,!1)}function ot(u,d,b,C){let A=tt(u,d),j=b.fontSize??16,M=Math.round(j*.875),N=b.measurer??z(b.fontFamily,b.fontFamilyMono),P=nt(d,`wrappingWidth`,120),F=nt(d,`minNodeWidth`,120),I=b.padding??8,L=b.icons,R=new Map,B=[],V=[];A.nodes.forEach((e,t)=>R.set(e.id,t));for(let e of A.nodes){let t=e.cssStyles.length>0?e.cssCompiledStyles.concat(e.cssStyles):e.cssCompiledStyles,n=s(t),r=+!!n.bold|(n.italic?2:0),i=e.labelType===`markdown`,a=n.fontSize??j,o,l;if(e.isGroup){let t=c(e.label,i,N,a,4e3,r);o={node:e,style:n,label:t,shape:`group`,w:0,h:0,dy:0,loops:0},l=O(0,0),l.isGroup=!0,l.dir=e.dir?D(e.dir):void 0,l.padX=$,l.padTop=t.height>0?t.height+16:$,l.padBottom=$,l.minW=t.width+2*$-12}else if(e.shape===`collapsedGroup`){let t=c(e.label,i,N,a,P,r),s=Math.max(t.width,F)+36,u=t.height+24+Ze;o={node:e,style:n,label:t,shape:Qe,w:s,h:u,dy:-Ze/2,loops:0},l=O(s,u)}else{let t=k(e.shape),s=c(e.label,i,N,a,P,r),u=v(t,t===`diam`?s.width:Math.max(s.width,F),s.height);o={node:e,style:n,label:s,shape:t,w:u.w,h:u.h,dy:u.dy,loops:0},l=O(u.w,u.h)}l.seq=B.length,B.push(o),V.push(l)}A.nodes.forEach((e,t)=>{V[t].parent=e.parentId===void 0?-1:R.get(e.parentId)??-1});let re=C?`TB`:D(u.direction),H=e=>{let t;for(let n=V[e].parent,r=0;n>=0&&t===void 0&&r<1e4;n=V[n].parent,r++)t=V[n].dir;return t??re},U=e=>{let t=H(e);return t===`LR`||t===`RL`},W=new Int32Array(V.length).fill(-1);for(let e=0;e<V.length;e++){let t=[],n=e;for(;n>=0&&W[n]<0&&t.length<=V.length;)t.push(n),n=V[n].parent;let r=n>=0?W[n]+1:0;for(let e=t.length-1;e>=0;e--)W[t[e]]=r++}let ie=(e,t)=>{let n=t;for(let r=W[t];r>W[e];r--)n=V[n].parent;return n===e&&t!==e},G=[],ae=[],oe=[],K=[];for(let e of A.edges){let t=R.get(e.start),n=R.get(e.end);if(t===void 0||n===void 0)continue;let r=c(e.label,e.labelType===`markdown`,N,M,P);ie(t,n)||ie(n,t)?K.push({edge:e,label:r,src:t,dst:n}):(t===n&&(B[t].loops++,U(t)?V[t].h+=2*(Xe+(r.height>0?r.height+8:0)):V[t].w+=2*(Xe+(r.width>0?r.width+12:0))),oe.push(e),ae.push(r),G.push({src:t,dst:n,minlen:e.minlen??1,labelW:r.width>0?r.width+12:0,labelH:r.height>0?r.height+4:0,route:[],labelX:0,labelY:0}))}let q=E(V,G,re,{nodeSep:nt(d,`nodeSpacing`,qe),edgeSep:Je,rankSep:nt(d,`rankSpacing`,Ye),portSep:20}),J=c(u.title,!1,N,j,4e3,1),se=J.height>0?J.height+12:0,Y=Math.max(q.width,J.width),ce=I+(Y-q.width)/2,le=I+se;te(V,G,ce,le);let X=Math.ceil(Y+2*I),ue=Math.ceil(q.height+se+2*I),de=[],fe=[],pe=[],me=[],he=K.length*V.length<2e6;for(let{edge:e,src:t,dst:n}of K){let r=ie(n,t),i=r?n:t,a=r?t:n,o=V[i],s=V[a],c=$e[o.dir??H(i)],l=r?c:c+2&3,u=e=>{let t=!(e&1),n=e===0||e===3?-1:1,i=t?s.x:s.x+n*s.w/2,a=t?s.y+n*s.h/2:s.y,c=t?s.x:o.x+n*o.w/2,l=t?o.y+n*o.h/2:s.y,u=+!t;return r?[i,a,u,c,l,u]:[c,l,u,i,a,u]},d=e=>{for(let t=0;t<V.length;t++){let n=V[t];if(t!==a&&!n.isGroup&&n.x+n.w/2>Math.min(e[0],e[3])-1&&n.x-n.w/2<Math.max(e[0],e[3])+1&&n.y+n.h/2>Math.min(e[1],e[4])-1&&n.y-n.h/2<Math.max(e[1],e[4])+1)return!0}return!1},p=u(l);if(he&&d(p))for(let e of[l+1&3,l+3&3,l+2&3]){let t=u(e);if(!d(t)){p=t;break}}me.push(p),pe.push((p[0]+p[3])/2,(p[1]+p[4])/2);let h=p.slice();y(h,r?0:3,B[a],s),fe.push(m(h,`linear`,0,f(e.arrowTypeEnd)))}let ge=new Map,_e=!1;for(let e of V)e.isGroup&&(_e=!0);if(_e){for(let e of G)T(ge,e.route);for(let e of me)T(ge,e)}let ve=``,ye=``;for(let e=0;e<B.length;e++){let s=B[e],c=V[e],u=s.node,d=c.x,f=c.y,p=n(u.cssClasses.replace(/^default\s?/,``)),m=a(u.id);if(c.isGroup){let e=w(c,s.label.width,ge,$);ve+=`<g class="pele-cluster pele-flow${p}" data-id="${m}"><rect x="${l(d-c.w/2)}" y="${l(f-c.h/2)}" width="${l(c.w)}" height="${l(c.h)}"${r(it(u.colorIndex??Q.size,`0.06`,s.style)+s.style.shape)}/>`+o(s.label,e,f-c.h/2+8+s.label.height/2,` class="pele-cluster-label" fill="var(--_m)"${s.style.text}`,L)+`</g>`;continue}let h=s.w,g=s.h,v=``,y;if(s.shape===Qe){let e=i(u.colorIndex??Q.size),t=g/2-Ze-2,n=t+(Ze+2)/2;y=`<rect x="${l(-h/2)}" y="${l(-g/2)}" width="${l(h)}" height="${l(g)}"${r(it(u.colorIndex??Q.size,`0.06`,s.style)+s.style.shape)}/><path d="M${l(-h/2+10)},${l(t)}H${l(h/2-10)}" fill="none" stroke="${e}" stroke-dasharray="3 3"${s.style.line}/><path class="pele-collapsed-mark" d="${st(-9,n)}${st(0,n)}${st(9,n)}" fill="${e}" stroke="none"/>`}else{let e=Q.get(u.kind??`task`)??1;v=` pele-kind-${u.kind??`task`}`,y=_(s.shape,h,g,it(e,`0.14`,s.style)+s.style.shape,` stroke="${i(e)}"`+s.style.line)}let C=o(s.label,0,s.dy,` class="pele-label"${s.style.text}`,L);if(/ internal-link(?: |$)/.test(p+` `)&&u.label&&b.links!==!1){let e=ne(u.label),n=ee(e,b),r=t(e);C=`<a class="internal-link"${n?` href="${r}"${x(b)}`:``} data-href="${r}">${C}</a>`,de.push({id:u.id,href:e,internal:!0})}let T=y+C;u.tooltip&&(T=`<title>${a(u.tooltip)}</title>`+T),u.link&&(T=S(T,u.link,u.id,de,b,u.linkTarget?` target="${t(u.linkTarget)}"`:``)),ye+=`<g class="pele-node pele-shape-${s.shape}${v}${p}" data-id="${m}" transform="translate(${l(d)},${l(f)})">${T}</g>`}let be=``,xe=``,Se=(e,r,i,o,c)=>{let l=e.style.length>0||e.cssCompiledStyles.length>0?s(e.cssCompiledStyles.concat(e.style)):void 0,u=e.arrowTypeEnd,d=l?.stroke?t(l.stroke):`var(--_l)`,f=e.thickness===`dotted`?`reference`:u===`arrow_cross`?`failure`:`sequence`,m=n(e.classes.replace(/edge-thickness-normal|edge-pattern-solid|flowchart-link/g,``));be+=`<g class="pele-edge pele-edge-${f}${m}" data-id="${a(e.id)}"${l?.line??``}><path d="${i.d}"${e.thickness===`dotted`?` stroke-dasharray="3 4"`:``}/>`+h(u,i.ex,i.ey,i.edx,i.edy,d)+`</g>`,r.width>0&&(xe+=p(e.id,r,o,c,l?.text??``,L))},Ce=new Map;for(let e=0;e<G.length;e++){let t=G[e],n=oe[e],r=ae[e],i=n.arrowTypeEnd,a;if(t.src===t.dst){let e=B[t.src],n=Ce.get(t.src)??0;Ce.set(t.src,n+1),a=g(V[t.src],e.w,e.h,n,U(t.src),Xe,f(i),t)}else{let e=t.route.slice();y(e,0,B[t.src],V[t.src]),y(e,e.length-3,B[t.dst],V[t.dst]),a=m(e,n.curve,0,f(i))}Se(n,r,a,t.labelX,t.labelY)}return K.forEach((e,t)=>Se(e.edge,e.label,fe[t],pe[2*t],pe[2*t+1])),{svg:e(`agentflow`,X,ue,j,b,u,o(J,X/2,I+J.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(ve?`<g class="pele-clusters">${ve}</g>`:``)+(be?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${be}</g>`:``)+(xe?`<g class="pele-edge-labels" font-size="${M}">${xe}</g>`:``)+`<g class="pele-nodes">${ye}</g>`),width:X,height:ue,links:de}}function st(e,t){return`M${l(e-1.75)},${l(t)}a1.75,1.75 0 1 0 3.5,0a1.75,1.75 0 1 0 -3.5,0Z`}var ct={type:`agentflow`,keepComments:!0,parse(e,t,n,r,i){let a=new pe({inheritDir:(t.flowchart??{}).inheritDir===!0,direction:typeof t.direction==`string`?t.direction:void 0,lineOffset:r,source:e,maxEdges:i.maxEdges});return n&&(a.title=n),Re(e,a),tt(a,t),a},render:at};export{ct as agentflow};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e,a as t,c as n,i as r,m as i,o as a,r as o,t as s,u as c,x as l}from"./E3FWOBN4-D5m5o2g0.js";import{n as u}from"./DKTLEL5E-DciMwFJ1.js";import{a as d,s as f}from"./CUVCMPQX-JTGMOfG2.js";import{c as p,d as m,f as h,g,h as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E}from"./C5HTQT3I-7U13x70S.js";import{t as D}from"./D4V2MWCI-CytzCr6g.js";import{PeleError as O,u as ee}from"./lazy-DaMZI1F7.js";var k=class{nodes=new Map;labels;links=[];trends=new Map;pipelines=new Map;annotations=[];notes=[];accelerators=[];deaccelerators=[];annotationsBox;axes={};size;addNode(e){let t=this.nodes.get(e.id)??{id:e.id,label:e.label};this.nodes.set(e.id,{...t,...e,className:e.className??t.className,labelOffsetX:e.labelOffsetX??t.labelOffsetX,labelOffsetY:e.labelOffsetY??t.labelOffsetY}),this.labels=void 0}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let t=this.nodes.get(e);t&&(t.isPipelineParent=!0)}addPipelineComponent(e,t){this.pipelines.get(e)?.componentIds.push(t);let n=this.nodes.get(t);n&&(n.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,t){this.annotationsBox={x:e,y:t}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,t){this.size={width:e,height:t}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;if(!this.labels){this.labels=new Map;for(let[e,t]of this.nodes)this.labels.has(t.label)||this.labels.set(t.label,e)}return this.labels.get(e)??e}build(){let e=[];for(let t of this.nodes.values()){if(typeof t.x!=`number`||typeof t.y!=`number`)throw new O(`Node "${t.label}" is missing coordinates`,`semantic`,{type:`wardley`});e.push(t)}return{nodes:e,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 A(e,t){let n=e<=1?e*100:e;if(n<0||n>100)throw new O(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`,`semantic`,{type:`wardley`});return n}function j(e,t,n){return{x:A(t,`${n} evolution`),y:A(e,`${n} visibility`)}}function M(e){return e===`+<>`?`bidirectional`:e===`+<`?`backward`:e===`+>`?`forward`:void 0}function te(e){if(!e?.startsWith(`+`))return{};let t=e.indexOf(`'`,2),n=e[1]===`'`&&t!==-1?e.slice(2,t):void 0;return e.includes(`<>`)?{flow:`bidirectional`,label:n}:e.includes(`<`)?{flow:`backward`,label:n}:e.includes(`>`)?{flow:`forward`,label:n}:{label:n}}function N(e){return e?[(e.negX?-1:1)*e.offsetX,(e.negY?-1:1)*e.offsetY]:[void 0,void 0]}function ne(e,t){e.size&&t.setSize(e.size.width,e.size.height),e.evolution&&t.setAxes({stages:e.evolution.stages.map(e=>e.secondName?`${e.name.trim()} / ${e.secondName.trim()}`:e.name.trim()),stageBoundaries:e.evolution.stages.filter(e=>e.boundary!==void 0).map(e=>e.boundary)});for(let n of e.anchors){let e=j(n.visibility,n.evolution,`Anchor "${n.name}"`);t.addNode({id:n.name,label:n.name,x:e.x,y:e.y,className:`anchor`})}for(let n of e.components){let e=j(n.visibility,n.evolution,`Component "${n.name}"`),[r,i]=N(n.label);t.addNode({id:n.name,label:n.name,x:e.x,y:e.y,className:`component`,labelOffsetX:r,labelOffsetY:i,inertia:n.inertia,sourceStrategy:n.decorator?.strategy})}for(let n of e.notes){let e=j(n.visibility,n.evolution,`Note "${n.text}"`);t.addNote({text:n.text,x:e.x,y:e.y})}for(let n of e.pipelines){let e=t.getNode(n.parent);if(!e||typeof e.y!=`number`)throw new O(`Pipeline "${n.parent}" must reference an existing component with coordinates.`,`semantic`,{type:`wardley`});let r=e.y;t.startPipeline(n.parent);for(let e of n.components){let i=`${n.parent}_${e.name}`,[a,o]=N(e.label),s=A(e.evolution,`Pipeline component "${e.name}" evolution`);t.addNode({id:i,label:e.name,x:s,y:r,className:`pipeline-component`,labelOffsetX:a,labelOffsetY:o,inertia:void 0,sourceStrategy:void 0}),t.addPipelineComponent(n.parent,i)}}for(let n of e.links){let e=!!n.arrow&&(n.arrow.includes(`-.->`)||n.arrow.includes(`.-.`)),r=te(n.arrow),i=M(n.fromPort)??M(n.toPort)??r.flow;t.addLink({source:t.resolveNodeId(n.from),target:t.resolveNodeId(n.to),dashed:e,label:r.label??n.linkLabel,flow:i})}for(let n of e.evolves){let e=t.getNode(n.component);e?.y!==void 0&&t.addTrend({nodeId:n.component,targetX:A(n.target,`Evolve target for "${n.component}"`),targetY:e.y})}if(e.annotations.length>0){let n=j(e.annotations[0].x,e.annotations[0].y,`Annotations box`);t.setAnnotationsBox(n.x,n.y)}for(let n of e.annotation){let e=j(n.x,n.y,`Annotation ${n.number}`);t.addAnnotation({number:n.number,coordinates:[{x:e.x,y:e.y}],text:n.text})}for(let n of e.accelerators){let e=j(n.x,n.y,`Accelerator "${n.name}"`);t.addAccelerator({name:n.name,x:e.x,y:e.y})}for(let n of e.deaccelerators){let e=j(n.x,n.y,`Deaccelerator "${n.name}"`);t.addDeaccelerator({name:n.name,x:e.x,y:e.y})}}function P(e,t){let n=new k;return ne(e,n),{type:`wardley`,title:e.title||t,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
2
|
+
`):void 0,...n.build()}}function F(e,t){let n=t;for(let t=e.charCodeAt(n);t>=48&&t<=57;t=e.charCodeAt(n))n++;return n}function I(){let e=0,t=0;return(n,r)=>{if((r<e||r>=t)&&(e=r,t=F(n,r)),t===r||n.charCodeAt(t)!==46)return-1;let i=F(n,t+1);return i>t+1?i:-1}}var L={name:`ARROW`,pattern:/->/y,first:`-`},R={name:`LINK_ARROW`,pattern:/-->|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/y,first:`->+`},z=(e,t)=>({name:e,pattern:new RegExp(t,`y`),first:t[0]}),re=[{name:`[`,pattern:`[`},{name:`,`,pattern:`,`},{name:`]`,pattern:`]`},{name:`@`,pattern:`@`},{name:`/`,pattern:`/`},{name:`(`,pattern:`(`},{name:`)`,pattern:`)`},{name:`-`,pattern:`-`,longer:[L,R,C]},{name:`{`,pattern:`{`},{name:`}`,pattern:`}`},{name:`WARDLEY_NUMBER`,pattern:/[0-9]+\.[0-9]+/y,first:`0123456789`,scanner:I},L,{name:`LINK_PORT`,pattern:/\+<>|\+>|\+</y,first:`+`},R,{name:`LINK_LABEL`,pattern:/;[^\n\r]+/y,first:`;`},{name:`STRATEGY`,pattern:/build|buy|outsource|market/y,first:`bom`},z(`KW_WARDLEY`,`wardley-beta`),z(`KW_SIZE`,`size`),z(`KW_EVOLUTION`,`evolution`),z(`KW_ANCHOR`,`anchor`),z(`KW_COMPONENT`,`component`),z(`KW_LABEL`,`label`),z(`KW_INERTIA`,`inertia`),z(`KW_EVOLVE`,`evolve`),z(`KW_PIPELINE`,`pipeline`),z(`KW_NOTE`,`note`),z(`KW_ANNOTATIONS`,`annotations`),z(`KW_ANNOTATION`,`annotation`),z(`KW_ACCELERATOR`,`accelerator`),z(`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:` `},D(),T,S,{name:`INT`,pattern:/0|[1-9][0-9]*(?!\.)/y,first:`0123456789`},y,{name:`ID`,pattern:/[\w]([-\w]*\w)?/y,first:`_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`},v,E,C,x,w];function B(e){let t=new _(b(e,re,`wardley`),re,`wardley`),n={$type:`Wardley`,anchors:[],components:[],links:[],evolves:[],pipelines:[],notes:[],annotations:[],annotation:[],accelerators:[],deaccelerators:[]},r=e=>t.kinds[t.i]===e,i=()=>r(36)||r(37)||r(30),a=()=>r(36)?h(t.take()):r(37)||r(30)?t.take():t.fail(`a name`),o=()=>Number(t.expect(10)),s=()=>parseInt(t.expect(35)),c=()=>r(10)?Number(t.take()):parseInt(t.expect(35)),l=()=>{if(!r(-1))for(r(38)||t.fail(`a line break or the end of input`);r(38);)t.i++},u=e=>{t.expect(0);let n=e();t.expect(1);let r=e();return t.expect(2),[n,r]},d=()=>{t.expect(21),t.expect(0);let e=t.accept(7),n=s();t.expect(1);let r=t.accept(7),i=s();return t.expect(2),{$type:`Label`,negX:e,offsetX:n,negY:r,offsetY:i}},f=()=>{let e={$type:`EvolutionStage`,name:a()};return t.accept(3)&&(e.boundary=o()),t.accept(4)&&(e.secondName=a()),e};for(;r(38);)t.i++;for(t.expect(16);!r(-1);)switch(t.kind){case 38:t.i++;break;case 32:n.accDescr=p(t.take()),l();break;case 33:n.accTitle=g(t.take()),l();break;case 34:n.title=m(t.take()),l();break;case 17:{t.i++;let[e,r]=u(s);l(),n.size={$type:`Size`,width:e,height:r};break}case 18:{t.i++;let e=[f()];for(t.expect(11),e.push(f());t.accept(11);)e.push(f());l(),n.evolution={$type:`Evolution`,stages:e};break}case 19:{t.i++;let e=a(),[r,i]=u(o);l(),n.anchors.push({$type:`Anchor`,name:e,visibility:r,evolution:i});break}case 20:{t.i++;let e={$type:`Component`,name:a(),visibility:0,evolution:0,inertia:!1};[e.visibility,e.evolution]=u(o),r(21)&&(e.label=d()),r(5)&&t.kinds[t.i+1]===15&&(t.i++,e.decorator={$type:`Decorator`,strategy:t.take()},t.expect(6)),t.accept(22)?e.inertia=!0:t.accept(5)&&(t.expect(22),t.expect(6),e.inertia=!0),l(),n.components.push(e);break}case 23:{t.i++;let e=a(),r=o();l(),n.evolves.push({$type:`Evolve`,component:e,target:r});break}case 24:{t.i++;let e=a();for(t.expect(8),t.expect(38);r(38);)t.i++;let i=[];do{t.expect(20);let e={$type:`PipelineComponent`,name:a(),evolution:0};t.expect(0),e.evolution=o(),t.expect(2),r(21)&&(e.label=d()),l(),i.push(e)}while(r(20));t.expect(9),l(),n.pipelines.push({$type:`Pipeline`,parent:e,components:i});break}case 25:{t.i++;let e=h(t.expect(36)),[r,i]=u(o);l(),n.notes.push({$type:`Note`,text:e,visibility:r,evolution:i});break}case 26:{t.i++;let[e,r]=u(c);l(),n.annotations.push({$type:`Annotations`,x:e,y:r});break}case 27:{t.i++;let e=s();t.expect(1);let[r,i]=u(c),a=h(t.expect(36));l(),n.annotation.push({$type:`Annotation`,number:e,x:r,y:i,text:a});break}case 28:case 29:{let e=t.kind===29;t.i++;let r=a(),[i,s]=u(o);l(),e?n.deaccelerators.push({$type:`Deaccelerator`,name:r,x:i,y:s}):n.accelerators.push({$type:`Accelerator`,name:r,x:i,y:s});break}default:{i()||t.fail(`a statement`);let e={$type:`Link`,from:a(),to:``};r(12)&&(e.fromPort=t.take()),(r(13)||r(11))&&(e.arrow=t.take()),e.to=a(),r(12)&&(e.toPort=t.take()),r(14)&&(e.linkLabel=t.take().substring(1).trim()),l(),n.links.push(e)}}return n}var ie=[`Genesis`,`Custom Built`,`Product`,`Commodity`],V=48,H=6,U=10,ae=8,W=15,G=60,oe=30,se=20,K=`var(--_c)`,q=`var(--_l)`;function ce(e,t,n,r,i){let a=e[`wardley-beta`]?.[t];return typeof a==`number`&&a>=r&&a<=i?a:n}function J(e,t,n){return e<t?t:e>n?n:e}function le(e,r,a,o){let c=n(e),u=``,d=a;for(let n of e.lines){let a=!0;for(let e of n){if(e.icon!==void 0)continue;let n=i(e.style&~c);u+=`<tspan${a?` x="${l(r)}" y="${l(d)}"`:``}${n}>${t(e.text)}</tspan>`,a=!1}d+=e.lineHeight}return u===``?``:`<text${s(o,c)} xml:space="preserve">${u}</text>`}function ue(e,t,n,r){return J(typeof t==`number`&&Number.isFinite(t)?t:ce(e,n,r,1,1e6),200,1e4)-2*V}function Y(e,t,n){let r=ue(t,e.size?.width,`width`,900);return u(n,r,160,(i,a)=>X(e,t,n,i,r,a))}function X(t,n,i,s,u,p){let m=i.fontSize??16,h=Math.round(m*.8125),g=Math.round(m*.6875),_=i.measurer??ee(i.fontFamily,i.fontFamilyMono),v=i.padding??8,y=ue(n,t.size?.height,`height`,600)*Math.max(.75,s/u),b=n[`wardley-beta`]?.showGrid===!0,x=0,S=0,C=s,w=y,T=(e,t,n,r)=>{e<x&&(x=e),t<S&&(S=t),n>C&&(C=n),r>w&&(w=r)},E=(e,t,n,r)=>(T(t-e.width/2,n-e.height/2,t+e.width/2,n+e.height/2),a(e,t,n,r,i.icons)),D=(e,t,n,r)=>(T(t,n-e.size,t+e.width,n-e.size+e.height+4),le(e,t,n,r)),O=(e,t,n=p?Math.max(64,Math.min(120,s/2)):4e3,r=0)=>c(e,!1,_,t,n,r),k=e=>e/100*s,A=e=>y-e/100*y,j=t.axes.stages&&t.axes.stages.length>0?t.axes.stages:ie,M=t.axes.stageBoundaries,te=M!==void 0&&M.length===j.length,N=``,ne=``,P=y,F=0;if(j.forEach((e,t)=>{let n=te?F:t/j.length,r=te?J(M[t],0,1):(t+1)/j.length;F=r,t>0&&(N+=`<path class="pele-wardley-stage" d="M${l(n*s)},0V${l(y)}" stroke="var(--_b)" stroke-dasharray="4 4"/>`);let i=O(e,h,Math.max(48,Math.abs(r-n)*s-12));ne+=E(i,(n+r)/2*s,y+8+i.height/2,` class="pele-wardley-stage-label" font-size="${h}" fill="var(--_m)"`),P=Math.max(P,y+8+i.height)}),b)for(let e=1;e<4;e++)N+=`<path class="pele-wardley-grid" d="M${l(s*e/4)},0V${l(y)}M0,${l(y*e/4)}H${l(s)}" stroke="var(--_b)" stroke-dasharray="2 6"/>`;N+=`<path class="pele-wardley-axis" d="M0,0V${l(y)}H${l(s)}" stroke="${q}"/>`;let I=O(t.axes.xLabel??`Evolution`,h),L=O(t.axes.yLabel??`Visibility`,h),R=` class="pele-wardley-axis-label" font-size="${h}" font-weight="var(--_hw)"`,z=E(I,s/2,P+6+I.height/2,R)+a(L,-16,y/2,`${R} transform="rotate(-90 -16 ${l(y/2)})"`);T(-16-L.height/2,0,0,0);let re=P+6+I.height+10,B=new Map;for(let e of t.nodes)B.set(e.id,{x:k(e.x),y:A(e.y),node:e});let V=``,ce=new Map;for(let e of t.pipelines){ce.set(e.nodeId,new Set(e.componentIds));let t=[];for(let n of e.componentIds){let e=B.get(n);e&&t.push(e)}if(t.length===0)continue;t.sort((e,t)=>e.x-t.x);let n=t[0].x,i=t[t.length-1].x,a=t[0].y,s=a-2*H,c=B.get(e.nodeId);c&&(c.x=(n+i)/2,c.y=s-U/6),T(n-W,s,i+W,s+4*H),V+=`<g class="pele-wardley-pipeline" data-id="${r(e.nodeId)}"><rect x="${l(n-W)}" y="${l(s)}" width="${l(i-n+2*W)}" height="${l(4*H)}" fill="var(--_s)" stroke="var(--_b)"${o}/>`+(t.length>1?`<path d="M${l(n)},${l(a)}H${l(i)}" stroke="${q}" stroke-dasharray="4 4"/>`:``)+`</g>`}let Y=new Map,X=(e,t,n)=>{let r=e.node;if(r.className===`anchor`){let e=Y.get(r);return e||Y.set(r,e=O(r.label,h,p?Math.max(64,s/2):4e3,1)),1/Math.hypot(t/(e.width/2+5),n/(h*.8))}return r.isPipelineParent?U/Math.SQRT2:r.sourceStrategy?2*H:H},Z=new Map,de=(e,t,n)=>{Math.abs(t)<.25||Math.abs(n)<.25||Z.set(e,(Z.get(e)??0)|(t>0?n<0?1:2:n<0?4:8))},fe=``;for(let e of t.links){let t=B.get(e.source),n=B.get(e.target);if(!t||!n||t===n||ce.get(e.target)?.has(e.source))continue;let i=n.x-t.x,a=n.y-t.y,o=Math.hypot(i,a);if(o<.01)continue;let s=i/o,c=a/o,u=X(t,s,c),p=X(n,s,c);if(u+p>=o)continue;de(t,s,c),de(n,-s,-c);let m=t.x+s*u,h=t.y+c*u,_=n.x-s*p,v=n.y-c*p,y=``;(e.flow===`forward`||e.flow===`bidirectional`)&&(y+=f(`arrow_point`,_,v,s,c,q),_-=s*d(`arrow_point`),v-=c*d(`arrow_point`)),(e.flow===`backward`||e.flow===`bidirectional`)&&(y+=f(`arrow_point`,m,h,-s,-c,q),m+=s*d(`arrow_point`),h+=c*d(`arrow_point`));let b=``;if(e.label){let r=O(e.label,g+1,200),i=s>=0?1:-1,a=c*i,o=-s*i,l=5+Math.abs(a)*r.width/2+Math.abs(o)*r.height/2;b=E(r,(t.x+n.x)/2+a*l,(t.y+n.y)/2+o*l,` class="pele-edge-label" font-size="${g+1}" fill="var(--_m)"`)}fe+=`<g class="pele-edge${e.dashed?` pele-wardley-dashed`:``}" data-id="${r(e.source)}-${r(e.target)}"><path d="M${l(m)},${l(h)}L${l(_)},${l(v)}" stroke="${q}"${e.dashed?` stroke-dasharray="6 6"`:``}/>`+y+b+`</g>`}let pe=``;for(let e of t.trends){let t=B.get(e.nodeId);if(!t)continue;let n=k(e.targetX),i=A(e.targetY),a=n-t.x,o=i-t.y,s=Math.hypot(a,o),c=``,u=s>0?X(t,a/s,o/s):0;if(s>u+H+4){let e=a/s,r=o/s,p=n-e*(H+2),m=i-r*(H+2);c=`<path d="M${l(t.x+e*u)},${l(t.y+r*u)}L${l(p-e*d(`arrow_point`))},${l(m-r*d(`arrow_point`))}" stroke="${K}" stroke-dasharray="4 4"/>`+f(`arrow_point`,p,m,e,r,K)}T(n-H,i-H,n+H,i+H),pe+=`<g class="pele-wardley-trend" data-id="${r(e.nodeId)}">${c}<circle cx="${l(n)}" cy="${l(i)}" r="${H}" fill="var(--_bg)" stroke="${K}"/></g>`}let me=``,Q=1.2*H,he=.7*H;for(let e of B.values()){let t=e.node,{x:n,y:i}=e,a=t.className===`anchor`,o=t.sourceStrategy,c=``;if(o){let e=o===`outsource`?`var(--_m)`:o===`buy`?`var(--_a)`:o===`build`?`var(--_s)`:`var(--_bg)`;c+=`<circle class="pele-wardley-${o}" cx="${l(n)}" cy="${l(i)}" r="${2*H}" fill="${e}" stroke="${q}"/>`}if(o===`market`){let e=Q*Math.cos(Math.PI/6),t=i+Q*Math.sin(Math.PI/6);c+=`<path d="M${l(n)},${l(i-Q)}L${l(n-e)},${l(t)}H${l(n+e)}Z" fill="none" stroke="${q}"/>`;for(let[r,a]of[[n,i-Q],[n-e,t],[n+e,t]])c+=`<circle cx="${l(r)}" cy="${l(a)}" r="${l(he)}" fill="var(--_bg)" stroke="${q}"/>`}else t.isPipelineParent?c+=`<rect x="${l(n-U/2)}" y="${l(i-U/2)}" width="${U}" height="${U}" fill="var(--_bg)" stroke="${q}"/>`:a||(c+=`<circle cx="${l(n)}" cy="${l(i)}" r="${H}" fill="var(--_bg)" stroke="${q}"/>`);if(t.inertia===!0){let e=(t.isPipelineParent?U/2:H)+10+(o?H+4:0);c+=`<rect class="pele-wardley-inertia" x="${l(n+e)}" y="${l(i-H)}" width="4" height="${2*H}" fill="${q}"/>`}let u=t.labelOffsetX===void 0?void 0:J(t.labelOffsetX,-5e3,5e3),d=t.labelOffsetY===void 0?void 0:J(t.labelOffsetY,-5e3,5e3),f;if(a)f=E(Y.get(t)??O(t.label,h,p?Math.max(64,s/2):4e3,1),n+(u??0),i+(d??-3),` class="pele-label" font-size="${h}" font-weight="var(--_hw)"`);else{let r=O(t.label,h),a=` class="pele-label" font-size="${h}"`,s=ae+(o?10:0);if(u!==void 0||d!==void 0)f=D(r,n+(u??s),i+(d??-s),a);else if(t.inPipeline)f=E(r,n,i+2*H+4+r.height/2,a);else{let t=Z.get(e)??0,o=t&1?t&2?t&4?t&8?1:8:4:2:1,c=o===1||o===2,l=o===1||o===4;f=D(r,c?n+s:n-s-r.width,l?i-s:i+s+h*.75,a)}}T(n-2*H,i-2*H,n+2*H+20,i+2*H),me+=`<g class="pele-node pele-wardley-${a?`anchor`:t.isPipelineParent?`pipeline-parent`:t.inPipeline?`pipeline-component`:`component`}" data-id="${r(t.id)}">${c}${f}</g>`}let ge=``;for(let e of t.annotations){let t=O(String(e.number),g,4e3,1),n=``;for(let r of e.coordinates){let e=k(r.x),i=A(r.y),o=Math.max(10,t.width/2+4);T(e-o,i-o,e+o,i+o),n+=`<circle cx="${l(e)}" cy="${l(i)}" r="${l(o)}" fill="var(--_bg)" stroke="${q}"/>`+a(t,e,i,` font-size="${g}" font-weight="var(--_hw)"`)}ge+=`<g class="pele-wardley-annotation" data-id="${r(String(e.number))}">${n}</g>`}let _e=t.annotations.filter(e=>e.text).sort((e,t)=>e.number-t.number);if(_e.length>0){let e=_e.map(e=>O(`${e.number}. ${e.text}`,h,p?Math.max(80,s-20):320)),n=0,r=0;for(let t of e)n=Math.max(n,t.width),r+=t.height;n+=20,r+=14;let i=t.annotationsBox,a=i?J(k(i.x),0,Math.max(0,s-n)):0,c=i?J(A(i.y),0,Math.max(0,y-r)):re;T(a,c,a+n,c+r);let u=``,d=c+7;for(let t of e)u+=le(t,a+10,d+t.lineHeight/2+h*.35,` font-size="${h}"`),d+=t.height;ge+=`<g class="pele-wardley-annotations"><rect x="${l(a)}" y="${l(c)}" width="${l(n)}" height="${l(r)}" fill="var(--_bg)" stroke="var(--_b)"${o}/>${u}</g>`}let ve=``;for(let e of t.notes)ve+=D(O(e.text,h,Math.min(360,s*.6),1),k(e.x),A(e.y),` class="pele-wardley-note" font-size="${h}" font-weight="var(--_hw)"`);let ye=``,be=(e,t,n,i)=>{let a=k(t),o=A(n),s=oe/2,c=i?a+G:a,u=i?a:a+G,d=i?a+G-se:a+se,f=`M${l(u)},${l(o-s)}H${l(d)}V${l(o-s-8)}L${l(c)},${l(o)}L${l(d)},${l(o+s+8)}V${l(o+s)}H${l(u)}Z`;T(a,o-s-8,a+G,o+s+8),ye+=`<g class="pele-wardley-${i?`accelerator`:`deaccelerator`}" data-id="${r(e)}"><path d="${f}" fill="var(--_s)" stroke="${q}"/>`+E(O(e,g+1,160,1),a+G/2,o+s+8+12,` font-size="${g+1}" font-weight="var(--_hw)"`)+`</g>`};for(let e of t.accelerators)be(e.name,e.x,e.y,!0);for(let e of t.deaccelerators)be(e.name,e.x,e.y,!1);let $=c(t.title,!1,_,m,p?Math.max(80,s):4e3,1),xe=$.height>0?$.height+12:0,Se=Math.min(x,s/2-$.width/2),Ce=Math.max(C,s/2+$.width/2),we=v-Se,Te=v+xe-S,Ee=Math.ceil(Ce-Se+2*v),De=Math.ceil(w-S+xe+2*v),Oe=a($,we+s/2,v+$.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${l(we)},${l(Te)})"><g class="pele-wardley-frame" fill="none">${N}</g>`+ne+z+V+(fe?`<g class="pele-edges" fill="none">${fe}</g>`:``)+(pe?`<g class="pele-wardley-trends" fill="none">${pe}</g>`:``)+me+ge+ve+ye+`</g>`;return{svg:e(`wardley`,Ee,De,m,i,t,Oe),width:Ee,height:De,links:[]}}var Z={type:`wardley`,section:`wardley-beta`,parse:(e,t,n)=>P(B(e),n),render:Y};export{Z as wardley};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{_ as e,a as t,f as n,i as r,l as i,o as a,r as o,u as s,x as c}from"./E3FWOBN4-D5m5o2g0.js";import{t as l}from"./DKTLEL5E-DciMwFJ1.js";import{a as u,s as d}from"./CUVCMPQX-JTGMOfG2.js";import{c as f,d as p,g as m,h,i as g,n as _,o as v,p as y,r as b,s as x,t as S}from"./C5HTQT3I-7U13x70S.js";import{n as C,r as w,t as T}from"./DUZNPW7S-D3pifVNb.js";import{t as E}from"./D4V2MWCI-CytzCr6g.js";import{PeleError as D,d as O,o as k,u as A}from"./lazy-DaMZI1F7.js";var j=new Map([[`ui`,`ui`],[`pcr`,`processor`],[`processor`,`processor`],[`rmo`,`readmodel`],[`readmodel`,`readmodel`],[`cmd`,`command`],[`command`,`command`],[`evt`,`event`],[`event`,`event`]]),M=new Map([[`trigger`,[0,`UI/Automation`,`UI/A: `]],[`state`,[100,`Command/Read Model`,`C/RM: `]],[`stream`,[200,`Events`,`Stream: `]]]);function N(e){return e===`ui`||e===`processor`?`trigger`:e===`event`?`stream`:`state`}function P(e){let t=e.indexOf(`{`),n=e.lastIndexOf(`}`),r=(t!==-1&&n>t?e.slice(t+1,n):t===-1&&e.length>=2?e.slice(1,-1):``).replace(/\r/g,``).split(`
|
|
2
|
+
`);for(;r.length>0&&r[0].trim()===``;)r.shift();for(;r.length>0&&r[r.length-1].trim()===``;)r.pop();let i=1/0;for(let e of r)e.trim()!==``&&(i=Math.min(i,e.length-e.trimStart().length));return r.map(e=>e.slice(Math.min(i,e.length)).trimEnd()).join(`
|
|
3
|
+
`)}function F(e,t){let n=new Set;for(let t of e.frames){if(n.has(t.name)){let n=k(e.$source,t.$offset).line;throw new D(`Duplicate event modeling frame ID "${t.name}" on line ${n}`,`semantic`,{type:`eventmodeling`,line:n})}n.add(t.name)}let r=new Map;for(let t of e.dataEntities)r.has(t.name)||r.set(t.name,t.dataBlockValue);let i=new Map,a=new Map,o=(e,t)=>{let n=N(e),r=t===void 0?n:`${n} ${t}`,o=i.get(r);if(!o){let[e,s,c]=M.get(n),l=e;t!==void 0&&(l=a.get(n)??e+1,a.set(n,l+1)),o={index:l,label:t===void 0?s:c+t,group:n,namespace:t},i.set(r,o)}return o},s=[],c=new Map,l=[];e.frames.forEach((e,t)=>{let n=e.entityIdentifier.split(`.`),i=n.length===2?n[0]:void 0,a=j.get(e.modelEntityType)??`event`,u=e.dataInlineValue===void 0?void 0:P(e.dataInlineValue);if(e.dataReference){let t=r.get(e.dataReference.$refText);t!==void 0&&(u=P(t))}let d={id:e.name,kind:a,entity:e.entityIdentifier,name:n.length===2?n[1]:e.entityIdentifier,namespace:i,reset:e.$type===`EmResetFrame`,lane:o(a,i),data:u,dataType:e.dataType};if(s.push(d),c.set(d.id,d),e.sourceFrames.length>0){let t=new Set(e.sourceFrames.map(e=>e.$refText));for(let e of s)t.has(e.id)&&l.push({source:e,target:d})}else if(t>0&&!d.reset){for(let e=t-1;e>=0;e--)if(s[e].lane!==d.lane){l.push({source:s[e],target:d});break}}});let u=e=>e.map(e=>e.entityIdentifier.$refText);return{type:`eventmodeling`,title:e.title&&p(e.title)||t,accTitle:e.accTitle?m(e.accTitle).replace(/^\s+/g,``):void 0,accDescr:e.accDescr?f(e.accDescr).replace(/\n\s+/g,`
|
|
4
|
+
`):void 0,boxes:s,lanes:[...i.values()].sort((e,t)=>e.index-t.index),relations:l,notes:e.noteEntities.map(e=>({frame:e.sourceFrame.$refText,text:P(e.dataBlockValue),dataType:e.dataType})),specifications:e.gwtEntities.map(e=>({frame:e.sourceFrame.$refText,given:u(e.givenStatements),when:u(e.whenStatements),then:u(e.thenStatements)})),entities:e.modelEntities.map(e=>e.name)}}var I={name:`EM_ID`,pattern:/[_a-zA-Z][\w_]*/y},L=e=>({name:e,pattern:e,longer:[I]}),R=e=>({name:e,pattern:e}),z=[`resetframe`,`readmodel`,`processor`,`timeframe`,`command`,`entity`,`event`,`jsobj`,`figma`,`given`,`json`,`salt`,`html`,`text`,`data`,`note`,`when`,`then`,`rmo`,`cmd`,`evt`,`pcr`,`uri`],B=[{...g(`eventmodeling`),longer:[I]},...z.map(L),R(`->>`),L(`gwt`),L(`ui`),L(`md`),L(`tf`),R(`[[`),R(`]]`),L(`rf`),R("`"),R(`.`),I,{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},E(`EM_ACC_DESCR`),{...S,name:`EM_ACC_TITLE`},{...y,name:`EM_TITLE`},{name:`EM_WS`,pattern:/\s+/y,hidden:!0},{...b,name:`EM_YAML`},{...v,name:`EM_DIRECTIVE`},{...x,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}],V=e=>B.findIndex(t=>t.name===e),H=e=>new Set(e.map(V)),U={keyword:0,arrow:V(`->>`),open:V(`[[`),close:V(`]]`),tick:V("`"),dot:V(`.`),id:V(`EM_ID`),frameId:V(`EM_FID`),inline:V(`EM_DATA_INLINE`),block:V(`EM_DATA_BLOCK`),accDescr:V(`EM_ACC_DESCR`),accTitle:V(`EM_ACC_TITLE`),title:V(`EM_TITLE`),entity:V(`entity`),data:V(`data`),note:V(`note`),gwt:V(`gwt`),given:V(`given`),when:V(`when`),then:V(`then`)},W=H([`tf`,`timeframe`]),G=H([`rf`,`resetframe`]),K=H([`rmo`,`readmodel`,`ui`,`cmd`,`command`,`evt`,`event`,`pcr`,`processor`]),q=H([`json`,`jsobj`,`figma`,`salt`,`uri`,`md`,`html`,`text`]);function J(e){let t=new h(_(e,B,`eventmodeling`),B,`eventmodeling`),n={$type:`EventModel`,modelEntities:[],frames:[],dataEntities:[],noteEntities:[],gwtEntities:[],$source:e},r=e=>t.kinds[t.i]===e,i=(e,n)=>e.has(t.kinds[t.i])?t.take():t.fail(n),a=()=>{let e=t.expect(U.id);for(;t.accept(U.dot);)e+=`.`+t.expect(U.id);return e},o=()=>{if(!t.accept(U.tick))return;let e=i(q,`a data type`);return t.expect(U.tick),e},s=()=>{let e=[];do i(K,`an entity type`),e.push({$type:`EmGwtStatement`,entityIdentifier:{$refText:t.expect(U.id)}});while(K.has(t.kinds[t.i]));return e};for(t.expect(U.keyword);!r(-1);){let e=t.kinds[t.i];if(e===U.accDescr)n.accDescr=t.take();else if(e===U.accTitle)n.accTitle=t.take();else if(e===U.title)n.title=t.take();else if(e===U.entity)t.i++,n.modelEntities.push({$type:`EmModelEntity`,name:a()});else if(W.has(e)||G.has(e)){let s={$type:W.has(e)?`EmTimeFrame`:`EmResetFrame`,name:``,modelEntityType:``,entityIdentifier:``,sourceFrames:[],$offset:t.tokens.starts[t.i]};for(t.i++,s.name=t.expect(U.frameId),s.modelEntityType=i(K,`an entity type`),s.entityIdentifier=a();t.accept(U.arrow);)s.sourceFrames.push({$refText:t.expect(U.frameId)});if(t.accept(U.open)&&(s.dataReference={$refText:t.expect(U.id)},t.expect(U.close)),r(U.tick)||r(U.inline)){let e=o();e!==void 0&&(s.dataType=e),s.dataInlineValue=t.expect(U.inline)}n.frames.push(s)}else if(e===U.data){t.i++;let e={$type:`EmDataEntity`,name:t.expect(U.id),dataBlockValue:``},r=o();r!==void 0&&(e.dataType=r),e.dataBlockValue=t.expect(U.block),n.dataEntities.push(e)}else if(e===U.note){t.i++;let e={$type:`EmNoteEntity`,sourceFrame:{$refText:t.expect(U.frameId)},dataBlockValue:``},r=o();r!==void 0&&(e.dataType=r),e.dataBlockValue=t.expect(U.block),n.noteEntities.push(e)}else if(e===U.gwt){t.i++;let e={$type:`EmGwt`,sourceFrame:{$refText:t.expect(U.frameId)},givenStatements:[],whenStatements:[],thenStatements:[]};t.expect(U.given),e.givenStatements=s(),t.accept(U.when)&&(e.whenStatements=s()),t.expect(U.then),e.thenStatements=s(),n.gwtEntities.push(e)}else t.fail(`a frame, an entity, a data block, a note, or a specification`)}return n}var ee=new Map([[`command`,0],[`event`,1],[`readmodel`,2],[`processor`,6]]),Y=12,X=10,te=96,ne=16,re=80,Z=12,ie=8,ae=48,oe=80,se=8;function Q(e,t){let n=[];for(let r of O(e).split(`
|
|
5
|
+
`)){let e=r.length<=t?void 0:Array.from(r);if(e===void 0||e.length<=t)n.push(r);else for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t).join(``))}return n}function $(e,n,r,i,a){let o=``;for(let a=0;a<e.length;a++)e[a]!==``&&(o+=`<tspan x="${c(n)}" y="${c(r+a*i)}">${t(e[a])}</tspan>`);return o===``?``:`<text${a} xml:space="preserve">${o}</text>`}function ce(e,t,n){return l(n,r=>le(e,t,n,r))}function le(t,l,f,p){if(p)return pe(t,f);let m=f.fontSize??16,h=Math.round(m*.875),g=Math.round(m*.8125),_=Math.round(m*.75),v=Math.round(_*1.4),y=Math.round(g*1.5),b=f.measurer??A(f.fontFamily,f.fontFamilyMono),x=f.padding??8,S=(e,t,n)=>{let r=0;for(let i of e)r=Math.max(r,b.width(i,t,n));return r},C=new Map,w=0;for(let e of t.lanes){let t=s(e.label,!1,b,g,4e3,1);w=Math.max(w,t.width),C.set(e,{lane:e,label:t,right:-1/0,y:0,h:0})}w+=2*Z;let T=[],E=new Map,D;for(let e of t.boxes){let t=C.get(e.lane),n=s(e.name,!1,b,h,4e3,1),r=e.data?Q(e.data,ae):[],i=Math.max(te,Math.max(n.width,S(r,_,4))+2*Y),a=2*X+n.height+(r.length>0?6+r.length*v:0),o=0;if(D){let n=D.x+Math.max(D.w/2,D.w-re);o=D.box.lane===e.lane?t.right+ne:Math.max(n,t.right+ne)}let c={box:e,name:n,data:r,x:o,y:0,w:i,h:a};t.right=o+i,t.h=Math.max(t.h,a),T.push(c),E.set(e,c),D=c}let O=0;for(let e of T)O=Math.max(O,e.x+e.w);let k=w+O+Z,j=s(t.title,!1,b,m,4e3,1),M=j.height>0?j.height+12:0,N=x,P=x+M,F=P,I=``;for(let e of C.values())e.y=F,e.h+=2*Z,I+=`<g class="pele-cluster pele-em-lane" data-id="${r(e.lane.label)}"><rect x="${c(N)}" y="${c(F)}" width="${c(k)}" height="${c(e.h)}" fill="var(--_s)"${o}/>`+a(e.label,N+Z+e.label.width/2,F+e.h/2,` class="pele-cluster-label" font-size="${g}" font-weight="var(--_hw)" fill="var(--_m)"`)+`</g>`,F+=e.h+ie;let L=C.size>0?F-ie:P,R=``;for(let e of T){let t=C.get(e.box.lane);e.x+=N+w,e.y=t.y+(t.h-e.h)/2;let s=ee.get(e.box.kind),l=`x="${c(e.x)}" y="${c(e.y)}" width="${c(e.w)}" height="${c(e.h)}"`,u=s===void 0?`<rect ${l} fill="var(--_bg)" stroke="var(--_b)"${o}/>`:`<rect ${l} fill="var(--_bg)"${o}/><rect ${l} fill="${n(s)}" fill-opacity="0.22" stroke="${n(s)}"${o}/>`,d=e.y+X+e.name.height/2,f=a(e.name,e.x+e.w/2,d,` class="pele-label" font-size="${h}" font-weight="var(--_hw)"`)+$(e.data,e.x+Y,e.y+X+e.name.height+6+v/2+_*.35,v,` class="pele-em-data" font-family="${i}" font-size="${_}"`);R+=`<g class="pele-node pele-em-${e.box.kind}${e.box.reset?` pele-em-reset`:``}" data-id="${r(e.box.id)}">${u}${f}</g>`}let z=``,B=u(`arrow_point`);for(let e of t.relations){let t=E.get(e.source),n=E.get(e.target);if(!t||!n||t===n)continue;let i,a;if(t.box.lane===n.box.lane){let e=n.x>=t.x,r=e?t.x+t.w:t.x,o=e?n.x:n.x+n.w,s=t.y+t.h/2,l=n.y+n.h/2,u=o>=r?1:-1;i=`M${c(r)},${c(s)}L${c(o-u*B)},${c(l)}`,a=d(`arrow_point`,o,l,u,0,`var(--_l)`)}else{let e=n.y>t.y,r=Math.max(t.x,n.x),o=Math.min(t.x+t.w,n.x+n.w),s=e=>Math.min(24,e/4),l=o-r>=16?(r+o)/2:n.x>t.x?t.x+t.w-s(t.w):t.x+s(t.w),u=o-r>=16?l:n.x>t.x?n.x+s(n.w):n.x+n.w-s(n.w),f=e?t.y+t.h:t.y,p=e?n.y:n.y+n.h,m=e?1:-1,h=p-m*B,g=(f+h)/2;i=l===u?`M${c(l)},${c(f)}V${c(h)}`:`M${c(l)},${c(f)}C${c(l)},${c(g)} ${c(u)},${c(g)} ${c(u)},${c(h)}`,a=d(`arrow_point`,u,p,0,m,`var(--_l)`)}z+=`<g class="pele-edge" data-id="${r(e.source.id)}-${r(e.target.id)}"><path d="${i}" fill="none" stroke="var(--_l)"/>${a}</g>`}let V=new Map;for(let e of t.boxes)V.set(e.id,e.name);let H=``,U=0,W=(e,t,n,i)=>{let l=s(`${t} · ${n}${V.has(n)?` `+V.get(n):``}`,!1,b,g,4e3,1),u=Math.max(l.width,S(i,g,0))+2*Y,d=2*X+l.height+i.length*y,f=L+(H===``&&C.size===0?0:se);H+=`<g class="pele-em-${e}" data-id="${r(n)}"><rect x="${c(N)}" y="${c(f)}" width="${c(u)}" height="${c(d)}" fill="var(--_bg)" stroke="var(--_b)"${o}/>`+a(l,N+Y+l.width/2,f+X+l.height/2,` font-size="${g}" font-weight="var(--_hw)"`)+$(i,N+Y,f+X+l.height+y/2+g*.35,y,` font-size="${g}"`)+`</g>`,L=f+d,U=Math.max(U,u)};for(let e of t.notes)W(`note`,`Note`,e.frame,Q(e.text,oe));for(let e of t.specifications){let t=[`Given ${e.given.join(`, `)}`];e.when.length>0&&t.push(`When ${e.when.join(`, `)}`),t.push(`Then ${e.then.join(`, `)}`),W(`specification`,`Given / When / Then`,e.frame,t.flatMap(e=>Q(e,oe)))}let G=Math.max(C.size>0?k:0,U,j.width),K=Math.ceil(G+2*x),q=Math.ceil(L+x),J=a(j,K/2,x+j.height/2,` class="pele-title" font-weight="var(--_tw)"`)+I+z+R+H;return{svg:e(`eventmodeling`,K,q,m,f,t,J),width:K,height:q,links:[]}}var ue=8,de=120,fe=20;function pe(l,f){let p=f.fontSize??16,m=Math.round(p*.875),h=Math.round(p*.75),g=f.padding??8,_=f.measurer??A(f.fontFamily,f.fontFamilyMono),v=Math.max(160,(f.maxWidth??320)-2*g),y=new Map(l.boxes.map((e,t)=>[e,t])),b=new Map,x=new Set;for(let e of l.relations){let t=y.get(e.source),n=y.get(e.target);if(t===void 0||n===void 0||t===n)continue;if(Math.abs(t-n)<2){x.add(l.boxes[Math.max(t,n)]);continue}let r=b.get(e.target);r?(r[0]=Math.min(r[0],t),r[1]=Math.max(r[1],t)):b.set(e.target,[Math.min(t,n),Math.max(t,n)])}let S=new Map,E=[];for(let[e,[t,n]]of[...b].sort((e,t)=>e[1][0]-t[1][0])){let r=E.findIndex(e=>e<t);r<0&&(r=E.length),E[r]=n,S.set(e,r)}let D=24+ue*Math.max(0,E.length-1),k=Math.max(de,v-D),j=k-2*Y,M=s(l.title,!1,_,p,v,1),N=g+(M.height?M.height+12:0),P=g+M.height,F=Math.max(M.width,k+D),I=``,L=``,R=``,z=new Map,B=(e,t,n=0)=>T(O(e),_,t,j,n);l.boxes.forEach((e,l)=>{let u=x.has(e)?j-fe:j,d=w(s(e.lane.label,!1,_,m,u,1),_,u),f=s(e.name,!1,_,m,j-36,1),p=e.data?B(e.data,h,4):void 0,v=Math.max(k,d.width+2*Y,f.width+2*Y+36,(p?.width??0)+2*Y),y=d.height+12,b=2*X+f.height+(p?p.height+6:0),S=ee.get(e.kind),T=N+y,E=`x="${c(g)}" y="${c(T)}" width="${c(v)}" height="${c(b)}"`;I+=`<g class="pele-cluster pele-em-lane" data-id="${r(e.lane.label)}">`+C(d,g+Y,N,` class="pele-cluster-label" font-size="${m}" font-weight="var(--_hw)" fill="var(--_m)"`)+`<g class="pele-node pele-em-${e.kind}${e.reset?` pele-em-reset`:``}" data-id="${r(e.id)}"><rect ${E} fill="var(--_bg)" stroke="var(--_b)"${o}/>`+(S===void 0?``:`<rect ${E} fill="${n(S)}" fill-opacity="0.22" stroke="${n(S)}"${o}/>`)+a(f,g+Y+f.width/2,T+X+f.height/2,` class="pele-label" font-size="${m}" font-weight="var(--_hw)"`)+`<text class="pele-em-frame" x="${c(g+v-Y)}" y="${c(T+X+m)}" text-anchor="end" font-size="${h}" fill="var(--_m)">${t(e.id)}</text>`+(p?$(p.lines.map(e=>e.map(e=>e.text).join(``)),g+Y,T+X+f.height+6+p.lineHeight/2+h*.35,p.lineHeight,` class="pele-em-data" font-family="${i}" font-size="${h}"`):``)+`</g></g>`,z.set(e,{y:T,h:b,w:v,index:l,lane:d.width}),F=Math.max(F,v+D),P=T+b,N=P+28});for(let e of l.relations){let t=z.get(e.source),n=z.get(e.target);if(!t||!n||t===n)continue;let i=n.y>t.y,a=i?1:-1,o=i?t.y+t.h:t.y,s=i?n.y:n.y+n.h,l,f;if(Math.abs(t.index-n.index)===1){let e=g+Math.max(Math.min(t.w,n.w)/2,Y+(i?n:t).lane+16);l=`M${c(e)},${c(o)}V${c(s-a*u(`arrow_point`))}`,f=d(`arrow_point`,e,s,0,a,`var(--_l)`)}else{let r=g+F-D+12+ue*(S.get(e.target)??0),i=t.y+t.h/2-5,a=n.y+n.h/2+5;l=`M${c(g+t.w)},${c(i)}H${c(r)}V${c(a)}H${c(g+n.w+u(`arrow_point`))}`,f=d(`arrow_point`,g+n.w,a,-1,0,`var(--_l)`)}L+=`<g class="pele-edge" data-id="${r(e.source.id)}-${r(e.target.id)}"><path d="${l}" fill="none" stroke="var(--_l)"/>${f}</g>`}let V=new Map(l.boxes.map(e=>[e.id,e.name])),H=(e,t,n,i)=>{let l=s(`${t} · ${n}${V.has(n)?` `+V.get(n):``}`,!1,_,m,j,1),u=B(i,m),d=Math.max(k,l.width+2*Y,u.width+2*Y),f=2*X+l.height+u.height;R+=`<g class="pele-em-${e}" data-id="${r(n)}"><rect x="${c(g)}" y="${c(N)}" width="${c(d)}" height="${c(f)}" fill="var(--_bg)" stroke="var(--_b)"${o}/>`+a(l,g+Y+l.width/2,N+X+l.height/2,` font-size="${m}" font-weight="var(--_hw)"`)+$(u.lines.map(e=>e.map(e=>e.text).join(``)),g+Y,N+X+l.height+u.lineHeight/2+m*.35,u.lineHeight,` font-size="${m}"`)+`</g>`,P=N+f,N=P+se,F=Math.max(F,d)};for(let e of l.notes)H(`note`,`Note`,e.frame,e.text);for(let e of l.specifications){let t=[`Given ${e.given.join(`, `)}`];e.when.length&&t.push(`When ${e.when.join(`, `)}`),t.push(`Then ${e.then.join(`, `)}`),H(`specification`,`Given / When / Then`,e.frame,t.join(`
|
|
6
|
+
`))}let U=Math.ceil(F+2*g),W=Math.ceil(P+g),G=a(M,U/2,g+M.height/2,` class="pele-title" font-weight="var(--_tw)"`)+L+I+R;return{svg:e(`eventmodeling`,U,W,p,f,l,G),width:U,height:W,links:[]}}var me={type:`eventmodeling`,keepComments:!0,parse:(e,t,n)=>F(J(e),n),render:ce};export{me as eventmodeling};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{_ as e,b as t,f as n,i as r,o as i,r as a,s as o,u as s,x as c}from"./E3FWOBN4-D5m5o2g0.js";import{i as l}from"./DKTLEL5E-DciMwFJ1.js";import{t as u}from"./RVARI57O-CgA1WoRv.js";import{PeleError as d,_ as f,b as p,g as m,h,s as g,u as _,y as v}from"./lazy-DaMZI1F7.js";var y=/^\d+$/,b=/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/,x=/^\d+px$/;function S(e,t,n){return new d(`value for ${e} ${t} is invalid, please use a valid ${n}`,`semantic`,{type:`quadrantChart`})}function C(e){let t=e.trim(),n=t.indexOf(`:`);if(n===-1)return[t,`undefined`];let r=t.slice(n+1).trimStart(),i=r.indexOf(`:`);return[t.slice(0,n).trimEnd(),i===-1?r:r.slice(0,i).trimEnd()]}function w(e){let t={};for(let n of e){let[e,r]=C(n);if(e===`radius`){if(!y.test(r))throw S(e,r,`number`);t.radius=parseInt(r)}else if(e===`color`){if(!b.test(r))throw S(e,r,`hex code`);t.color=r}else if(e===`stroke-color`){if(!b.test(r))throw S(e,r,`hex code`);t.strokeColor=r}else if(e===`stroke-width`){if(!x.test(r))throw S(e,r,`number of pixels (eg. 10px)`);t.strokeWidth=r}else throw new d(`style named ${e} is not supported.`,`semantic`,{type:`quadrantChart`})}return t}function T(e){return{text:e.text.trim(),type:e.type}}var E=class{type=`quadrantChart`;title;accTitle;accDescr;quadrants=[void 0,void 0,void 0,void 0];xAxisLeft;xAxisRight;yAxisBottom;yAxisTop;points=[];classes=new Map;setQuadrant1Text(e){this.quadrants[0]=T(e)}setQuadrant2Text(e){this.quadrants[1]=T(e)}setQuadrant3Text(e){this.quadrants[2]=T(e)}setQuadrant4Text(e){this.quadrants[3]=T(e)}setXAxisLeftText(e){this.xAxisLeft=T(e)}setXAxisRightText(e){this.xAxisRight=T(e)}setYAxisBottomText(e){this.yAxisBottom=T(e)}setYAxisTopText(e){this.yAxisTop=T(e)}addPoint(e,t,n,r,i){this.points.push({x:Number(n),y:Number(r),text:T(e),className:t,...w(i)})}addClass(e,t){this.classes.set(e,w(t))}setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
2
|
+
`)}},D=`$end.INVALID.NEWLINE.title.title_value.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.X-AXIS.Y-AXIS.AXIS-TEXT-DELIMITER.QUADRANT_1.QUADRANT_2.QUADRANT_3.QUADRANT_4.CLASSDEF.MD_STR.STR.class_name.point_start.point_x.point_y.QUADRANT.ALPHA.UNICODE_TEXT.COLON.PLUS.COMMA.EQUALS.MULT.BRKT.UNDERSCORE.DOT.AMP.MINUS.NUM.SPACE.SEMI.PUNCTUATION.EOF`.split(`.`),O=[41,4,6,8,9,19],k=new Uint8Array(128);for(let[e,t]of[[`:`,27],[`+`,28],[`,`,29],[`=`,30],[`*`,31],[`#`,32],[`_`,33],[`.`,34],[`&`,35],[`-`,36],[` \v\f`,38],[`;`,39],["!$%'`?\\/",40]])for(let n=0;n<e.length;n++)k[e.charCodeAt(n)]=t;function A(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=0,l=0,d=0,g=0,_=0,y=0,b=0,x=0,S=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},C=e=>{a.push(o),o=e},w=()=>{a.length>0&&(o=a.pop())},T=n=>{let r=e.indexOf(`
|
|
3
|
+
`,n);return r===-1?t:r},E=t=>{for(;e.charCodeAt(t)===32;)t++;return t},D=n=>{for(;n<t&&h(e.charCodeAt(n));)n++;return n},A=n=>{let r=e.charCodeAt(n);if(r===49)return n+1;if(r!==48)return-1;let i=n+1;if(i<t&&!f(e.charCodeAt(i))&&v(e.charCodeAt(i+1)))for(i+=2;v(e.charCodeAt(i));)i++;return i};t:for(;s<t;){let n=e.charCodeAt(s),r=e.charCodeAt(s+1);switch(o){case 0:break;case 1:case 2:case 3:S(O[o],s,T(s)),w();continue;case 4:if(n===125)s++,w();else{let n=e.indexOf(`}`,s);S(9,s,n===-1?t:n)}continue;case 5:if(n===34)s++,w();else{let n=e.indexOf(`"`,s);S(19,s,n===-1?t:n)}continue;case 6:if(n===96&&r===34){s+=2,w();continue}if(n!==96&&n!==34){let n=s+1;for(let r=e.charCodeAt(n);n<t&&r!==96&&r!==34;r=e.charCodeAt(++n));S(18,s,n);continue}break t;case 7:if(m(n)){let t=s+1;for(;m(e.charCodeAt(t));)t++;S(20,s,t),w();continue}break t;case 8:{let t=A(s);if(t!==-1){S(22,s,t),C(9);continue}let n=D(s);if(e.charCodeAt(n)===93){s=E(n+1),w();continue}break t}case 9:{let t=D(s);if(e.charCodeAt(t)===44){s=D(t+1),o=10;continue}break t}case 10:{let e=A(s);if(e!==-1){S(23,s,e),w();continue}break t}}if(n===37&&r===37){s=T(s+2);continue}if(n===10||n===13){let t=s+1;for(let n=e.charCodeAt(t);n===10||n===13;n=e.charCodeAt(++t));S(2,s,t);continue}let i=n|32;if(i===116&&u(e,s,`title`)&&!m(e.charCodeAt(s+5))){S(3,s,s+5),C(1);continue}if(i===97&&u(e,s,`acc`)){let t=u(e,s+3,`descr`);if(t||u(e,s+3,`title`)){let n=D(s+8),r=e.charCodeAt(n);if(r===58){S(t?7:5,s,D(n+1)),C(t?3:2);continue}if(r===123&&t){s=D(n+1),C(4);continue}}}let a=s;n===32&&((s<c||s>=l)&&(c=s,l=E(s)),a=l);let f=e.charCodeAt(a),j=f|32,M=0,N=0;if(j===120&&u(e,a,`x-axis`))M=10,N=a+6;else if(j===121&&u(e,a,`y-axis`))M=11,N=a+6;else if(f===45){if(a<d||a>=g)for(d=a,g=a;e.charCodeAt(g)===45;)g++;g-a>=2&&e.charCodeAt(g)===62&&(M=12,N=g+1)}else if(j===113&&u(e,a,`quadrant`)){let t=e.charCodeAt(a+9);e.charCodeAt(a+8)===45&&t>=49&&t<=52?(M=13+t-49,N=a+10):u(e,a+8,`chart`)&&(M=24,N=a+13)}if(M!==0)S(M,s,E(N));else if(i===99&&u(e,s,`classdef`)&&!m(e.charCodeAt(s+8)))S(17,s,s+8);else if(n===34)r===96?(s+=2,C(6)):(s++,C(5));else if(n===58&&r===58&&e.charCodeAt(s+2)===58)s+=3,C(7);else{if(n===58||h(n)){let t=s;if(n!==58&&((s<_||s>=y)&&(_=s,y=D(s)),t=y),e.charCodeAt(t)===58&&((t+1<b||t+1>=x)&&(b=t+1,x=D(t+1)),e.charCodeAt(x)===91)){S(21,s,D(x+1)),C(8);continue}}if(p(n)){let t=s+1;for(;p(e.charCodeAt(t));)t++;S(25,s,t)}else if(n>=128){let t=s+1;for(;e.charCodeAt(t)>=128;)t++;S(26,s,t)}else if(v(n)){let t=s+1;for(;v(e.charCodeAt(t));)t++;S(37,s,t)}else if(k[n]!==0)S(k[n],s,s+1);else break}}return s<t?(n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}):(o<O.length&&(n.push(O[o]),r.push(``),i.push(t)),n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i})}function j(...e){let t=new Uint8Array(42);for(let n of e)t[n]=1;return t}var M=j(40,35,37,25,29,28,30,31,34,32,33,26),N=j(25,37,36,29,27,35,32,31,26),P=j(25,37,27,38,32,36),F=j(2,39,41),I=[`setQuadrant1Text`,`setQuadrant2Text`,`setQuadrant3Text`,`setQuadrant4Text`],L=`'STR', 'MD_STR', 'ALPHA', 'NUM', 'UNICODE_TEXT', 'PUNCTUATION'`;function R(e,t){let{types:n,texts:r,starts:i}=A(e),a=0,o=t=>{let r=n[a];throw r===1?g(`quadrantChart`,e,i[a],``,!0):g(`quadrantChart`,e,i[a],`Expecting ${t}, got '${D[r]}'`)},s=e=>(n[a]!==e&&o(`'${D[e]}'`),r[a++]),c=e=>e===19||e===18||M[e]===1,l=()=>{let e=n[a];c(e)||o(L);let t=r[a++];for(;M[n[a]]===1||n[a]===38||n[a]===36;)t+=r[a++];return{text:t,type:e===18?`markdown`:`text`}},u=()=>{let e=[];for(;;){P[n[a]]===0&&o(`'ALPHA', 'NUM', 'COLON', 'SPACE', 'BRKT', 'MINUS'`);let t=r[a++];for(;P[n[a]]===1;)t+=r[a++];if(e.push(t.trim()),n[a]!==29)return e;a++}};for(;F[n[a]]===1||n[a]===38;)a++;for(s(24);n[a]!==0;){for(;n[a]===38;)a++;let e=n[a];switch(e){case 17:{a++,s(38),N[n[a]]===0&&o(`'ALPHA', 'NUM', 'UNICODE_TEXT'`);let e=r[a++];for(;N[n[a]]===1;)e+=r[a++];s(38),t.addClass(e,u());break}case 10:case 11:{a++;let r=l(),i;n[a]===12&&(a++,c(n[a])?i=l():r.text+=` ⟶ `),e===10?(t.setXAxisLeftText(r),i&&t.setXAxisRightText(i)):(t.setYAxisBottomText(r),i&&t.setYAxisTopText(i));break}case 13:case 14:case 15:case 16:a++,t[I[e-13]](l());break;case 3:a++,t.setDiagramTitle(s(4).trim());break;case 5:a++,t.setAccTitle(s(6).trim());break;case 7:a++,t.setAccDescription(s(8).trim());break;case 9:t.setAccDescription(r[a++].trim());break;default:if(c(e)){let e=l(),i=n[a]===20?r[a++]:``;s(21);let o=s(22),c=s(23);t.addPoint(e,i,o,c,P[n[a]]===1?u():[])}}F[n[a]]===0&&o(`'NEWLINE', 'SEMI', 'EOF'`),a++}}var ee=4,te=300;function z(e,t){return e.quadrantChart?.[t]}function B(e,t,n,r){let i=z(e,t);return typeof i==`number`&&i>=0?Math.min(i,r):n}function ne(e){return e.startsWith(`#`)?e:`#`+e}function V(u,d,f){let p=f.fontSize??16,m=Math.round(p*.875),h=Math.round(p*.75),g=f.measurer??_(f.fontFamily,f.fontFamilyMono),v=Math.round(Math.max(100,B(d,`chartWidth`,500,4e3))),y=Math.round(l(f,v,280)),b=Math.round(Math.max(100,B(d,`chartHeight`,500,4e3))*y/v),x=B(d,`quadrantPadding`,f.padding??8,200),S=B(d,`xAxisLabelPadding`,5,200),C=B(d,`yAxisLabelPadding`,5,200),w=u.points.length>0,T=(e,t,n)=>s(e?.text,e?.type===`markdown`,g,t,Math.max(n,40)),E=s(u.title,!1,g,p,Math.max(y-2*x,40),1),D=B(d,`titlePadding`,10,200),O=E.height>0?E.height+D:0,k=!!(u.xAxisLeft?.text||u.xAxisRight?.text),A=!!(u.yAxisBottom?.text||u.yAxisTop?.text),j=w||z(d,`xAxisPosition`)===`bottom`,M=z(d,`yAxisPosition`)===`right`,N=y-2*x,P=T(u.xAxisLeft,m,u.xAxisRight?N/2-16:N),F=T(u.xAxisRight,m,N/2-16),I=Math.max(P.height,F.height),L=k?I+S:0,R=b-2*x-O-L,V=T(u.yAxisBottom,m,u.yAxisTop?R/2-16:R),H=T(u.yAxisTop,m,R/2-16),U=Math.max(V.height,H.height),re=A?U+C:0,W=x+(M?0:re),G=x+O+(j?0:L),K=Math.max(0,N-re),q=Math.max(0,R),J=Math.max(0,(K-ee)/2),Y=Math.max(0,(q-ee)/2),X=[W+J,G,W+K-J,G+q,W,G+Y,W+K,G+q-Y],ie=(e,t,n,r,i)=>{for(let a=e;a<X.length;a+=4)if(t<X[a+2]&&r>X[a]&&n<X[a+3]&&i>X[a+1])return!1;return!0},ae=B(d,`quadrantTextTopPadding`,5,200),oe=``;for(let e=0;e<4;e++){let t=e===0||e===3?W+K-J:W,n=e<2?G:G+q-Y,r=T(u.quadrants[e],p,J-16),o=t+J/2,s=w?n+ae+r.height/2:n+Y/2;X.push(o-r.width/2,s-r.height/2,o+r.width/2,s+r.height/2),oe+=`<g class="pele-quadrant" data-id="${e+1}"><rect x="${c(t)}" y="${c(n)}" width="${c(J)}" height="${c(Y)}"${a}/>`+i(r,o,s,` class="pele-label" fill="var(--_fg)" stroke="none"`)+`</g>`}let Z=``;if(k){let e=j?G+q+S+I/2:G-S-I/2;Z+=i(P,F.height>0?W+K/4:W+P.width/2,e,``)+i(F,W+K*3/4,e,``)}if(A){let e=M?W+K+C+U/2:W-C-U/2,t=(t,n)=>t.height>0?`<g transform="translate(${c(e)},${c(n)}) rotate(-90)">${i(t,0,0,``)}</g>`:``;Z+=t(V,H.height>0?G+q*3/4:G+q-V.width/2)+t(H,G+q/4)}let se=B(d,`pointRadius`,5,200),ce=B(d,`pointTextPadding`,5,200),le=n(0),Q=[],ue=[];for(let e of u.points){if(!(e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1))continue;let n=u.classes.get(e.className),i=Math.min(e.radius??n?.radius??se,2e3),a=e.color??n?.color,s=e.strokeColor??n?.strokeColor,l=e.strokeWidth??n?.strokeWidth,d=[];a&&d.push(`fill:`+ne(a)),l&&(s&&d.push(`stroke:`+ne(s)),d.push(`stroke-width:`+l));let f=W+e.x*K,p=G+(1-e.y)*q;Q.push({cx:f,cy:p,reach:i+(l?Math.min(parseInt(l),400)/2:0),text:T(e.text,h,200)}),ue.push(`<circle class="pele-point${t(e.className)}" data-id="${r(e.text.text)}" cx="${c(f)}" cy="${c(p)}" r="${c(i)}"${l&&!s?` stroke="${le}"`:``}${o(d).shape}/>`)}let $=Q.length<=te;if($)for(let{cx:e,cy:t,reach:n}of Q)X.push(e-n,t-n,e+n,t+n);let de=``;for(let{cx:e,cy:t,reach:n,text:r}of Q){let a=r.width/2,o=r.size*.6+(r.height-r.lineHeight)/2,s=n+ce,c=Math.min(s,Math.max(0,(J-r.width)/2)),l=8+4*(e<W+K/2?t<G+q/2?1:2:t<G+q/2?0:3),u=Math.max(t+s,X[l+3]+ce)+o,d=[e,t+s+o,e,t-s-o,e+s+a,t,e-s-a,t,e,u],f=e,p=d[1],m=!1;for(let e=0;e<20;e+=2){let t=e%10,n=t===8?c:0,i=(t<4||t===8)&&r.width<K?Math.min(Math.max(d[t],W+a+n),W+K-a-n):d[t],s=d[t+1];if(i-a<W||i+a>W+K||s-o<G||s+o>G+q)continue;let l=!$||ie(e<10?0:8,i-a,s-o,i+a,s+o);if((!m||l)&&(f=i,p=s,m=!0),l)break}$&&X.push(f-a,p-o,f+a,p+o),de+=i(r,f,p,` class="pele-label"`)}let fe=i(E,y/2,D/2+E.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g class="pele-quadrants" fill="var(--_s)" stroke="var(--_b)">${oe}</g>`+(Z?`<g class="pele-axis-labels" font-size="${m}" fill="var(--_m)">${Z}</g>`:``)+(Q.length>0?`<g class="pele-points" fill="${le}">${ue.reverse().join(``)}</g><g class="pele-point-labels" font-size="${h}">${de}</g>`:``);return{svg:e(`quadrantChart`,y,b,p,f,u,fe),width:y,height:b,links:[]}}var H={type:`quadrantChart`,parse(e,t,n){let r=new E;return r.title=n,R(e,r),r},render:V};export{H as quadrantChart};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e,x as t}from"./E3FWOBN4-D5m5o2g0.js";import{g as n,s as r}from"./lazy-DaMZI1F7.js";var i=[`1`,`INVALID`,`SPACELINE`,`NL`,`EOF`,``,`SPACELIST`,`ICON`,`CLASS`,`NODE_DSTART`,`NODE_ID`,`NODE_DESCR`,`NODE_DEND`,`SHAPE_DATA`];function a(e,t){return e===5?t?`KANBAN`:`MINDMAP`:i[e]}var o={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6};function s(e,t){switch(e){case`[`:return o.RECT;case`(`:return t===`)`?o.ROUNDED_RECT:o.CLOUD;case`((`:return o.CIRCLE;case`)`:return o.CLOUD;case`))`:return o.BANG;case`{{`:return o.HEXAGON;default:return o.DEFAULT}}var c=/\s+/y,l=/.+/y,u=/[^([\n){}]+/y,d=/[^([\n){}@]+/y,f=/[^)\](}]+/y,p=/[^`"]+/y,m=/[^}^"]+/y,h=/\n\s*/g;function g(e,t,n){for(let r=0;r<n.length;r++)if((e.charCodeAt(t+r)|32)!==n.charCodeAt(r))return!1;return!0}function _(e,t){let r=e.length,i=[],a=[],o=[],s=t?`kanban`:`mindmap`,_=t?d:u,v=0,y=0,b=-1,x=(e,t,n)=>{i.push(e),a.push(t),o.push(y),y=n},S=(t,n,r)=>{x(t,e.slice(y,n),n),v=r},C=(t,n)=>(t.lastIndex=n,t.test(e)?t.lastIndex:-1),w=t=>{let n=e.indexOf(t,y);return n===-1?r:n};for(;y<r;){let r=e.charCodeAt(y),i=e.charCodeAt(y+1),a;if(v===0){let o=r<=32||r>=160?Math.max(C(c,y),y):y;if(t&&r===64&&i===123)x(13,``,y+2),v=6;else if(e.charCodeAt(o)===37&&e.charCodeAt(o+1)===37)S(2,C(l,o),0);else if(o>y)b<y&&(b=w(`
|
|
2
|
+
`)),b>=o?S(6,o,0):(a=e.lastIndexOf(`
|
|
3
|
+
`,o-1))>y?S(2,a+1,0):S(3,y+1,0);else if(g(e,y,s)&&!n(e.charCodeAt(y+s.length)))S(5,y+s.length,0);else if(r===58&&i===58&&e.charCodeAt(y+2)===58)y+=3,v=1;else if(r===58&&i===58&&g(e,y+2,`icon`)&&e.charCodeAt(y+6)===40)y+=7,v=2;else if(r===45&&i===41||r===40&&(i===45||i===40)||(r===41||r===123)&&i===r)S(9,y+2,3);else if(r===41||r===40||r===91)S(9,y+1,3);else if((a=C(_,y))!==-1)S(10,a,0);else break}else if(v===3)r===34?(v=i===96?5:4,y+=i===96?2:1):r===41||r===40?S(12,i===r||r===40&&i===45?y+2:y+1,0):r===93?S(12,y+1,0):r===125&&i===125||r===45&&i===41?S(12,y+2,0):S(11,C(r===125?l:f,y),3);else if(v===4)r===34?(y++,v=3):S(11,w(`"`),4);else if(v===5){if(r===96&&i===34)y+=2,v=3;else if((a=C(p,y))!==-1)S(11,a,5);else break}else if(v===1){if((a=C(l,y))!==-1)S(8,a,0);else if(r===10)y++,v=0;else break}else if(v===2)r===41?(y++,v=0):S(7,w(`)`),2);else if(v===6){if(r===34)S(13,y+1,7);else if(r===125)y++,v=0;else if((a=C(m,y))!==-1)S(13,a,6);else break}else r===34?S(13,y+1,6):(a=w(`"`),x(13,e.slice(y,a).replace(h,`<br/>`),a))}return y<r?x(1,``,y):(v===0&&x(4,``,r),x(0,``,r)),{types:i,texts:a,starts:o}}var v=`'SPACELINE', 'NL', 'EOF'`,y=new Uint8Array(14);for(let e of[2,6,7,8,9,10])y[e]=1;function b(e){return e===2||e===3||e===4}function x(e,t,n){let i=n?`kanban`:`mindmap`,{types:o,texts:s,starts:c}=_(e,n),l=n?`, 'SHAPE_DATA'`:``,u=0,d=t=>{let s=o[u];throw s===1?r(i,e,c[u],``,!0):r(i,e,c[u],`Expecting ${t}, got '${a(s,n)}'`)},f=`'${a(5,n)}'`;if(o[u]===2){for(u++;o[u]===2||o[u]===3;)u++;o[u]!==5&&d(`'SPACELINE', 'NL', ${f}`)}else o[u]!==5&&d(`'SPACELINE', ${f}`);u++;let p=`'SPACELINE', 'NL', 'SPACELIST', 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'`;for(o[u]===3&&(u++,p=`'SPACELINE', 'SPACELIST', 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'`);;){let e=o[u],n=0,r=e===6;if(r&&(n=s[u++].length,e=o[u]),e===10||e===9){let r,i,a=0;if(e===10&&(r=s[u++]),o[u]===9){let e=s[u++];o[u]!==11&&d(`'NODE_DESCR'`),i=s[u++],o[u]!==12&&d(`'NODE_DEND'`);let n=s[u++];!b(o[u])&&o[u]!==13&&d(v+l),a=t.getType(e,n)}else!b(o[u])&&o[u]!==13&&d(v+`, 'NODE_DSTART'`+l),i=r;if(o[u]===13){let e=s[u++];for(;o[u]===13;)e+=s[u++];b(o[u])||d(v+l),t.addNode(n,r??i,i,a,e)}else t.addNode(n,r??i,i,a)}else if(e===7||e===8){let n=s[u++];b(o[u])||d(v),t.decorateNode(e===7?{icon:n}:{class:n})}else r?b(e)||d(v+`, 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'`):e===2?b(o[++u])||d(v):d(p);for(u++;o[u]===3||o[u]===4;)u++;if(o[u]===0)return;y[o[u]]===0&&d(v+`, 'SPACELIST', 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'`)}}function S(n,r,i,a,o){return`<svg class="pele-icon" data-icon="${e(n)}" x="${t(r)}" y="${t(i)}" width="${t(a)}" height="${t(a)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${o?.(n)??``}</svg>`}export{S as n,x as r,s as t};
|