var gvjs_Z3="linktable",gvjs__3="sankey.link.color.focused",gvjs_wpa="sankey.link.color.selected",gvjs_xpa="sankey.link.color.unfocused",gvjs_ypa="sankey.link.color.unselected",gvjs_03="sankey.node.color.focused",gvjs_zpa="sankey.node.color.selected",gvjs_Apa="sankey.node.color.unfocused",gvjs_Bpa="sankey.node.color.unselected",gvjs_13="sankey.node.label.focused",gvjs_Cpa="sankey.node.label.selected",gvjs_Dpa="sankey.node.label.unfocused",gvjs_Epa="sankey.node.label.unselected",gvjs_23="unique";
function gvjs_33(){}gvjs_o(gvjs_33,gvjs_Cl);gvjs_33.prototype.Pb=function(a){try{this.Ac(a)}catch(b){return!1}return!0};
gvjs_33.prototype.Ac=function(a){if(Array.isArray(a)){var b=a;a=gvjs_Dl(b[0]);b=gvjs_Dl(b[1]);var c=a.$();if(3>c)throw Error("Invalid linkTable format: must have at least 3 columns.");this.jb(gvjs_Z3,a,0,gvjs_g);this.jb(gvjs_Z3,a,1,gvjs_g);this.jb(gvjs_Z3,a,2,gvjs_g);var d=null,e=null,f=null,g=3;3<c&&""==a.Jg(3)&&(this.jb(gvjs_Z3,a,3,gvjs_g),d=3,g=4);for(c=g;c<a.$();++c)g=a.Jg(c),g==gvjs_Jd&&null===e?(e=c,this.jb(gvjs_Z3,a,c,gvjs_l)):g==gvjs_Pd&&null===f&&(f=c,this.jb(gvjs_Z3,a,c,gvjs_l));c=b.$();
if(1!==c&&2!==c)throw Error("Invalid nodeTable format: must have 1 or 2 columns.");this.jb("nodetable",b,0,gvjs_l);2===c&&this.jb("nodetable",b,1,gvjs_l);g=[];for(var h=[],k=b.ca(),l=0,m=a.ca();l<m;++l){var n=a.getValue(l,0),p=a.getValue(l,1);if(n>=k||p>=k)throw Error("Invalid linkTable row: source and target nodes must be in the range 0 to "+(k-1)+".");var q=a.getValue(l,2),r=null,t=null,u=null;null!=e&&(r=a.getStringValue(l,e));null!=d&&(t=a.getValue(l,d));null!=f&&(u=a.getValue(l,f));h.push({source:n,
target:p,value:q,style:r,tooltip:u,opacity:t})}a=0;for(e=b.ca();a<e;++a)g.push({name:b.getValue(a,0),Eb:2===c?b.getValue(a,1):""});return{links:h,nodes:g,pF:f,VR:d}}a=gvjs_Dl(a);c=a.$();if(3>c)throw Error("Invalid data table format: must have at least 3 columns.");this.jb(gvjs_fp,a,0,gvjs_l);this.jb(gvjs_fp,a,1,gvjs_l);this.jb(gvjs_fp,a,2,gvjs_g);f=d=b=null;e=3;3<c&&""==a.Jg(3)&&(this.jb(gvjs_fp,a,3,gvjs_g),b=3,e=4);for(c=e;c<a.$();++c)e=a.Jg(c),e==gvjs_Jd&&null===d?(d=c,this.jb(gvjs_fp,a,c,gvjs_l)):
e==gvjs_Pd&&null===f&&(f=c,this.jb(gvjs_fp,a,c,gvjs_l));c=new Map;e=[];g=[];h=0;for(k=a.ca();h<k;++h)l=a.getStringValue(h,0),m=a.getStringValue(h,1),l=gvjs_Fpa(c,e,l),m=gvjs_Fpa(c,e,m),n=a.getValue(h,2),p=null,null!=d&&(p=a.getStringValue(h,d)),q=null!=f?a.getValue(h,f):null,r=null,null!=b&&(r=a.getValue(h,b)),g.push({source:l,target:m,value:n,style:p,tooltip:q,opacity:r});return{links:g,nodes:e,pF:f,VR:b}};
function gvjs_Fpa(a,b,c){if(a.has(c))return a.get(c);a.set(c,b.length);b.push({name:c,Eb:""});return b.length-1}gvjs_33.prototype.jb=function(a,b,c,d,e){if(!gvjs_Gl(b,c,d,e))throw Error(gvjs_hs+a+": column #"+c+gvjs_ba+d+"'.");};function gvjs_43(a,b){gvjs_OR.call(this);this.xa=null;this.Hi=b;this.VI=null;this.u3=new Set;this.t3=new Set;this.ua=a}gvjs_o(gvjs_43,gvjs_OR);
gvjs_43.prototype.AB=function(a){var b=[],c=gvjs_GL(a.Oa());this.xa&&(this.ua.$f?gvjs_IG(this.xa,this.Hi.getContainer()):b.push(new gvjs_NR(gvjs_KG(this.xa,c).j(),new gvjs_IL(gvjs_NQ),gvjs_Pd)),this.xa=null);var d=new Set,e=new Set,f=new Set,g=new Set;null!=this.VI&&gvjs_Gpa(this,this.VI,e,d);var h=gvjs_8d(this.t3);for(a=h.next();!a.done;a=h.next())gvjs_Hpa(this,a.value,f,g);h=gvjs_8d(this.u3);for(a=h.next();!a.done;a=h.next())gvjs_Ipa(this,a.value,f,g);var k=0<g.size,l=0<d.size;gvjs_u(this.ua.labels,
function(p,q){var r=p.styles.Hd,t=gvjs_TQ;g.has(q)&&d.has(q)?(r=p.styles.dL,t=gvjs_Cs):d.has(q)?r=p.styles.focused:g.has(q)?(r=p.styles.selected,t=gvjs_Cs):k&&l?r=p.styles.eM:k?r=p.styles.dM:l&&(r=p.styles.cM);p=c.ys(p.text,p.x,p.y,p.width,p.angle,p.bA,p.dA,r);q=gvjs_KL(gvjs_KL(new gvjs_IL(gvjs_3r),gvjs_ps,q),gvjs_rs,gvjs_8c);b.push(new gvjs_NR(p,q,t))},this);gvjs_u(this.ua.wS,function(p,q){var r=gvjs_KL(gvjs_KL(gvjs_JL(q),gvjs_rs,"node"),"NAME",this.ua.labels[q].text),t=p.Rb.Hd,u=gvjs_TQ;g.has(q)&&
d.has(q)?(t=p.Rb.dL,u=gvjs_YQ):d.has(q)?t=p.Rb.focused:g.has(q)?(u=gvjs_YQ,t=p.Rb.selected):k&&l?t=p.Rb.eM:k?t=p.Rb.dM:l&&(t=p.Rb.cM);p=c.Bl(p.x,p.y,p.width,p.height,t);b.push(new gvjs_NR(p,r,u))},this);var m=0<f.size,n=0<e.size;gvjs_u(this.ua.paths,function(p,q){var r=gvjs_KL(gvjs_KL(new gvjs_IL(gvjs_os),gvjs_ps,q),gvjs_rs,"link"),t=p.Rb.Hd,u=gvjs_Cw;f.has(q)&&e.has(q)?(t=p.Rb.dL,u=gvjs_YQ):e.has(q)?t=p.Rb.focused:f.has(q)?(u=gvjs_YQ,t=p.Rb.selected):m&&n?t=p.Rb.eM:m?t=p.Rb.dM:n&&(t=p.Rb.cM);p=c.Dc(p.vc,
t);b.push(new gvjs_NR(p,r,u))},this);return b};gvjs_43.prototype.Tb=function(){return this.ua.size};function gvjs_Gpa(a,b,c,d){b=b.rb.SUBTYPE;if(null!=a.VI){var e=a.VI.rb.ROW_INDEX;"node"===b?gvjs_Ipa(a,e,c,d):"link"===b&&gvjs_Hpa(a,e,c,d)}}function gvjs_Hpa(a,b,c,d){a=a.ua.paths[b];c.add(b);d.add(a.A$);d.add(a.Gga)}function gvjs_Ipa(a,b,c,d){d.add(b);gvjs_u(gvjs_nj(a.ua.Rsa[b]),function(e){c.add(e);e=a.ua.paths[e];d.add(e.A$);d.add(e.Gga)})}
gvjs_43.prototype.nm=function(a,b,c){switch(b.type){case gvjs_Pd:a.type()===gvjs_os?this.bz(a,c):a.type();break;case gvjs_xu:a.type()===gvjs_os?this.VI=c?a:null:a.type();break;case gvjs_k:a.type()===gvjs_os&&(b=a.rb.ROW_INDEX,"node"===a.rb.SUBTYPE?c?this.u3.add(b):this.u3.delete(b):c?this.t3.add(b):this.t3.delete(b))}};
gvjs_43.prototype.bz=function(a,b){this.Hi.clear();this.xa=null;if(b){b=a.rb.SUBTYPE;var c=a.rb.ROW_INDEX;a=this.ua.size;a=new gvjs_B(0,a.width,a.height,0);var d=null,e=null,f=null,g=null;"node"==b?(g=this.ua.wS[c],e=new gvjs_z(g.x,g.y),f=gvjs_ez(e,new gvjs_z(-1,1))):"link"==b&&(g=this.ua.paths[c],b=g.vc,e=new gvjs_z((b.vc[0].data.x+b.vc[1].data.x)/2,(b.vc[0].data.y+b.vc[1].data.y)/2),f=gvjs_ez(e,new gvjs_z(-1,1)));g.tooltip&&e&&f&&(g.tooltip.content&&this.ua.$f?d={html:gvjs_5f(gvjs_Ob,{"class":gvjs_Nu},
gvjs_OA(g.tooltip.content)),hO:g.tooltip.Nh,pivot:f,anchor:e,HG:a,spacing:20,margin:5}:(b={entries:[]},g.tooltip.content?b.entries.push(gvjs_hG(g.tooltip.content,this.ua.Dp)):g.tooltip.title&&(b.entries.push(gvjs_hG(g.tooltip.title,this.ua.Dp)),b.entries.push(gvjs_hG(g.tooltip.pxa.toString(),this.ua.Dp,g.tooltip.nxa,this.ua.Dp)),g.tooltip.Lda&&g.tooltip.Mda&&b.entries.push(gvjs_hG(g.tooltip.Mda.toString(),this.ua.Dp,g.tooltip.Lda,this.ua.Dp))),d=gvjs_kG(b,this.ua.sc,!1,e,a,f,void 0,this.ua.$f)));
d&&(this.xa=d)}};var gvjs_Jpa={NONE:gvjs_f,vBa:"source",GBa:"target",jAa:gvjs_Bp},gvjs_Kpa={oV:gvjs_Ht,SBa:gvjs_23};function gvjs_Lpa(a,b,c,d){this.Z=a;this.m=b;this.Zd=c;this.eb=d;this.gb=(new gvjs_33).Ac(a);this.vsa=gvjs_L(b,"sankey.iterations");this.kca=gvjs_qy(b,"sankey.link.color");gvjs_qy(b,"sankey.link.focused");gvjs_qy(b,"sankey.link.unfocused");a=b.cD("sankey.link.colors");this.lca=null==a?null:gvjs_v(a,function(e){return gvjs_vj(gvjs_qj(e).hex)});this.uD=gvjs_J(b,"sankey.link.colorMode",gvjs_f,gvjs_Jpa);this.Ema=gvjs_L(b,"sankey.link.defaultOpacity",this.kca.fillOpacity);this.Sca=gvjs_L(b,"sankey.link.minOpacity",
.2);this.gta=gvjs_L(b,"sankey.link.maxOpacity",.6);a=b.cD("sankey.node.colors");this.Rta=null==a?null:gvjs_v(a,function(e){return gvjs_vj(gvjs_qj(e).hex)});this.Qta=gvjs_qy(b,"sankey.node.color");this.w1=gvjs_J(b,"sankey.node.colorMode",gvjs_23,gvjs_Kpa);this.bQ=gvjs_K(b,gvjs_2u,!1);this.Oe=gvjs_ry(b,"sankey.node.label");this.Wba=gvjs_L(b,"sankey.node.labelPadding");this.Sta=gvjs_L(b,"sankey.node.nodePadding");this.Tta=gvjs_L(b,"sankey.node.width")}
gvjs_Lpa.prototype.$g=function(){var a=gvjs_Mpa(this);gvjs_Npa(a);var b=this.Oe.fontSize;b=d3.sankey().nodeWidth(this.Tta).nodePadding(this.Sta).size([this.eb.width,this.eb.height-b/2]).iterations(this.vsa);b(a);gvjs_Opa(a.nodes);var c=new gvjs__R(this.bQ,this.Rta),d=new gvjs__R(this.bQ,this.lca),e=[],f=[],g=[],h=null==this.lca&&this.w1===gvjs_23;gvjs_u(a.nodes,function(w,x){w.idx=x;c.Au(this.w1===gvjs_Ht?w.Eb:String(x));h||("source"===this.uD&&0<w.sourceLinks.length||"target"===this.uD&&0<w.targetLinks.length||
this.uD===gvjs_Bp)&&d.Au(String(x))},this);var k=null;null!=this.gb.pF&&(k=this.gb.pF);var l=this.Z.Ga(2);null===l&&(l="Width");var m=null;null!=this.gb.VR&&(m=this.Z.Ga(this.gb.VR),null===m&&(m="Opacity"));var n=Infinity,p=-Infinity;null!=this.gb.VR&&gvjs_u(a.links,function(w){null!=w.opacity&&(n=Math.min(n,w.opacity),p=Math.max(p,w.opacity))},this);var q=c.cd(),r=h?q:d.cd();gvjs_u(a.links,function(w,x){w.idx=x;var y=this.Ema;null!=w.opacity&&p>n&&(y=this.Sca+(w.opacity-n)/(p-n)*(this.gta-this.Sca));
var z=this.kca.clone();z.mf(y);y="source"===this.uD?String(w.source.idx):"target"===this.uD?String(w.target.idx):null;null!=y?z.Te(r.Cq(y)):this.uD===gvjs_Bp&&gvjs_cy(z,{Vf:r.Cq(String(w.source.idx)),sf:r.Cq(String(w.target.idx)),tn:1,un:1,x1:gvjs_Ro,y1:0,x2:gvjs_So,y2:0,Sn:!0,sp:!1});y=w.style;if(null!=y&&(y=gvjs_bJ(y),null!=y)){y=new gvjs_Aj([y]);var A=void 0===A?"":A;z.Te(gvjs_oy(y,[A+gvjs_pp,A+gvjs_np],z.fill));z.mf(gvjs_ny(y,A+gvjs_qp,z.fillOpacity));z.rd(gvjs_oy(y,[A+gvjs_3p,A+gvjs_0p],z.Uj()));
gvjs_ay(z,gvjs_ny(y,A+gvjs_4p,z.strokeOpacity));z.hl(gvjs_L(y,A+gvjs_5p,z.strokeWidth))}x=null!=k&&w.tooltip?{Nh:!(!this.Z.getProperty(x,k,gvjs_av)&&!this.Z.Bd(k,gvjs_av)),content:w.tooltip}:{title:w.source.name+" -> "+w.target.name,nxa:l,pxa:w.value,Lda:m,Mda:w.opacity};A=new gvjs_SA;y=w.source.x0+(w.source.x1-w.source.x0);var B=w.source.y0+(w.y0-w.source.y0-w.width/2),D=w.target.x0,C=w.target.y0+(w.y1-w.target.y0-w.width/2),G=(D-y)/3;A.move(y,B);A.Jp(y+G,B,y+2*G,C,D,C);A.va(D,C+w.width);A.Jp(y+
2*G,C+w.width,y+G,B+w.width,y,B+w.width);A.close();y=null==this.m.fa(gvjs_wpa)?z.clone().mf(.8):gvjs_qy(this.m,gvjs_wpa,z);B=null==this.m.fa(gvjs__3)?z.clone().mf(.8):gvjs_qy(this.m,gvjs__3,z);D=gvjs_qy(this.m,gvjs_xpa,z);C=null==this.m.fa(gvjs_ypa)?z.clone().mf(.2):gvjs_qy(this.m,gvjs_ypa,z);G=gvjs_qy(this.m,gvjs__3,y);var J=gvjs_qy(this.m,gvjs_xpa,C);e.push({Rb:{Hd:z,selected:y,focused:B,cM:D,dM:C,dL:G,eM:J},tooltip:x,A$:w.source.idx,Gga:w.target.idx,vc:A})},this);var t=this.eb.width,u=b.nodeWidth(),
v={};gvjs_u(a.nodes,function(w,x){var y=new Set;gvjs_u(w.sourceLinks,function(I){y.add(I.idx)},this);gvjs_u(w.targetLinks,function(I){y.add(I.idx)},this);v[x]=y;x=w.x0<t/2;var z=this.Qta.clone();z.Te(q.Cq(this.w1===gvjs_Ht?w.Eb:String(w.idx)));z.rd(z.fill,0);var A=null==this.m.fa(gvjs_zpa)?z.clone().mf(1):gvjs_qy(this.m,gvjs_zpa,z),B=null==this.m.fa(gvjs_03)?z.clone().mf(1):gvjs_qy(this.m,gvjs_03,z),D=gvjs_qy(this.m,gvjs_Apa,z),C=null==this.m.fa(gvjs_Bpa)?z.clone().mf(.2):gvjs_qy(this.m,gvjs_Bpa,
z),G=gvjs_qy(this.m,gvjs_03,A),J=gvjs_qy(this.m,gvjs_Apa,C);g.push({Rb:{Hd:z,selected:A,focused:B,cM:D,dM:C,dL:G,eM:J},x:w.x0,y:w.y0,tooltip:w.tooltip,width:u,height:w.y1-w.y0});z=null==this.m.fa(gvjs_Cpa)?gvjs_jy((new gvjs_ly(this.Oe)).setOpacity(.8),!0):gvjs_ry(this.m,gvjs_Cpa,this.Oe);A=null==this.m.fa(gvjs_13)?gvjs_jy((new gvjs_ly(this.Oe)).setOpacity(.8),!0):gvjs_ry(this.m,gvjs_13,this.Oe);B=gvjs_ry(this.m,gvjs_Dpa,this.Oe);D=null==this.m.fa(gvjs_Epa)?(new gvjs_ly(this.Oe)).setOpacity(.4):gvjs_ry(this.m,
gvjs_Epa,this.Oe);C=gvjs_ry(this.m,gvjs_13,z);G=gvjs_ry(this.m,gvjs_Dpa,D);f.push({angle:0,bA:x?gvjs_2:gvjs_R,dA:gvjs_0,styles:{Hd:this.Oe,selected:z,focused:A,cM:B,dM:D,dL:C,eM:G},text:w.name,width:0,x:x?w.x0+u+this.Wba:w.x0-this.Wba,y:w.y0+(w.y1-w.y0)/2})},this);return{labels:f,paths:e,wS:g,Rsa:v,nodeWidth:u,size:this.eb,sc:this.Zd,$f:gvjs_K(this.m,gvjs_nx,!0),Dp:gvjs_ry(this.m,gvjs_px)}};function gvjs_Mpa(a){a=a.gb;return{nodes:a.nodes,links:a.links}}
function gvjs_Npa(a){var b=gvjs_v(a.nodes,function(e,f){return{index:f,Hga:[]}});gvjs_u(a.links,function(e){b[e.source].Hga.push(b[e.target])});a=new Set(b);for(var c=new Set,d=0;0<a.size;){if(d>b.length)throw a=gvjs_v(gvjs_nj(a),function(e){return e.index}).join(","),Error("Cycle found in rows: "+a);gvjs_u(gvjs_nj(a),function(e){gvjs_u(e.Hga,function(f){c.add(f)})});a=c;c=new Set;d++}}
function gvjs_Opa(a){gvjs_u(a,function(b){gvjs_Qe(b.targetLinks,function(c,d){function e(f){return(f.target.y0-(f.source.y0+(f.y0-f.source.y0-f.width/2)))/(f.target.x0-f.source.x0)}return e(d)-e(c)})});gvjs_u(a,function(b){var c=0;gvjs_u(b.targetLinks,function(d){d.y1=c+d.target.y0+d.width/2;c+=d.width})})};function gvjs_53(a){gvjs_UL.call(this,a)}gvjs_o(gvjs_53,gvjs_UL);gvjs_=gvjs_53.prototype;gvjs_.xq=function(){return{NAME:gvjs_Zv}};
gvjs_.og=function(){return{backgroundColor:{fill:gvjs_Ox,stroke:gvjs_rt,strokeWidth:10,strokeOpacity:.2},tooltip:{isHtml:!1,textStyle:{fontName:gvjs_2r,fontSize:16,color:gvjs_rt}},sankey:{iterations:32,link:{colorMode:gvjs_f,color:{fill:"#aaa",fillOpacity:.8,stroke:gvjs_f},defaultOpacity:.6,minOpacity:.2,maxOpacity:.6},node:{colorMode:gvjs_23,color:{fill:gvjs_rt,fillOpacity:.8},label:{fontName:gvjs_Dw,fontSize:10,color:gvjs_kr,bold:!1,italic:!1},labelPadding:6,nodePadding:10,width:10,interactivity:!1,
selectionMode:gvjs_Ww}}}};gvjs_.Mm=function(a,b){return new gvjs_43(a,b)};gvjs_.Al=function(a,b,c,d){return new gvjs_Lpa(a,b,c,d)};gvjs_.po=function(a,b,c,d){a=gvjs_UL.prototype.po.call(this,a,b,c,d);a.$t([gvjs_Cw,gvjs_TQ,gvjs_Bw,gvjs_YQ,gvjs_Ds,gvjs_Cs,gvjs_Pd]);return a};
gvjs_.xs=function(a){var b=gvjs_K(a,"sankey.node.interactivity",!1),c=[new gvjs_JR([new gvjs_IL(gvjs_os)]),new gvjs_MR([new gvjs_IL(gvjs_os)])];b&&c.push(new gvjs_LR([gvjs_KL(new gvjs_IL(gvjs_os),gvjs_rs,"node")]));gvjs_K(a,"sankey.link.interactivity",!1)&&(a=gvjs_J(a,"sankey.link.selectionMode",gvjs_Ww)===gvjs_Ww,c.push(new gvjs_KR([gvjs_KL(new gvjs_IL(gvjs_os),gvjs_rs,"link")],a)));return c};gvjs_q(gvjs_Mc,gvjs_53,void 0);gvjs_53.prototype.draw=gvjs_53.prototype.draw;gvjs_53.prototype.setSelection=gvjs_53.prototype.setSelection;gvjs_53.prototype.getSelection=gvjs_53.prototype.getSelection;gvjs_53.prototype.clearChart=gvjs_53.prototype.Jb;gvjs_53.prototype.getContainer=gvjs_53.prototype.getContainer;