@codragraph/cli 2.1.5 → 2.2.0-rc.6
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/README.md +18 -13
- package/dist/cli/analyze.d.ts +9 -4
- package/dist/cli/analyze.js +37 -13
- package/dist/cli/graphpack.d.ts +48 -0
- package/dist/cli/graphpack.js +217 -0
- package/dist/cli/index.js +81 -3
- package/dist/cli/status.d.ts +1 -1
- package/dist/cli/status.js +8 -0
- package/dist/cli/tool.d.ts +11 -2
- package/dist/cli/tool.js +138 -8
- package/dist/core/adaptive-profile.d.ts +52 -0
- package/dist/core/adaptive-profile.js +180 -0
- package/dist/core/cgdb/cgdb-adapter.d.ts +34 -5
- package/dist/core/cgdb/cgdb-adapter.js +418 -5
- package/dist/core/cgdb/pool-adapter.js +1 -1
- package/dist/core/graphpack/index.d.ts +14 -0
- package/dist/core/graphpack/index.js +474 -0
- package/dist/core/graphpack/types.d.ts +129 -0
- package/dist/core/graphpack/types.js +4 -0
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +3 -1
- package/dist/core/ingestion/pipeline-phases/structure.js +19 -3
- package/dist/core/ingestion/pipeline.d.ts +10 -0
- package/dist/core/run-analyze.d.ts +27 -2
- package/dist/core/run-analyze.js +598 -27
- package/dist/core/search/bm25-index.d.ts +19 -0
- package/dist/core/search/bm25-index.js +68 -29
- package/dist/core/semantic/relationships.d.ts +36 -0
- package/dist/core/semantic/relationships.js +261 -0
- package/dist/mcp/local/local-backend.js +48 -3
- package/dist/mcp/resources.js +125 -0
- package/dist/mcp/tools.js +105 -0
- package/dist/server/api.js +112 -0
- package/dist/storage/repo-manager.d.ts +29 -0
- package/dist/web/assets/agent-CQNZQ-hg.js +1139 -0
- package/dist/web/assets/architectureDiagram-UL44E2DR-B5_goS_i.js +36 -0
- package/dist/web/assets/blockDiagram-7IZFK4PR-D7ZAlDyv.js +132 -0
- package/dist/web/assets/{c4Diagram-DFAF54RM-C4Hl3J2U.js → c4Diagram-Y2BXMSZH-Djcgm_54.js} +1 -1
- package/dist/web/assets/{chunk-7RZVMHOQ-BitYcNVR.js → chunk-3SSMPTDK-Cv2Zy2FO.js} +1 -1
- package/dist/web/assets/{chunk-TBF5ZNIQ-DL5stGM1.js → chunk-6764PJDD-Cppb-jH-.js} +1 -1
- package/dist/web/assets/{chunk-KSICW3F5-BYzvDLNI.js → chunk-AZZRMDJM-BHlLC7p3.js} +1 -1
- package/dist/web/assets/{chunk-AEOMTBSW-BgTIXPsY.js → chunk-JQRUD6KW-3F8Zg-1N.js} +1 -1
- package/dist/web/assets/chunk-KRXBNO2N-C0mbN9a7.js +1 -0
- package/dist/web/assets/chunk-LCXTWHL2-BoiuJpIF.js +231 -0
- package/dist/web/assets/{chunk-O5ABG6QK-dHwHzA6n.js → chunk-LII3EMHJ-Dqq0Qguw.js} +1 -1
- package/dist/web/assets/chunk-RG4AUYOV-Bl5F_gDs.js +206 -0
- package/dist/web/assets/{chunk-TU3PZOEN-RLyvLcv-.js → chunk-T5OCTHI4-B2tIcggA.js} +1 -1
- package/dist/web/assets/chunk-W44A43WB-BHe37iN7.js +13 -0
- package/dist/web/assets/{chunk-RWUO3TPN-BgRTY0_k.js → chunk-ZXARS5L4-wcrIaQvY.js} +1 -1
- package/dist/web/assets/classDiagram-KGZ6W3CR-IbI6v_24.js +1 -0
- package/dist/web/assets/classDiagram-v2-72OJOZXJ-IbI6v_24.js +1 -0
- package/dist/web/assets/{cose-bilkent-PNC4W37J-DVhePRYg.js → cose-bilkent-UX7MHV2Q-BWr7v0Wr.js} +1 -1
- package/dist/web/assets/dagre-ND4H6XIP-De5LIh1B.js +4 -0
- package/dist/web/assets/diagram-3NCE3AQN-Dd22FSHy.js +43 -0
- package/dist/web/assets/diagram-GF46GFSD-Cev3THY8.js +24 -0
- package/dist/web/assets/diagram-HNR7UZ2L-D8Z8RQGs.js +3 -0
- package/dist/web/assets/diagram-QXG6HAR7-B8VOJOiE.js +24 -0
- package/dist/web/assets/diagram-WEQXMOUZ-va1bLoMD.js +10 -0
- package/dist/web/assets/{erDiagram-GCSMX5X6-C3dhDFA8.js → erDiagram-L5TCEMPS-B3_9uAoP.js} +5 -5
- package/dist/web/assets/{flowDiagram-OTCZ4VVT-CWSFWmhr.js → flowDiagram-H6V6AXG4-98m6maI1.js} +9 -9
- package/dist/web/assets/ganttDiagram-JCBTUEKG-vE2nzETb.js +292 -0
- package/dist/web/assets/gitGraphDiagram-S2ZK5IYY-DKc8uUg_.js +106 -0
- package/dist/web/assets/index-BAhe1HSk.css +1 -0
- package/dist/web/assets/index-VTKdaklA.js +1415 -0
- package/dist/web/assets/infoDiagram-3YFTVSEB-DYP-Srzx.js +2 -0
- package/dist/web/assets/{ishikawaDiagram-YMYX4NHK-DUoJvNP2.js → ishikawaDiagram-BNXS4ZKH-QZnkpmmb.js} +3 -3
- package/dist/web/assets/{journeyDiagram-SO5T7YLQ-RMFPNNqz.js → journeyDiagram-M6C3CM3L-B5ojIuqu.js} +1 -1
- package/dist/web/assets/{kanban-definition-LJHFXRCJ-BzpDs1K9.js → kanban-definition-75IXJCU3-BJA8liRR.js} +4 -4
- package/dist/web/assets/{katex-GD7MH7QM-DBQvrix-.js → katex-K3KEBU37-DUqZiCRL.js} +1 -1
- package/dist/web/assets/mindmap-definition-2TDM6QVE-BQj5yylD.js +96 -0
- package/dist/web/assets/pieDiagram-CU6KROY3-4eSrPiQz.js +30 -0
- package/dist/web/assets/quadrantDiagram-VICAPDV7-PzxN8j55.js +7 -0
- package/dist/web/assets/{requirementDiagram-M5DCFWZL-DLHOVTSv.js → requirementDiagram-JXO7QTGE-CtplTc5y.js} +2 -2
- package/dist/web/assets/sankeyDiagram-URQDO5SZ-CoSgvkxv.js +40 -0
- package/dist/web/assets/sequenceDiagram-VS2MUI6T-D7ygyXvJ.js +162 -0
- package/dist/web/assets/stateDiagram-7D4R322I-v01gvwji.js +1 -0
- package/dist/web/assets/stateDiagram-v2-36443NZ5-DFD2b8_x.js +1 -0
- package/dist/web/assets/{timeline-definition-5SPVSISX-TRSDRgPw.js → timeline-definition-O6YCAMPW-CTI3M65J.js} +4 -4
- package/dist/web/assets/{vennDiagram-IE5QUKF5-DNy7HRBM.js → vennDiagram-MWXL3ELB-RnB0XMP7.js} +6 -6
- package/dist/web/assets/wardley-L42UT6IY-5TKZOOLJ-C-ZcgEBb.js +173 -0
- package/dist/web/assets/wardleyDiagram-CUQ6CDDI-EwRi4kwo.js +78 -0
- package/dist/web/assets/{xychartDiagram-ZHJ5623Y-Dr9r7a35.js → xychartDiagram-N2JHSOCM-DA38II6y.js} +4 -4
- package/dist/web/index.html +2 -2
- package/package.json +2 -2
- package/vendor/node_modules/node-addon-api/node_addon_api_except.stamp +0 -0
- package/dist/web/assets/agent-D5lb0zXz.js +0 -1089
- package/dist/web/assets/architectureDiagram-EMZXCZ2Q-CZtc99v_.js +0 -36
- package/dist/web/assets/blockDiagram-IGV67L2C-BtoUp-6Y.js +0 -132
- package/dist/web/assets/chunk-3GS5O3IE-DkUjU0WD.js +0 -231
- package/dist/web/assets/chunk-3YCYZ6SJ-CQkVgT_z.js +0 -1
- package/dist/web/assets/chunk-H3VCZNTA-Cx5XV_aC.js +0 -13
- package/dist/web/assets/chunk-HN6EAY2L-BBnyTNdB.js +0 -1
- package/dist/web/assets/chunk-PK6DOVAG-CvsEnugt.js +0 -206
- package/dist/web/assets/classDiagram-PPOCWD7C-DTr8QIOf.js +0 -1
- package/dist/web/assets/classDiagram-v2-23LJLIIU-DTr8QIOf.js +0 -1
- package/dist/web/assets/dagre-E77IOHMT-Dzx0A6ZU.js +0 -4
- package/dist/web/assets/diagram-H7BISOXX-CC9pRew1.js +0 -43
- package/dist/web/assets/diagram-JC5VWROH-Bau_i9tf.js +0 -24
- package/dist/web/assets/diagram-LXUTUG65-D9_FM2Gt.js +0 -10
- package/dist/web/assets/diagram-WEHSV5V5-BMlayouL.js +0 -24
- package/dist/web/assets/ganttDiagram-MUNLMDZQ-D3a67Yol.js +0 -292
- package/dist/web/assets/gitGraphDiagram-3HKGZ4G3-7jmry-vM.js +0 -106
- package/dist/web/assets/index-BgeqpYgd.js +0 -1415
- package/dist/web/assets/index-CT0GtFLZ.css +0 -1
- package/dist/web/assets/infoDiagram-MN7RKWGX-G7lhP0Ib.js +0 -2
- package/dist/web/assets/mindmap-definition-2EUWGEK5-Bk0O4roa.js +0 -96
- package/dist/web/assets/pieDiagram-3IATQBI2-DKU7kpgS.js +0 -30
- package/dist/web/assets/quadrantDiagram-E256RVCF-BY0TGWCS.js +0 -7
- package/dist/web/assets/sankeyDiagram-L3NBLAOT-DVMj5rX2.js +0 -10
- package/dist/web/assets/sequenceDiagram-ZOUHS735-CJC73bV-.js +0 -157
- package/dist/web/assets/stateDiagram-MLPALWAM-BCFyESls.js +0 -1
- package/dist/web/assets/stateDiagram-v2-B5LQ5ZB2-DahzzIca.js +0 -1
- package/dist/web/assets/wardley-RL74JXVD-BCRCBASE-B-eZEzf9.js +0 -161
- package/dist/web/assets/wardleyDiagram-XU3VSMPF-BP-r1xzR.js +0 -20
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{m as o,
|
|
2
|
-
|
|
3
|
-
Expecting `+Y.join(", ")+", got '"+(this.terminals_[x]||x)+"'":Q="Parse error on line "+(D+1)+": Unexpected "+(x==S?"end of input":"'"+(this.terminals_[x]||x)+"'"),this.parseError(Q,{text
|
|
1
|
+
import{m as o,I as ft,ap as Rt,aq as Nt,ar as At,q as yt,p as $,a7 as Pt,a8 as Wt,as as mt,i as Z,a9 as ct,y as jt,at as Vt,u as zt}from"./index-VTKdaklA.js";var rt=function(){var e=o(function(k,a,c,p){for(c=c||{},p=k.length;p--;c[k[p]]=a);return c},"o"),t=[6,11,13,14,15,17,19,20,23,24],r=[1,12],n=[1,13],i=[1,14],l=[1,15],s=[1,16],d=[1,19],u=[1,20],b={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:o(function(k,a,c,p,g,h,_){var m=h.length-1;switch(g){case 1:return h[m-1];case 3:p.setDirection("LR");break;case 4:p.setDirection("TD");break;case 5:this.$=[];break;case 6:h[m-1].push(h[m]),this.$=h[m-1];break;case 7:case 8:this.$=h[m];break;case 9:case 10:this.$=[];break;case 11:p.getCommonDb().setDiagramTitle(h[m].substr(6)),this.$=h[m].substr(6);break;case 12:this.$=h[m].trim(),p.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=h[m].trim(),p.getCommonDb().setAccDescription(this.$);break;case 15:p.addSection(h[m].substr(8)),this.$=h[m].substr(8);break;case 18:p.addTask(h[m],0,""),this.$=h[m];break;case 19:p.addEvent(h[m].substr(2)),this.$=h[m];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:r,15:n,17:i,19:l,20:s,21:17,22:18,23:d,24:u},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:r,15:n,17:i,19:l,20:s,21:17,22:18,23:d,24:u},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:o(function(k,a){if(a.recoverable)this.trace(k);else{var c=new Error(k);throw c.hash=a,c}},"parseError"),parse:o(function(k){var a=this,c=[0],p=[],g=[null],h=[],_=this.table,m="",D=0,T=0,A=0,O=2,S=1,B=h.slice.call(arguments,1),v=Object.create(this.lexer),M={yy:{}};for(var j in this.yy)Object.prototype.hasOwnProperty.call(this.yy,j)&&(M.yy[j]=this.yy[j]);v.setInput(k,M.yy),M.yy.lexer=v,M.yy.parser=this,typeof v.yylloc>"u"&&(v.yylloc={});var V=v.yylloc;h.push(V);var G=v.options&&v.options.ranges;typeof M.yy.parseError=="function"?this.parseError=M.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(N){c.length=c.length-2*N,g.length=g.length-N,h.length=h.length-N}o(U,"popStack");function I(){var N;return N=p.pop()||v.lex()||S,typeof N!="number"&&(N instanceof Array&&(p=N,N=p.pop()),N=a.symbols_[N]||N),N}o(I,"lex");for(var x,H,E,w,P,W,C={},F,R,J,Y;;){if(E=c[c.length-1],this.defaultActions[E]?w=this.defaultActions[E]:((x===null||typeof x>"u")&&(x=I()),w=_[E]&&_[E][x]),typeof w>"u"||!w.length||!w[0]){var Q="";Y=[];for(F in _[E])this.terminals_[F]&&F>O&&Y.push("'"+this.terminals_[F]+"'");v.showPosition?Q="Parse error on line "+(D+1)+`:
|
|
2
|
+
`+v.showPosition()+`
|
|
3
|
+
Expecting `+Y.join(", ")+", got '"+(this.terminals_[x]||x)+"'":Q="Parse error on line "+(D+1)+": Unexpected "+(x==S?"end of input":"'"+(this.terminals_[x]||x)+"'"),this.parseError(Q,{text:v.match,token:this.terminals_[x]||x,line:v.yylineno,loc:V,expected:Y})}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+E+", token: "+x);switch(w[0]){case 1:c.push(x),g.push(v.yytext),h.push(v.yylloc),c.push(w[1]),x=null,H?(x=H,H=null):(T=v.yyleng,m=v.yytext,D=v.yylineno,V=v.yylloc,A>0);break;case 2:if(R=this.productions_[w[1]][1],C.$=g[g.length-R],C._$={first_line:h[h.length-(R||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(R||1)].first_column,last_column:h[h.length-1].last_column},G&&(C._$.range=[h[h.length-(R||1)].range[0],h[h.length-1].range[1]]),W=this.performAction.apply(C,[m,T,D,M.yy,w[1],g,h].concat(B)),typeof W<"u")return W;R&&(c=c.slice(0,-1*R*2),g=g.slice(0,-1*R),h=h.slice(0,-1*R)),c.push(this.productions_[w[1]][0]),g.push(C.$),h.push(C._$),J=_[c[c.length-2]][c[c.length-1]],c.push(J);break;case 3:return!0}}return!0},"parse")},y=function(){var k={EOF:1,parseError:o(function(a,c){if(this.yy.parser)this.yy.parser.parseError(a,c);else throw new Error(a)},"parseError"),setInput:o(function(a,c){return this.yy=c||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var c=a.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:o(function(a){var c=a.length,p=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var h=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===g.length?this.yylloc.first_column:0)+g[g.length-p.length].length-p[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[h[0],h[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(a){this.unput(this.match.slice(a))},"less"),pastInput:o(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var a=this.pastInput(),c=new Array(a.length+1).join("-");return a+this.upcomingInput()+`
|
|
5
5
|
`+c+"^"},"showPosition"),test_match:o(function(a,c){var p,g,h;if(this.options.backtrack_lexer&&(h={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(h.yylloc.range=this.yylloc.range.slice(0))),g=a[0].match(/(?:\r\n?|\n).*/g),g&&(this.yylineno+=g.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:g?g[g.length-1].length-g[g.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],p=this.performAction.call(this,this.yy,this,c,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),p)return p;if(this._backtrack){for(var _ in h)this[_]=h[_];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,c,p,g;this._more||(this.yytext="",this.match="");for(var h=this._currentRules(),_=0;_<h.length;_++)if(p=this._input.match(this.rules[h[_]]),p&&(!c||p[0].length>c[0].length)){if(c=p,g=_,this.options.backtrack_lexer){if(a=this.test_match(p,h[_]),a!==!1)return a;if(this._backtrack){c=!1;continue}else return!1}else if(!this.options.flex)break}return c?(a=this.test_match(c,h[g]),a!==!1?a:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var a=this.next();return a||this.lex()},"lex"),begin:o(function(a){this.conditionStack.push(a)},"begin"),popState:o(function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},"topState"),pushState:o(function(a){this.begin(a)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(a,c,p,g){switch(p){case 0:break;case 1:break;case 2:return 13;case 3:break;case 4:break;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}};return k}();b.lexer=y;function f(){this.yy={}}return o(f,"Parser"),f.prototype=b,b.Parser=f,new f}();rt.parser=rt;var Ft=rt,xt={};jt(xt,{addEvent:()=>It,addSection:()=>$t,addTask:()=>Tt,addTaskOrg:()=>Mt,clear:()=>_t,default:()=>Gt,getCommonDb:()=>kt,getDirection:()=>vt,getSections:()=>Et,getTasks:()=>St,setDirection:()=>wt});var q="",bt=0,at="LR",nt=[],X=[],K=[],kt=o(()=>Vt,"getCommonDb"),_t=o(function(){nt.length=0,X.length=0,q="",K.length=0,at="LR",zt()},"clear"),wt=o(function(e){at=e},"setDirection"),vt=o(function(){return at},"getDirection"),$t=o(function(e){q=e,nt.push(e)},"addSection"),Et=o(function(){return nt},"getSections"),St=o(function(){let e=ht(),t=100,r=0;for(;!e&&r<t;)e=ht(),r++;return X.push(...K),X},"getTasks"),Tt=o(function(e,t,r){let n={id:bt++,section:q,type:q,task:e,score:t||0,events:r?[r]:[]};K.push(n)},"addTask"),It=o(function(e){K.find(t=>t.id===bt-1).events.push(e)},"addEvent"),Mt=o(function(e){let t={section:q,type:q,description:e,task:e,classes:[]};X.push(t)},"addTaskOrg"),ht=o(function(){let e=o(function(r){return K[r].processed},"compileTask"),t=!0;for(let[r,n]of K.entries())e(r),t=t&&n.processed;return t},"compileTasks"),Gt={clear:_t,getCommonDb:kt,getDirection:vt,setDirection:wt,addSection:$t,getSections:Et,getTasks:St,addTask:Tt,addTaskOrg:Mt,addEvent:It},Ht=0,tt=o(function(e,t){let r=e.append("rect");return r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),r.attr("rx",t.rx),r.attr("ry",t.ry),t.class!==void 0&&r.attr("class",t.class),r},"drawRect"),Ut=o(function(e,t){let r=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),n=e.append("g");n.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),n.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function i(d){let u=ct().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);d.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}o(i,"smile");function l(d){let u=ct().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);d.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}o(l,"sad");function s(d){d.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return o(s,"ambivalent"),t.score>3?i(n):t.score<3?l(n):s(n),r},"drawFace"),Yt=o(function(e,t){let r=e.append("circle");return r.attr("cx",t.cx),r.attr("cy",t.cy),r.attr("class","actor-"+t.pos),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("r",t.r),r.class!==void 0&&r.attr("class",r.class),t.title!==void 0&&r.append("title").text(t.title),r},"drawCircle"),Ct=o(function(e,t){let r=t.text.replace(/<br\s*\/?>/gi," "),n=e.append("text");n.attr("x",t.x),n.attr("y",t.y),n.attr("class","legend"),n.style("text-anchor",t.anchor),t.class!==void 0&&n.attr("class",t.class);let i=n.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.text(r),n},"drawText"),qt=o(function(e,t){function r(i,l,s,d,u){return i+","+l+" "+(i+s)+","+l+" "+(i+s)+","+(l+d-u)+" "+(i+s-u*1.2)+","+(l+d)+" "+i+","+(l+d)}o(r,"genPoints");let n=e.append("polygon");n.attr("points",r(t.x,t.y,50,20,7)),n.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,Ct(e,t)},"drawLabel"),Kt=o(function(e,t,r){let n=e.append("g"),i=st();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=r.width,i.height=r.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,tt(n,i),Lt(r)(t.text,n,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},r,t.colour)},"drawSection"),it=-1,Jt=o(function(e,t,r,n){let i=t.x+r.width/2,l=e.append("g");it++,l.append("line").attr("id",n+"-task"+it).attr("x1",i).attr("y1",t.y).attr("x2",i).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Ut(l,{cx:i,cy:300+(5-t.score)*30,score:t.score});let s=st();s.x=t.x,s.y=t.y,s.fill=t.fill,s.width=r.width,s.height=r.height,s.class="task task-type-"+t.num,s.rx=3,s.ry=3,tt(l,s),Lt(r)(t.task,l,s.x,s.y,s.width,s.height,{class:"task"},r,t.colour)},"drawTask"),Qt=o(function(e,t){tt(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),Zt=o(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),st=o(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),Lt=function(){function e(i,l,s,d,u,b,y,f){let k=l.append("text").attr("x",s+u/2).attr("y",d+b/2+5).style("font-color",f).style("text-anchor","middle").text(i);n(k,y)}o(e,"byText");function t(i,l,s,d,u,b,y,f,k){let{taskFontSize:a,taskFontFamily:c}=f,p=i.split(/<br\s*\/?>/gi);for(let g=0;g<p.length;g++){let h=g*a-a*(p.length-1)/2,_=l.append("text").attr("x",s+u/2).attr("y",d).attr("fill",k).style("text-anchor","middle").style("font-size",a).style("font-family",c);_.append("tspan").attr("x",s+u/2).attr("dy",h).text(p[g]),_.attr("y",d+b/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),n(_,y)}}o(t,"byTspan");function r(i,l,s,d,u,b,y,f){let k=l.append("switch"),a=k.append("foreignObject").attr("x",s).attr("y",d).attr("width",u).attr("height",b).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");a.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(i),t(i,k,s,d,u,b,y,f),n(a,y)}o(r,"byFo");function n(i,l){for(let s in l)s in l&&i.attr(s,l[s])}return o(n,"_setTextAttrs"),function(i){return i.textPlacement==="fo"?r:i.textPlacement==="old"?e:t}}(),Xt=o(function(e,t){Ht=0,it=-1,e.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},"initGraphics");function ot(e,t){e.each(function(){var r=Z(this),n=r.text().split(/(\s+|<br>)/).reverse(),i,l=[],s=1.1,d=r.attr("y"),u=parseFloat(r.attr("dy")),b=r.text(null).append("tspan").attr("x",0).attr("y",d).attr("dy",u+"em");for(let y=0;y<n.length;y++)i=n[n.length-1-y],l.push(i),b.text(l.join(" ").trim()),(b.node().getComputedTextLength()>t||i==="<br>")&&(l.pop(),b.text(l.join(" ").trim()),i==="<br>"?l=[""]:l=[i],b=r.append("tspan").attr("x",0).attr("y",d).attr("dy",s+"em").text(i))})}o(ot,"wrap");var te=o(function(e,t,r,n,i,l=!1){var g,h,_;let{theme:s,look:d}=n,u=s==null?void 0:s.includes("redux"),b=((g=n==null?void 0:n.themeVariables)==null?void 0:g.THEME_COLOR_LIMIT)??12,y=r%b-1,f=e.append("g");t.section=y,f.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+y));let k=f.append("g"),a=f.append("g"),c=a.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(ot,t.width).node().getBBox(),p=(h=n.fontSize)!=null&&h.replace?n.fontSize.replace("px",""):n.fontSize;if(t.height=c.height+p*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,a.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),u&&a.attr("transform",`translate(${t.width/2}, ${l?t.padding/2+3:t.padding})`),re(k,t,y,i,n),d==="neo"&&(f.attr("data-look","neo"),u)){let m=s.includes("dark"),D=((_=e.node())==null?void 0:_.ownerSVGElement)??e.node(),T=Z(D),A=T.attr("id")??"",O=A?`${A}-drop-shadow`:"drop-shadow";if(T.select(`#${O}`).empty()){let S=T.select("defs");(S.empty()?T.append("defs"):S).append("filter").attr("id",O).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",m?"0.2":"0.06").attr("flood-color",m?"#FFFFFF":"#000000")}}return t},"drawNode"),ee=o(function(e,t,r){var s;let n=e.append("g"),i=n.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(ot,t.width).node().getBBox(),l=(s=r.fontSize)!=null&&s.replace?r.fontSize.replace("px",""):r.fontSize;return n.remove(),i.height+l*1.1*.5+t.padding},"getVirtualNodeHeight"),re=o(function(e,t,r,n,i){let{theme:l}=i,s=l!=null&&l.includes("redux")?0:5,d=5,u=s>0?`M0 ${t.height-d} v${-t.height+2*d} q0,-${s},${s},-${s} h${t.width-2*d} q${s},0,${s},${s} v${t.height-d} H0 Z`:`M0 ${t.height-d} v${-(t.height-d)} h${t.width} v${t.height} H0 Z`;e.append("path").attr("id",n+"-node-"+Ht++).attr("class","node-bkg node-"+t.type).attr("d",u),l!=null&&l.includes("redux")||e.append("line").attr("class","node-line-"+r).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),L={drawRect:tt,drawCircle:Yt,drawSection:Kt,drawText:Ct,drawLabel:qt,drawTask:Jt,drawBackgroundRect:Qt,getTextObj:Zt,getNoteRect:st,initGraphics:Xt,drawNode:te,getVirtualNodeHeight:ee},ie=o(function(e,t,r,n){var V,G,U;let i=yt(),{look:l,theme:s,themeVariables:d}=i,{useGradient:u,gradientStart:b,gradientStop:y}=d,f=((V=i.timeline)==null?void 0:V.leftMargin)??50;v.debug("timeline",n.db);let k=i.securityLevel,a;k==="sandbox"&&(a=Z("#i"+t));let c=(k==="sandbox"?Z(a.nodes()[0].contentDocument.body):Z("body")).select("#"+t);c.append("g");let p=n.db.getTasks(),g=n.db.getCommonDb().getDiagramTitle();v.debug("task",p),L.initGraphics(c,t);let h=n.db.getSections();v.debug("sections",h);let _=0,m=0,D=0,T=0,A=50+f,O=50;T=50;let S=0,B=!0;h.forEach(function(I){let x={number:S,descr:I,section:S,width:150,padding:20,maxHeight:_},H=L.getVirtualNodeHeight(c,x,i);v.debug("sectionHeight before draw",H),_=Math.max(_,H+20)});let $=0,M=0;v.debug("tasks.length",p.length);for(let[I,x]of p.entries()){let H={number:I,descr:x,section:x.section,width:150,padding:20,maxHeight:m},E=L.getVirtualNodeHeight(c,H,i);v.debug("taskHeight before draw",E),m=Math.max(m,E+20),$=Math.max($,x.events.length);let w=0;for(let P of x.events){let W={descr:P,section:x.section,number:x.section,width:150,padding:20,maxHeight:50};w+=L.getVirtualNodeHeight(c,W,i)}x.events.length>0&&(w+=(x.events.length-1)*10),M=Math.max(M,w)}v.debug("maxSectionHeight before draw",_),v.debug("maxTaskHeight before draw",m),h&&h.length>0?h.forEach(I=>{let x=p.filter(P=>P.section===I),H={number:S,descr:I,section:S,width:200*Math.max(x.length,1)-50,padding:20,maxHeight:_};v.debug("sectionNode",H);let E=c.append("g"),w=L.drawNode(E,H,S,i,t);v.debug("sectionNode output",w),E.attr("transform",`translate(${A}, ${T})`),O+=_+50,x.length>0&&dt(c,x,S,A,O,m,i,$,M,_,!1,t),A+=200*Math.max(x.length,1),O=T,S++}):(B=!1,dt(c,p,S,A,O,m,i,$,M,_,!0,t));let j=c.node().getBBox();if(v.debug("bounds",j),g&&c.append("text").text(g).attr("x",l==="neo"?j.x*2+f:j.width/2-f).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),D=B?_+m+150:m+100,c.append("g").attr("class","lineWrapper").append("line").attr("x1",f).attr("y1",D).attr("x2",j.width+3*f).attr("y2",D).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),l==="neo"&&u&&s!=="neutral"){let I=c.select("defs"),x=(I.empty()?c.append("defs"):I).append("linearGradient").attr("id",c.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");x.append("stop").attr("offset","0%").attr("stop-color",b).attr("stop-opacity",1),x.append("stop").attr("offset","100%").attr("stop-color",y).attr("stop-opacity",1)}mt(void 0,c,((G=i.timeline)==null?void 0:G.padding)??50,((U=i.timeline)==null?void 0:U.useMaxWidth)??!1)},"draw"),dt=o(function(e,t,r,n,i,l,s,d,u,b,y,f){var k;for(let a of t){let c={descr:a.task,section:r,number:r,width:150,padding:20,maxHeight:l};v.debug("taskNode",c);let p=e.append("g").attr("class","taskWrapper"),g=L.drawNode(p,c,r,s,f).height;if(v.debug("taskHeight after draw",g),p.attr("transform",`translate(${n}, ${i})`),l=Math.max(l,g),a.events){let h=e.append("g").attr("class","lineWrapper"),_=l;i+=100,_=_+ae(e,a.events,r,n,i,s,f),i-=100,h.append("line").attr("x1",n+190/2).attr("y1",i+l).attr("x2",n+190/2).attr("y2",i+l+100+u+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${f}-arrowhead)`).attr("stroke-dasharray","5,5")}n=n+200,y&&!((k=s.timeline)!=null&&k.disableMulticolor)&&r++}i=i-10},"drawTasks"),ae=o(function(e,t,r,n,i,l,s){let d=0,u=i;i=i+100;for(let b of t){let y={descr:b,section:r,number:r,width:150,padding:20,maxHeight:50};v.debug("eventNode",y);let f=e.append("g").attr("class","eventWrapper"),k=L.drawNode(f,y,r,l,s,!0).height;d=d+k,f.attr("transform",`translate(${n}, ${i})`),i=i+10+k}return i=u,d},"drawEvents"),ne={setConf:o(()=>{},"setConf"),draw:ie},et=200,z=5,se=et+z*2,lt=et+100,oe=lt+z*2,Dt=10,le=0,ut=20,Ot=20,pt=30,Bt=50,ce=o(function(e,t,r,n){var G,U,I,x,H;let i=yt(),l=((G=i.timeline)==null?void 0:G.leftMargin)??50;v.debug("timeline",n.db);let s=Pt(t);s.append("g");let d=n.db.getTasks(),u=n.db.getCommonDb().getDiagramTitle();v.debug("task",d),L.initGraphics(s);let b=n.db.getSections();v.debug("sections",b);let y=0,f=0,k=50+l,a=50,c=a,p=k,g=se+Ot,h=oe+Bt,_=p+g,m=0,D=b&&b.length>0,T=D?_:k+g,A=Math.max(50,g+h-z*2);b.forEach(function(E){let w={number:m,descr:E,section:m,width:A,padding:z,maxHeight:y},P=L.getVirtualNodeHeight(s,w,i);v.debug("sectionHeight before draw",P),y=Math.max(y,P)});let O=0;v.debug("tasks.length",d.length);for(let[E,w]of d.entries()){let P={number:E,descr:w,section:w.section,width:et,padding:z,maxHeight:f},W=L.getVirtualNodeHeight(s,P,i);v.debug("taskHeight before draw",W),f=Math.max(f,W);let C=0;for(let F of w.events){let R={descr:F,section:w.section,number:w.section,width:lt,padding:z,maxHeight:50};C+=L.getVirtualNodeHeight(s,R,i)}w.events.length>0&&(C+=(w.events.length-1)*Dt),O=Math.max(O,C)+le}v.debug("maxSectionHeight before draw",y),v.debug("maxTaskHeight before draw",f);let S=Math.max(f,O)+pt;D?b.forEach(E=>{let w=d.filter(Q=>Q.section===E),P={number:m,descr:E,section:m,width:A,padding:z,maxHeight:y};v.debug("sectionNode",P);let W=s.append("g"),C=L.drawNode(W,P,m,i);v.debug("sectionNode output",C);let F=T-g;W.attr("transform",`translate(${F}, ${a})`);let R=a+C.height+ut;w.length>0&>(s,w,m,T,R,f,i,S,!1);let J=w.length,Y=C.height+ut+S*Math.max(J,1)-(J>0?pt*2:0);a+=Y,m++}):gt(s,d,m,T,a,f,i,S,!0);let B=(U=s.node())==null?void 0:U.getBBox();if(!B)throw new Error("bbox not found");if(v.debug("bounds",B),u){if(s.append("text").text(u).attr("x",B.width/2-l).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),B=(I=s.node())==null?void 0:I.getBBox(),!B)throw new Error("bbox not found");v.debug("bounds after title",B)}let[$]=Wt(i.fontSize),M=($??16)*2,j=($??16)*.5+20,V=s.append("g").attr("class","lineWrapper");V.append("line").attr("x1",T).attr("y1",c-M).attr("x2",T).attr("y2",B.y+B.height+j).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),V.lower(),mt(void 0,s,((x=i.timeline)==null?void 0:x.padding)??50,((H=i.timeline)==null?void 0:H.useMaxWidth)??!1)},"draw"),gt=o(function(e,t,r,n,i,l,s,d,u){var b;for(let y of t){let f={descr:y.task,section:r,number:r,width:et,padding:z,maxHeight:l};v.debug("taskNode",f);let k=e.append("g").attr("class","taskWrapper"),a=L.drawNode(k,f,r,s),c=a.height;v.debug("taskHeight after draw",c);let p=n-Ot-a.width;if(k.attr("transform",`translate(${p}, ${i})`),l=Math.max(l,c),y.events&&y.events.length>0){let g=i,h=n+Bt;he(e,y.events,r,n,h,g,s)}i=i+d,u&&!((b=s.timeline)!=null&&b.disableMulticolor)&&r++}},"drawTasks"),he=o(function(e,t,r,n,i,l,s){let d=l;for(let u of t){let b={descr:u,section:r,number:r,width:lt,padding:z,maxHeight:0};v.debug("eventNode",b);let y=e.append("g").attr("class","eventWrapper"),f=L.drawNode(y,b,r,s).height;y.attr("transform",`translate(${i}, ${d})`);let k=e.append("g").attr("class","lineWrapper"),a=d+f/2;k.append("line").attr("x1",n).attr("y1",a).attr("x2",i).attr("y2",a).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),d=d+f+Dt}return d-l},"drawEvents"),de={setConf:o(()=>{},"setConf"),draw:ce},ue=o(e=>{var d;let{theme:t}=ft(),r=t==null?void 0:t.includes("dark"),n=t==null?void 0:t.includes("color"),i=((d=e.svgId)==null?void 0:d.replace(/^#/,""))??"",l=i?`url(#${i}-drop-shadow)`:e.dropShadow??"none",s="";for(let u=0;u<e.THEME_COLOR_LIMIT;u++){let b=`${17-3*u}`,y=n?e.borderColorArray[u]:e.mainBkg,f=n?e.borderColorArray[u]:e.nodeBorder;s+=`
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var a=this.next();return a||this.lex()},"lex"),begin:o(function(a){this.conditionStack.push(a)},"begin"),popState:o(function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},"topState"),pushState:o(function(a){this.begin(a)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(a,c,p,g){switch(p){case 0:break;case 1:break;case 2:return 13;case 3:break;case 4:break;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}};return k}();b.lexer=y;function f(){this.yy={}}return o(f,"Parser"),f.prototype=b,b.Parser=f,new f}();rt.parser=rt;var Ft=rt,xt={};jt(xt,{addEvent:()=>It,addSection:()=>vt,addTask:()=>Tt,addTaskOrg:()=>Mt,clear:()=>_t,default:()=>Gt,getCommonDb:()=>kt,getDirection:()=>$t,getSections:()=>Et,getTasks:()=>St,setDirection:()=>wt});var q="",bt=0,at="LR",nt=[],X=[],K=[],kt=o(()=>Vt,"getCommonDb"),_t=o(function(){nt.length=0,X.length=0,q="",K.length=0,at="LR",zt()},"clear"),wt=o(function(e){at=e},"setDirection"),$t=o(function(){return at},"getDirection"),vt=o(function(e){q=e,nt.push(e)},"addSection"),Et=o(function(){return nt},"getSections"),St=o(function(){let e=ht(),t=100,r=0;for(;!e&&r<t;)e=ht(),r++;return X.push(...K),X},"getTasks"),Tt=o(function(e,t,r){let n={id:bt++,section:q,type:q,task:e,score:t||0,events:r?[r]:[]};K.push(n)},"addTask"),It=o(function(e){K.find(t=>t.id===bt-1).events.push(e)},"addEvent"),Mt=o(function(e){let t={section:q,type:q,description:e,task:e,classes:[]};X.push(t)},"addTaskOrg"),ht=o(function(){let e=o(function(r){return K[r].processed},"compileTask"),t=!0;for(let[r,n]of K.entries())e(r),t=t&&n.processed;return t},"compileTasks"),Gt={clear:_t,getCommonDb:kt,getDirection:$t,setDirection:wt,addSection:vt,getSections:Et,getTasks:St,addTask:Tt,addTaskOrg:Mt,addEvent:It},Ht=0,tt=o(function(e,t){let r=e.append("rect");return r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),r.attr("rx",t.rx),r.attr("ry",t.ry),t.class!==void 0&&r.attr("class",t.class),r},"drawRect"),Ut=o(function(e,t){let r=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),n=e.append("g");n.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),n.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function i(d){let u=ct().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);d.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}o(i,"smile");function l(d){let u=ct().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);d.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}o(l,"sad");function s(d){d.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return o(s,"ambivalent"),t.score>3?i(n):t.score<3?l(n):s(n),r},"drawFace"),Yt=o(function(e,t){let r=e.append("circle");return r.attr("cx",t.cx),r.attr("cy",t.cy),r.attr("class","actor-"+t.pos),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("r",t.r),r.class!==void 0&&r.attr("class",r.class),t.title!==void 0&&r.append("title").text(t.title),r},"drawCircle"),Ct=o(function(e,t){let r=t.text.replace(/<br\s*\/?>/gi," "),n=e.append("text");n.attr("x",t.x),n.attr("y",t.y),n.attr("class","legend"),n.style("text-anchor",t.anchor),t.class!==void 0&&n.attr("class",t.class);let i=n.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.text(r),n},"drawText"),qt=o(function(e,t){function r(i,l,s,d,u){return i+","+l+" "+(i+s)+","+l+" "+(i+s)+","+(l+d-u)+" "+(i+s-u*1.2)+","+(l+d)+" "+i+","+(l+d)}o(r,"genPoints");let n=e.append("polygon");n.attr("points",r(t.x,t.y,50,20,7)),n.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,Ct(e,t)},"drawLabel"),Kt=o(function(e,t,r){let n=e.append("g"),i=st();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=r.width,i.height=r.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,tt(n,i),Lt(r)(t.text,n,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},r,t.colour)},"drawSection"),it=-1,Jt=o(function(e,t,r,n){let i=t.x+r.width/2,l=e.append("g");it++,l.append("line").attr("id",n+"-task"+it).attr("x1",i).attr("y1",t.y).attr("x2",i).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Ut(l,{cx:i,cy:300+(5-t.score)*30,score:t.score});let s=st();s.x=t.x,s.y=t.y,s.fill=t.fill,s.width=r.width,s.height=r.height,s.class="task task-type-"+t.num,s.rx=3,s.ry=3,tt(l,s),Lt(r)(t.task,l,s.x,s.y,s.width,s.height,{class:"task"},r,t.colour)},"drawTask"),Qt=o(function(e,t){tt(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),Zt=o(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),st=o(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),Lt=function(){function e(i,l,s,d,u,b,y,f){let k=l.append("text").attr("x",s+u/2).attr("y",d+b/2+5).style("font-color",f).style("text-anchor","middle").text(i);n(k,y)}o(e,"byText");function t(i,l,s,d,u,b,y,f,k){let{taskFontSize:a,taskFontFamily:c}=f,p=i.split(/<br\s*\/?>/gi);for(let g=0;g<p.length;g++){let h=g*a-a*(p.length-1)/2,_=l.append("text").attr("x",s+u/2).attr("y",d).attr("fill",k).style("text-anchor","middle").style("font-size",a).style("font-family",c);_.append("tspan").attr("x",s+u/2).attr("dy",h).text(p[g]),_.attr("y",d+b/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),n(_,y)}}o(t,"byTspan");function r(i,l,s,d,u,b,y,f){let k=l.append("switch"),a=k.append("foreignObject").attr("x",s).attr("y",d).attr("width",u).attr("height",b).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");a.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(i),t(i,k,s,d,u,b,y,f),n(a,y)}o(r,"byFo");function n(i,l){for(let s in l)s in l&&i.attr(s,l[s])}return o(n,"_setTextAttrs"),function(i){return i.textPlacement==="fo"?r:i.textPlacement==="old"?e:t}}(),Xt=o(function(e,t){Ht=0,it=-1,e.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},"initGraphics");function ot(e,t){e.each(function(){var r=Z(this),n=r.text().split(/(\s+|<br>)/).reverse(),i,l=[],s=1.1,d=r.attr("y"),u=parseFloat(r.attr("dy")),b=r.text(null).append("tspan").attr("x",0).attr("y",d).attr("dy",u+"em");for(let y=0;y<n.length;y++)i=n[n.length-1-y],l.push(i),b.text(l.join(" ").trim()),(b.node().getComputedTextLength()>t||i==="<br>")&&(l.pop(),b.text(l.join(" ").trim()),i==="<br>"?l=[""]:l=[i],b=r.append("tspan").attr("x",0).attr("y",d).attr("dy",s+"em").text(i))})}o(ot,"wrap");var te=o(function(e,t,r,n,i,l=!1){var g,h,_;let{theme:s,look:d}=n,u=s==null?void 0:s.includes("redux"),b=((g=n==null?void 0:n.themeVariables)==null?void 0:g.THEME_COLOR_LIMIT)??12,y=r%b-1,f=e.append("g");t.section=y,f.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+y));let k=f.append("g"),a=f.append("g"),c=a.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(ot,t.width).node().getBBox(),p=(h=n.fontSize)!=null&&h.replace?n.fontSize.replace("px",""):n.fontSize;if(t.height=c.height+p*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,a.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),u&&a.attr("transform",`translate(${t.width/2}, ${l?t.padding/2+3:t.padding})`),re(k,t,y,i,n),d==="neo"&&(f.attr("data-look","neo"),u)){let m=s.includes("dark"),D=((_=e.node())==null?void 0:_.ownerSVGElement)??e.node(),T=Z(D),A=T.attr("id")??"",O=A?`${A}-drop-shadow`:"drop-shadow";if(T.select(`#${O}`).empty()){let S=T.select("defs");(S.empty()?T.append("defs"):S).append("filter").attr("id",O).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",m?"0.2":"0.06").attr("flood-color",m?"#FFFFFF":"#000000")}}return t},"drawNode"),ee=o(function(e,t,r){var s;let n=e.append("g"),i=n.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(ot,t.width).node().getBBox(),l=(s=r.fontSize)!=null&&s.replace?r.fontSize.replace("px",""):r.fontSize;return n.remove(),i.height+l*1.1*.5+t.padding},"getVirtualNodeHeight"),re=o(function(e,t,r,n,i){let{theme:l}=i,s=l!=null&&l.includes("redux")?0:5,d=5,u=s>0?`M0 ${t.height-d} v${-t.height+2*d} q0,-${s},${s},-${s} h${t.width-2*d} q${s},0,${s},${s} v${t.height-d} H0 Z`:`M0 ${t.height-d} v${-(t.height-d)} h${t.width} v${t.height} H0 Z`;e.append("path").attr("id",n+"-node-"+Ht++).attr("class","node-bkg node-"+t.type).attr("d",u),l!=null&&l.includes("redux")||e.append("line").attr("class","node-line-"+r).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),L={drawRect:tt,drawCircle:Yt,drawSection:Kt,drawText:Ct,drawLabel:qt,drawTask:Jt,drawBackgroundRect:Qt,getTextObj:Zt,getNoteRect:st,initGraphics:Xt,drawNode:te,getVirtualNodeHeight:ee},ie=o(function(e,t,r,n){var V,G,U;let i=yt(),{look:l,theme:s,themeVariables:d}=i,{useGradient:u,gradientStart:b,gradientStop:y}=d,f=((V=i.timeline)==null?void 0:V.leftMargin)??50;$.debug("timeline",n.db);let k=i.securityLevel,a;k==="sandbox"&&(a=Z("#i"+t));let c=(k==="sandbox"?Z(a.nodes()[0].contentDocument.body):Z("body")).select("#"+t);c.append("g");let p=n.db.getTasks(),g=n.db.getCommonDb().getDiagramTitle();$.debug("task",p),L.initGraphics(c,t);let h=n.db.getSections();$.debug("sections",h);let _=0,m=0,D=0,T=0,A=50+f,O=50;T=50;let S=0,B=!0;h.forEach(function(I){let x={number:S,descr:I,section:S,width:150,padding:20,maxHeight:_},H=L.getVirtualNodeHeight(c,x,i);$.debug("sectionHeight before draw",H),_=Math.max(_,H+20)});let v=0,M=0;$.debug("tasks.length",p.length);for(let[I,x]of p.entries()){let H={number:I,descr:x,section:x.section,width:150,padding:20,maxHeight:m},E=L.getVirtualNodeHeight(c,H,i);$.debug("taskHeight before draw",E),m=Math.max(m,E+20),v=Math.max(v,x.events.length);let w=0;for(let P of x.events){let W={descr:P,section:x.section,number:x.section,width:150,padding:20,maxHeight:50};w+=L.getVirtualNodeHeight(c,W,i)}x.events.length>0&&(w+=(x.events.length-1)*10),M=Math.max(M,w)}$.debug("maxSectionHeight before draw",_),$.debug("maxTaskHeight before draw",m),h&&h.length>0?h.forEach(I=>{let x=p.filter(P=>P.section===I),H={number:S,descr:I,section:S,width:200*Math.max(x.length,1)-50,padding:20,maxHeight:_};$.debug("sectionNode",H);let E=c.append("g"),w=L.drawNode(E,H,S,i,t);$.debug("sectionNode output",w),E.attr("transform",`translate(${A}, ${T})`),O+=_+50,x.length>0&&dt(c,x,S,A,O,m,i,v,M,_,!1,t),A+=200*Math.max(x.length,1),O=T,S++}):(B=!1,dt(c,p,S,A,O,m,i,v,M,_,!0,t));let j=c.node().getBBox();if($.debug("bounds",j),g&&c.append("text").text(g).attr("x",l==="neo"?j.x*2+f:j.width/2-f).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),D=B?_+m+150:m+100,c.append("g").attr("class","lineWrapper").append("line").attr("x1",f).attr("y1",D).attr("x2",j.width+3*f).attr("y2",D).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),l==="neo"&&u&&s!=="neutral"){let I=c.select("defs"),x=(I.empty()?c.append("defs"):I).append("linearGradient").attr("id",c.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");x.append("stop").attr("offset","0%").attr("stop-color",b).attr("stop-opacity",1),x.append("stop").attr("offset","100%").attr("stop-color",y).attr("stop-opacity",1)}mt(void 0,c,((G=i.timeline)==null?void 0:G.padding)??50,((U=i.timeline)==null?void 0:U.useMaxWidth)??!1)},"draw"),dt=o(function(e,t,r,n,i,l,s,d,u,b,y,f){var k;for(let a of t){let c={descr:a.task,section:r,number:r,width:150,padding:20,maxHeight:l};$.debug("taskNode",c);let p=e.append("g").attr("class","taskWrapper"),g=L.drawNode(p,c,r,s,f).height;if($.debug("taskHeight after draw",g),p.attr("transform",`translate(${n}, ${i})`),l=Math.max(l,g),a.events){let h=e.append("g").attr("class","lineWrapper"),_=l;i+=100,_=_+ae(e,a.events,r,n,i,s,f),i-=100,h.append("line").attr("x1",n+190/2).attr("y1",i+l).attr("x2",n+190/2).attr("y2",i+l+100+u+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${f}-arrowhead)`).attr("stroke-dasharray","5,5")}n=n+200,y&&!((k=s.timeline)!=null&&k.disableMulticolor)&&r++}i=i-10},"drawTasks"),ae=o(function(e,t,r,n,i,l,s){let d=0,u=i;i=i+100;for(let b of t){let y={descr:b,section:r,number:r,width:150,padding:20,maxHeight:50};$.debug("eventNode",y);let f=e.append("g").attr("class","eventWrapper"),k=L.drawNode(f,y,r,l,s,!0).height;d=d+k,f.attr("transform",`translate(${n}, ${i})`),i=i+10+k}return i=u,d},"drawEvents"),ne={setConf:o(()=>{},"setConf"),draw:ie},et=200,z=5,se=et+z*2,lt=et+100,oe=lt+z*2,Dt=10,le=0,ut=20,Ot=20,pt=30,Bt=50,ce=o(function(e,t,r,n){var G,U,I,x,H;let i=yt(),l=((G=i.timeline)==null?void 0:G.leftMargin)??50;$.debug("timeline",n.db);let s=Pt(t);s.append("g");let d=n.db.getTasks(),u=n.db.getCommonDb().getDiagramTitle();$.debug("task",d),L.initGraphics(s);let b=n.db.getSections();$.debug("sections",b);let y=0,f=0,k=50+l,a=50,c=a,p=k,g=se+Ot,h=oe+Bt,_=p+g,m=0,D=b&&b.length>0,T=D?_:k+g,A=Math.max(50,g+h-z*2);b.forEach(function(E){let w={number:m,descr:E,section:m,width:A,padding:z,maxHeight:y},P=L.getVirtualNodeHeight(s,w,i);$.debug("sectionHeight before draw",P),y=Math.max(y,P)});let O=0;$.debug("tasks.length",d.length);for(let[E,w]of d.entries()){let P={number:E,descr:w,section:w.section,width:et,padding:z,maxHeight:f},W=L.getVirtualNodeHeight(s,P,i);$.debug("taskHeight before draw",W),f=Math.max(f,W);let C=0;for(let F of w.events){let R={descr:F,section:w.section,number:w.section,width:lt,padding:z,maxHeight:50};C+=L.getVirtualNodeHeight(s,R,i)}w.events.length>0&&(C+=(w.events.length-1)*Dt),O=Math.max(O,C)+le}$.debug("maxSectionHeight before draw",y),$.debug("maxTaskHeight before draw",f);let S=Math.max(f,O)+pt;D?b.forEach(E=>{let w=d.filter(Q=>Q.section===E),P={number:m,descr:E,section:m,width:A,padding:z,maxHeight:y};$.debug("sectionNode",P);let W=s.append("g"),C=L.drawNode(W,P,m,i);$.debug("sectionNode output",C);let F=T-g;W.attr("transform",`translate(${F}, ${a})`);let R=a+C.height+ut;w.length>0&>(s,w,m,T,R,f,i,S,!1);let J=w.length,Y=C.height+ut+S*Math.max(J,1)-(J>0?pt*2:0);a+=Y,m++}):gt(s,d,m,T,a,f,i,S,!0);let B=(U=s.node())==null?void 0:U.getBBox();if(!B)throw new Error("bbox not found");if($.debug("bounds",B),u){if(s.append("text").text(u).attr("x",B.width/2-l).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),B=(I=s.node())==null?void 0:I.getBBox(),!B)throw new Error("bbox not found");$.debug("bounds after title",B)}let[v]=Wt(i.fontSize),M=(v??16)*2,j=(v??16)*.5+20,V=s.append("g").attr("class","lineWrapper");V.append("line").attr("x1",T).attr("y1",c-M).attr("x2",T).attr("y2",B.y+B.height+j).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),V.lower(),mt(void 0,s,((x=i.timeline)==null?void 0:x.padding)??50,((H=i.timeline)==null?void 0:H.useMaxWidth)??!1)},"draw"),gt=o(function(e,t,r,n,i,l,s,d,u){var b;for(let y of t){let f={descr:y.task,section:r,number:r,width:et,padding:z,maxHeight:l};$.debug("taskNode",f);let k=e.append("g").attr("class","taskWrapper"),a=L.drawNode(k,f,r,s),c=a.height;$.debug("taskHeight after draw",c);let p=n-Ot-a.width;if(k.attr("transform",`translate(${p}, ${i})`),l=Math.max(l,c),y.events&&y.events.length>0){let g=i,h=n+Bt;he(e,y.events,r,n,h,g,s)}i=i+d,u&&!((b=s.timeline)!=null&&b.disableMulticolor)&&r++}},"drawTasks"),he=o(function(e,t,r,n,i,l,s){let d=l;for(let u of t){let b={descr:u,section:r,number:r,width:lt,padding:z,maxHeight:0};$.debug("eventNode",b);let y=e.append("g").attr("class","eventWrapper"),f=L.drawNode(y,b,r,s).height;y.attr("transform",`translate(${i}, ${d})`);let k=e.append("g").attr("class","lineWrapper"),a=d+f/2;k.append("line").attr("x1",n).attr("y1",a).attr("x2",i).attr("y2",a).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),d=d+f+Dt}return d-l},"drawEvents"),de={setConf:o(()=>{},"setConf"),draw:ce},ue=o(e=>{var d;let{theme:t}=ft(),r=t==null?void 0:t.includes("dark"),n=t==null?void 0:t.includes("color"),i=((d=e.svgId)==null?void 0:d.replace(/^#/,""))??"",l=i?`url(#${i}-drop-shadow)`:e.dropShadow??"none",s="";for(let u=0;u<e.THEME_COLOR_LIMIT;u++){let b=`${17-3*u}`,y=n?e.borderColorArray[u]:e.mainBkg,f=n?e.borderColorArray[u]:e.nodeBorder;s+=`
|
|
7
7
|
.section-${u-1} rect,
|
|
8
8
|
.section-${u-1} path,
|
|
9
9
|
.section-${u-1} circle {
|
package/dist/web/assets/{vennDiagram-IE5QUKF5-DNy7HRBM.js → vennDiagram-MWXL3ELB-RnB0XMP7.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{l as ht,a as ut,o as ct,n as ft,s as dt,e as yt,m as y,I as Pe,a7 as gt,i as pe,aM as pt,ap as xt,aN as je,aq as mt,ar as bt,b as vt,u as It,L as kt,E as wt}from"./index-VTKdaklA.js";var xe=function(){var e=y(function(k,f,v,g){for(v=v||{},g=k.length;g--;v[k[g]]=f);return v},"o"),n=[5,8],r=[7,8,11,12,17,19,22,24],t=[1,17],s=[1,18],i=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],l=[1,31],o=[1,39],c=[7,8,11,12,17,19,22,24,27],u=[1,57],h=[1,56],x=[1,58],d=[1,59],b=[1,60],p=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],S={trace:y(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:y(function(k,f,v,g,m,a,_){var I=a.length-1;switch(m){case 1:return a[I-1];case 2:case 3:case 4:this.$=[];break;case 5:a[I-1].push(a[I]),this.$=a[I-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=a[I];break;case 8:g.setDiagramTitle(a[I].substr(6)),this.$=a[I].substr(6);break;case 9:g.addSubsetData([a[I]],void 0,void 0),g.setIndentMode&&g.setIndentMode(!0);break;case 10:g.addSubsetData([a[I-1]],a[I],void 0),g.setIndentMode&&g.setIndentMode(!0);break;case 11:g.addSubsetData([a[I-2]],void 0,parseFloat(a[I])),g.setIndentMode&&g.setIndentMode(!0);break;case 12:g.addSubsetData([a[I-3]],a[I-2],parseFloat(a[I])),g.setIndentMode&&g.setIndentMode(!0);break;case 13:if(a[I].length<2)throw new Error("union requires multiple identifiers");g.validateUnionIdentifiers&&g.validateUnionIdentifiers(a[I]),g.addSubsetData(a[I],void 0,void 0),g.setIndentMode&&g.setIndentMode(!0);break;case 14:if(a[I-1].length<2)throw new Error("union requires multiple identifiers");g.validateUnionIdentifiers&&g.validateUnionIdentifiers(a[I-1]),g.addSubsetData(a[I-1],a[I],void 0),g.setIndentMode&&g.setIndentMode(!0);break;case 15:if(a[I-2].length<2)throw new Error("union requires multiple identifiers");g.validateUnionIdentifiers&&g.validateUnionIdentifiers(a[I-2]),g.addSubsetData(a[I-2],void 0,parseFloat(a[I])),g.setIndentMode&&g.setIndentMode(!0);break;case 16:if(a[I-3].length<2)throw new Error("union requires multiple identifiers");g.validateUnionIdentifiers&&g.validateUnionIdentifiers(a[I-3]),g.addSubsetData(a[I-3],a[I-2],parseFloat(a[I])),g.setIndentMode&&g.setIndentMode(!0);break;case 17:case 18:case 19:g.addTextData(a[I-1],a[I],void 0);break;case 20:case 21:g.addTextData(a[I-2],a[I-1],a[I]);break;case 23:g.addStyleData(a[I-1],a[I]);break;case 24:case 25:case 26:var $=g.getCurrentSets();if(!$)throw new Error("text requires set");g.addTextData($,a[I],void 0);break;case 27:case 28:var $=g.getCurrentSets();if(!$)throw new Error("text requires set");g.addTextData($,a[I-1],a[I]);break;case 29:case 41:this.$=[a[I]];break;case 30:case 42:this.$=[...a[I-2],a[I]];break;case 31:this.$=[a[I-2],a[I]];break;case 33:this.$=a[I].join(" ");break;case 34:this.$=[a[I]];break;case 35:a[I-1].push(a[I]),this.$=a[I-1];break;case 43:case 44:this.$=a[I];break}},"anonymous"),table:[e(n,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},e(r,[2,4],{6:5}),e(n,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},e(r,[2,5]),e(r,[2,6]),e(r,[2,7]),e(r,[2,8]),{13:16,20:t,21:s},{13:20,18:19,20:t,21:s},{13:20,18:21,20:t,21:s},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:t,21:s},e(r,[2,9],{14:[1,27],15:[1,28]}),e(i,[2,43]),e(i,[2,44]),e(r,[2,13],{14:[1,29],15:[1,30],27:l}),e(i,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:l},e(r,[2,22]),e(r,[2,24],{14:[1,35]}),e(r,[2,25],{14:[1,36]}),e(r,[2,26]),{20:o,25:37,26:38,27:l},e(r,[2,10],{15:[1,40]}),{16:[1,41]},e(r,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:t,21:s},e(r,[2,17],{14:[1,45]}),e(r,[2,18],{14:[1,46]}),e(r,[2,19]),e(r,[2,27]),e(r,[2,28]),e(r,[2,23],{27:[1,47]}),e(c,[2,29]),{15:[1,48]},{16:[1,49]},e(r,[2,11]),{16:[1,50]},e(r,[2,15]),e(i,[2,42]),e(r,[2,20]),e(r,[2,21]),{20:o,26:51},{16:u,20:h,21:[1,53],28:52,29:54,30:55,31:x,32:d,33:b},e(r,[2,12]),e(r,[2,16]),e(c,[2,30]),e(c,[2,31]),e(c,[2,32]),e(c,[2,33],{30:61,16:u,20:h,31:x,32:d,33:b}),e(p,[2,34]),e(p,[2,36]),e(p,[2,37]),e(p,[2,38]),e(p,[2,39]),e(p,[2,40]),e(p,[2,35])],defaultActions:{6:[2,1]},parseError:y(function(k,f){if(f.recoverable)this.trace(k);else{var v=new Error(k);throw v.hash=f,v}},"parseError"),parse:y(function(k){var f=this,v=[0],g=[],m=[null],a=[],_=this.table,I="",$=0,P=0,F=0,q=2,Y=1,H=a.slice.call(arguments,1),E=Object.create(this.lexer),z={yy:{}};for(var D in this.yy)Object.prototype.hasOwnProperty.call(this.yy,D)&&(z.yy[D]=this.yy[D]);E.setInput(k,z.yy),z.yy.lexer=E,z.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var O=E.yylloc;a.push(O);var A=E.options&&E.options.ranges;typeof z.yy.parseError=="function"?this.parseError=z.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function j(W){v.length=v.length-2*W,m.length=m.length-W,a.length=a.length-W}y(j,"popStack");function U(){var W;return W=g.pop()||E.lex()||Y,typeof W!="number"&&(W instanceof Array&&(g=W,W=g.pop()),W=f.symbols_[W]||W),W}y(U,"lex");for(var R,B,N,L,w,C,K={},Z,G,J,se;;){if(N=v[v.length-1],this.defaultActions[N]?L=this.defaultActions[N]:((R===null||typeof R>"u")&&(R=U()),L=_[N]&&_[N][R]),typeof L>"u"||!L.length||!L[0]){var ge="";se=[];for(Z in _[N])this.terminals_[Z]&&Z>q&&se.push("'"+this.terminals_[Z]+"'");E.showPosition?ge="Parse error on line "+($+1)+`:
|
|
2
2
|
`+E.showPosition()+`
|
|
3
|
-
Expecting `+se.join(", ")+", got '"+(this.terminals_[R]||R)+"'":ge="Parse error on line "+($+1)+": Unexpected "+(R==Y?"end of input":"'"+(this.terminals_[R]||R)+"'"),this.parseError(ge,{text:E.match,token:this.terminals_[R]||R,line:E.yylineno,loc:
|
|
3
|
+
Expecting `+se.join(", ")+", got '"+(this.terminals_[R]||R)+"'":ge="Parse error on line "+($+1)+": Unexpected "+(R==Y?"end of input":"'"+(this.terminals_[R]||R)+"'"),this.parseError(ge,{text:E.match,token:this.terminals_[R]||R,line:E.yylineno,loc:O,expected:se})}if(L[0]instanceof Array&&L.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+R);switch(L[0]){case 1:v.push(R),m.push(E.yytext),a.push(E.yylloc),v.push(L[1]),R=null,B?(R=B,B=null):(P=E.yyleng,I=E.yytext,$=E.yylineno,O=E.yylloc,F>0);break;case 2:if(G=this.productions_[L[1]][1],K.$=m[m.length-G],K._$={first_line:a[a.length-(G||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(G||1)].first_column,last_column:a[a.length-1].last_column},A&&(K._$.range=[a[a.length-(G||1)].range[0],a[a.length-1].range[1]]),C=this.performAction.apply(K,[I,P,$,z.yy,L[1],m,a].concat(H)),typeof C<"u")return C;G&&(v=v.slice(0,-1*G*2),m=m.slice(0,-1*G),a=a.slice(0,-1*G)),v.push(this.productions_[L[1]][0]),m.push(K.$),a.push(K._$),J=_[v[v.length-2]][v[v.length-1]],v.push(J);break;case 3:return!0}}return!0},"parse")},T=function(){var k={EOF:1,parseError:y(function(f,v){if(this.yy.parser)this.yy.parser.parseError(f,v);else throw new Error(f)},"parseError"),setInput:y(function(f,v){return this.yy=v||this.yy||{},this._input=f,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:y(function(){var f=this._input[0];this.yytext+=f,this.yyleng++,this.offset++,this.match+=f,this.matched+=f;var v=f.match(/(?:\r\n?|\n).*/g);return v?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),f},"input"),unput:y(function(f){var v=f.length,g=f.split(/(?:\r\n?|\n)/g);this._input=f+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-v),this.offset-=v;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var a=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===m.length?this.yylloc.first_column:0)+m[m.length-g.length].length-g[0].length:this.yylloc.first_column-v},this.options.ranges&&(this.yylloc.range=[a[0],a[0]+this.yyleng-v]),this.yyleng=this.yytext.length,this},"unput"),more:y(function(){return this._more=!0,this},"more"),reject:y(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:y(function(f){this.unput(this.match.slice(f))},"less"),pastInput:y(function(){var f=this.matched.substr(0,this.matched.length-this.match.length);return(f.length>20?"...":"")+f.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:y(function(){var f=this.match;return f.length<20&&(f+=this._input.substr(0,20-f.length)),(f.substr(0,20)+(f.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:y(function(){var f=this.pastInput(),v=new Array(f.length+1).join("-");return f+this.upcomingInput()+`
|
|
5
5
|
`+v+"^"},"showPosition"),test_match:y(function(f,v){var g,m,a;if(this.options.backtrack_lexer&&(a={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(a.yylloc.range=this.yylloc.range.slice(0))),m=f[0].match(/(?:\r\n?|\n).*/g),m&&(this.yylineno+=m.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:m?m[m.length-1].length-m[m.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+f[0].length},this.yytext+=f[0],this.match+=f[0],this.matches=f,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(f[0].length),this.matched+=f[0],g=this.performAction.call(this,this.yy,this,v,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),g)return g;if(this._backtrack){for(var _ in a)this[_]=a[_];return!1}return!1},"test_match"),next:y(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var f,v,g,m;this._more||(this.yytext="",this.match="");for(var a=this._currentRules(),_=0;_<a.length;_++)if(g=this._input.match(this.rules[a[_]]),g&&(!v||g[0].length>v[0].length)){if(v=g,m=_,this.options.backtrack_lexer){if(f=this.test_match(g,a[_]),f!==!1)return f;if(this._backtrack){v=!1;continue}else return!1}else if(!this.options.flex)break}return v?(f=this.test_match(v,a[m]),f!==!1?f:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:y(function(){var f=this.next();return f||this.lex()},"lex"),begin:y(function(f){this.conditionStack.push(f)},"begin"),popState:y(function(){var f=this.conditionStack.length-1;return f>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:y(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:y(function(f){return f=this.conditionStack.length-1-Math.abs(f||0),f>=0?this.conditionStack[f]:"INITIAL"},"topState"),pushState:y(function(f){this.begin(f)},"pushState"),stateStackSize:y(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:y(function(f,v,g,m){switch(g){case 0:break;case 1:break;case 2:break;case 3:if(f.getIndentMode&&f.getIndentMode())return f.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:f.setIndentMode&&f.setIndentMode(!1),this.begin("INITIAL"),this.unput(v.yytext);break;case 6:return this.begin("bol"),8;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(f.consumeIndentText)f.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return v.yytext=v.yytext.slice(2,-2),14;case 17:return v.yytext=v.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return k}();S.lexer=T;function M(){this.yy={}}return y(M,"Parser"),M.prototype=S,S.Parser=M,new M}();xe.parser=xe;var St=xe,ve=[],Ie=[],ke=[],we=new Set,Se,_e=!1,_t=y((e,n,r)=>{let t=de(e).sort(),s=r??10/Math.pow(e.length,2);Se=t,t.length===1&&we.add(t[0]),ve.push({sets:t,size:s,label:n?ne(n):void 0})},"addSubsetData"),Mt=y(()=>ve,"getSubsetData"),ne=y(e=>{let n=e.trim();return n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n},"normalizeText"),Et=y(e=>e&&ne(e),"normalizeStyleValue"),Tt=y((e,n,r)=>{let t=ne(n);Ie.push({sets:de(e).sort(),id:t,label:r?ne(r):void 0})},"addTextData"),zt=y((e,n)=>{let r=de(e).sort(),t={};for(let[s,i]of n)t[s]=Et(i)??i;ke.push({targets:r,styles:t})},"addStyleData"),Dt=y(()=>ke,"getStyleData"),de=y(e=>e.map(n=>ne(n)),"normalizeIdentifierList"),Rt=y(e=>{let n=de(e).filter(r=>!we.has(r));if(n.length>0)throw new Error(`unknown set identifier: ${n.join(", ")}`)},"validateUnionIdentifiers"),$t=y(()=>Ie,"getTextData"),At=y(()=>Se,"getCurrentSets"),
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:y(function(){var f=this.next();return f||this.lex()},"lex"),begin:y(function(f){this.conditionStack.push(f)},"begin"),popState:y(function(){var f=this.conditionStack.length-1;return f>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:y(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:y(function(f){return f=this.conditionStack.length-1-Math.abs(f||0),f>=0?this.conditionStack[f]:"INITIAL"},"topState"),pushState:y(function(f){this.begin(f)},"pushState"),stateStackSize:y(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:y(function(f,v,g,m){switch(g){case 0:break;case 1:break;case 2:break;case 3:if(f.getIndentMode&&f.getIndentMode())return f.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:f.setIndentMode&&f.setIndentMode(!1),this.begin("INITIAL"),this.unput(v.yytext);break;case 6:return this.begin("bol"),8;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(f.consumeIndentText)f.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return v.yytext=v.yytext.slice(2,-2),14;case 17:return v.yytext=v.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return k}();S.lexer=T;function M(){this.yy={}}return y(M,"Parser"),M.prototype=S,S.Parser=M,new M}();xe.parser=xe;var St=xe,ve=[],Ie=[],ke=[],we=new Set,Se,_e=!1,_t=y((e,n,r)=>{let t=de(e).sort(),s=r??10/Math.pow(e.length,2);Se=t,t.length===1&&we.add(t[0]),ve.push({sets:t,size:s,label:n?ne(n):void 0})},"addSubsetData"),Mt=y(()=>ve,"getSubsetData"),ne=y(e=>{let n=e.trim();return n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n},"normalizeText"),Et=y(e=>e&&ne(e),"normalizeStyleValue"),Tt=y((e,n,r)=>{let t=ne(n);Ie.push({sets:de(e).sort(),id:t,label:r?ne(r):void 0})},"addTextData"),zt=y((e,n)=>{let r=de(e).sort(),t={};for(let[s,i]of n)t[s]=Et(i)??i;ke.push({targets:r,styles:t})},"addStyleData"),Dt=y(()=>ke,"getStyleData"),de=y(e=>e.map(n=>ne(n)),"normalizeIdentifierList"),Rt=y(e=>{let n=de(e).filter(r=>!we.has(r));if(n.length>0)throw new Error(`unknown set identifier: ${n.join(", ")}`)},"validateUnionIdentifiers"),$t=y(()=>Ie,"getTextData"),At=y(()=>Se,"getCurrentSets"),Ct=y(()=>_e,"getIndentMode"),Ot=y(e=>{_e=e},"setIndentMode"),Ft=wt.venn;function qe(){return kt(Ft,Pe().venn)}y(qe,"getConfig");var Nt=y(()=>{It(),ve.length=0,Ie.length=0,ke.length=0,we.clear(),Se=void 0,_e=!1},"customClear"),Lt={getConfig:qe,clear:Nt,setAccTitle:yt,getAccTitle:dt,setDiagramTitle:ft,getDiagramTitle:ct,getAccDescription:ut,setAccDescription:ht,addSubsetData:_t,getSubsetData:Mt,addTextData:Tt,addStyleData:zt,validateUnionIdentifiers:Rt,getTextData:$t,getStyleData:Dt,getCurrentSets:At,getIndentMode:Ct,setIndentMode:Ot},jt=y(e=>`
|
|
7
7
|
.venn-title {
|
|
8
8
|
font-size: 32px;
|
|
9
9
|
fill: ${e.vennTitleTextColor};
|
|
@@ -25,10 +25,10 @@ Expecting `+se.join(", ")+", got '"+(this.terminals_[R]||R)+"'":ge="Parse error
|
|
|
25
25
|
font-family: ${e.fontFamily};
|
|
26
26
|
color: ${e.vennSetTextColor};
|
|
27
27
|
}
|
|
28
|
-
`,"getStyles"),Pt=jt;function re(e,n){let r=Ve(e),t=r.filter(o=>Ge(o,e)),s=0,i=0,l=[];if(t.length>1){let o=Ee(t);for(let u=0;u<t.length;++u){let h=t[u];h.angle=Math.atan2(h.x-o.x,h.y-o.y)}t.sort((u,h)=>h.angle-u.angle);let c=t[t.length-1];for(let u=0;u<t.length;++u){let h=t[u];i+=(c.x+h.x)*(h.y-c.y);let x={x:(h.x+c.x)/2,y:(h.y+c.y)/2},d=null;for(let b=0;b<h.parentIndex.length;++b)if(c.parentIndex.includes(h.parentIndex[b])){let p=e[h.parentIndex[b]],S=Math.atan2(h.x-p.x,h.y-p.y),T=Math.atan2(c.x-p.x,c.y-p.y),M=T-S;M<0&&(M+=2*Math.PI);let k=T-M/2,f=V(x,{x:p.x+p.radius*Math.sin(k),y:p.y+p.radius*Math.cos(k)});f>p.radius*2&&(f=p.radius*2),(d==null||d.width>f)&&(d={circle:p,width:f,p1:h,p2:c,large:f>p.radius,sweep:!0})}d!=null&&(l.push(d),s+=le(d.circle.radius,d.width),c=h)}}else{let o=e[0];for(let u=1;u<e.length;++u)e[u].radius<o.radius&&(o=e[u]);let c=!1;for(let u=0;u<e.length;++u)if(V(e[u],o)>Math.abs(o.radius-e[u].radius)){c=!0;break}c?s=i=0:(s=o.radius*o.radius*Math.PI,l.push({circle:o,p1:{x:o.x,y:o.y+o.radius},p2:{x:o.x-1e-10,y:o.y+o.radius},width:o.radius*2,large:!0,sweep:!0}))}return i/=2,n&&(n.area=s+i,n.arcArea=s,n.polygonArea=i,n.arcs=l,n.innerPoints=t,n.intersectionPoints=r),s+i}y(re,"intersectionArea");function Ge(e,n){return n.every(r=>V(e,r)<r.radius+1e-10)}y(Ge,"containedInCircles");function Ve(e){let n=[];for(let r=0;r<e.length;++r)for(let t=r+1;t<e.length;++t){let s=Me(e[r],e[t]);for(let i of s)i.parentIndex=[r,t],n.push(i)}return n}y(Ve,"getIntersectionPoints");function le(e,n){return e*e*Math.acos(1-n/e)-(e-n)*Math.sqrt(n*(2*e-n))}y(le,"circleArea");function V(e,n){return Math.sqrt((e.x-n.x)*(e.x-n.x)+(e.y-n.y)*(e.y-n.y))}y(V,"distance");function ye(e,n,r){if(r>=e+n)return 0;if(r<=Math.abs(e-n))return Math.PI*Math.min(e,n)*Math.min(e,n);let t=e-(r*r-n*n+e*e)/(2*r),s=n-(r*r-e*e+n*n)/(2*r);return le(e,t)+le(n,s)}y(ye,"circleOverlap");function Me(e,n){let r=V(e,n),t=e.radius,s=n.radius;if(r>=t+s||r<=Math.abs(t-s))return[];let i=(t*t-s*s+r*r)/(2*r),l=Math.sqrt(t*t-i*i),o=e.x+i*(n.x-e.x)/r,c=e.y+i*(n.y-e.y)/r,u=-(n.y-e.y)*(l/r),h=-(n.x-e.x)*(l/r);return[{x:o+u,y:c-h},{x:o-u,y:c+h}]}y(Me,"circleCircleIntersection");function Ee(e){let n={x:0,y:0};for(let r of e)n.x+=r.x,n.y+=r.y;return n.x/=e.length,n.y/=e.length,n}y(Ee,"getCenter");function Ue(e,n,r,t){t=t||{};let s=t.maxIterations||100,i=t.tolerance||1e-10,l=e(n),o=e(r),c=r-n;if(l*o>0)throw"Initial bisect points must have opposite signs";if(l===0)return n;if(o===0)return r;for(let u=0;u<s;++u){c/=2;let h=n+c,x=e(h);if(x*l>=0&&(n=h),Math.abs(c)<i||x===0)return h}return n+c}y(Ue,"bisect");function oe(e){let n=new Array(e);for(let r=0;r<e;++r)n[r]=0;return n}y(oe,"zeros");function me(e,n){return oe(e).map(()=>oe(n))}y(me,"zerosM");function ee(e,n){let r=0;for(let t=0;t<e.length;++t)r+=e[t]*n[t];return r}y(ee,"dot");function he(e){return Math.sqrt(ee(e,e))}y(he,"norm2");function ue(e,n,r){for(let t=0;t<n.length;++t)e[t]=n[t]*r}y(ue,"scale");function X(e,n,r,t,s){for(let i=0;i<e.length;++i)e[i]=n*r[i]+t*s[i]}y(X,"weightedSum");function Te(e,n,r){r=r||{};let t=r.maxIterations||n.length*200,s=r.nonZeroDelta||1.05,i=r.zeroDelta||.001,l=r.minErrorDelta||1e-6,o=r.minErrorDelta||1e-5,c=r.rho!==void 0?r.rho:1,u=r.chi!==void 0?r.chi:2,h=r.psi!==void 0?r.psi:-.5,x=r.sigma!==void 0?r.sigma:.5,d,b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=e(n),p[0].id=0;for(let g=0;g<b;++g){let m=n.slice();m[g]=m[g]?m[g]*s:i,p[g+1]=m,p[g+1].fx=e(m),p[g+1].id=g+1}function S(g){for(let m=0;m<g.length;m++)p[b][m]=g[m];p[b].fx=g.fx}y(S,"updateSimplex");let T=y((g,m)=>g.fx-m.fx,"sortOrder"),M=n.slice(),k=n.slice(),f=n.slice(),v=n.slice();for(let g=0;g<t;++g){if(p.sort(T),r.history){let a=p.map(_=>{let I=_.slice();return I.fx=_.fx,I.id=_.id,I});a.sort((_,I)=>_.id-I.id),r.history.push({x:p[0].slice(),fx:p[0].fx,simplex:a})}d=0;for(let a=0;a<b;++a)d=Math.max(d,Math.abs(p[0][a]-p[1][a]));if(Math.abs(p[0].fx-p[b].fx)<l&&d<o)break;for(let a=0;a<b;++a){M[a]=0;for(let _=0;_<b;++_)M[a]+=p[_][a];M[a]/=b}let m=p[b];if(X(k,1+c,M,-c,m),k.fx=e(k),k.fx<p[0].fx)X(v,1+u,M,-u,m),v.fx=e(v),v.fx<k.fx?S(v):S(k);else if(k.fx>=p[b-1].fx){let a=!1;if(k.fx>m.fx?(X(f,1+h,M,-h,m),f.fx=e(f),f.fx<m.fx?S(f):a=!0):(X(f,1-h*c,M,h*c,m),f.fx=e(f),f.fx<k.fx?S(f):a=!0),a){if(x>=1)break;for(let _=1;_<p.length;++_)X(p[_],1-x,p[0],x,p[_]),p[_].fx=e(p[_])}}else S(k)}return p.sort(T),{fx:p[0].fx,x:p[0]}}y(Te,"nelderMead");function Be(e,n,r,t,s,i,l){let o=r.fx,c=ee(r.fxprime,n),u=o,h=o,x=c,d=0;s=s||1,i=i||1e-6,l=l||.1;function b(p,S,T){for(let M=0;M<16;++M)if(s=(p+S)/2,X(t.x,1,r.x,s,n),u=t.fx=e(t.x,t.fxprime),x=ee(t.fxprime,n),u>o+i*s*c||u>=T)S=s;else{if(Math.abs(x)<=-l*c)return s;x*(S-p)>=0&&(S=p),p=s,T=u}return 0}y(b,"zoom");for(let p=0;p<10;++p){if(X(t.x,1,r.x,s,n),u=t.fx=e(t.x,t.fxprime),x=ee(t.fxprime,n),u>o+i*s*c||p&&u>=h)return b(d,s,h);if(Math.abs(x)<=-l*c)return s;if(x>=0)return b(s,d,u);h=u,d=s,s*=2}return s}y(Be,"wolfeLineSearch");function Ye(e,n,r){let t={x:n.slice(),fx:0,fxprime:n.slice()},s={x:n.slice(),fx:0,fxprime:n.slice()},i=n.slice(),l,o,c=1,u;r=r||{},u=r.maxIterations||n.length*20,t.fx=e(t.x,t.fxprime),l=t.fxprime.slice(),ue(l,t.fxprime,-1);for(let h=0;h<u;++h){if(c=Be(e,l,t,s,c),r.history&&r.history.push({x:t.x.slice(),fx:t.fx,fxprime:t.fxprime.slice(),alpha:c}),!c)ue(l,t.fxprime,-1);else{X(i,1,s.fxprime,-1,t.fxprime);let x=ee(t.fxprime,t.fxprime),d=Math.max(0,ee(i,s.fxprime)/x);X(l,d,l,-1,s.fxprime),o=t,t=s,s=o}if(he(t.fxprime)<=1e-5)break}return r.history&&r.history.push({x:t.x.slice(),fx:t.fx,fxprime:t.fxprime.slice(),alpha:c}),t}y(Ye,"conjugateGradient");function ze(e,n={}){n.maxIterations=n.maxIterations||500;let r=n.initialLayout||Je,t=n.lossFunction||te,s=He(e,n),i=r(s,n),l=Object.keys(i),o=[];for(let u of l)o.push(i[u].x),o.push(i[u].y);let c=Te(u=>{let h={};for(let x=0;x<l.length;++x){let d=l[x];h[d]={x:u[2*x],y:u[2*x+1],radius:i[d].radius}}return t(h,s)},o,n).x;for(let u=0;u<l.length;++u){let h=l[u];i[h].x=c[2*u],i[h].y=c[2*u+1]}return i}y(ze,"venn");var We=1e-10;function ce(e,n,r){return Math.min(e,n)*Math.min(e,n)*Math.PI<=r+We?Math.abs(e-n):Ue(t=>ye(e,n,t)-r,0,e+n)}y(ce,"distanceFromIntersectArea");function He(e,n={}){let r=n.distinct,t=e.map(o=>Object.assign({},o));function s(o){return o.join(";")}if(y(s,"toKey"),r){let o=new Map;for(let c of t)for(let u=0;u<c.sets.length;u++){let h=String(c.sets[u]);o.set(h,c.size+(o.get(h)||0));for(let x=u+1;x<c.sets.length;x++){let d=String(c.sets[x]),b=`${h};${d}`,p=`${d};${h}`;o.set(b,c.size+(o.get(b)||0)),o.set(p,c.size+(o.get(p)||0))}}for(let c of t)c.sets.length<3&&(c.size=o.get(s(c.sets)))}let i=[],l=new Set;for(let o of t)if(o.sets.length===1)i.push(o.sets[0]);else if(o.sets.length===2){let c=o.sets[0],u=o.sets[1];l.add(s(o.sets)),l.add(s([u,c]))}i.sort((o,c)=>o===c?0:o<c?-1:1);for(let o=0;o<i.length;++o){let c=i[o];for(let u=o+1;u<i.length;++u){let h=i[u];l.has(s([c,h]))||t.push({sets:[c,h],size:0})}}return t}y(He,"addMissingAreas");function Ke(e,n,r){let t=me(n.length,n.length),s=me(n.length,n.length);return e.filter(i=>i.sets.length===2).forEach(i=>{let l=r[i.sets[0]],o=r[i.sets[1]],c=Math.sqrt(n[l].size/Math.PI),u=Math.sqrt(n[o].size/Math.PI),h=ce(c,u,i.size);t[l][o]=t[o][l]=h;let x=0;i.size+1e-10>=Math.min(n[l].size,n[o].size)?x=1:i.size<=1e-10&&(x=-1),s[l][o]=s[o][l]=x}),{distances:t,constraints:s}}y(Ke,"getDistanceMatrices");function Xe(e,n,r,t){for(let i=0;i<n.length;++i)n[i]=0;let s=0;for(let i=0;i<r.length;++i){let l=e[2*i],o=e[2*i+1];for(let c=i+1;c<r.length;++c){let u=e[2*c],h=e[2*c+1],x=r[i][c],d=t[i][c],b=(u-l)*(u-l)+(h-o)*(h-o),p=Math.sqrt(b),S=b-x*x;d>0&&p<=x||d<0&&p>=x||(s+=2*S*S,n[2*i]+=4*S*(l-u),n[2*i+1]+=4*S*(o-h),n[2*c]+=4*S*(u-l),n[2*c+1]+=4*S*(h-o))}}return s}y(Xe,"constrainedMDSGradient");function Je(e,n={}){let r=Ze(e,n),t=n.lossFunction||te;if(e.length>=8){let s=Qe(e,n),i=t(s,e),l=t(r,e);i+1e-8<l&&(r=s)}return r}y(Je,"bestInitialLayout");function Qe(e,n={}){let r=n.restarts||10,t=[],s={};for(let d of e)d.sets.length===1&&(s[d.sets[0]]=t.length,t.push(d));let{distances:i,constraints:l}=Ke(e,t,s),o=he(i.map(he))/i.length;i=i.map(d=>d.map(b=>b/o));let c=y((d,b)=>Xe(d,b,i,l),"obj"),u=null;for(let d=0;d<r;++d){let b=oe(i.length*2).map(Math.random),p=Ye(c,b,n);(!u||p.fx<u.fx)&&(u=p)}let h=u.x,x={};for(let d=0;d<t.length;++d){let b=t[d];x[b.sets[0]]={x:h[2*d]*o,y:h[2*d+1]*o,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(let d of n.history)ue(d.x,o);return x}y(Qe,"constrainedMDSLayout");function Ze(e,n){let r=n&&n.lossFunction?n.lossFunction:te,t={},s={};for(let x of e)if(x.sets.length===1){let d=x.sets[0];t[d]={x:1e10,y:1e10,rowid:t.length,size:x.size,radius:Math.sqrt(x.size/Math.PI)},s[d]=[]}e=e.filter(x=>x.sets.length===2);for(let x of e){let d=x.weight!=null?x.weight:1,b=x.sets[0],p=x.sets[1];x.size+We>=Math.min(t[b].size,t[p].size)&&(d=0),s[b].push({set:p,size:x.size,weight:d}),s[p].push({set:b,size:x.size,weight:d})}let i=[];Object.keys(s).forEach(x=>{let d=0;for(let b=0;b<s[x].length;++b)d+=s[x][b].size*s[x][b].weight;i.push({set:x,size:d})});function l(x,d){return d.size-x.size}y(l,"sortOrder"),i.sort(l);let o={};function c(x){return x.set in o}y(c,"isPositioned");function u(x,d){t[d].x=x.x,t[d].y=x.y,o[d]=!0}y(u,"positionSet"),u({x:0,y:0},i[0].set);for(let x=1;x<i.length;++x){let d=i[x].set,b=s[d].filter(c),p=t[d];if(b.sort(l),b.length===0)throw"ERROR: missing pairwise overlap information";let S=[];for(var h=0;h<b.length;++h){let k=t[b[h].set],f=ce(p.radius,k.radius,b[h].size);S.push({x:k.x+f,y:k.y}),S.push({x:k.x-f,y:k.y}),S.push({y:k.y+f,x:k.x}),S.push({y:k.y-f,x:k.x});for(let v=h+1;v<b.length;++v){let g=t[b[v].set],m=ce(p.radius,g.radius,b[v].size),a=Me({x:k.x,y:k.y,radius:f},{x:g.x,y:g.y,radius:m});S.push(...a)}}let T=1e50,M=S[0];for(let k of S){t[d].x=k.x,t[d].y=k.y;let f=r(t,e);f<T&&(T=f,M=k)}u(M,d)}return t}y(Ze,"greedyLayout");function te(e,n){let r=0;for(let t of n){if(t.sets.length===1)continue;let s;if(t.sets.length===2){let l=e[t.sets[0]],o=e[t.sets[1]];s=ye(l.radius,o.radius,V(l,o))}else s=re(t.sets.map(l=>e[l]));let i=t.weight!=null?t.weight:1;r+=i*(s-t.size)*(s-t.size)}return r}y(te,"lossFunction");function De(e,n){let r=0;for(let t of n){if(t.sets.length===1)continue;let s;if(t.sets.length===2){let o=e[t.sets[0]],c=e[t.sets[1]];s=ye(o.radius,c.radius,V(o,c))}else s=re(t.sets.map(o=>e[o]));let i=t.weight!=null?t.weight:1,l=Math.log((s+1)/(t.size+1));r+=i*l*l}return r}y(De,"logRatioLossFunction");function et(e,n,r){if(r==null?e.sort((s,i)=>i.radius-s.radius):e.sort(r),e.length>0){let s=e[0].x,i=e[0].y;for(let l of e)l.x-=s,l.y-=i}if(e.length===2&&V(e[0],e[1])<Math.abs(e[1].radius-e[0].radius)&&(e[1].x=e[0].x+e[0].radius-e[1].radius-1e-10,e[1].y=e[0].y),e.length>1){let s=Math.atan2(e[1].x,e[1].y)-n,i=Math.cos(s),l=Math.sin(s);for(let o of e){let c=o.x,u=o.y;o.x=i*c-l*u,o.y=l*c+i*u}}if(e.length>2){let s=Math.atan2(e[2].x,e[2].y)-n;for(;s<0;)s+=2*Math.PI;for(;s>2*Math.PI;)s-=2*Math.PI;if(s>Math.PI){let i=e[1].y/(1e-10+e[1].x);for(let l of e){var t=(l.x+i*l.y)/(1+i*i);l.x=2*t-l.x,l.y=2*t*i-l.y}}}}y(et,"orientateCircles");function tt(e){e.forEach(s=>{s.parent=s});function n(s){return s.parent!==s&&(s.parent=n(s.parent)),s.parent}y(n,"find");function r(s,i){let l=n(s),o=n(i);l.parent=o}y(r,"union");for(let s=0;s<e.length;++s)for(let i=s+1;i<e.length;++i){let l=e[s].radius+e[i].radius;V(e[s],e[i])+1e-10<l&&r(e[i],e[s])}let t=new Map;for(let s=0;s<e.length;++s){let i=n(e[s]).parent.setid;t.has(i)||t.set(i,[]),t.get(i).push(e[s])}return e.forEach(s=>{delete s.parent}),Array.from(t.values())}y(tt,"disjointCluster");function fe(e){let n=y(r=>{let t=e.reduce((i,l)=>Math.max(i,l[r]+l.radius),Number.NEGATIVE_INFINITY),s=e.reduce((i,l)=>Math.min(i,l[r]-l.radius),Number.POSITIVE_INFINITY);return{max:t,min:s}},"minMax");return{xRange:n("x"),yRange:n("y")}}y(fe,"getBoundingBox");function Re(e,n,r){n==null&&(n=Math.PI/2);let t=Oe(e).map(u=>Object.assign({},u)),s=tt(t);for(let u of s){et(u,n,r);let h=fe(u);u.size=(h.xRange.max-h.xRange.min)*(h.yRange.max-h.yRange.min),u.bounds=h}s.sort((u,h)=>h.size-u.size),t=s[0];let i=t.bounds,l=(i.xRange.max-i.xRange.min)/50;function o(u,h,x){if(!u)return;let d=u.bounds,b,p;if(h)b=i.xRange.max-d.xRange.min+l;else{b=i.xRange.max-d.xRange.max;let S=(d.xRange.max-d.xRange.min)/2-(i.xRange.max-i.xRange.min)/2;S<0&&(b+=S)}if(x)p=i.yRange.max-d.yRange.min+l;else{p=i.yRange.max-d.yRange.max;let S=(d.yRange.max-d.yRange.min)/2-(i.yRange.max-i.yRange.min)/2;S<0&&(p+=S)}for(let S of u)S.x+=b,S.y+=p,t.push(S)}y(o,"addCluster");let c=1;for(;c<s.length;)o(s[c],!0,!1),o(s[c+1],!1,!0),o(s[c+2],!0,!0),c+=3,i=fe(t);return Ae(t)}y(Re,"normalizeSolution");function $e(e,n,r,t,s){let i=Oe(e);n-=2*t,r-=2*t;let{xRange:l,yRange:o}=fe(i);if(l.max===l.min||o.max===o.min)return console.log("not scaling solution: zero size detected"),e;let c,u;if(s){let b=Math.sqrt(s/Math.PI)*2;c=n/b,u=r/b}else c=n/(l.max-l.min),u=r/(o.max-o.min);let h=Math.min(u,c),x=(n-(l.max-l.min)*h)/2,d=(r-(o.max-o.min)*h)/2;return Ae(i.map(b=>({radius:h*b.radius,x:t+x+(b.x-l.min)*h,y:t+d+(b.y-o.min)*h,setid:b.setid})))}y($e,"scaleSolution");function Ae(e){let n={};for(let r of e)n[r.setid]=r;return n}y(Ae,"toObjectNotation");function Oe(e){return Object.keys(e).map(n=>Object.assign(e[n],{setid:n}))}y(Oe,"fromObjectNotation");function nt(e={}){let n=!1,r=600,t=350,s=15,i=1e3,l=Math.PI/2,o=!0,c=null,u=!0,h=!0,x=null,d=null,b=!1,p=null,S=e&&e.symmetricalTextCentre?e.symmetricalTextCentre:!1,T={},M=e&&e.colourScheme?e.colourScheme:e&&e.colorScheme?e.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],k=0,f=y(function(a){if(a in T)return T[a];var _=T[a]=M[k];return k+=1,k>=M.length&&(k=0),_},"colours"),v=ze,g=te;function m(a){let _=a.datum(),I=new Set;_.forEach(w=>{w.size==0&&w.sets.length==1&&I.add(w.sets[0])}),_=_.filter(w=>!w.sets.some(O=>I.has(O)));let $={},P={};if(_.length>0){let w=v(_,{lossFunction:g,distinct:b});o&&(w=Re(w,l,d)),$=$e(w,r,t,s,c),P=Fe($,_,S)}let F={};_.forEach(w=>{w.label&&(F[w.sets]=w.label)});function q(w){if(w.sets in F)return F[w.sets];if(w.sets.length==1)return""+w.sets[0]}y(q,"label"),a.selectAll("svg").data([$]).enter().append("svg");let Y=a.select("svg");n?Y.attr("viewBox",`0 0 ${r} ${t}`):Y.attr("width",r).attr("height",t);let H={},E=!1;Y.selectAll(".venn-area path").each(function(w){let O=this.getAttribute("d");w.sets.length==1&&O&&!b&&(E=!0,H[w.sets[0]]=it(O))});function z(w){return O=>{let K=w.sets.map(Z=>{let G=H[Z],J=$[Z];return G||(G={x:r/2,y:t/2,radius:1}),J||(J={x:r/2,y:t/2,radius:1}),{x:G.x*(1-O)+J.x*O,y:G.y*(1-O)+J.y*O,radius:G.radius*(1-O)+J.radius*O}});return be(K,p)}}y(z,"pathTween");let D=Y.selectAll(".venn-area").data(_,w=>w.sets),C=D.enter().append("g").attr("class",w=>`venn-area venn-${w.sets.length==1?"circle":"intersection"}${w.colour||w.color?" venn-coloured":""}`).attr("data-venn-sets",w=>w.sets.join("_")),A=C.append("path"),j=C.append("text").attr("class","label").text(w=>q(w)).attr("text-anchor","middle").attr("dy",".35em").attr("x",r/2).attr("y",t/2);h&&(A.style("fill-opacity","0").filter(w=>w.sets.length==1).style("fill",w=>w.colour?w.colour:w.color?w.color:f(w.sets)).style("fill-opacity",".25"),j.style("fill",w=>w.colour||w.color?"#FFF":e.textFill?e.textFill:w.sets.length==1?f(w.sets):"#444"));function U(w){return typeof w.transition=="function"?w.transition("venn").duration(i):w}y(U,"asTransition");let R=a;E&&typeof R.transition=="function"?(R=U(a),R.selectAll("path").attrTween("d",z)):R.selectAll("path").attr("d",w=>be(w.sets.map(O=>$[O])),p);let B=R.selectAll("text").filter(w=>w.sets in P).text(w=>q(w)).attr("x",w=>Math.floor(P[w.sets].x)).attr("y",w=>Math.floor(P[w.sets].y));u&&(E?"on"in B?B.on("end",ie($,q)):B.each("end",ie($,q)):B.each(ie($,q)));let L=U(D.exit()).remove();typeof D.transition=="function"&&L.selectAll("path").attrTween("d",z);let N=L.selectAll("text").attr("x",r/2).attr("y",t/2);return x!==null&&(j.style("font-size","0px"),B.style("font-size",x),N.style("font-size","0px")),{circles:$,textCentres:P,nodes:D,enter:C,update:R,exit:L}}return y(m,"chart"),m.wrap=function(a){return arguments.length?(u=a,m):u},m.useViewBox=function(){return n=!0,m},m.width=function(a){return arguments.length?(r=a,m):r},m.height=function(a){return arguments.length?(t=a,m):t},m.padding=function(a){return arguments.length?(s=a,m):s},m.distinct=function(a){return arguments.length?(b=a,m):b},m.colours=function(a){return arguments.length?(f=a,m):f},m.colors=function(a){return arguments.length?(f=a,m):f},m.fontSize=function(a){return arguments.length?(x=a,m):x},m.round=function(a){return arguments.length?(p=a,m):p},m.duration=function(a){return arguments.length?(i=a,m):i},m.layoutFunction=function(a){return arguments.length?(v=a,m):v},m.normalize=function(a){return arguments.length?(o=a,m):o},m.scaleToFit=function(a){return arguments.length?(c=a,m):c},m.styled=function(a){return arguments.length?(h=a,m):h},m.orientation=function(a){return arguments.length?(l=a,m):l},m.orientationOrder=function(a){return arguments.length?(d=a,m):d},m.lossFunction=function(a){return arguments.length?(g=a==="default"?te:a==="logRatio"?De:a,m):g},m}y(nt,"VennDiagram");function ie(e,n){return function(r){let t=this,s=e[r.sets[0]].radius||50,i=n(r)||"",l=i.split(/\s+/).reverse(),o=(i.length+l.length)/3,c=l.pop(),u=[c],h=0,x=1.1;t.textContent=null;let d=[];function b(k){let f=t.ownerDocument.createElementNS(t.namespaceURI,"tspan");return f.textContent=k,d.push(f),t.append(f),f}y(b,"append");let p=b(c);for(;c=l.pop(),!!c;){u.push(c);let k=u.join(" ");p.textContent=k,k.length>o&&p.getComputedTextLength()>s&&(u.pop(),p.textContent=u.join(" "),u=[c],p=b(c),h++)}let S=.35-h*x/2,T=t.getAttribute("x"),M=t.getAttribute("y");d.forEach((k,f)=>{k.setAttribute("x",T),k.setAttribute("y",M),k.setAttribute("dy",`${S+f*x}em`)})}}y(ie,"wrapText");function ae(e,n,r){let t=n[0].radius-V(n[0],e);for(let s=1;s<n.length;++s){let i=n[s].radius-V(n[s],e);i<=t&&(t=i)}for(let s=0;s<r.length;++s){let i=V(r[s],e)-r[s].radius;i<=t&&(t=i)}return t}y(ae,"circleMargin");function Ce(e,n,r){let t=[];for(let h of e)t.push({x:h.x,y:h.y}),t.push({x:h.x+h.radius/2,y:h.y}),t.push({x:h.x-h.radius/2,y:h.y}),t.push({x:h.x,y:h.y+h.radius/2}),t.push({x:h.x,y:h.y-h.radius/2});let s=t[0],i=ae(t[0],e,n);for(let h=1;h<t.length;++h){let x=ae(t[h],e,n);x>=i&&(s=t[h],i=x)}let l=Te(h=>-1*ae({x:h[0],y:h[1]},e,n),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x,o={x:r?0:l[0],y:l[1]},c=!0;for(let h of e)if(V(o,h)>h.radius){c=!1;break}for(let h of n)if(V(o,h)<h.radius){c=!1;break}if(c)return o;if(e.length==1)return{x:e[0].x,y:e[0].y};let u={};return re(e,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Ce(e,[]):Ee(u.arcs.map(h=>h.p1))}y(Ce,"computeTextCentre");function rt(e){let n={},r=Object.keys(e);for(let t of r)n[t]=[];for(let t=0;t<r.length;t++){let s=r[t],i=e[s];for(let l=t+1;l<r.length;++l){let o=r[l],c=e[o],u=V(i,c);u+c.radius<=i.radius+1e-10?n[o].push(s):u+i.radius<=c.radius+1e-10&&n[s].push(o)}}return n}y(rt,"getOverlappingCircles");function Fe(e,n,r){let t={},s=rt(e);for(let i=0;i<n.length;++i){let l=n[i].sets,o={},c={};for(let d=0;d<l.length;++d){o[l[d]]=!0;let b=s[l[d]];for(let p=0;p<b.length;++p)c[b[p]]=!0}let u=[],h=[];for(let d in e)d in o?u.push(e[d]):d in c||h.push(e[d]);let x=Ce(u,h,r);t[l]=x,x.disjoint&&n[i].size>0&&console.log("WARNING: area "+l+" not represented on screen")}return t}y(Fe,"computeTextCentres");function st(e,n,r){let t=[];return t.push(`
|
|
28
|
+
`,"getStyles"),Pt=jt;function re(e,n){let r=Ve(e),t=r.filter(o=>Ge(o,e)),s=0,i=0,l=[];if(t.length>1){let o=Ee(t);for(let u=0;u<t.length;++u){let h=t[u];h.angle=Math.atan2(h.x-o.x,h.y-o.y)}t.sort((u,h)=>h.angle-u.angle);let c=t[t.length-1];for(let u=0;u<t.length;++u){let h=t[u];i+=(c.x+h.x)*(h.y-c.y);let x={x:(h.x+c.x)/2,y:(h.y+c.y)/2},d=null;for(let b=0;b<h.parentIndex.length;++b)if(c.parentIndex.includes(h.parentIndex[b])){let p=e[h.parentIndex[b]],S=Math.atan2(h.x-p.x,h.y-p.y),T=Math.atan2(c.x-p.x,c.y-p.y),M=T-S;M<0&&(M+=2*Math.PI);let k=T-M/2,f=V(x,{x:p.x+p.radius*Math.sin(k),y:p.y+p.radius*Math.cos(k)});f>p.radius*2&&(f=p.radius*2),(d==null||d.width>f)&&(d={circle:p,width:f,p1:h,p2:c,large:f>p.radius,sweep:!0})}d!=null&&(l.push(d),s+=le(d.circle.radius,d.width),c=h)}}else{let o=e[0];for(let u=1;u<e.length;++u)e[u].radius<o.radius&&(o=e[u]);let c=!1;for(let u=0;u<e.length;++u)if(V(e[u],o)>Math.abs(o.radius-e[u].radius)){c=!0;break}c?s=i=0:(s=o.radius*o.radius*Math.PI,l.push({circle:o,p1:{x:o.x,y:o.y+o.radius},p2:{x:o.x-1e-10,y:o.y+o.radius},width:o.radius*2,large:!0,sweep:!0}))}return i/=2,n&&(n.area=s+i,n.arcArea=s,n.polygonArea=i,n.arcs=l,n.innerPoints=t,n.intersectionPoints=r),s+i}y(re,"intersectionArea");function Ge(e,n){return n.every(r=>V(e,r)<r.radius+1e-10)}y(Ge,"containedInCircles");function Ve(e){let n=[];for(let r=0;r<e.length;++r)for(let t=r+1;t<e.length;++t){let s=Me(e[r],e[t]);for(let i of s)i.parentIndex=[r,t],n.push(i)}return n}y(Ve,"getIntersectionPoints");function le(e,n){return e*e*Math.acos(1-n/e)-(e-n)*Math.sqrt(n*(2*e-n))}y(le,"circleArea");function V(e,n){return Math.sqrt((e.x-n.x)*(e.x-n.x)+(e.y-n.y)*(e.y-n.y))}y(V,"distance");function ye(e,n,r){if(r>=e+n)return 0;if(r<=Math.abs(e-n))return Math.PI*Math.min(e,n)*Math.min(e,n);let t=e-(r*r-n*n+e*e)/(2*r),s=n-(r*r-e*e+n*n)/(2*r);return le(e,t)+le(n,s)}y(ye,"circleOverlap");function Me(e,n){let r=V(e,n),t=e.radius,s=n.radius;if(r>=t+s||r<=Math.abs(t-s))return[];let i=(t*t-s*s+r*r)/(2*r),l=Math.sqrt(t*t-i*i),o=e.x+i*(n.x-e.x)/r,c=e.y+i*(n.y-e.y)/r,u=-(n.y-e.y)*(l/r),h=-(n.x-e.x)*(l/r);return[{x:o+u,y:c-h},{x:o-u,y:c+h}]}y(Me,"circleCircleIntersection");function Ee(e){let n={x:0,y:0};for(let r of e)n.x+=r.x,n.y+=r.y;return n.x/=e.length,n.y/=e.length,n}y(Ee,"getCenter");function Ue(e,n,r,t){t=t||{};let s=t.maxIterations||100,i=t.tolerance||1e-10,l=e(n),o=e(r),c=r-n;if(l*o>0)throw"Initial bisect points must have opposite signs";if(l===0)return n;if(o===0)return r;for(let u=0;u<s;++u){c/=2;let h=n+c,x=e(h);if(x*l>=0&&(n=h),Math.abs(c)<i||x===0)return h}return n+c}y(Ue,"bisect");function oe(e){let n=new Array(e);for(let r=0;r<e;++r)n[r]=0;return n}y(oe,"zeros");function me(e,n){return oe(e).map(()=>oe(n))}y(me,"zerosM");function ee(e,n){let r=0;for(let t=0;t<e.length;++t)r+=e[t]*n[t];return r}y(ee,"dot");function he(e){return Math.sqrt(ee(e,e))}y(he,"norm2");function ue(e,n,r){for(let t=0;t<n.length;++t)e[t]=n[t]*r}y(ue,"scale");function X(e,n,r,t,s){for(let i=0;i<e.length;++i)e[i]=n*r[i]+t*s[i]}y(X,"weightedSum");function Te(e,n,r){r=r||{};let t=r.maxIterations||n.length*200,s=r.nonZeroDelta||1.05,i=r.zeroDelta||.001,l=r.minErrorDelta||1e-6,o=r.minErrorDelta||1e-5,c=r.rho!==void 0?r.rho:1,u=r.chi!==void 0?r.chi:2,h=r.psi!==void 0?r.psi:-.5,x=r.sigma!==void 0?r.sigma:.5,d,b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=e(n),p[0].id=0;for(let g=0;g<b;++g){let m=n.slice();m[g]=m[g]?m[g]*s:i,p[g+1]=m,p[g+1].fx=e(m),p[g+1].id=g+1}function S(g){for(let m=0;m<g.length;m++)p[b][m]=g[m];p[b].fx=g.fx}y(S,"updateSimplex");let T=y((g,m)=>g.fx-m.fx,"sortOrder"),M=n.slice(),k=n.slice(),f=n.slice(),v=n.slice();for(let g=0;g<t;++g){if(p.sort(T),r.history){let a=p.map(_=>{let I=_.slice();return I.fx=_.fx,I.id=_.id,I});a.sort((_,I)=>_.id-I.id),r.history.push({x:p[0].slice(),fx:p[0].fx,simplex:a})}d=0;for(let a=0;a<b;++a)d=Math.max(d,Math.abs(p[0][a]-p[1][a]));if(Math.abs(p[0].fx-p[b].fx)<l&&d<o)break;for(let a=0;a<b;++a){M[a]=0;for(let _=0;_<b;++_)M[a]+=p[_][a];M[a]/=b}let m=p[b];if(X(k,1+c,M,-c,m),k.fx=e(k),k.fx<p[0].fx)X(v,1+u,M,-u,m),v.fx=e(v),v.fx<k.fx?S(v):S(k);else if(k.fx>=p[b-1].fx){let a=!1;if(k.fx>m.fx?(X(f,1+h,M,-h,m),f.fx=e(f),f.fx<m.fx?S(f):a=!0):(X(f,1-h*c,M,h*c,m),f.fx=e(f),f.fx<k.fx?S(f):a=!0),a){if(x>=1)break;for(let _=1;_<p.length;++_)X(p[_],1-x,p[0],x,p[_]),p[_].fx=e(p[_])}}else S(k)}return p.sort(T),{fx:p[0].fx,x:p[0]}}y(Te,"nelderMead");function Be(e,n,r,t,s,i,l){let o=r.fx,c=ee(r.fxprime,n),u=o,h=o,x=c,d=0;s=s||1,i=i||1e-6,l=l||.1;function b(p,S,T){for(let M=0;M<16;++M)if(s=(p+S)/2,X(t.x,1,r.x,s,n),u=t.fx=e(t.x,t.fxprime),x=ee(t.fxprime,n),u>o+i*s*c||u>=T)S=s;else{if(Math.abs(x)<=-l*c)return s;x*(S-p)>=0&&(S=p),p=s,T=u}return 0}y(b,"zoom");for(let p=0;p<10;++p){if(X(t.x,1,r.x,s,n),u=t.fx=e(t.x,t.fxprime),x=ee(t.fxprime,n),u>o+i*s*c||p&&u>=h)return b(d,s,h);if(Math.abs(x)<=-l*c)return s;if(x>=0)return b(s,d,u);h=u,d=s,s*=2}return s}y(Be,"wolfeLineSearch");function Ye(e,n,r){let t={x:n.slice(),fx:0,fxprime:n.slice()},s={x:n.slice(),fx:0,fxprime:n.slice()},i=n.slice(),l,o,c=1,u;r=r||{},u=r.maxIterations||n.length*20,t.fx=e(t.x,t.fxprime),l=t.fxprime.slice(),ue(l,t.fxprime,-1);for(let h=0;h<u;++h){if(c=Be(e,l,t,s,c),r.history&&r.history.push({x:t.x.slice(),fx:t.fx,fxprime:t.fxprime.slice(),alpha:c}),!c)ue(l,t.fxprime,-1);else{X(i,1,s.fxprime,-1,t.fxprime);let x=ee(t.fxprime,t.fxprime),d=Math.max(0,ee(i,s.fxprime)/x);X(l,d,l,-1,s.fxprime),o=t,t=s,s=o}if(he(t.fxprime)<=1e-5)break}return r.history&&r.history.push({x:t.x.slice(),fx:t.fx,fxprime:t.fxprime.slice(),alpha:c}),t}y(Ye,"conjugateGradient");function ze(e,n={}){n.maxIterations=n.maxIterations||500;let r=n.initialLayout||Je,t=n.lossFunction||te,s=He(e,n),i=r(s,n),l=Object.keys(i),o=[];for(let u of l)o.push(i[u].x),o.push(i[u].y);let c=Te(u=>{let h={};for(let x=0;x<l.length;++x){let d=l[x];h[d]={x:u[2*x],y:u[2*x+1],radius:i[d].radius}}return t(h,s)},o,n).x;for(let u=0;u<l.length;++u){let h=l[u];i[h].x=c[2*u],i[h].y=c[2*u+1]}return i}y(ze,"venn");var We=1e-10;function ce(e,n,r){return Math.min(e,n)*Math.min(e,n)*Math.PI<=r+We?Math.abs(e-n):Ue(t=>ye(e,n,t)-r,0,e+n)}y(ce,"distanceFromIntersectArea");function He(e,n={}){let r=n.distinct,t=e.map(o=>Object.assign({},o));function s(o){return o.join(";")}if(y(s,"toKey"),r){let o=new Map;for(let c of t)for(let u=0;u<c.sets.length;u++){let h=String(c.sets[u]);o.set(h,c.size+(o.get(h)||0));for(let x=u+1;x<c.sets.length;x++){let d=String(c.sets[x]),b=`${h};${d}`,p=`${d};${h}`;o.set(b,c.size+(o.get(b)||0)),o.set(p,c.size+(o.get(p)||0))}}for(let c of t)c.sets.length<3&&(c.size=o.get(s(c.sets)))}let i=[],l=new Set;for(let o of t)if(o.sets.length===1)i.push(o.sets[0]);else if(o.sets.length===2){let c=o.sets[0],u=o.sets[1];l.add(s(o.sets)),l.add(s([u,c]))}i.sort((o,c)=>o===c?0:o<c?-1:1);for(let o=0;o<i.length;++o){let c=i[o];for(let u=o+1;u<i.length;++u){let h=i[u];l.has(s([c,h]))||t.push({sets:[c,h],size:0})}}return t}y(He,"addMissingAreas");function Ke(e,n,r){let t=me(n.length,n.length),s=me(n.length,n.length);return e.filter(i=>i.sets.length===2).forEach(i=>{let l=r[i.sets[0]],o=r[i.sets[1]],c=Math.sqrt(n[l].size/Math.PI),u=Math.sqrt(n[o].size/Math.PI),h=ce(c,u,i.size);t[l][o]=t[o][l]=h;let x=0;i.size+1e-10>=Math.min(n[l].size,n[o].size)?x=1:i.size<=1e-10&&(x=-1),s[l][o]=s[o][l]=x}),{distances:t,constraints:s}}y(Ke,"getDistanceMatrices");function Xe(e,n,r,t){for(let i=0;i<n.length;++i)n[i]=0;let s=0;for(let i=0;i<r.length;++i){let l=e[2*i],o=e[2*i+1];for(let c=i+1;c<r.length;++c){let u=e[2*c],h=e[2*c+1],x=r[i][c],d=t[i][c],b=(u-l)*(u-l)+(h-o)*(h-o),p=Math.sqrt(b),S=b-x*x;d>0&&p<=x||d<0&&p>=x||(s+=2*S*S,n[2*i]+=4*S*(l-u),n[2*i+1]+=4*S*(o-h),n[2*c]+=4*S*(u-l),n[2*c+1]+=4*S*(h-o))}}return s}y(Xe,"constrainedMDSGradient");function Je(e,n={}){let r=Ze(e,n),t=n.lossFunction||te;if(e.length>=8){let s=Qe(e,n),i=t(s,e),l=t(r,e);i+1e-8<l&&(r=s)}return r}y(Je,"bestInitialLayout");function Qe(e,n={}){let r=n.restarts||10,t=[],s={};for(let d of e)d.sets.length===1&&(s[d.sets[0]]=t.length,t.push(d));let{distances:i,constraints:l}=Ke(e,t,s),o=he(i.map(he))/i.length;i=i.map(d=>d.map(b=>b/o));let c=y((d,b)=>Xe(d,b,i,l),"obj"),u=null;for(let d=0;d<r;++d){let b=oe(i.length*2).map(Math.random),p=Ye(c,b,n);(!u||p.fx<u.fx)&&(u=p)}let h=u.x,x={};for(let d=0;d<t.length;++d){let b=t[d];x[b.sets[0]]={x:h[2*d]*o,y:h[2*d+1]*o,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(let d of n.history)ue(d.x,o);return x}y(Qe,"constrainedMDSLayout");function Ze(e,n){let r=n&&n.lossFunction?n.lossFunction:te,t={},s={};for(let x of e)if(x.sets.length===1){let d=x.sets[0];t[d]={x:1e10,y:1e10,rowid:t.length,size:x.size,radius:Math.sqrt(x.size/Math.PI)},s[d]=[]}e=e.filter(x=>x.sets.length===2);for(let x of e){let d=x.weight!=null?x.weight:1,b=x.sets[0],p=x.sets[1];x.size+We>=Math.min(t[b].size,t[p].size)&&(d=0),s[b].push({set:p,size:x.size,weight:d}),s[p].push({set:b,size:x.size,weight:d})}let i=[];Object.keys(s).forEach(x=>{let d=0;for(let b=0;b<s[x].length;++b)d+=s[x][b].size*s[x][b].weight;i.push({set:x,size:d})});function l(x,d){return d.size-x.size}y(l,"sortOrder"),i.sort(l);let o={};function c(x){return x.set in o}y(c,"isPositioned");function u(x,d){t[d].x=x.x,t[d].y=x.y,o[d]=!0}y(u,"positionSet"),u({x:0,y:0},i[0].set);for(let x=1;x<i.length;++x){let d=i[x].set,b=s[d].filter(c),p=t[d];if(b.sort(l),b.length===0)throw"ERROR: missing pairwise overlap information";let S=[];for(var h=0;h<b.length;++h){let k=t[b[h].set],f=ce(p.radius,k.radius,b[h].size);S.push({x:k.x+f,y:k.y}),S.push({x:k.x-f,y:k.y}),S.push({y:k.y+f,x:k.x}),S.push({y:k.y-f,x:k.x});for(let v=h+1;v<b.length;++v){let g=t[b[v].set],m=ce(p.radius,g.radius,b[v].size),a=Me({x:k.x,y:k.y,radius:f},{x:g.x,y:g.y,radius:m});S.push(...a)}}let T=1e50,M=S[0];for(let k of S){t[d].x=k.x,t[d].y=k.y;let f=r(t,e);f<T&&(T=f,M=k)}u(M,d)}return t}y(Ze,"greedyLayout");function te(e,n){let r=0;for(let t of n){if(t.sets.length===1)continue;let s;if(t.sets.length===2){let l=e[t.sets[0]],o=e[t.sets[1]];s=ye(l.radius,o.radius,V(l,o))}else s=re(t.sets.map(l=>e[l]));let i=t.weight!=null?t.weight:1;r+=i*(s-t.size)*(s-t.size)}return r}y(te,"lossFunction");function De(e,n){let r=0;for(let t of n){if(t.sets.length===1)continue;let s;if(t.sets.length===2){let o=e[t.sets[0]],c=e[t.sets[1]];s=ye(o.radius,c.radius,V(o,c))}else s=re(t.sets.map(o=>e[o]));let i=t.weight!=null?t.weight:1,l=Math.log((s+1)/(t.size+1));r+=i*l*l}return r}y(De,"logRatioLossFunction");function et(e,n,r){if(r==null?e.sort((s,i)=>i.radius-s.radius):e.sort(r),e.length>0){let s=e[0].x,i=e[0].y;for(let l of e)l.x-=s,l.y-=i}if(e.length===2&&V(e[0],e[1])<Math.abs(e[1].radius-e[0].radius)&&(e[1].x=e[0].x+e[0].radius-e[1].radius-1e-10,e[1].y=e[0].y),e.length>1){let s=Math.atan2(e[1].x,e[1].y)-n,i=Math.cos(s),l=Math.sin(s);for(let o of e){let c=o.x,u=o.y;o.x=i*c-l*u,o.y=l*c+i*u}}if(e.length>2){let s=Math.atan2(e[2].x,e[2].y)-n;for(;s<0;)s+=2*Math.PI;for(;s>2*Math.PI;)s-=2*Math.PI;if(s>Math.PI){let i=e[1].y/(1e-10+e[1].x);for(let l of e){var t=(l.x+i*l.y)/(1+i*i);l.x=2*t-l.x,l.y=2*t*i-l.y}}}}y(et,"orientateCircles");function tt(e){e.forEach(s=>{s.parent=s});function n(s){return s.parent!==s&&(s.parent=n(s.parent)),s.parent}y(n,"find");function r(s,i){let l=n(s),o=n(i);l.parent=o}y(r,"union");for(let s=0;s<e.length;++s)for(let i=s+1;i<e.length;++i){let l=e[s].radius+e[i].radius;V(e[s],e[i])+1e-10<l&&r(e[i],e[s])}let t=new Map;for(let s=0;s<e.length;++s){let i=n(e[s]).parent.setid;t.has(i)||t.set(i,[]),t.get(i).push(e[s])}return e.forEach(s=>{delete s.parent}),Array.from(t.values())}y(tt,"disjointCluster");function fe(e){let n=y(r=>{let t=e.reduce((i,l)=>Math.max(i,l[r]+l.radius),Number.NEGATIVE_INFINITY),s=e.reduce((i,l)=>Math.min(i,l[r]-l.radius),Number.POSITIVE_INFINITY);return{max:t,min:s}},"minMax");return{xRange:n("x"),yRange:n("y")}}y(fe,"getBoundingBox");function Re(e,n,r){n==null&&(n=Math.PI/2);let t=Ce(e).map(u=>Object.assign({},u)),s=tt(t);for(let u of s){et(u,n,r);let h=fe(u);u.size=(h.xRange.max-h.xRange.min)*(h.yRange.max-h.yRange.min),u.bounds=h}s.sort((u,h)=>h.size-u.size),t=s[0];let i=t.bounds,l=(i.xRange.max-i.xRange.min)/50;function o(u,h,x){if(!u)return;let d=u.bounds,b,p;if(h)b=i.xRange.max-d.xRange.min+l;else{b=i.xRange.max-d.xRange.max;let S=(d.xRange.max-d.xRange.min)/2-(i.xRange.max-i.xRange.min)/2;S<0&&(b+=S)}if(x)p=i.yRange.max-d.yRange.min+l;else{p=i.yRange.max-d.yRange.max;let S=(d.yRange.max-d.yRange.min)/2-(i.yRange.max-i.yRange.min)/2;S<0&&(p+=S)}for(let S of u)S.x+=b,S.y+=p,t.push(S)}y(o,"addCluster");let c=1;for(;c<s.length;)o(s[c],!0,!1),o(s[c+1],!1,!0),o(s[c+2],!0,!0),c+=3,i=fe(t);return Ae(t)}y(Re,"normalizeSolution");function $e(e,n,r,t,s){let i=Ce(e);n-=2*t,r-=2*t;let{xRange:l,yRange:o}=fe(i);if(l.max===l.min||o.max===o.min)return console.log("not scaling solution: zero size detected"),e;let c,u;if(s){let b=Math.sqrt(s/Math.PI)*2;c=n/b,u=r/b}else c=n/(l.max-l.min),u=r/(o.max-o.min);let h=Math.min(u,c),x=(n-(l.max-l.min)*h)/2,d=(r-(o.max-o.min)*h)/2;return Ae(i.map(b=>({radius:h*b.radius,x:t+x+(b.x-l.min)*h,y:t+d+(b.y-o.min)*h,setid:b.setid})))}y($e,"scaleSolution");function Ae(e){let n={};for(let r of e)n[r.setid]=r;return n}y(Ae,"toObjectNotation");function Ce(e){return Object.keys(e).map(n=>Object.assign(e[n],{setid:n}))}y(Ce,"fromObjectNotation");function nt(e={}){let n=!1,r=600,t=350,s=15,i=1e3,l=Math.PI/2,o=!0,c=null,u=!0,h=!0,x=null,d=null,b=!1,p=null,S=e&&e.symmetricalTextCentre?e.symmetricalTextCentre:!1,T={},M=e&&e.colourScheme?e.colourScheme:e&&e.colorScheme?e.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],k=0,f=y(function(a){if(a in T)return T[a];var _=T[a]=M[k];return k+=1,k>=M.length&&(k=0),_},"colours"),v=ze,g=te;function m(a){let _=a.datum(),I=new Set;_.forEach(w=>{w.size==0&&w.sets.length==1&&I.add(w.sets[0])}),_=_.filter(w=>!w.sets.some(C=>I.has(C)));let $={},P={};if(_.length>0){let w=v(_,{lossFunction:g,distinct:b});o&&(w=Re(w,l,d)),$=$e(w,r,t,s,c),P=Fe($,_,S)}let F={};_.forEach(w=>{w.label&&(F[w.sets]=w.label)});function q(w){if(w.sets in F)return F[w.sets];if(w.sets.length==1)return""+w.sets[0]}y(q,"label"),a.selectAll("svg").data([$]).enter().append("svg");let Y=a.select("svg");n?Y.attr("viewBox",`0 0 ${r} ${t}`):Y.attr("width",r).attr("height",t);let H={},E=!1;Y.selectAll(".venn-area path").each(function(w){let C=this.getAttribute("d");w.sets.length==1&&C&&!b&&(E=!0,H[w.sets[0]]=it(C))});function z(w){return C=>{let K=w.sets.map(Z=>{let G=H[Z],J=$[Z];return G||(G={x:r/2,y:t/2,radius:1}),J||(J={x:r/2,y:t/2,radius:1}),{x:G.x*(1-C)+J.x*C,y:G.y*(1-C)+J.y*C,radius:G.radius*(1-C)+J.radius*C}});return be(K,p)}}y(z,"pathTween");let D=Y.selectAll(".venn-area").data(_,w=>w.sets),O=D.enter().append("g").attr("class",w=>`venn-area venn-${w.sets.length==1?"circle":"intersection"}${w.colour||w.color?" venn-coloured":""}`).attr("data-venn-sets",w=>w.sets.join("_")),A=O.append("path"),j=O.append("text").attr("class","label").text(w=>q(w)).attr("text-anchor","middle").attr("dy",".35em").attr("x",r/2).attr("y",t/2);h&&(A.style("fill-opacity","0").filter(w=>w.sets.length==1).style("fill",w=>w.colour?w.colour:w.color?w.color:f(w.sets)).style("fill-opacity",".25"),j.style("fill",w=>w.colour||w.color?"#FFF":e.textFill?e.textFill:w.sets.length==1?f(w.sets):"#444"));function U(w){return typeof w.transition=="function"?w.transition("venn").duration(i):w}y(U,"asTransition");let R=a;E&&typeof R.transition=="function"?(R=U(a),R.selectAll("path").attrTween("d",z)):R.selectAll("path").attr("d",w=>be(w.sets.map(C=>$[C])),p);let B=R.selectAll("text").filter(w=>w.sets in P).text(w=>q(w)).attr("x",w=>Math.floor(P[w.sets].x)).attr("y",w=>Math.floor(P[w.sets].y));u&&(E?"on"in B?B.on("end",ie($,q)):B.each("end",ie($,q)):B.each(ie($,q)));let N=U(D.exit()).remove();typeof D.transition=="function"&&N.selectAll("path").attrTween("d",z);let L=N.selectAll("text").attr("x",r/2).attr("y",t/2);return x!==null&&(j.style("font-size","0px"),B.style("font-size",x),L.style("font-size","0px")),{circles:$,textCentres:P,nodes:D,enter:O,update:R,exit:N}}return y(m,"chart"),m.wrap=function(a){return arguments.length?(u=a,m):u},m.useViewBox=function(){return n=!0,m},m.width=function(a){return arguments.length?(r=a,m):r},m.height=function(a){return arguments.length?(t=a,m):t},m.padding=function(a){return arguments.length?(s=a,m):s},m.distinct=function(a){return arguments.length?(b=a,m):b},m.colours=function(a){return arguments.length?(f=a,m):f},m.colors=function(a){return arguments.length?(f=a,m):f},m.fontSize=function(a){return arguments.length?(x=a,m):x},m.round=function(a){return arguments.length?(p=a,m):p},m.duration=function(a){return arguments.length?(i=a,m):i},m.layoutFunction=function(a){return arguments.length?(v=a,m):v},m.normalize=function(a){return arguments.length?(o=a,m):o},m.scaleToFit=function(a){return arguments.length?(c=a,m):c},m.styled=function(a){return arguments.length?(h=a,m):h},m.orientation=function(a){return arguments.length?(l=a,m):l},m.orientationOrder=function(a){return arguments.length?(d=a,m):d},m.lossFunction=function(a){return arguments.length?(g=a==="default"?te:a==="logRatio"?De:a,m):g},m}y(nt,"VennDiagram");function ie(e,n){return function(r){let t=this,s=e[r.sets[0]].radius||50,i=n(r)||"",l=i.split(/\s+/).reverse(),o=(i.length+l.length)/3,c=l.pop(),u=[c],h=0,x=1.1;t.textContent=null;let d=[];function b(k){let f=t.ownerDocument.createElementNS(t.namespaceURI,"tspan");return f.textContent=k,d.push(f),t.append(f),f}y(b,"append");let p=b(c);for(;c=l.pop(),!!c;){u.push(c);let k=u.join(" ");p.textContent=k,k.length>o&&p.getComputedTextLength()>s&&(u.pop(),p.textContent=u.join(" "),u=[c],p=b(c),h++)}let S=.35-h*x/2,T=t.getAttribute("x"),M=t.getAttribute("y");d.forEach((k,f)=>{k.setAttribute("x",T),k.setAttribute("y",M),k.setAttribute("dy",`${S+f*x}em`)})}}y(ie,"wrapText");function ae(e,n,r){let t=n[0].radius-V(n[0],e);for(let s=1;s<n.length;++s){let i=n[s].radius-V(n[s],e);i<=t&&(t=i)}for(let s=0;s<r.length;++s){let i=V(r[s],e)-r[s].radius;i<=t&&(t=i)}return t}y(ae,"circleMargin");function Oe(e,n,r){let t=[];for(let h of e)t.push({x:h.x,y:h.y}),t.push({x:h.x+h.radius/2,y:h.y}),t.push({x:h.x-h.radius/2,y:h.y}),t.push({x:h.x,y:h.y+h.radius/2}),t.push({x:h.x,y:h.y-h.radius/2});let s=t[0],i=ae(t[0],e,n);for(let h=1;h<t.length;++h){let x=ae(t[h],e,n);x>=i&&(s=t[h],i=x)}let l=Te(h=>-1*ae({x:h[0],y:h[1]},e,n),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x,o={x:r?0:l[0],y:l[1]},c=!0;for(let h of e)if(V(o,h)>h.radius){c=!1;break}for(let h of n)if(V(o,h)<h.radius){c=!1;break}if(c)return o;if(e.length==1)return{x:e[0].x,y:e[0].y};let u={};return re(e,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Oe(e,[]):Ee(u.arcs.map(h=>h.p1))}y(Oe,"computeTextCentre");function rt(e){let n={},r=Object.keys(e);for(let t of r)n[t]=[];for(let t=0;t<r.length;t++){let s=r[t],i=e[s];for(let l=t+1;l<r.length;++l){let o=r[l],c=e[o],u=V(i,c);u+c.radius<=i.radius+1e-10?n[o].push(s):u+i.radius<=c.radius+1e-10&&n[s].push(o)}}return n}y(rt,"getOverlappingCircles");function Fe(e,n,r){let t={},s=rt(e);for(let i=0;i<n.length;++i){let l=n[i].sets,o={},c={};for(let d=0;d<l.length;++d){o[l[d]]=!0;let b=s[l[d]];for(let p=0;p<b.length;++p)c[b[p]]=!0}let u=[],h=[];for(let d in e)d in o?u.push(e[d]):d in c||h.push(e[d]);let x=Oe(u,h,r);t[l]=x,x.disjoint&&n[i].size>0&&console.log("WARNING: area "+l+" not represented on screen")}return t}y(Fe,"computeTextCentres");function st(e,n,r){let t=[];return t.push(`
|
|
29
29
|
M`,e,n),t.push(`
|
|
30
30
|
m`,-r,0),t.push(`
|
|
31
31
|
a`,r,r,0,1,0,r*2,0),t.push(`
|
|
32
|
-
a`,r,r,0,1,0,-r*2,0),t.join(" ")}y(st,"circlePath");function it(e){let n=e.split(" ");return{x:Number.parseFloat(n[1]),y:Number.parseFloat(n[2]),radius:-Number.parseFloat(n[4])}}y(it,"circleFromPath");function
|
|
32
|
+
a`,r,r,0,1,0,-r*2,0),t.join(" ")}y(st,"circlePath");function it(e){let n=e.split(" ");return{x:Number.parseFloat(n[1]),y:Number.parseFloat(n[2]),radius:-Number.parseFloat(n[4])}}y(it,"circleFromPath");function Ne(e){if(e.length===0)return[];let n={};return re(e,n),n.arcs}y(Ne,"intersectionAreaArcs");function Le(e,n){if(e.length===0)return"M 0 0";let r=Math.pow(10,n||0),t=n!=null?i=>Math.round(i*r)/r:i=>i;if(e.length==1){let i=e[0].circle;return st(t(i.x),t(i.y),t(i.radius))}let s=[`
|
|
33
33
|
M`,t(e[0].p2.x),t(e[0].p2.y)];for(let i of e){let l=t(i.circle.radius);s.push(`
|
|
34
|
-
A`,l,l,0,i.large?1:0,i.sweep?1:0,t(i.p1.x),t(i.p1.y))}return s.join(" ")}y(
|
|
34
|
+
A`,l,l,0,i.large?1:0,i.sweep?1:0,t(i.p1.x),t(i.p1.y))}return s.join(" ")}y(Le,"arcsToPath");function be(e,n){return Le(Ne(e),n)}y(be,"intersectionAreaPath");function at(e,n={}){let{lossFunction:r,layoutFunction:t=ze,normalize:s=!0,orientation:i=Math.PI/2,orientationOrder:l,width:o=600,height:c=350,padding:u=15,scaleToFit:h=!1,symmetricalTextCentre:x=!1,distinct:d,round:b=2}=n,p=t(e,{lossFunction:r==="default"||!r?te:r==="logRatio"?De:r,distinct:d});s&&(p=Re(p,i,l));let S=$e(p,o,c,u,h),T=Fe(S,e,x),M=new Map(Object.keys(S).map(v=>[v,{set:v,x:S[v].x,y:S[v].y,radius:S[v].radius}])),k=e.map(v=>{let g=v.sets.map(_=>M.get(_)),m=Ne(g),a=Le(m,b);return{circles:g,arcs:m,path:a,area:v,has:new Set(v.sets)}});function f(v){let g="";for(let m of k)m.has.size>v.length&&v.every(a=>m.has.has(a))&&(g+=" "+m.path);return g}return y(f,"genDistinctPath"),k.map(({circles:v,arcs:g,path:m,area:a})=>({data:a,text:T[a.sets],circles:v,arcs:g,path:m,distinctPath:m+f(a.sets)}))}y(at,"layout");function lt(e){let n=new Map;for(let r of e){let t=r.targets.join("|"),s=n.get(t);s?Object.assign(s,r.styles):n.set(t,{...r.styles})}return n}y(lt,"buildStyleByKey");var qt=y((e,n,r,t)=>{var q,Y,H;let s=t.db,i=(q=s.getConfig)==null?void 0:q.call(s),{themeVariables:l,look:o,handDrawnSeed:c}=Pe(),u=o==="handDrawn",h=[l.venn1,l.venn2,l.venn3,l.venn4,l.venn5,l.venn6,l.venn7,l.venn8].filter(Boolean),x=(Y=s.getDiagramTitle)==null?void 0:Y.call(s),d=s.getSubsetData(),b=s.getTextData(),p=lt(s.getStyleData()),S=(i==null?void 0:i.width)??800,T=(i==null?void 0:i.height)??450,M=S/1600,k=x?48*M:0,f=l.primaryTextColor??l.textColor,v=gt(n);v.attr("viewBox",`0 0 ${S} ${T}`),x&&v.append("text").text(x).attr("class","venn-title").attr("font-size",`${32*M}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*M).style("fill",l.vennTitleTextColor||l.titleColor);let g=pe(document.createElement("div")),m=nt().width(S).height(T-k);g.datum(d).call(m);let a=u?pt.svg(g.select("svg").node()):void 0,_=at(d,{width:S,height:T-k,padding:(i==null?void 0:i.padding)??15}),I=new Map;for(let E of _){let z=Q([...E.data.sets].sort());I.set(z,E)}b.length>0&&ot(i,I,g,b,M,p);let $=xt(l.background||"#f4f4f4");g.selectAll(".venn-circle").each(function(E,z){var L;let D=pe(this),O=Q([...E.sets].sort()),A=p.get(O),j=(A==null?void 0:A.fill)||h[z%h.length]||l.primaryColor;D.classed(`venn-set-${z%8}`,!0);let U=(A==null?void 0:A["fill-opacity"])??.1,R=(A==null?void 0:A.stroke)||j,B=(A==null?void 0:A["stroke-width"])||`${5*M}`;if(u&&a){let w=I.get(O);if(w&&w.circles.length>0){let C=w.circles[0],K=a.circle(C.x,C.y,C.radius*2,{roughness:.7,seed:c,fill:je(j,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+z*60,stroke:R,strokeWidth:parseFloat(String(B))});D.select("path").remove(),(L=D.node())==null||L.insertBefore(K,D.select("text").node())}}else D.select("path").style("fill",j).style("fill-opacity",U).style("stroke",R).style("stroke-width",B).style("stroke-opacity",.95);let N=(A==null?void 0:A.color)||($?mt(j,30):bt(j,30));D.select("text").style("font-size",`${48*M}px`).style("fill",N)}),u&&a?g.selectAll(".venn-intersection").each(function(E){var j;let z=pe(this),D=Q([...E.sets].sort()),O=p.get(D),A=O==null?void 0:O.fill;if(A){let U=z.select("path"),R=U.attr("d");if(R){let B=a.path(R,{roughness:.7,seed:c,fill:je(A,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),N=U.node();(j=N==null?void 0:N.parentNode)==null||j.insertBefore(B,N),U.remove()}}else z.select("path").style("fill-opacity",0);z.select("text").style("font-size",`${48*M}px`).style("fill",(O==null?void 0:O.color)??l.vennSetTextColor??f)}):(g.selectAll(".venn-intersection text").style("font-size",`${48*M}px`).style("fill",E=>{var D;let z=Q([...E.sets].sort());return((D=p.get(z))==null?void 0:D.color)??l.vennSetTextColor??f}),g.selectAll(".venn-intersection path").style("fill-opacity",E=>{var D;let z=Q([...E.sets].sort());return(D=p.get(z))!=null&&D.fill?1:0}).style("fill",E=>{var D;let z=Q([...E.sets].sort());return((D=p.get(z))==null?void 0:D.fill)??"transparent"}));let P=v.append("g").attr("transform",`translate(0, ${k})`),F=g.select("svg").node();if(F&&"childNodes"in F)for(let E of[...F.childNodes])(H=P.node())==null||H.appendChild(E);vt(v,T,S,(i==null?void 0:i.useMaxWidth)??!0)},"draw");function Q(e){return e.join("|")}y(Q,"stableSetsKey");function ot(e,n,r,t,s,i){var u;let l=(e==null?void 0:e.useDebugLayout)??!1,o=r.select("svg").append("g").attr("class","venn-text-nodes"),c=new Map;for(let h of t){let x=Q(h.sets),d=c.get(x);d?d.push(h):c.set(x,[h])}for(let[h,x]of c.entries()){let d=n.get(h);if(!(d!=null&&d.text))continue;let b=d.text.x,p=d.text.y,S=Math.min(...d.circles.map(F=>F.radius)),T=Math.min(...d.circles.map(F=>F.radius-Math.hypot(b-F.x,p-F.y))),M=Number.isFinite(T)?Math.max(0,T):0;M===0&&Number.isFinite(S)&&(M=S*.6);let k=o.append("g").attr("class","venn-text-area").attr("font-size",`${40*s}px`);l&&k.append("circle").attr("class","venn-text-debug-circle").attr("cx",b).attr("cy",p).attr("r",M).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*s).attr("stroke-dasharray",`${6*s} ${4*s}`);let f=Math.max(80*s,M*2*.95),v=Math.max(60*s,M*2*.95),g=(d.data.label&&d.data.label.length>0?Math.min(32*s,M*.25):0)+(x.length<=2?30*s:0),m=b-f/2,a=p-v/2+g,_=Math.max(1,Math.ceil(Math.sqrt(x.length))),I=Math.max(1,Math.ceil(x.length/_)),$=f/_,P=v/I;for(let[F,q]of x.entries()){let Y=F%_,H=Math.floor(F/_),E=m+$*(Y+.5),z=a+P*(H+.5);l&&k.append("rect").attr("class","venn-text-debug-cell").attr("x",m+$*Y).attr("y",a+P*H).attr("width",$).attr("height",P).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*s).attr("stroke-dasharray",`${4*s} ${3*s}`);let D=$*.9,O=P*.9,A=k.append("foreignObject").attr("class","venn-text-node-fo").attr("width",D).attr("height",O).attr("x",E-D/2).attr("y",z-O/2).attr("overflow","visible"),j=(u=i.get(q.id))==null?void 0:u.color,U=A.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(q.label??q.id);j&&U.style("color",j)}}}y(ot,"renderTextNodes");var Gt={draw:qt},Ut={parser:St,db:Lt,renderer:Gt,styles:Pt};export{Ut as diagram};
|