@eventcatalogtest/studio
Version:
A drag and drop UI for distributed systems that keeps your diagrams where they belong – in your repo
4 lines • 21.6 kB
JavaScript
"use strict";exports.id=3300,exports.ids=[3300],exports.modules={73300:(a,b,c)=>{c.d(b,{diagram:()=>_});var d=c(32892),e=c(38073);function f(a,b){let c;if(void 0===b)for(let b of a)null!=b&&(c>b||void 0===c&&b>=b)&&(c=b);else{let d=-1;for(let e of a)null!=(e=b(e,++d,a))&&(c>e||void 0===c&&e>=e)&&(c=e)}return c}function g(a){return a.target.depth}function h(a,b){return a.sourceLinks.length?a.depth:b-1}function i(a,b){let c=0;if(void 0===b)for(let b of a)(b*=1)&&(c+=b);else{let d=-1;for(let e of a)(e=+b(e,++d,a))&&(c+=e)}return c}function j(a,b){let c;if(void 0===b)for(let b of a)null!=b&&(c<b||void 0===c&&b>=b)&&(c=b);else{let d=-1;for(let e of a)null!=(e=b(e,++d,a))&&(c<e||void 0===c&&e>=e)&&(c=e)}return c}function k(a){return function(){return a}}function l(a,b){return n(a.source,b.source)||a.index-b.index}function m(a,b){return n(a.target,b.target)||a.index-b.index}function n(a,b){return a.y0-b.y0}function o(a){return a.value}function p(a){return a.index}function q(a){return a.nodes}function r(a){return a.links}function s(a,b){let c=a.get(b);if(!c)throw Error("missing: "+b);return c}function t({nodes:a}){for(let b of a){let a=b.y0,c=a;for(let c of b.sourceLinks)c.y0=a+c.width/2,a+=c.width;for(let a of b.targetLinks)a.y1=c+a.width/2,c+=a.width}}var u=Math.PI,v=2*u,w=v-1e-6;function x(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function y(){return new x}x.prototype=y.prototype={constructor:x,moveTo:function(a,b){this._+="M"+(this._x0=this._x1=+a)+","+(this._y0=this._y1=+b)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(a,b){this._+="L"+(this._x1=+a)+","+(this._y1=+b)},quadraticCurveTo:function(a,b,c,d){this._+="Q"+ +a+","+ +b+","+(this._x1=+c)+","+(this._y1=+d)},bezierCurveTo:function(a,b,c,d,e,f){this._+="C"+ +a+","+ +b+","+ +c+","+ +d+","+(this._x1=+e)+","+(this._y1=+f)},arcTo:function(a,b,c,d,e){a*=1,b*=1,c*=1,d*=1,e*=1;var f=this._x1,g=this._y1,h=c-a,i=d-b,j=f-a,k=g-b,l=j*j+k*k;if(e<0)throw Error("negative radius: "+e);if(null===this._x1)this._+="M"+(this._x1=a)+","+(this._y1=b);else if(l>1e-6)if(Math.abs(k*h-i*j)>1e-6&&e){var m=c-f,n=d-g,o=h*h+i*i,p=Math.sqrt(o),q=Math.sqrt(l),r=e*Math.tan((u-Math.acos((o+l-(m*m+n*n))/(2*p*q)))/2),s=r/q,t=r/p;Math.abs(s-1)>1e-6&&(this._+="L"+(a+s*j)+","+(b+s*k)),this._+="A"+e+","+e+",0,0,"+ +(k*m>j*n)+","+(this._x1=a+t*h)+","+(this._y1=b+t*i)}else this._+="L"+(this._x1=a)+","+(this._y1=b)},arc:function(a,b,c,d,e,f){a*=1,b*=1,c*=1,f=!!f;var g=c*Math.cos(d),h=c*Math.sin(d),i=a+g,j=b+h,k=1^f,l=f?d-e:e-d;if(c<0)throw Error("negative radius: "+c);null===this._x1?this._+="M"+i+","+j:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-j)>1e-6)&&(this._+="L"+i+","+j),c&&(l<0&&(l=l%v+v),l>w?this._+="A"+c+","+c+",0,1,"+k+","+(a-g)+","+(b-h)+"A"+c+","+c+",0,1,"+k+","+(this._x1=i)+","+(this._y1=j):l>1e-6&&(this._+="A"+c+","+c+",0,"+ +(l>=u)+","+k+","+(this._x1=a+c*Math.cos(e))+","+(this._y1=b+c*Math.sin(e))))},rect:function(a,b,c,d){this._+="M"+(this._x0=this._x1=+a)+","+(this._y0=this._y1=+b)+"h"+ +c+"v"+ +d+"h"+-c+"Z"},toString:function(){return this._}};var z=Array.prototype.slice;function A(a){return function(){return a}}function B(a){return a[0]}function C(a){return a[1]}function D(a){return a.source}function E(a){return a.target}function F(a,b,c,d,e){a.moveTo(b,c),a.bezierCurveTo(b=(b+d)/2,c,b,e,d,e)}function G(a){return[a.source.x1,a.y0]}function H(a){return[a.target.x0,a.y1]}var I=function(){var a=(0,d.K2)(function(a,b,c,d){for(c=c||{},d=a.length;d--;c[a[d]]=b);return c},"o"),b=[1,9],c=[1,10],e=[1,5,10,12],f={trace:(0,d.K2)(function(){},"trace"),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:(0,d.K2)(function(a,b,c,d,e,f,g){var h=f.length-1;switch(e){case 7:let i=d.findOrCreateNode(f[h-4].trim().replaceAll('""','"')),j=d.findOrCreateNode(f[h-2].trim().replaceAll('""','"')),k=parseFloat(f[h].trim());d.addLink(i,j,k);break;case 8:case 9:case 11:this.$=f[h];break;case 10:this.$=f[h-1]}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:b,20:c},{1:[2,6],7:11,10:[1,12]},a(c,[2,4],{9:13,5:[1,14]}),{12:[1,15]},a(e,[2,8]),a(e,[2,9]),{19:[1,16]},a(e,[2,11]),{1:[2,1]},{1:[2,5]},a(c,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:b,20:c},{15:18,16:7,17:8,18:b,20:c},{18:[1,19]},a(c,[2,3]),{12:[1,20]},a(e,[2,10]),{15:21,16:7,17:8,18:b,20:c},a([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:(0,d.K2)(function(a,b){if(b.recoverable)this.trace(a);else{var c=Error(a);throw c.hash=b,c}},"parseError"),parse:(0,d.K2)(function(a){var b=this,c=[0],e=[],f=[null],g=[],h=this.table,i="",j=0,k=0,l=0,m=g.slice.call(arguments,1),n=Object.create(this.lexer),o={};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(o[p]=this.yy[p]);n.setInput(a,o),o.lexer=n,o.parser=this,void 0===n.yylloc&&(n.yylloc={});var q=n.yylloc;g.push(q);var r=n.options&&n.options.ranges;function s(){var a;return"number"!=typeof(a=e.pop()||n.lex()||1)&&(a instanceof Array&&(a=(e=a).pop()),a=b.symbols_[a]||a),a}"function"==typeof o.parseError?this.parseError=o.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,d.K2)(function(a){c.length=c.length-2*a,f.length=f.length-a,g.length=g.length-a},"popStack"),(0,d.K2)(s,"lex");for(var t,u,v,w,x,y,z,A,B,C={};;){if(v=c[c.length-1],this.defaultActions[v]?w=this.defaultActions[v]:(null==t&&(t=s()),w=h[v]&&h[v][t]),void 0===w||!w.length||!w[0]){var D="";for(y in B=[],h[v])this.terminals_[y]&&y>2&&B.push("'"+this.terminals_[y]+"'");D=n.showPosition?"Parse error on line "+(j+1)+":\n"+n.showPosition()+"\nExpecting "+B.join(", ")+", got '"+(this.terminals_[t]||t)+"'":"Parse error on line "+(j+1)+": Unexpected "+(1==t?"end of input":"'"+(this.terminals_[t]||t)+"'"),this.parseError(D,{text:n.match,token:this.terminals_[t]||t,line:n.yylineno,loc:q,expected:B})}if(w[0]instanceof Array&&w.length>1)throw Error("Parse Error: multiple actions possible at state: "+v+", token: "+t);switch(w[0]){case 1:c.push(t),f.push(n.yytext),g.push(n.yylloc),c.push(w[1]),t=null,u?(t=u,u=null):(k=n.yyleng,i=n.yytext,j=n.yylineno,q=n.yylloc,l>0&&l--);break;case 2:if(z=this.productions_[w[1]][1],C.$=f[f.length-z],C._$={first_line:g[g.length-(z||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(z||1)].first_column,last_column:g[g.length-1].last_column},r&&(C._$.range=[g[g.length-(z||1)].range[0],g[g.length-1].range[1]]),void 0!==(x=this.performAction.apply(C,[i,k,j,o,w[1],f,g].concat(m))))return x;z&&(c=c.slice(0,-1*z*2),f=f.slice(0,-1*z),g=g.slice(0,-1*z)),c.push(this.productions_[w[1]][0]),f.push(C.$),g.push(C._$),A=h[c[c.length-2]][c[c.length-1]],c.push(A);break;case 3:return!0}}return!0},"parse")};function g(){this.yy={}}return f.lexer={EOF:1,parseError:(0,d.K2)(function(a,b){if(this.yy.parser)this.yy.parser.parseError(a,b);else throw Error(a)},"parseError"),setInput:(0,d.K2)(function(a,b){return this.yy=b||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:(0,d.K2)(function(){var a=this._input[0];return this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a,a.match(/(?:\r\n?|\n).*/g)?(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:(0,d.K2)(function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b),this.offset-=b;var d=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),c.length-1&&(this.yylineno-=c.length-1);var e=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:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},"unput"),more:(0,d.K2)(function(){return this._more=!0,this},"more"),reject:(0,d.K2)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,d.K2)(function(a){this.unput(this.match.slice(a))},"less"),pastInput:(0,d.K2)(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:(0,d.K2)(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:(0,d.K2)(function(){var a=this.pastInput(),b=Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},"showPosition"),test_match:(0,d.K2)(function(a,b){var c,d,e;if(this.options.backtrack_lexer&&(e={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&&(e.yylloc.range=this.yylloc.range.slice(0))),(d=a[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.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],c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack)for(var f in e)this[f]=e[f];return!1},"test_match"),next:(0,d.K2)(function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var a,b,c,d,e=this._currentRules(),f=0;f<e.length;f++)if((c=this._input.match(this.rules[e[f]]))&&(!b||c[0].length>b[0].length)){if(b=c,d=f,this.options.backtrack_lexer){if(!1!==(a=this.test_match(c,e[f])))return a;if(!this._backtrack)return!1;b=!1;continue}if(!this.options.flex)break}return b?!1!==(a=this.test_match(b,e[d]))&&a:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,d.K2)(function(){var a=this.next();return a||this.lex()},"lex"),begin:(0,d.K2)(function(a){this.conditionStack.push(a)},"begin"),popState:(0,d.K2)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,d.K2)(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:(0,d.K2)(function(a){return(a=this.conditionStack.length-1-Math.abs(a||0))>=0?this.conditionStack[a]:"INITIAL"},"topState"),pushState:(0,d.K2)(function(a){this.begin(a)},"pushState"),stateStackSize:(0,d.K2)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,d.K2)(function(a,b,c,d){switch(c){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}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],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}}},(0,d.K2)(g,"Parser"),g.prototype=f,f.Parser=g,new g}();I.parser=I;var J=[],K=[],L=new Map,M=(0,d.K2)(()=>{J=[],K=[],L=new Map,(0,d.IU)()},"clear"),N=class{constructor(a,b,c=0){this.source=a,this.target=b,this.value=c}static{(0,d.K2)(this,"SankeyLink")}},O=(0,d.K2)((a,b,c)=>{J.push(new N(a,b,c))},"addLink"),P=class{constructor(a){this.ID=a}static{(0,d.K2)(this,"SankeyNode")}},Q=(0,d.K2)(a=>{a=d.Y2.sanitizeText(a,(0,d.D7)());let b=L.get(a);return void 0===b&&(b=new P(a),L.set(a,b),K.push(b)),b},"findOrCreateNode"),R=(0,d.K2)(()=>K,"getNodes"),S=(0,d.K2)(()=>J,"getLinks"),T=(0,d.K2)(()=>({nodes:K.map(a=>({id:a.ID})),links:J.map(a=>({source:a.source.ID,target:a.target.ID,value:a.value}))}),"getGraph"),U={nodesMap:L,getConfig:(0,d.K2)(()=>(0,d.D7)().sankey,"getConfig"),getNodes:R,getLinks:S,getGraph:T,addLink:O,findOrCreateNode:Q,getAccTitle:d.iN,setAccTitle:d.SV,getAccDescription:d.m7,setAccDescription:d.EI,getDiagramTitle:d.ab,setDiagramTitle:d.ke,clear:M},V=class a{static{(0,d.K2)(this,"Uid")}static{this.count=0}static next(b){return new a(b+ ++a.count)}constructor(a){this.id=a,this.href=`#${a}`}toString(){return"url("+this.href+")"}},W={left:function(a){return a.depth},right:function(a,b){return b-1-a.height},center:function(a){return a.targetLinks.length?a.depth:a.sourceLinks.length?f(a.sourceLinks,g)-1:0},justify:h},X=(0,d.K2)(function(a,b,c,g){let u,v,{securityLevel:w,sankey:x}=(0,d.D7)(),I=d.ME.sankey;"sandbox"===w&&(u=(0,e.Ltv)("#i"+b));let J="sandbox"===w?(0,e.Ltv)(u.nodes()[0].contentDocument.body):(0,e.Ltv)("body"),K="sandbox"===w?J.select(`[id="${b}"]`):(0,e.Ltv)(`[id="${b}"]`),L=x?.width??I.width,M=x?.height??I.width,N=x?.useMaxWidth??I.useMaxWidth,O=x?.nodeAlignment??I.nodeAlignment,P=x?.prefix??I.prefix,Q=x?.suffix??I.suffix,R=x?.showValues??I.showValues,S=g.db.getGraph(),T=W[O];(function(){let a,b,c=0,d=0,e=1,g=1,u=24,v=8,w,x=p,y=h,z=q,A=r,B=6;function C(){let h={nodes:z.apply(null,arguments),links:A.apply(null,arguments)};return function({nodes:a,links:c}){for(let[b,c]of a.entries())c.index=b,c.sourceLinks=[],c.targetLinks=[];let d=new Map(a.map((b,c)=>[x(b,c,a),b]));for(let[a,b]of c.entries()){b.index=a;let{source:c,target:e}=b;"object"!=typeof c&&(c=b.source=s(d,c)),"object"!=typeof e&&(e=b.target=s(d,e)),c.sourceLinks.push(b),e.targetLinks.push(b)}if(null!=b)for(let{sourceLinks:c,targetLinks:d}of a)c.sort(b),d.sort(b)}(h),function({nodes:a}){for(let b of a)b.value=void 0===b.fixedValue?Math.max(i(b.sourceLinks,o),i(b.targetLinks,o)):b.fixedValue}(h),function({nodes:a}){let b=a.length,c=new Set(a),d=new Set,e=0;for(;c.size;){for(let a of c)for(let{target:b}of(a.depth=e,a.sourceLinks))d.add(b);if(++e>b)throw Error("circular link");c=d,d=new Set}}(h),function({nodes:a}){let b=a.length,c=new Set(a),d=new Set,e=0;for(;c.size;){for(let a of c)for(let{source:b}of(a.height=e,a.targetLinks))d.add(b);if(++e>b)throw Error("circular link");c=d,d=new Set}}(h),function(h){let k=function({nodes:b}){let d=j(b,a=>a.depth)+1,f=(e-c-u)/(d-1),g=Array(d);for(let a of b){let b=Math.max(0,Math.min(d-1,Math.floor(y.call(null,a,d))));a.layer=b,a.x0=c+b*f,a.x1=a.x0+u,g[b]?g[b].push(a):g[b]=[a]}if(a)for(let b of g)b.sort(a);return g}(h);w=Math.min(v,(g-d)/(j(k,a=>a.length)-1));let p=f(k,a=>(g-d-(a.length-1)*w)/i(a,o));for(let a of k){let c=d;for(let b of a)for(let a of(b.y0=c,b.y1=c+b.value*p,c=b.y1+w,b.sourceLinks))a.width=a.value*p;c=(g-c+w)/(a.length+1);for(let b=0;b<a.length;++b){let d=a[b];d.y0+=c*(b+1),d.y1+=c*(b+1)}var q=a;if(void 0===b)for(let{sourceLinks:a,targetLinks:b}of q)a.sort(m),b.sort(l)}for(let b=0;b<B;++b){let c=Math.pow(.99,b),d=Math.max(1-c,(b+1)/B);(function(b,c,d){for(let e=b.length,f=e-2;f>=0;--f){let e=b[f];for(let a of e){let b=0,d=0;for(let{target:c,value:e}of a.sourceLinks){let f=e*(c.layer-a.layer);b+=function(a,b){let c=b.y0-(b.targetLinks.length-1)*w/2;for(let{source:d,width:e}of b.targetLinks){if(d===a)break;c+=e+w}for(let{target:d,width:e}of a.sourceLinks){if(d===b)break;c-=e}return c}(a,c)*f,d+=f}if(!(d>0))continue;let e=(b/d-a.y0)*c;a.y0+=e,a.y1+=e,G(a)}void 0===a&&e.sort(n),D(e,d)}})(k,c,d),function(b,c,d){for(let e=1,f=b.length;e<f;++e){let f=b[e];for(let a of f){let b=0,d=0;for(let{source:c,value:e}of a.targetLinks){let f=e*(a.layer-c.layer);b+=function(a,b){let c=a.y0-(a.sourceLinks.length-1)*w/2;for(let{target:d,width:e}of a.sourceLinks){if(d===b)break;c+=e+w}for(let{source:d,width:e}of b.targetLinks){if(d===a)break;c-=e}return c}(c,a)*f,d+=f}if(!(d>0))continue;let e=(b/d-a.y0)*c;a.y0+=e,a.y1+=e,G(a)}void 0===a&&f.sort(n),D(f,d)}}(k,c,d)}}(h),t(h),h}function D(a,b){let c=a.length>>1,e=a[c];F(a,e.y0-w,c-1,b),E(a,e.y1+w,c+1,b),F(a,g,a.length-1,b),E(a,d,0,b)}function E(a,b,c,d){for(;c<a.length;++c){let e=a[c],f=(b-e.y0)*d;f>1e-6&&(e.y0+=f,e.y1+=f),b=e.y1+w}}function F(a,b,c,d){for(;c>=0;--c){let e=a[c],f=(e.y1-b)*d;f>1e-6&&(e.y0-=f,e.y1-=f),b=e.y0-w}}function G({sourceLinks:a,targetLinks:c}){if(void 0===b){for(let{source:{sourceLinks:a}}of c)a.sort(m);for(let{target:{targetLinks:b}}of a)b.sort(l)}}return C.update=function(a){return t(a),a},C.nodeId=function(a){return arguments.length?(x="function"==typeof a?a:k(a),C):x},C.nodeAlign=function(a){return arguments.length?(y="function"==typeof a?a:k(a),C):y},C.nodeSort=function(b){return arguments.length?(a=b,C):a},C.nodeWidth=function(a){return arguments.length?(u=+a,C):u},C.nodePadding=function(a){return arguments.length?(v=w=+a,C):v},C.nodes=function(a){return arguments.length?(z="function"==typeof a?a:k(a),C):z},C.links=function(a){return arguments.length?(A="function"==typeof a?a:k(a),C):A},C.linkSort=function(a){return arguments.length?(b=a,C):b},C.size=function(a){return arguments.length?(c=d=0,e=+a[0],g=+a[1],C):[e-c,g-d]},C.extent=function(a){return arguments.length?(c=+a[0][0],e=+a[1][0],d=+a[0][1],g=+a[1][1],C):[[c,d],[e,g]]},C.iterations=function(a){return arguments.length?(B=+a,C):B},C})().nodeId(a=>a.id).nodeWidth(10).nodePadding(10+15*!!R).nodeAlign(T).extent([[0,0],[L,M]])(S);let U=(0,e.UMr)(e.zt);K.append("g").attr("class","nodes").selectAll(".node").data(S.nodes).join("g").attr("class","node").attr("id",a=>(a.uid=V.next("node-")).id).attr("transform",function(a){return"translate("+a.x0+","+a.y0+")"}).attr("x",a=>a.x0).attr("y",a=>a.y0).append("rect").attr("height",a=>a.y1-a.y0).attr("width",a=>a.x1-a.x0).attr("fill",a=>U(a.id));let X=(0,d.K2)(({id:a,value:b})=>R?`${a}
${P}${Math.round(100*b)/100}${Q}`:a,"getText");K.append("g").attr("class","node-labels").attr("font-size",14).selectAll("text").data(S.nodes).join("text").attr("x",a=>a.x0<L/2?a.x1+6:a.x0-6).attr("y",a=>(a.y1+a.y0)/2).attr("dy",`${R?"0":"0.35"}em`).attr("text-anchor",a=>a.x0<L/2?"start":"end").text(X);let Y=K.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(S.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),Z=x?.linkColor??"gradient";if("gradient"===Z){let a=Y.append("linearGradient").attr("id",a=>(a.uid=V.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",a=>a.source.x1).attr("x2",a=>a.target.x0);a.append("stop").attr("offset","0%").attr("stop-color",a=>U(a.source.id)),a.append("stop").attr("offset","100%").attr("stop-color",a=>U(a.target.id))}switch(Z){case"gradient":v=(0,d.K2)(a=>a.uid,"coloring");break;case"source":v=(0,d.K2)(a=>U(a.source.id),"coloring");break;case"target":v=(0,d.K2)(a=>U(a.target.id),"coloring");break;default:v=Z}Y.append("path").attr("d",(function(a){var b=D,c=E,d=B,e=C,f=null;function g(){var g,h=z.call(arguments),i=b.apply(this,h),j=c.apply(this,h);if(f||(f=g=y()),a(f,+d.apply(this,(h[0]=i,h)),+e.apply(this,h),+d.apply(this,(h[0]=j,h)),+e.apply(this,h)),g)return f=null,g+""||null}return g.source=function(a){return arguments.length?(b=a,g):b},g.target=function(a){return arguments.length?(c=a,g):c},g.x=function(a){return arguments.length?(d="function"==typeof a?a:A(+a),g):d},g.y=function(a){return arguments.length?(e="function"==typeof a?a:A(+a),g):e},g.context=function(a){return arguments.length?(f=null==a?null:a,g):f},g})(F).source(G).target(H)).attr("stroke",v).attr("stroke-width",a=>Math.max(1,a.width)),(0,d.ot)(void 0,K,0,N)},"draw"),Y=(0,d.K2)(a=>a.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,"\n").trim(),"prepareTextForParsing"),Z=(0,d.K2)(a=>`.label {
font-family: ${a.fontFamily};
}`,"getStyles"),$=I.parse.bind(I);I.parse=a=>$(Y(a));var _={styles:Z,parser:I,db:U,renderer:{draw:X}}}};