import{$a as Lt,A as bt,G as Ft,Ia as St,Xa as wt,Za as Q,b as Vt,bb as At,c as Wt,cb as Et,db as Tt,eb as Ct,fb as Mt,gb as Ot,h as X,hb as It,l as vt}from"./chunk-PBNKOM7K.min.js";import{d as ot}from"./chunk-P42HNYSU.min.js";function G(t,n){let o;if(n===void 0)for(let l of t)l!=null&&(o<l||o===void 0&&l>=l)&&(o=l);else{let l=-1;for(let f of t)(f=n(f,++l,t))!=null&&(o<f||o===void 0&&f>=f)&&(o=f)}return o}function $(t,n){let o;if(n===void 0)for(let l of t)l!=null&&(o>l||o===void 0&&l>=l)&&(o=l);else{let l=-1;for(let f of t)(f=n(f,++l,t))!=null&&(o>f||o===void 0&&f>=f)&&(o=f)}return o}function B(t,n){let o=0;if(n===void 0)for(let l of t)(l=+l)&&(o+=l);else{let l=-1;for(let f of t)(f=+n(f,++l,t))&&(o+=f)}return o}function Ut(t){return t.target.depth}function st(t){return t.depth}function it(t,n){return n-1-t.height}function K(t,n){return t.sourceLinks.length?t.depth:n-1}function at(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks,Ut)-1:0}function V(t){return function(){return t}}function Nt(t,n){return J(t.source,n.source)||t.index-n.index}function Pt(t,n){return J(t.target,n.target)||t.index-n.index}function J(t,n){return t.y0-n.y0}function lt(t){return t.value}function Yt(t){return t.index}function qt(t){return t.nodes}function Ht(t){return t.links}function zt(t,n){let o=t.get(n);if(!o)throw new Error("missing: "+n);return o}function Rt({nodes:t}){for(let n of t){let o=n.y0,l=o;for(let f of n.sourceLinks)f.y0=o+f.width/2,o+=f.width;for(let f of n.targetLinks)f.y1=l+f.width/2,l+=f.width}}function Z(){let t=0,n=0,o=1,l=1,f=24,k=8,y,g=Yt,r=K,i,u,m=qt,b=Ht,d=6;function _(){let e={nodes:m.apply(null,arguments),links:b.apply(null,arguments)};return A(e),L(e),E(e),M(e),w(e),Rt(e),e}_.update=function(e){return Rt(e),e},_.nodeId=function(e){return arguments.length?(g=typeof e=="function"?e:V(e),_):g},_.nodeAlign=function(e){return arguments.length?(r=typeof e=="function"?e:V(e),_):r},_.nodeSort=function(e){return arguments.length?(i=e,_):i},_.nodeWidth=function(e){return arguments.length?(f=+e,_):f},_.nodePadding=function(e){return arguments.length?(k=y=+e,_):k},_.nodes=function(e){return arguments.length?(m=typeof e=="function"?e:V(e),_):m},_.links=function(e){return arguments.length?(b=typeof e=="function"?e:V(e),_):b},_.linkSort=function(e){return arguments.length?(u=e,_):u},_.size=function(e){return arguments.length?(t=n=0,o=+e[0],l=+e[1],_):[o-t,l-n]},_.extent=function(e){return arguments.length?(t=+e[0][0],o=+e[1][0],n=+e[0][1],l=+e[1][1],_):[[t,n],[o,l]]},_.iterations=function(e){return arguments.length?(d=+e,_):d};function A({nodes:e,links:h}){for(let[c,s]of e.entries())s.index=c,s.sourceLinks=[],s.targetLinks=[];let a=new Map(e.map((c,s)=>[g(c,s,e),c]));for(let[c,s]of h.entries()){s.index=c;let{source:x,target:v}=s;typeof x!="object"&&(x=s.source=zt(a,x)),typeof v!="object"&&(v=s.target=zt(a,v)),x.sourceLinks.push(s),v.targetLinks.push(s)}if(u!=null)for(let{sourceLinks:c,targetLinks:s}of e)c.sort(u),s.sort(u)}function L({nodes:e}){for(let h of e)h.value=h.fixedValue===void 0?Math.max(B(h.sourceLinks,lt),B(h.targetLinks,lt)):h.fixedValue}function E({nodes:e}){let h=e.length,a=new Set(e),c=new Set,s=0;for(;a.size;){for(let x of a){x.depth=s;for(let{target:v}of x.sourceLinks)c.add(v)}if(++s>h)throw new Error("circular link");a=c,c=new Set}}function M({nodes:e}){let h=e.length,a=new Set(e),c=new Set,s=0;for(;a.size;){for(let x of a){x.height=s;for(let{source:v}of x.targetLinks)c.add(v)}if(++s>h)throw new Error("circular link");a=c,c=new Set}}function O({nodes:e}){let h=G(e,s=>s.depth)+1,a=(o-t-f)/(h-1),c=new Array(h);for(let s of e){let x=Math.max(0,Math.min(h-1,Math.floor(r.call(null,s,h))));s.layer=x,s.x0=t+x*a,s.x1=s.x0+f,c[x]?c[x].push(s):c[x]=[s]}if(i)for(let s of c)s.sort(i);return c}function R(e){let h=$(e,a=>(l-n-(a.length-1)*y)/B(a,lt));for(let a of e){let c=n;for(let s of a){s.y0=c,s.y1=c+s.value*h,c=s.y1+y;for(let x of s.sourceLinks)x.width=x.value*h}c=(l-c+y)/(a.length+1);for(let s=0;s<a.length;++s){let x=a[s];x.y0+=c*(s+1),x.y1+=c*(s+1)}P(a)}}function w(e){let h=O(e);y=Math.min(k,(l-n)/(G(h,a=>a.length)-1)),R(h);for(let a=0;a<d;++a){let c=Math.pow(.99,a),s=Math.max(1-c,(a+1)/d);z(h,c,s),C(h,c,s)}}function C(e,h,a){for(let c=1,s=e.length;c<s;++c){let x=e[c];for(let v of x){let U=0,D=0;for(let{source:q,value:rt}of v.targetLinks){let H=rt*(v.layer-q.layer);U+=T(q,v)*H,D+=H}if(!(D>0))continue;let Y=(U/D-v.y0)*h;v.y0+=Y,v.y1+=Y,S(v)}i===void 0&&x.sort(J),I(x,a)}}function z(e,h,a){for(let c=e.length,s=c-2;s>=0;--s){let x=e[s];for(let v of x){let U=0,D=0;for(let{target:q,value:rt}of v.sourceLinks){let H=rt*(q.layer-v.layer);U+=F(v,q)*H,D+=H}if(!(D>0))continue;let Y=(U/D-v.y0)*h;v.y0+=Y,v.y1+=Y,S(v)}i===void 0&&x.sort(J),I(x,a)}}function I(e,h){let a=e.length>>1,c=e[a];p(e,c.y0-y,a-1,h),N(e,c.y1+y,a+1,h),p(e,l,e.length-1,h),N(e,n,0,h)}function N(e,h,a,c){for(;a<e.length;++a){let s=e[a],x=(h-s.y0)*c;x>1e-6&&(s.y0+=x,s.y1+=x),h=s.y1+y}}function p(e,h,a,c){for(;a>=0;--a){let s=e[a],x=(s.y1-h)*c;x>1e-6&&(s.y0-=x,s.y1-=x),h=s.y0-y}}function S({sourceLinks:e,targetLinks:h}){if(u===void 0){for(let{source:{sourceLinks:a}}of h)a.sort(Pt);for(let{target:{targetLinks:a}}of e)a.sort(Nt)}}function P(e){if(u===void 0)for(let{sourceLinks:h,targetLinks:a}of e)h.sort(Pt),a.sort(Nt)}function T(e,h){let a=e.y0-(e.sourceLinks.length-1)*y/2;for(let{target:c,width:s}of e.sourceLinks){if(c===h)break;a+=s+y}for(let{source:c,width:s}of h.targetLinks){if(c===e)break;a-=s}return a}function F(e,h){let a=h.y0-(h.targetLinks.length-1)*y/2;for(let{source:c,width:s}of h.targetLinks){if(c===e)break;a+=s+y}for(let{target:c,width:s}of e.sourceLinks){if(c===h)break;a-=s}return a}return _}var ut=Math.PI,ft=2*ut,j=1e-6,Xt=ft-j;function ct(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Dt(){return new ct}ct.prototype=Dt.prototype={constructor:ct,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,o,l){this._+="Q"+ +t+","+ +n+","+(this._x1=+o)+","+(this._y1=+l)},bezierCurveTo:function(t,n,o,l,f,k){this._+="C"+ +t+","+ +n+","+ +o+","+ +l+","+(this._x1=+f)+","+(this._y1=+k)},arcTo:function(t,n,o,l,f){t=+t,n=+n,o=+o,l=+l,f=+f;var k=this._x1,y=this._y1,g=o-t,r=l-n,i=k-t,u=y-n,m=i*i+u*u;if(f<0)throw new Error("negative radius: "+f);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(m>j)if(!(Math.abs(u*g-r*i)>j)||!f)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var b=o-k,d=l-y,_=g*g+r*r,A=b*b+d*d,L=Math.sqrt(_),E=Math.sqrt(m),M=f*Math.tan((ut-Math.acos((_+m-A)/(2*L*E)))/2),O=M/E,R=M/L;Math.abs(O-1)>j&&(this._+="L"+(t+O*i)+","+(n+O*u)),this._+="A"+f+","+f+",0,0,"+ +(u*b>i*d)+","+(this._x1=t+R*g)+","+(this._y1=n+R*r)}},arc:function(t,n,o,l,f,k){t=+t,n=+n,o=+o,k=!!k;var y=o*Math.cos(l),g=o*Math.sin(l),r=t+y,i=n+g,u=1^k,m=k?l-f:f-l;if(o<0)throw new Error("negative radius: "+o);this._x1===null?this._+="M"+r+","+i:(Math.abs(this._x1-r)>j||Math.abs(this._y1-i)>j)&&(this._+="L"+r+","+i),o&&(m<0&&(m=m%ft+ft),m>Xt?this._+="A"+o+","+o+",0,1,"+u+","+(t-y)+","+(n-g)+"A"+o+","+o+",0,1,"+u+","+(this._x1=r)+","+(this._y1=i):m>j&&(this._+="A"+o+","+o+",0,"+ +(m>=ut)+","+u+","+(this._x1=t+o*Math.cos(f))+","+(this._y1=n+o*Math.sin(f))))},rect:function(t,n,o,l){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +o+"v"+ +l+"h"+-o+"Z"},toString:function(){return this._}};var ht=Dt;function dt(t){return function(){return t}}function jt(t){return t[0]}function $t(t){return t[1]}var Bt=Array.prototype.slice;function Gt(t){return t.source}function Kt(t){return t.target}function Qt(t){var n=Gt,o=Kt,l=jt,f=$t,k=null;function y(){var g,r=Bt.call(arguments),i=n.apply(this,r),u=o.apply(this,r);if(k||(k=g=ht()),t(k,+l.apply(this,(r[0]=i,r)),+f.apply(this,r),+l.apply(this,(r[0]=u,r)),+f.apply(this,r)),g)return k=null,g+""||null}return y.source=function(g){return arguments.length?(n=g,y):n},y.target=function(g){return arguments.length?(o=g,y):o},y.x=function(g){return arguments.length?(l=typeof g=="function"?g:dt(+g),y):l},y.y=function(g){return arguments.length?(f=typeof g=="function"?g:dt(+g),y):f},y.context=function(g){return arguments.length?(k=g??null,y):k},y}function Jt(t,n,o,l,f){t.moveTo(n,o),t.bezierCurveTo(n=(n+l)/2,o,n,f,l,f)}function pt(){return Qt(Jt)}function Zt(t){return[t.source.x1,t.y0]}function te(t){return[t.target.x0,t.y1]}function yt(){return pt().source(Zt).target(te)}var Je=ot(Vt(),1),Ze=ot(Wt(),1),tn=ot(Ft(),1);var mt=function(){var t=function(g,r,i,u){for(i=i||{},u=g.length;u--;i[g[u]]=r);return i},n=[1,9],o=[1,10],l=[1,5,10,12],f={trace:function(){},yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:function(r,i,u,m,b,d,_){var A=d.length-1;switch(b){case 7:let L=m.findOrCreateNode(d[A-4].trim().replaceAll('""','"')),E=m.findOrCreateNode(d[A-2].trim().replaceAll('""','"')),M=parseFloat(d[A].trim());m.addLink(L,E,M);break;case 8:case 9:case 11:this.$=d[A];break;case 10:this.$=d[A-1];break}},table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:o},{1:[2,6],7:11,10:[1,12]},t(o,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(l,[2,8]),t(l,[2,9]),{19:[1,16]},t(l,[2,11]),{1:[2,1]},{1:[2,5]},t(o,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:o},{15:18,16:7,17:8,18:n,20:o},{18:[1,19]},t(o,[2,3]),{12:[1,20]},t(l,[2,10]),{15:21,16:7,17:8,18:n,20:o},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:function(r,i){if(i.recoverable)this.trace(r);else{var u=new Error(r);throw u.hash=i,u}},parse:function(r){var i=this,u=[0],m=[],b=[null],d=[],_=this.table,A="",L=0,E=0,M=2,O=1,R=d.slice.call(arguments,1),w=Object.create(this.lexer),C={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(C.yy[z]=this.yy[z]);w.setInput(r,C.yy),C.yy.lexer=w,C.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var I=w.yylloc;d.push(I);var N=w.options&&w.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function p(){var v;return v=m.pop()||w.lex()||O,typeof v!="number"&&(v instanceof Array&&(m=v,v=m.pop()),v=i.symbols_[v]||v),v}for(var S,P,T,F,e={},h,a,c,s;;){if(P=u[u.length-1],this.defaultActions[P]?T=this.defaultActions[P]:((S===null||typeof S>"u")&&(S=p()),T=_[P]&&_[P][S]),typeof T>"u"||!T.length||!T[0]){var x="";s=[];for(h in _[P])this.terminals_[h]&&h>M&&s.push("'"+this.terminals_[h]+"'");w.showPosition?x="Parse error on line "+(L+1)+`:
`+w.showPosition()+`
Expecting `+s.join(", ")+", got '"+(this.terminals_[S]||S)+"'":x="Parse error on line "+(L+1)+": Unexpected "+(S==O?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(x,{text:w.match,token:this.terminals_[S]||S,line:w.yylineno,loc:I,expected:s})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+S);switch(T[0]){case 1:u.push(S),b.push(w.yytext),d.push(w.yylloc),u.push(T[1]),S=null,E=w.yyleng,A=w.yytext,L=w.yylineno,I=w.yylloc;break;case 2:if(a=this.productions_[T[1]][1],e.$=b[b.length-a],e._$={first_line:d[d.length-(a||1)].first_line,last_line:d[d.length-1].last_line,first_column:d[d.length-(a||1)].first_column,last_column:d[d.length-1].last_column},N&&(e._$.range=[d[d.length-(a||1)].range[0],d[d.length-1].range[1]]),F=this.performAction.apply(e,[A,E,L,C.yy,T[1],b,d].concat(R)),typeof F<"u")return F;a&&(u=u.slice(0,-1*a*2),b=b.slice(0,-1*a),d=d.slice(0,-1*a)),u.push(this.productions_[T[1]][0]),b.push(e.$),d.push(e._$),c=_[u[u.length-2]][u[u.length-1]],u.push(c);break;case 3:return!0}}return!0}},k=function(){var g={EOF:1,parseError:function(i,u){if(this.yy.parser)this.yy.parser.parseError(i,u);else throw new Error(i)},setInput:function(r,i){return this.yy=i||this.yy||{},this._input=r,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},input:function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var i=r.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},unput:function(r){var i=r.length,u=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;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),u.length-1&&(this.yylineno-=u.length-1);var b=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:u?(u.length===m.length?this.yylloc.first_column:0)+m[m.length-u.length].length-u[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[b[0],b[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject: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).
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(r){this.unput(this.match.slice(r))},pastInput:function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var r=this.pastInput(),i=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
`+i+"^"},test_match:function(r,i){var u,m,b;if(this.options.backtrack_lexer&&(b={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&&(b.yylloc.range=this.yylloc.range.slice(0))),m=r[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+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,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(r[0].length),this.matched+=r[0],u=this.performAction.call(this,this.yy,this,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),u)return u;if(this._backtrack){for(var d in b)this[d]=b[d];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,i,u,m;this._more||(this.yytext="",this.match="");for(var b=this._currentRules(),d=0;d<b.length;d++)if(u=this._input.match(this.rules[b[d]]),u&&(!i||u[0].length>i[0].length)){if(i=u,m=d,this.options.backtrack_lexer){if(r=this.test_match(u,b[d]),r!==!1)return r;if(this._backtrack){i=!1;continue}else return!1}else if(!this.options.flex)break}return i?(r=this.test_match(i,b[m]),r!==!1?r:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var i=this.next();return i||this.lex()},begin:function(i){this.conditionStack.push(i)},popState:function(){var i=this.conditionStack.length-1;return i>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(i){return i=this.conditionStack.length-1-Math.abs(i||0),i>=0?this.conditionStack[i]:"INITIAL"},pushState:function(i){this.begin(i)},stateStackSize:function(){return this.conditionStack.length},options:{easy_keword_rules:!0},performAction:function(i,u,m,b){switch(m){case 0:return this.pushState("csv"),4;case 1:return 10;case 2:return 5;case 3:return 12;case 4:return this.pushState("escaped_text"),18;case 5:return 20;case 6:return this.popState("escaped_text"),18;case 7:return 19}},rules:[/^(?:sankey-beta\b)/,/^(?:$)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:(\u002C))/,/^(?:(\u0022))/,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/,/^(?:(\u0022)(?!(\u0022)))/,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/],conditions:{csv:{rules:[1,2,3,4,5,6,7],inclusive:!1},escaped_text:{rules:[6,7],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};return g}();f.lexer=k;function y(){this.yy={}}return y.prototype=f,f.Parser=y,new y}();mt.parser=mt;var tt=mt,et=[],nt=[],W={},ee=()=>{et=[],nt=[],W={},At()},gt=class{constructor(n,o,l=0){this.source=n,this.target=o,this.value=l}},ne=(t,n,o)=>{et.push(new gt(t,n,o))},xt=class{constructor(n){this.ID=n}},re=t=>(t=St.sanitizeText(t,Q()),W[t]||(W[t]=new xt(t),nt.push(W[t])),W[t]),oe=()=>nt,se=()=>et,ie=()=>({nodes:nt.map(t=>({id:t.ID})),links:et.map(t=>({source:t.source.ID,target:t.target.ID,value:t.value}))}),ae={nodesMap:W,getConfig:()=>Q().sankey,getNodes:oe,getLinks:se,getGraph:ie,addLink:ne,findOrCreateNode:re,getAccTitle:Tt,setAccTitle:Et,getAccDescription:Mt,setAccDescription:Ct,getDiagramTitle:It,setDiagramTitle:Ot,clear:ee},kt=class{static next(t){return new kt(t+ ++kt.count)}constructor(t){this.id=t,this.href=`#${t}`}toString(){return"url("+this.href+")"}},_t=kt;_t.count=0;var le={left:st,right:it,center:at,justify:K},ue=function(t,n,o,l){let{securityLevel:f,sankey:k}=Q(),y=wt.sankey,g;f==="sandbox"&&(g=X("#i"+n));let r=f==="sandbox"?X(g.nodes()[0].contentDocument.body):X("body"),i=f==="sandbox"?r.select(`[id="${n}"]`):X(`[id="${n}"]`),u=k?.width??y.width,m=k?.height??y.width,b=k?.useMaxWidth??y.useMaxWidth,d=k?.nodeAlignment??y.nodeAlignment,_=k?.prefix??y.prefix,A=k?.suffix??y.suffix,L=k?.showValues??y.showValues;Lt(i,m,u,b);let E=l.db.getGraph(),M=le[d],O=10;Z().nodeId(p=>p.id).nodeWidth(O).nodePadding(10+(L?15:0)).nodeAlign(M).extent([[0,0],[u,m]])(E);let w=vt(bt);i.append("g").attr("class","nodes").selectAll(".node").data(E.nodes).join("g").attr("class","node").attr("id",p=>(p.uid=_t.next("node-")).id).attr("transform",function(p){return"translate("+p.x0+","+p.y0+")"}).attr("x",p=>p.x0).attr("y",p=>p.y0).append("rect").attr("height",p=>p.y1-p.y0).attr("width",p=>p.x1-p.x0).attr("fill",p=>w(p.id));let C=({id:p,value:S})=>L?`${p}
${_}${Math.round(S*100)/100}${A}`:p;i.append("g").attr("class","node-labels").attr("font-family","sans-serif").attr("font-size",14).selectAll("text").data(E.nodes).join("text").attr("x",p=>p.x0<u/2?p.x1+6:p.x0-6).attr("y",p=>(p.y1+p.y0)/2).attr("dy",`${L?"0":"0.35"}em`).attr("text-anchor",p=>p.x0<u/2?"start":"end").text(C);let z=i.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(E.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),I=k?.linkColor||"gradient";if(I==="gradient"){let p=z.append("linearGradient").attr("id",S=>(S.uid=_t.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",S=>S.source.x1).attr("x2",S=>S.target.x0);p.append("stop").attr("offset","0%").attr("stop-color",S=>w(S.source.id)),p.append("stop").attr("offset","100%").attr("stop-color",S=>w(S.target.id))}let N;switch(I){case"gradient":N=p=>p.uid;break;case"source":N=p=>w(p.source.id);break;case"target":N=p=>w(p.target.id);break;default:N=I}z.append("path").attr("d",yt()).attr("stroke",N).attr("stroke-width",p=>Math.max(1,p.width))},fe={draw:ue},ce=t=>t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,`
`).trim(),he=tt.parse.bind(tt);tt.parse=t=>he(ce(t));var en={parser:tt,db:ae,renderer:fe};export{en as diagram};
//# sourceMappingURL=sankeyDiagram-a7f8e230-TNNMDSPM.min.js.map
