spytial-core 1.9.6 → 1.9.7
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.
|
@@ -808,7 +808,7 @@ Expecting `+M1.join(", ")+", got '"+(this.terminals_[to]||to)+"'":g1="Parse erro
|
|
|
808
808
|
`:""}function $T(t,r){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}var Zrt,tnt,ent,rnt,nnt,int,gh,bf,ont,ant,unt,p0,Zw,tI,eI,rI,nI,iI,sI,oI,Ant,Cnt,aI,uI,lI,cI,hI,fI,dI,FT,pI,Bnt,jnt,xI,$nt,mI,qnt,gI,BT,Q2,qE,yI,vI,zE,IT,Ynt,Fw,Wnt,Xnt,Qnt,EI,_I,bI,AI,_3,Uw,xit,mit,CI,NI,RI,KT,git,lv,yit,vit,Eit,_it,LT,Tit,bit,Ait,Oit,wI,Sit,YE,Cit,Nit,Rit,wit,II,DI,Iit,LI,Dit,PI,X0,Lit,Pit,Fit,cv,kI,MT,FI,BI,Xm,Qit,Jit,Zit,tst,est,rst,nst,ist,HT,sst,ost,ast,ust,lst,cst,hst,b3,QE=Cn(()=>{Zrt=Qw,tnt=Yrt,ent=Wrt,rnt=Qrt,nnt=Jrt,int=Xrt,gh={isNothing:Zrt,isObject:tnt,toArray:ent,repeat:rnt,isNegativeZero:nnt,extend:int};uv.prototype=Object.create(Error.prototype);uv.prototype.constructor=uv;uv.prototype.toString=function(r){return this.name+": "+Jw(this,r)};bf=uv;ont=snt,ant=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],unt=["scalar","sequence","mapping"];p0=cnt;DT.prototype.extend=function(r){var n=[],c=[];if(r instanceof p0)c.push(r);else if(Array.isArray(r))c=c.concat(r);else if(r&&(Array.isArray(r.implicit)||Array.isArray(r.explicit)))r.implicit&&(n=n.concat(r.implicit)),r.explicit&&(c=c.concat(r.explicit));else throw new bf("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(e){if(!(e instanceof p0))throw new bf("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&e.loadKind!=="scalar")throw new bf("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new bf("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),c.forEach(function(e){if(!(e instanceof p0))throw new bf("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(DT.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(c),s.compiledImplicit=kw(s,"implicit"),s.compiledExplicit=kw(s,"explicit"),s.compiledTypeMap=hnt(s.compiledImplicit,s.compiledExplicit),s};Zw=DT,tI=new p0("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}}),eI=new p0("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}}),rI=new p0("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}}),nI=new Zw({explicit:[tI,eI,rI]});iI=new p0("tag:yaml.org,2002:null",{kind:"scalar",resolve:fnt,construct:dnt,predicate:pnt,represent:{canonical:function(){return "~"},lowercase:function(){return "null"},uppercase:function(){return "NULL"},camelcase:function(){return "Null"},empty:function(){return ""}},defaultStyle:"lowercase"});sI=new p0("tag:yaml.org,2002:bool",{kind:"scalar",resolve:xnt,construct:mnt,predicate:gnt,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"});oI=new p0("tag:yaml.org,2002:int",{kind:"scalar",resolve:_nt,construct:Tnt,predicate:bnt,represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Ant=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");Cnt=/^[-+]?[0-9]+e/;aI=new p0("tag:yaml.org,2002:float",{kind:"scalar",resolve:Ont,construct:Snt,predicate:Rnt,represent:Nnt,defaultStyle:"lowercase"}),uI=nI.extend({implicit:[iI,sI,oI,aI]}),lI=uI,cI=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),hI=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");fI=new p0("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:wnt,construct:Int,instanceOf:Date,represent:Dnt});dI=new p0("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Lnt}),FT=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
809
809
|
\r`;pI=new p0("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Pnt,construct:Mnt,predicate:Fnt,represent:knt}),Bnt=Object.prototype.hasOwnProperty,jnt=Object.prototype.toString;xI=new p0("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Unt,construct:Knt}),$nt=Object.prototype.toString;mI=new p0("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Hnt,construct:Gnt}),qnt=Object.prototype.hasOwnProperty;gI=new p0("tag:yaml.org,2002:set",{kind:"mapping",resolve:znt,construct:Vnt}),BT=lI.extend({implicit:[fI,dI],explicit:[pI,xI,mI,gI]}),Q2=Object.prototype.hasOwnProperty,qE=1,yI=2,vI=3,zE=4,IT=1,Ynt=2,Fw=3,Wnt=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Xnt=/[\x85\u2028\u2029]/,Qnt=/[,\[\]\{\}]/,EI=/^(?:!|!!|![a-z\-]+!)$/i,_I=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;bI=new Array(256),AI=new Array(256);for(_3=0;_3<256;_3++)bI[_3]=jw(_3)?1:0,AI[_3]=jw(_3);Uw={YAML:function(r,n,c){var s,e,i;r.version!==null&&Es(r,"duplication of %YAML directive"),c.length!==1&&Es(r,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(c[0]),s===null&&Es(r,"ill-formed argument of the YAML directive"),e=parseInt(s[1],10),i=parseInt(s[2],10),e!==1&&Es(r,"unacceptable YAML version of the document"),r.version=c[0],r.checkLineBreaks=i<2,i!==1&&i!==2&&VE(r,"unsupported YAML version of the document");},TAG:function(r,n,c){var s,e;c.length!==2&&Es(r,"TAG directive accepts exactly two arguments"),s=c[0],e=c[1],EI.test(s)||Es(r,"ill-formed tag handle (first argument) of the TAG directive"),Q2.call(r.tagMap,s)&&Es(r,'there is a previously declared suffix for "'+s+'" tag handle'),_I.test(e)||Es(r,"ill-formed tag prefix (second argument) of the TAG directive");try{e=decodeURIComponent(e);}catch{Es(r,"tag prefix is malformed: "+e);}r.tagMap[s]=e;}};xit=dit,mit=pit,CI={loadAll:xit,load:mit},NI=Object.prototype.toString,RI=Object.prototype.hasOwnProperty,KT=65279,git=9,lv=10,yit=13,vit=32,Eit=33,_it=34,LT=35,Tit=37,bit=38,Ait=39,Oit=42,wI=44,Sit=45,YE=58,Cit=61,Nit=62,Rit=63,wit=64,II=91,DI=93,Iit=96,LI=123,Dit=124,PI=125,X0={};X0[0]="\\0";X0[7]="\\a";X0[8]="\\b";X0[9]="\\t";X0[10]="\\n";X0[11]="\\v";X0[12]="\\f";X0[13]="\\r";X0[27]="\\e";X0[34]='\\"';X0[92]="\\\\";X0[133]="\\N";X0[160]="\\_";X0[8232]="\\L";X0[8233]="\\P";Lit=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Pit=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;Fit=1,cv=2;kI=1,MT=2,FI=3,BI=4,Xm=5;Qit=Xit,Jit={dump:Qit};Zit=p0,tst=Zw,est=nI,rst=uI,nst=lI,ist=BT,HT=CI.load,sst=CI.loadAll,ost=Jit.dump,ast=bf,ust={binary:pI,float:aI,map:rI,null:iI,pairs:mI,set:gI,timestamp:fI,bool:sI,int:oI,merge:dI,omap:xI,seq:eI,str:tI},lst=$T("safeLoad","load"),cst=$T("safeLoadAll","loadAll"),hst=$T("safeDump","dump"),b3={Type:Zit,Schema:tst,FAILSAFE_SCHEMA:est,JSON_SCHEMA:rst,CORE_SCHEMA:nst,DEFAULT_SCHEMA:ist,load:HT,loadAll:sst,dump:ost,YAMLException:ast,types:ust,safeLoad:lst,safeLoadAll:cst,safeDump:hst};});function jI(t,r){if(t!=null&&(typeof t!="number"||Number.isNaN(t)||t<=0))throw new Error(`Size ${r} must be greater than 0`)}function KI(t,r){jI(t.width,`${r} width`),jI(t.height,`${r} height`);}function UI(){return {constraints:{orientation:{relative:[],cyclic:[]},alignment:[],grouping:{byfield:[],byselector:[]}},directives:{atomColors:[],sizes:[],icons:[],edgeColors:[],attributes:[],tags:[],hiddenFields:[],inferredEdges:[],hiddenAtoms:[],hideDisconnected:false,hideDisconnectedBuiltIns:false}}}function J2(t){if(!t)return UI();let r=HT(t),n=r?.constraints,c=r?.directives,s=UI(),e=[],i=[];if(n&&Array.isArray(n))try{let o=yst(n);s.constraints=o;let p=n;e=p.filter(E=>E.size).map(E=>(KI(E.size,"constraint"),{height:E.size.height,width:E.size.width,selector:E.size.selector})),i=p.filter(E=>E.hideAtom).map(E=>({selector:E.hideAtom.selector}));}catch(o){let p=o instanceof Error?o.message:String(o);throw new Error(`${p}`)}if(c&&Array.isArray(c))try{let o=vst(c);s.directives=o,s.directives.sizes=[...e,...o.sizes],s.directives.hiddenAtoms=[...i,...o.hiddenAtoms];}catch(o){let p=o instanceof Error?o.message:String(o);throw new Error(`${p}`)}else s.directives.sizes=e,s.directives.hiddenAtoms=i;return s}function dst(t){let r=new Map,n=[];for(let c of t){let s=`${c.selector.trim()}|${c.direction}`;r.has(s)||(r.set(s,c),n.push(c));}return n}function pst(t){let r=new Map,n=[];for(let c of t){let s=`${c.selector.trim()}|${c.directions.sort().join(",")}`;r.has(s)||(r.set(s,c),n.push(c));}return n}function xst(t){let r=new Map,n=[];for(let c of t){let s=`${c.selector.trim()}|${c.direction}`;r.has(s)||(r.set(s,c),n.push(c));}return n}function mst(t){let r=new Map,n=[];for(let c of t){let s=`${c.selector.trim()}|${c.name}|${c.addEdge}`;r.has(s)||(r.set(s,c),n.push(c));}return n}function gst(t){let r=new Map,n=[];for(let c of t){let s=`${c.field}|${c.groupOn}|${c.addToGroup}|${c.selector||""}`;r.has(s)||(r.set(s,c),n.push(c));}return n}function yst(t){let r=t,n=r.filter(p=>p.cyclic).map(p=>{if(!p.cyclic.selector)throw new Error("Cyclic constraint must have a selector");return new e4(p.cyclic.direction||"clockwise",p.cyclic.selector)});n=dst(n);let c={};n.forEach(p=>{let E=p.selector.trim();if(!c[E])c[E]=p.direction;else if(c[E]!==p.direction)throw new Error(`Inconsistent cyclic constraint for selector ${E}: ${c[E]}, ${p.direction}`)});let s=r.filter(p=>p.orientation).map(p=>{var E=true;let b=p.orientation;if(!b.selector)throw new Error("Orientation constraint must have selector field");if(!b.directions)throw new Error("Orientation constraint must have directions field");let y=new A3(b.directions,b.selector);if(E=y.isInternallyConsistent(),!E)throw new Error(y.inconsistencyMessage());return y});s=pst(s);let e=r.filter(p=>p.group).filter(p=>p.group.field).map(p=>{if(p.group.groupOn==null)throw new Error("Grouping constraint must have groupOn field");if(p.group.field==null)throw new Error("Grouping constraint must specify a field");if(p.group.addToGroup==null)throw new Error("Grouping constraint must specify addToGroup");return new t4(p.group.field,p.group.groupOn,p.group.addToGroup,p.group.selector)});e=gst(e);let i=r.filter(p=>p.group).filter(p=>p.group.selector&&p.group.name&&!p.group.field).map(p=>{if(!p.group.selector)throw new Error("Grouping constraint must have a selector.");if(!p.group.name)throw new Error("Grouping constraint must have a name.");return new ZE(p.group.selector,p.group.name,p.group.addEdge)});i=mst(i);let o=r.filter(p=>p.align).map(p=>{if(!p.align.selector)throw new Error("Align constraint must have a selector");if(!p.align.direction)throw new Error("Align constraint must have a direction");let E=new JE(p.align.direction,p.align.selector);if(!E.isInternallyConsistent())throw new Error(E.inconsistencyMessage());return E});return o=xst(o),{orientation:{relative:s,cyclic:n},alignment:o,grouping:{byfield:e,byselector:i}}}function vst(t){let r=t,n=r.filter(l=>l.icon).map(l=>({path:l.icon.path,selector:l.icon.selector,showLabels:l.icon.showLabels||false})),c=r.filter(l=>l.atomColor).map(l=>({color:l.atomColor.value,selector:l.atomColor.selector})),s=r.filter(l=>l.size).map(l=>(KI(l.size,"directive"),{height:l.size.height,width:l.size.width,selector:l.size.selector})),e=r.filter(l=>l.edgeColor).map(l=>({color:l.edgeColor.value,field:l.edgeColor.field,selector:l.edgeColor.selector,filter:l.edgeColor.filter,style:l.edgeColor.style,weight:l.edgeColor.weight,showLabel:l.edgeColor.showLabel,hidden:l.edgeColor.hidden})),i=r.filter(l=>l.attribute).map(l=>({field:l.attribute.field,selector:l.attribute.selector,filter:l.attribute.filter})),o=r.filter(l=>l.hideField).map(l=>({field:l.hideField.field,selector:l.hideField.selector,filter:l.hideField.filter})),p=r.filter(l=>l.flag).map(l=>l.flag),E=p.includes("hideDisconnected"),b=p.includes("hideDisconnectedBuiltIns"),y=r.filter(l=>l.inferredEdge).map(l=>({name:l.inferredEdge.name,selector:l.inferredEdge.selector,color:l.inferredEdge.color,style:l.inferredEdge.style,weight:l.inferredEdge.weight})),m=r.filter(l=>l.hideAtom).map(l=>({selector:l.hideAtom.selector})),a=r.filter(l=>l.tag).map(l=>({toTag:l.tag.toTag,name:l.tag.name,value:l.tag.value}));return {atomColors:c,sizes:s,icons:n,edgeColors:e,attributes:i,tags:a,hiddenFields:o,inferredEdges:y,hiddenAtoms:m,hideDisconnected:E,hideDisconnectedBuiltIns:b}}var tg,A3,JE,ZE,t4,e4,O3=Cn(()=>{QE();tg=class{constructor(r){this.selector=r;}isInternallyConsistent(){return true}inconsistencyMessage(){return `Inconsistent Constraint Operation: ${this.selector}`}toHTML(){return `ConstraintOperation with selector <code>${this.selector} </code>.`}},A3=class extends tg{constructor(r,n){super(n),this.directions=r;}isInternallyConsistent(){return !(this.directions.includes("above")&&this.directions.includes("below")||this.directions.includes("left")&&this.directions.includes("right")||this.directions.includes("directlyLeft")&&!this.directions.every(r=>r==="left"||r==="directlyLeft")||this.directions.includes("directlyRight")&&!this.directions.every(r=>r==="right"||r==="directlyRight")||this.directions.includes("directlyAbove")&&!this.directions.every(r=>r==="above"||r==="directlyAbove")||this.directions.includes("directlyBelow")&&!this.directions.every(r=>r==="below"||r==="directlyBelow"))}inconsistencyMessage(){return `Orientation Constraint with directions [${this.directions.join(", ")}] and selector <code>${this.selector}</code> is internally inconsistent.`}toHTML(){return `OrientationConstraint with directions [${this.directions.join(", ")}] and selector <code>${this.selector}</code>`}},JE=class extends tg{constructor(r,n){super(n),this.direction=r;}isInternallyConsistent(){return this.direction==="horizontal"||this.direction==="vertical"}inconsistencyMessage(){return `Align Constraint with direction [${this.direction}] and selector <code>${this.selector}</code> is internally inconsistent.`}toHTML(){return `AlignConstraint with direction [${this.direction}] and selector <code>${this.selector}</code>`}},ZE=class extends tg{constructor(r,n,c=false){super(r),this.name=n,this.addEdge=c;}toHTML(){return `GroupBySelector with selector <code>${this.selector}</code>
|
|
810
810
|
and name <code>${this.name}</code>.`}},t4=class{constructor(r,n,c,s){this.field=r,this.groupOn=n,this.addToGroup=c,this.selector=s;}toHTML(){let r=this.selector?` with selector <pre>${this.selector}</pre>`:"";return `GroupByField on field <pre>${this.field}</pre> grouping field index <pre>${this.groupOn}</pre>
|
|
811
|
-
adding to group index <pre>${this.addToGroup}</pre>${r}.`}},e4=class extends tg{constructor(r,n){super(n),this.direction=r;}inconsistencyMessage(){return `Cyclic constraint with direction [${this.direction}] with selector <code>${this.selector}</code> is inconsistent.`}toHTML(){return `Cyclic constraint with direction [${this.direction}] and selector <code>${this.selector}</code>`}};});function GT(t){if(typeof t!="string")return;let r=t.trim().toLowerCase();if(r==="solid"||r==="dashed"||r==="dotted")return r}var $I=Cn(()=>{});function VT(t){if(!t)return "";if(t.startsWith("http")||t.startsWith("data:")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../"))return t;let r=t.indexOf(":");if(r>0){let c=t.substring(0,r),s=t.substring(r+1),e=zT[c];if(e)return e(s)}let n=qT[t];return n||t}function Est(){return Object.keys(qT)}function _st(){return Object.keys(zT)}function Tst(t){return t in qT}function bst(t){let r=t.indexOf(":");return r<=0?false:t.substring(0,r)in zT}var qT,zT,YT=Cn(()=>{qT={person:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z"/></svg>')}`,"person-fill":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/></svg>')}`,people:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M15 14s1 0 1-1-1-4-5-4-5 3-5 4 1 1 1 1zm-7.978-1L7 12.996c.001-.264.167-1.03.76-1.72C8.312 10.629 9.282 10 11 10c1.717 0 2.687.63 3.24 1.276.593.69.758 1.457.76 1.72l-.008.002-.014.002zM11 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4m3-2a3 3 0 1 1-6 0 3 3 0 0 1 6 0M6.936 9.28a6 6 0 0 0-1.23-.247A7 7 0 0 0 5 9c-4 0-5 3-5 4q0 1 1 1h4.216A2.24 2.24 0 0 1 5 13c0-1.01.377-2.042 1.09-2.904.243-.294.526-.569.846-.816M4.92 10A5.5 5.5 0 0 0 4 13H1c0-.26.164-1.03.76-1.724.545-.636 1.492-1.256 3.16-1.275ZM1.5 5.5a3 3 0 1 1 6 0 3 3 0 0 1-6 0m3-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4"/></svg>')}`,home:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5z"/></svg>')}`,house:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5z"/></svg>')}`,building:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M4 2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5zM4 5.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zM7.5 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5zm2.5.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zM4.5 8a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5zm2.5.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5z"/><path d="M2 1a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1zm11 0H3v14h3v-2.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5V15h3z"/></svg>')}`,star:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M2.866 14.85c-.078.444.36.791.746.593l4.39-2.256 4.389 2.256c.386.198.824-.149.746-.592l-.83-4.73 3.522-3.356c.33-.314.16-.888-.282-.95l-4.898-.696L8.465.792a.513.513 0 0 0-.927 0L5.354 5.12l-4.898.696c-.441.062-.612.636-.283.95l3.523 3.356-.83 4.73zm4.905-2.767-3.686 1.894.694-3.957a.56.56 0 0 0-.163-.505L1.71 6.745l4.052-.576a.53.53 0 0 0 .393-.288L8 2.223l1.847 3.658a.53.53 0 0 0 .393.288l4.052.575-2.906 2.77a.56.56 0 0 0-.163.506l.694 3.957-3.686-1.894a.5.5 0 0 0-.461 0z"/></svg>')}`,"star-fill":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/></svg>')}`,heart:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143q.09.083.176.171a3 3 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15"/></svg>')}`,"heart-fill":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314"/></svg>')}`,circle:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><circle cx="8" cy="8" r="8"/></svg>')}`,square:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><rect width="16" height="16"/></svg>')}`,triangle:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M7.022 1.566a1.13 1.13 0 0 1 1.96 0l6.857 11.667c.457.778-.092 1.767-.98 1.767H1.144c-.889 0-1.437-.99-.98-1.767z"/></svg>')}`,"tic-x":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="2" y1="2" x2="14" y2="14"/><line x1="14" y1="2" x2="2" y2="14"/></svg>')}`,"tic-o":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><circle cx="8" cy="8" r="6"/></svg>')}`,"arrow-right":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8"/></svg>')}`,"arrow-left":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/></svg>')}`,"arrow-up":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5"/></svg>')}`,"arrow-down":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1"/></svg>')}`,check:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z"/></svg>')}`,x:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/></svg>')}`,plus:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/></svg>')}`,minus:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8"/></svg>')}`,warning:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.15.15 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.2.2 0 0 1-.054.06.1.1 0 0 1-.066.017H1.146a.1.1 0 0 1-.066-.017.2.2 0 0 1-.054-.06.18.18 0 0 1 .002-.183L7.884 2.073a.15.15 0 0 1 .054-.057m1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767z"/><path d="M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/></svg>')}`,info:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/></svg>')}`,gear:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"/><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"/></svg>')}`,database:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M4.318 2.687C5.234 2.271 6.536 2 8 2s2.766.27 3.682.687C12.644 3.125 13 3.627 13 4c0 .374-.356.875-1.318 1.313C10.766 5.729 9.464 6 8 6s-2.766-.27-3.682-.687C3.356 4.875 3 4.373 3 4c0-.374.356-.875 1.318-1.313M13 5.698V7c0 .374-.356.875-1.318 1.313C10.766 8.729 9.464 9 8 9s-2.766-.27-3.682-.687C3.356 7.875 3 7.373 3 7V5.698c.271.202.58.378.904.525C4.978 6.711 6.427 7 8 7s3.022-.289 4.096-.777A5 5 0 0 0 13 5.698M14 4c0-1.007-.875-1.755-1.904-2.223C11.022 1.289 9.573 1 8 1s-3.022.289-4.096.777C2.875 2.245 2 2.993 2 4v9c0 1.007.875 1.755 1.904 2.223C4.978 15.71 6.427 16 8 16s3.022-.289 4.096-.777C13.125 14.755 14 14.007 14 13zm-1 4.698V10c0 .374-.356.875-1.318 1.313C10.766 11.729 9.464 12 8 12s-2.766-.27-3.682-.687C3.356 10.875 3 10.373 3 10V8.698c.271.202.58.378.904.525C4.978 9.71 6.427 10 8 10s3.022-.289 4.096-.777A5 5 0 0 0 13 8.698m0 3V13c0 .374-.356.875-1.318 1.313C10.766 14.729 9.464 15 8 15s-2.766-.27-3.682-.687C3.356 13.875 3 13.373 3 13v-1.302c.271.202.58.378.904.525C4.978 12.71 6.427 13 8 13s3.022-.289 4.096-.777c.324-.147.633-.323.904-.525"/></svg>')}`,folder:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3H14.5A1.5 1.5 0 0 1 16 4.5v1.384l-.195-.131a1 1 0 0 0-.163-.084l-.022-.01-.053-.021A.5.5 0 0 0 15.5 5H.5a.5.5 0 0 0-.5.5v.01c.053-.01.108-.017.164-.022L.162 5.5zm-.11 2.13H15.57a.5.5 0 0 1 .49.6l-1.037 5.184A1.5 1.5 0 0 1 13.549 13H2.451a1.5 1.5 0 0 1-1.474-1.22L-.06 6.6a.5.5 0 0 1 .49-.6"/></svg>')}`,file:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm0 1h8a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1"/></svg>')}`,tree:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8.416.223a.5.5 0 0 0-.832 0l-3 4.5A.5.5 0 0 0 5 5.5h.098L3.076 8.735A.5.5 0 0 0 3.5 9.5h.191l-1.638 3.276a.5.5 0 0 0 .447.724H7V16h2v-2.5h4.5a.5.5 0 0 0 .447-.724L12.31 9.5h.191a.5.5 0 0 0 .424-.765L10.902 5.5H11a.5.5 0 0 0 .416-.777z"/></svg>')}`,flower:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 1a4 4 0 0 0-4 4v.2A4.5 4.5 0 0 0 5.52 14h4.96A4.5 4.5 0 0 0 12 5.2V5a4 4 0 0 0-4-4"/></svg>')}`,car:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M2.52 3.515A2.5 2.5 0 0 1 4.82 2h6.36a2.5 2.5 0 0 1 2.3 1.515l1.34 3.147a.5.5 0 0 1-.068.51A.5.5 0 0 1 14.5 7H14v3a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-.5H5V10a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7h-.5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .034-.18zM4 8.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1m8 0a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1M4.82 3a1.5 1.5 0 0 0-1.38.91L2.46 6h11.08l-.98-2.09A1.5 1.5 0 0 0 11.18 3z"/></svg>')}`,envelope:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1zm13 2.383-4.708 2.825L15 11.105zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741M1 11.105l4.708-2.897L1 5.383z"/></svg>')}`,phone:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M3.654 1.328a.678.678 0 0 0-1.015-.063L1.605 2.3c-.483.484-.661 1.169-.45 1.77a17.6 17.6 0 0 0 4.168 6.608 17.6 17.6 0 0 0 6.608 4.168c.601.211 1.286.033 1.77-.45l1.034-1.034a.678.678 0 0 0-.063-1.015l-2.307-1.794a.68.68 0 0 0-.58-.122l-2.19.547a1.75 1.75 0 0 1-1.657-.459L5.482 8.062a1.75 1.75 0 0 1-.46-1.657l.548-2.19a.68.68 0 0 0-.122-.58zM1.884.511a1.745 1.745 0 0 1 2.612.163L6.29 2.98c.329.423.445.974.315 1.494l-.547 2.19a.68.68 0 0 0 .178.643l2.457 2.457a.68.68 0 0 0 .644.178l2.189-.547a1.75 1.75 0 0 1 1.494.315l2.306 1.794c.829.645.905 1.87.163 2.611l-1.034 1.034c-.74.74-1.846 1.065-2.877.702a18.6 18.6 0 0 1-7.01-4.42 18.6 18.6 0 0 1-4.42-7.009c-.362-1.03-.037-2.137.703-2.877z"/></svg>')}`,flag:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M14.778.085A.5.5 0 0 1 15 .5V8a.5.5 0 0 1-.314.464L14.5 8l.186.464-.003.001-.006.003-.023.009a12 12 0 0 1-.397.15c-.264.095-.631.223-1.047.35-.816.252-1.879.523-2.71.523-.847 0-1.548-.28-2.158-.525l-.028-.01C7.68 8.71 7.14 8.5 6.5 8.5c-.7 0-1.638.23-2.437.477A20 20 0 0 0 3 9.342V15.5a.5.5 0 0 1-1 0V.5a.5.5 0 0 1 1 0v.282c.226-.079.496-.17.79-.26C4.606.272 5.67 0 6.5 0c.84 0 1.524.277 2.121.519l.043.018C9.286.788 9.828 1 10.5 1c.7 0 1.638-.23 2.437-.477a20 20 0 0 0 1.349-.476l.019-.007.004-.002h.001"/></svg>')}`,lock:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2m3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2M5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1"/></svg>')}`,key:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8a4 4 0 0 1 7.465-2H14a.5.5 0 0 1 .354.146l1.5 1.5a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0L13 9.207l-.646.647a.5.5 0 0 1-.708 0L11 9.207l-.646.647a.5.5 0 0 1-.708 0L9 9.207l-.646.647A.5.5 0 0 1 8 10h-.535A4 4 0 0 1 0 8m4-3a3 3 0 1 0 2.712 4.285A.5.5 0 0 1 7.163 9h.63l.853-.854a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.793-.793-1-1h-6.63a.5.5 0 0 1-.451-.285A3 3 0 0 0 4 5m-1.5 3a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0"/></svg>')}`},zT={bi:t=>`https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/icons/${t}.svg`,fa:t=>`https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/svgs/solid/${t}.svg`,"fa-solid":t=>`https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/svgs/solid/${t}.svg`,"fa-regular":t=>`https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/svgs/regular/${t}.svg`,"fa-brands":t=>`https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/svgs/brands/${t}.svg`,lucide:t=>`https://cdn.jsdelivr.net/npm/lucide-static@0.300.0/icons/${t}.svg`,heroicons:t=>`https://cdn.jsdelivr.net/npm/heroicons@2.1.1/24/outline/${t}.svg`,"heroicons-solid":t=>`https://cdn.jsdelivr.net/npm/heroicons@2.1.1/24/solid/${t}.svg`,tabler:t=>`https://cdn.jsdelivr.net/npm/@tabler/icons@2.44.0/icons/${t}.svg`,simple:t=>`https://cdn.jsdelivr.net/npm/simple-icons@10.4.0/icons/${t}.svg`};});var Ast,Ost,e1,r4=Cn(()=>{(({min:Ast,max:Ost}=Math)),e1=(t,r=0,n=1)=>Ast(Ost(r,t),n);});var S3,HI=Cn(()=>{r4();S3=t=>{t._clipped=false,t._unclipped=t.slice(0);for(let r=0;r<=3;r++)r<3?((t[r]<0||t[r]>255)&&(t._clipped=true),t[r]=e1(t[r],0,255)):r===3&&(t[r]=e1(t[r],0,1));return t};});function Zi(t){return GI[Object.prototype.toString.call(t)]||"object"}var GI,fv=Cn(()=>{GI={};for(let t of ["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])GI[`[object ${t}]`]=t.toLowerCase();});var Li,qI=Cn(()=>{fv();Li=(t,r=null)=>t.length>=3?Array.prototype.slice.call(t):Zi(t[0])=="object"&&r?r.split("").filter(n=>t[0][n]!==void 0).map(n=>t[0][n]):t[0].slice(0);});var Dd,zI=Cn(()=>{fv();Dd=t=>{if(t.length<2)return null;let r=t.length-1;return Zi(t[r])=="string"?t[r].toLowerCase():null};});function a4(t){return [...t.slice(0,3).reverse(),...t.slice(3)]}var n4,i4,s4,x0,dv,r1,o4,VI,YI,As=Cn(()=>{HI();r4();fv();qI();zI();(({PI:n4,min:i4,max:s4}=Math)),x0=t=>Math.round(t*100)/100,dv=t=>Math.round(t*100)/100,r1=n4*2,o4=n4/3,VI=n4/180,YI=180/n4;});var rs,Yc=Cn(()=>{rs={format:{},autodetect:[]};});var WT,dn,lo=Cn(()=>{As();Yc();WT=class{constructor(...r){let n=this;if(Zi(r[0])==="object"&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];let c=Dd(r),s=false;if(!c){s=true,rs.sorted||(rs.autodetect=rs.autodetect.sort((e,i)=>i.p-e.p),rs.sorted=true);for(let e of rs.autodetect)if(c=e.test(...r),c)break}if(rs.format[c]){let e=rs.format[c].apply(null,s?r:r.slice(0,-1));n._rgb=S3(e);}else throw new Error("unknown format: "+r);n._rgb.length===3&&n._rgb.push(1);}toString(){return Zi(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}},dn=WT;});var WI,XI=Cn(()=>{WI="3.2.0";});var QI,Os,Cc=Cn(()=>{lo();XI();QI=(...t)=>new dn(...t);QI.version=WI;Os=QI;});var Sst,Z2,XT=Cn(()=>{Sst={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},Z2=Sst;});var Cst,Nst,Rst,u4,QT=Cn(()=>{Cst=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Nst=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Rst=t=>{if(t.match(Cst)){(t.length===4||t.length===7)&&(t=t.substr(1)),t.length===3&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let r=parseInt(t,16),n=r>>16,c=r>>8&255,s=r&255;return [n,c,s,1]}if(t.match(Nst)){(t.length===5||t.length===9)&&(t=t.substr(1)),t.length===4&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);let r=parseInt(t,16),n=r>>24&255,c=r>>16&255,s=r>>8&255,e=Math.round((r&255)/255*100)/100;return [n,c,s,e]}throw new Error(`unknown hex color: ${t}`)},u4=Rst;});var l4,wst,c4,JT=Cn(()=>{As();(({round:l4}=Math)),wst=(...t)=>{let[r,n,c,s]=Li(t,"rgba"),e=Dd(t)||"auto";s===void 0&&(s=1),e==="auto"&&(e=s<1?"rgba":"rgb"),r=l4(r),n=l4(n),c=l4(c);let o="000000"+(r<<16|n<<8|c).toString(16);o=o.substr(o.length-6);let p="0"+l4(s*255).toString(16);switch(p=p.substr(p.length-2),e.toLowerCase()){case "rgba":return `#${o}${p}`;case "argb":return `#${p}${o}`;default:return `#${o}`}},c4=wst;});var JI=Cn(()=>{lo();Yc();As();XT();QT();JT();dn.prototype.name=function(){let t=c4(this._rgb,"rgb");for(let r of Object.keys(Z2))if(Z2[r]===t)return r.toLowerCase();return t};rs.format.named=t=>{if(t=t.toLowerCase(),Z2[t])return u4(Z2[t]);throw new Error("unknown color name: "+t)};rs.autodetect.push({p:5,test:(t,...r)=>{if(!r.length&&Zi(t)==="string"&&Z2[t.toLowerCase()])return "named"}});});var ZI=Cn(()=>{lo();As();dn.prototype.alpha=function(t,r=false){return t!==void 0&&Zi(t)==="number"?r?(this._rgb[3]=t,this):new dn([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]};});var tD=Cn(()=>{lo();dn.prototype.clipped=function(){return this._rgb._clipped||false};});function n1(t){let r=Ist.get(String(t).toLowerCase());if(!r)throw new Error("unknown Lab illuminant "+t);pv.labWhitePoint=t,pv.Xn=r[0],pv.Zn=r[1];}function tx(){return pv.labWhitePoint}var pv,cp,Ist,ex=Cn(()=>{pv={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:.008856451679035631,kKE:8,kK:903.2962962962963,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-0.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-0.2040259135167538,m20:-0.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-0.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-0.0685,m20:-0.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-0.008528664575177328,m10:-0.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},cp=pv,Ist=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);});var Dst,Lst,ZT,tb,eg,xv=Cn(()=>{ex();As();Dst=(...t)=>{t=Li(t,"lab");let[r,n,c]=t,[s,e,i]=Lst(r,n,c),[o,p,E]=tb(s,e,i);return [o,p,E,t.length>3?t[3]:1]},Lst=(t,r,n)=>{let{kE:c,kK:s,kKE:e,Xn:i,Yn:o,Zn:p}=cp,E=(t+16)/116,b=.002*r+E,y=E-.005*n,m=b*b*b,a=y*y*y,l=m>c?m:(116*b-16)/s,u=t>e?Math.pow((t+16)/116,3):t/s,h=a>c?a:(116*y-16)/s,d=l*i,g=u*o,_=h*p;return [d,g,_]},ZT=t=>{let r=Math.sign(t);return t=Math.abs(t),(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*r},tb=(t,r,n)=>{let{MtxAdaptMa:c,MtxAdaptMaI:s,MtxXYZ2RGB:e,RefWhiteRGB:i,Xn:o,Yn:p,Zn:E}=cp,b=o*c.m00+p*c.m10+E*c.m20,y=o*c.m01+p*c.m11+E*c.m21,m=o*c.m02+p*c.m12+E*c.m22,a=i.X*c.m00+i.Y*c.m10+i.Z*c.m20,l=i.X*c.m01+i.Y*c.m11+i.Z*c.m21,u=i.X*c.m02+i.Y*c.m12+i.Z*c.m22,h=(t*c.m00+r*c.m10+n*c.m20)*(a/b),d=(t*c.m01+r*c.m11+n*c.m21)*(l/y),g=(t*c.m02+r*c.m12+n*c.m22)*(u/m),_=h*s.m00+d*s.m10+g*s.m20,S=h*s.m01+d*s.m11+g*s.m21,v=h*s.m02+d*s.m12+g*s.m22,T=ZT(_*e.m00+S*e.m10+v*e.m20),q=ZT(_*e.m01+S*e.m11+v*e.m21),G=ZT(_*e.m02+S*e.m12+v*e.m22);return [T*255,q*255,G*255]},eg=Dst;});function Mst(t,r,n){let{Xn:c,Yn:s,Zn:e,kE:i,kK:o}=cp,p=t/c,E=r/s,b=n/e,y=p>i?Math.pow(p,1/3):(o*p+16)/116,m=E>i?Math.pow(E,1/3):(o*E+16)/116,a=b>i?Math.pow(b,1/3):(o*b+16)/116;return [116*m-16,500*(y-m),200*(m-a)]}function eb(t){let r=Math.sign(t);return t=Math.abs(t),(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*r}var Pst,rb,rg,mv=Cn(()=>{ex();As();Pst=(...t)=>{let[r,n,c,...s]=Li(t,"rgb"),[e,i,o]=rb(r,n,c),[p,E,b]=Mst(e,i,o);return [p,E,b,...s.length>0&&s[0]<1?[s[0]]:[]]};rb=(t,r,n)=>{t=eb(t/255),r=eb(r/255),n=eb(n/255);let{MtxRGB2XYZ:c,MtxAdaptMa:s,MtxAdaptMaI:e,Xn:i,Yn:o,Zn:p,As:E,Bs:b,Cs:y}=cp,m=t*c.m00+r*c.m10+n*c.m20,a=t*c.m01+r*c.m11+n*c.m21,l=t*c.m02+r*c.m12+n*c.m22,u=i*s.m00+o*s.m10+p*s.m20,h=i*s.m01+o*s.m11+p*s.m21,d=i*s.m02+o*s.m12+p*s.m22,g=m*s.m00+a*s.m10+l*s.m20,_=m*s.m01+a*s.m11+l*s.m21,S=m*s.m02+a*s.m12+l*s.m22;return g*=u/E,_*=h/b,S*=d/y,m=g*e.m00+_*e.m10+S*e.m20,a=g*e.m01+_*e.m11+S*e.m21,l=g*e.m02+_*e.m12+S*e.m22,[m,a,l]},rg=Pst;});var kst,ng=Cn(()=>{As();Cc();lo();Yc();xv();mv();ex();dn.prototype.lab=function(){return rg(this._rgb)};kst=(...t)=>new dn(...t,"lab");Object.assign(Os,{lab:kst,getLabWhitePoint:tx,setLabWhitePoint:n1});rs.format.lab=eg;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"lab"),Zi(t)==="array"&&t.length===3)return "lab"}});});var eD=Cn(()=>{ng();lo();ex();dn.prototype.darken=function(t=1){let r=this,n=r.lab();return n[0]-=cp.Kn*t,new dn(n,"lab").alpha(r.alpha(),true)};dn.prototype.brighten=function(t=1){return this.darken(-t)};dn.prototype.darker=dn.prototype.darken;dn.prototype.brighter=dn.prototype.brighten;});var rD=Cn(()=>{lo();dn.prototype.get=function(t){let[r,n]=t.split("."),c=this[r]();if(n){let s=r.indexOf(n)-(r.substr(0,2)==="ok"?2:0);if(s>-1)return c[s];throw new Error(`unknown channel ${n} in mode ${r}`)}else return c};});var Fst,Bst,jst,Ust,nb,ib=Cn(()=>{lo();As();(({pow:Fst}=Math)),Bst=1e-7,jst=20;dn.prototype.luminance=function(t,r="rgb"){if(t!==void 0&&Zi(t)==="number"){if(t===0)return new dn([0,0,0,this._rgb[3]],"rgb");if(t===1)return new dn([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),c=jst,s=(i,o)=>{let p=i.interpolate(o,.5,r),E=p.luminance();return Math.abs(t-E)<Bst||!c--?p:E>t?s(i,p):s(p,o)},e=(n>t?s(new dn([0,0,0]),this):s(this,new dn([255,255,255]))).rgb();return new dn([...e,this._rgb[3]])}return Ust(...this._rgb.slice(0,3))};Ust=(t,r,n)=>(t=nb(t),r=nb(r),n=nb(n),.2126*t+.7152*r+.0722*n),nb=t=>(t/=255,t<=.03928?t/12.92:Fst((t+.055)/1.055,2.4));});var Du,Ld=Cn(()=>{Du={};});var hp,gv=Cn(()=>{lo();As();Ld();hp=(t,r,n=.5,...c)=>{let s=c[0]||"lrgb";if(!Du[s]&&!c.length&&(s=Object.keys(Du)[0]),!Du[s])throw new Error(`interpolation mode ${s} is not defined`);return Zi(t)!=="object"&&(t=new dn(t)),Zi(r)!=="object"&&(r=new dn(r)),Du[s](t,r,n).alpha(t.alpha()+n*(r.alpha()-t.alpha()))};});var nD=Cn(()=>{lo();gv();dn.prototype.mix=dn.prototype.interpolate=function(t,r=.5,...n){return hp(this,t,r,...n)};});var iD=Cn(()=>{lo();dn.prototype.premultiply=function(t=false){let r=this._rgb,n=r[3];return t?(this._rgb=[r[0]*n,r[1]*n,r[2]*n,n],this):new dn([r[0]*n,r[1]*n,r[2]*n,n],"rgb")};});var Kst,$st,Hst,h4,sb=Cn(()=>{As();(({sin:Kst,cos:$st}=Math)),Hst=(...t)=>{let[r,n,c]=Li(t,"lch");return isNaN(c)&&(c=0),c=c*VI,[r,$st(c)*n,Kst(c)*n]},h4=Hst;});var Gst,ig,f4=Cn(()=>{As();sb();xv();Gst=(...t)=>{t=Li(t,"lch");let[r,n,c]=t,[s,e,i]=h4(r,n,c),[o,p,E]=eg(s,e,i);return [o,p,E,t.length>3?t[3]:1]},ig=Gst;});var qst,sD,oD=Cn(()=>{As();f4();qst=(...t)=>{let r=a4(Li(t,"hcl"));return ig(...r)},sD=qst;});var zst,Vst,Yst,Wst,d4,ob=Cn(()=>{As();(({sqrt:zst,atan2:Vst,round:Yst}=Math)),Wst=(...t)=>{let[r,n,c]=Li(t,"lab"),s=zst(n*n+c*c),e=(Vst(c,n)*YI+360)%360;return Yst(s*1e4)===0&&(e=Number.NaN),[r,s,e]},d4=Wst;});var Xst,yv,ab=Cn(()=>{As();mv();ob();Xst=(...t)=>{let[r,n,c,...s]=Li(t,"rgb"),[e,i,o]=rg(r,n,c),[p,E,b]=d4(e,i,o);return [p,E,b,...s.length>0&&s[0]<1?[s[0]]:[]]},yv=Xst;});var Qst,Jst,vv=Cn(()=>{As();Cc();lo();Yc();f4();oD();ab();dn.prototype.lch=function(){return yv(this._rgb)};dn.prototype.hcl=function(){return a4(yv(this._rgb))};Qst=(...t)=>new dn(...t,"lch"),Jst=(...t)=>new dn(...t,"hcl");Object.assign(Os,{lch:Qst,hcl:Jst});rs.format.lch=ig;rs.format.hcl=sD;["lch","hcl"].forEach(t=>rs.autodetect.push({p:2,test:(...r)=>{if(r=Li(r,t),Zi(r)==="array"&&r.length===3)return t}}));});var aD=Cn(()=>{vv();lo();ex();dn.prototype.saturate=function(t=1){let r=this,n=r.lch();return n[1]+=cp.Kn*t,n[1]<0&&(n[1]=0),new dn(n,"lch").alpha(r.alpha(),true)};dn.prototype.desaturate=function(t=1){return this.saturate(-t)};});var uD=Cn(()=>{lo();As();dn.prototype.set=function(t,r,n=false){let[c,s]=t.split("."),e=this[c]();if(s){let i=c.indexOf(s)-(c.substr(0,2)==="ok"?2:0);if(i>-1){if(Zi(r)=="string")switch(r.charAt(0)){case "+":e[i]+=+r;break;case "-":e[i]+=+r;break;case "*":e[i]*=+r.substr(1);break;case "/":e[i]/=+r.substr(1);break;default:e[i]=+r;}else if(Zi(r)==="number")e[i]=r;else throw new Error("unsupported value for Color.set");let o=new dn(e,c);return n?(this._rgb=o._rgb,this):o}throw new Error(`unknown channel ${s} in mode ${c}`)}else return e};});var lD=Cn(()=>{ng();lo();gv();dn.prototype.tint=function(t=.5,...r){return hp(this,"white",t,...r)};dn.prototype.shade=function(t=.5,...r){return hp(this,"black",t,...r)};});var Zst,cD=Cn(()=>{lo();Ld();Zst=(t,r,n)=>{let c=t._rgb,s=r._rgb;return new dn(c[0]+n*(s[0]-c[0]),c[1]+n*(s[1]-c[1]),c[2]+n*(s[2]-c[2]),"rgb")};Du.rgb=Zst;});var ub,sg,tot,hD=Cn(()=>{lo();Ld();(({sqrt:ub,pow:sg}=Math)),tot=(t,r,n)=>{let[c,s,e]=t._rgb,[i,o,p]=r._rgb;return new dn(ub(sg(c,2)*(1-n)+sg(i,2)*n),ub(sg(s,2)*(1-n)+sg(o,2)*n),ub(sg(e,2)*(1-n)+sg(p,2)*n),"rgb")};Du.lrgb=tot;});var eot,fD=Cn(()=>{ng();Ld();lo();eot=(t,r,n)=>{let c=t.lab(),s=r.lab();return new dn(c[0]+n*(s[0]-c[0]),c[1]+n*(s[1]-c[1]),c[2]+n*(s[2]-c[2]),"lab")};Du.lab=eot;});var i1,C3=Cn(()=>{lo();i1=(t,r,n,c)=>{let s,e;c==="hsl"?(s=t.hsl(),e=r.hsl()):c==="hsv"?(s=t.hsv(),e=r.hsv()):c==="hcg"?(s=t.hcg(),e=r.hcg()):c==="hsi"?(s=t.hsi(),e=r.hsi()):c==="lch"||c==="hcl"?(c="hcl",s=t.hcl(),e=r.hcl()):c==="oklch"&&(s=t.oklch().reverse(),e=r.oklch().reverse());let i,o,p,E,b,y;(c.substr(0,1)==="h"||c==="oklch")&&([i,p,b]=s,[o,E,y]=e);let m,a,l,u;return !isNaN(i)&&!isNaN(o)?(o>i&&o-i>180?u=o-(i+360):o<i&&i-o>180?u=o+360-i:u=o-i,a=i+n*u):isNaN(i)?isNaN(o)?a=Number.NaN:(a=o,(b==1||b==0)&&c!="hsv"&&(m=E)):(a=i,(y==1||y==0)&&c!="hsv"&&(m=p)),m===void 0&&(m=p+n*(E-p)),l=b+n*(y-b),c==="oklch"?new dn([l,m,a],c):new dn([a,m,l],c)};});var dD,pD=Cn(()=>{vv();C3();Ld();dD=(t,r,n)=>i1(t,r,n,"lch");Du.lch=dD;Du.hcl=dD;});var rot,xD,mD=Cn(()=>{As();rot=t=>{if(Zi(t)=="number"&&t>=0&&t<=16777215){let r=t>>16,n=t>>8&255,c=t&255;return [r,n,c,1]}throw new Error("unknown num color: "+t)},xD=rot;});var not,gD,yD=Cn(()=>{As();not=(...t)=>{let[r,n,c]=Li(t,"rgb");return (r<<16)+(n<<8)+c},gD=not;});var iot,lb=Cn(()=>{Cc();lo();Yc();As();mD();yD();dn.prototype.num=function(){return gD(this._rgb)};iot=(...t)=>new dn(...t,"num");Object.assign(Os,{num:iot});rs.format.num=xD;rs.autodetect.push({p:5,test:(...t)=>{if(t.length===1&&Zi(t[0])==="number"&&t[0]>=0&&t[0]<=16777215)return "num"}});});var sot,vD=Cn(()=>{lb();Ld();lo();sot=(t,r,n)=>{let c=t.num(),s=r.num();return new dn(c+n*(s-c),"num")};Du.num=sot;});var oot,aot,ED,_D=Cn(()=>{As();(({floor:oot}=Math)),aot=(...t)=>{t=Li(t,"hcg");let[r,n,c]=t,s,e,i;c=c*255;let o=n*255;if(n===0)s=e=i=c;else {r===360&&(r=0),r>360&&(r-=360),r<0&&(r+=360),r/=60;let p=oot(r),E=r-p,b=c*(1-n),y=b+o*(1-E),m=b+o*E,a=b+o;switch(p){case 0:[s,e,i]=[a,m,b];break;case 1:[s,e,i]=[y,a,b];break;case 2:[s,e,i]=[b,a,m];break;case 3:[s,e,i]=[b,y,a];break;case 4:[s,e,i]=[m,b,a];break;case 5:[s,e,i]=[a,b,y];break}}return [s,e,i,t.length>3?t[3]:1]},ED=aot;});var uot,TD,bD=Cn(()=>{As();uot=(...t)=>{let[r,n,c]=Li(t,"rgb"),s=i4(r,n,c),e=s4(r,n,c),i=e-s,o=i*100/255,p=s/(255-i)*100,E;return i===0?E=Number.NaN:(r===e&&(E=(n-c)/i),n===e&&(E=2+(c-r)/i),c===e&&(E=4+(r-n)/i),E*=60,E<0&&(E+=360)),[E,o,p]},TD=uot;});var lot,cb=Cn(()=>{As();Cc();lo();Yc();_D();bD();dn.prototype.hcg=function(){return TD(this._rgb)};lot=(...t)=>new dn(...t,"hcg");Os.hcg=lot;rs.format.hcg=ED;rs.autodetect.push({p:1,test:(...t)=>{if(t=Li(t,"hcg"),Zi(t)==="array"&&t.length===3)return "hcg"}});});var cot,AD=Cn(()=>{cb();C3();Ld();cot=(t,r,n)=>i1(t,r,n,"hcg");Du.hcg=cot;});var og,hot,OD,SD=Cn(()=>{As();(({cos:og}=Math)),hot=(...t)=>{t=Li(t,"hsi");let[r,n,c]=t,s,e,i;return isNaN(r)&&(r=0),isNaN(n)&&(n=0),r>360&&(r-=360),r<0&&(r+=360),r/=360,r<1/3?(i=(1-n)/3,s=(1+n*og(r1*r)/og(o4-r1*r))/3,e=1-(i+s)):r<2/3?(r-=1/3,s=(1-n)/3,e=(1+n*og(r1*r)/og(o4-r1*r))/3,i=1-(s+e)):(r-=2/3,e=(1-n)/3,i=(1+n*og(r1*r)/og(o4-r1*r))/3,s=1-(e+i)),s=e1(c*s*3),e=e1(c*e*3),i=e1(c*i*3),[s*255,e*255,i*255,t.length>3?t[3]:1]},OD=hot;});var fot,dot,pot,xot,CD,ND=Cn(()=>{As();(({min:fot,sqrt:dot,acos:pot}=Math)),xot=(...t)=>{let[r,n,c]=Li(t,"rgb");r/=255,n/=255,c/=255;let s,e=fot(r,n,c),i=(r+n+c)/3,o=i>0?1-e/i:0;return o===0?s=NaN:(s=(r-n+(r-c))/2,s/=dot((r-n)*(r-n)+(r-c)*(n-c)),s=pot(s),c>n&&(s=r1-s),s/=r1),[s*360,o,i]},CD=xot;});var mot,hb=Cn(()=>{As();Cc();lo();Yc();SD();ND();dn.prototype.hsi=function(){return CD(this._rgb)};mot=(...t)=>new dn(...t,"hsi");Os.hsi=mot;rs.format.hsi=OD;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"hsi"),Zi(t)==="array"&&t.length===3)return "hsi"}});});var got,RD=Cn(()=>{hb();C3();Ld();got=(t,r,n)=>i1(t,r,n,"hsi");Du.hsi=got;});var yot,Ev,fb=Cn(()=>{As();yot=(...t)=>{t=Li(t,"hsl");let[r,n,c]=t,s,e,i;if(n===0)s=e=i=c*255;else {let o=[0,0,0],p=[0,0,0],E=c<.5?c*(1+n):c+n-c*n,b=2*c-E,y=r/360;o[0]=y+1/3,o[1]=y,o[2]=y-1/3;for(let m=0;m<3;m++)o[m]<0&&(o[m]+=1),o[m]>1&&(o[m]-=1),6*o[m]<1?p[m]=b+(E-b)*6*o[m]:2*o[m]<1?p[m]=E:3*o[m]<2?p[m]=b+(E-b)*(2/3-o[m])*6:p[m]=b;[s,e,i]=[p[0]*255,p[1]*255,p[2]*255];}return t.length>3?[s,e,i,t[3]]:[s,e,i,1]},Ev=yot;});var vot,p4,db=Cn(()=>{As();vot=(...t)=>{t=Li(t,"rgba");let[r,n,c]=t;r/=255,n/=255,c/=255;let s=i4(r,n,c),e=s4(r,n,c),i=(e+s)/2,o,p;return e===s?(o=0,p=Number.NaN):o=i<.5?(e-s)/(e+s):(e-s)/(2-e-s),r==e?p=(n-c)/(e-s):n==e?p=2+(c-r)/(e-s):c==e&&(p=4+(r-n)/(e-s)),p*=60,p<0&&(p+=360),t.length>3&&t[3]!==void 0?[p,o,i,t[3]]:[p,o,i]},p4=vot;});var Eot,x4=Cn(()=>{As();Cc();lo();Yc();fb();db();dn.prototype.hsl=function(){return p4(this._rgb)};Eot=(...t)=>new dn(...t,"hsl");Os.hsl=Eot;rs.format.hsl=Ev;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"hsl"),Zi(t)==="array"&&t.length===3)return "hsl"}});});var _ot,wD=Cn(()=>{x4();C3();Ld();_ot=(t,r,n)=>i1(t,r,n,"hsl");Du.hsl=_ot;});var Tot,bot,ID,DD=Cn(()=>{As();(({floor:Tot}=Math)),bot=(...t)=>{t=Li(t,"hsv");let[r,n,c]=t,s,e,i;if(c*=255,n===0)s=e=i=c;else {r===360&&(r=0),r>360&&(r-=360),r<0&&(r+=360),r/=60;let o=Tot(r),p=r-o,E=c*(1-n),b=c*(1-n*p),y=c*(1-n*(1-p));switch(o){case 0:[s,e,i]=[c,y,E];break;case 1:[s,e,i]=[b,c,E];break;case 2:[s,e,i]=[E,c,y];break;case 3:[s,e,i]=[E,b,c];break;case 4:[s,e,i]=[y,E,c];break;case 5:[s,e,i]=[c,E,b];break}}return [s,e,i,t.length>3?t[3]:1]},ID=bot;});var Aot,Oot,Sot,LD,PD=Cn(()=>{As();(({min:Aot,max:Oot}=Math)),Sot=(...t)=>{t=Li(t,"rgb");let[r,n,c]=t,s=Aot(r,n,c),e=Oot(r,n,c),i=e-s,o,p,E;return E=e/255,e===0?(o=Number.NaN,p=0):(p=i/e,r===e&&(o=(n-c)/i),n===e&&(o=2+(c-r)/i),c===e&&(o=4+(r-n)/i),o*=60,o<0&&(o+=360)),[o,p,E]},LD=Sot;});var Cot,pb=Cn(()=>{As();Cc();lo();Yc();DD();PD();dn.prototype.hsv=function(){return LD(this._rgb)};Cot=(...t)=>new dn(...t,"hsv");Os.hsv=Cot;rs.format.hsv=ID;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"hsv"),Zi(t)==="array"&&t.length===3)return "hsv"}});});var Not,MD=Cn(()=>{pb();C3();Ld();Not=(t,r,n)=>i1(t,r,n,"hsv");Du.hsv=Not;});function N3(t,r){let n=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(r[0])||(r=r.map(i=>[i]));let c=r[0].length,s=r[0].map((i,o)=>r.map(p=>p[o])),e=t.map(i=>s.map(o=>Array.isArray(i)?i.reduce((p,E,b)=>p+E*(o[b]||0),0):o.reduce((p,E)=>p+E*i,0)));return n===1&&(e=e[0]),c===1?e.map(i=>i[0]):e}var xb=Cn(()=>{});function wot(t){var r=[[1.2268798758459243,-0.5578149944602171,.2813910456659647],[-0.0405757452148008,1.112286803280317,-0.0717110580655164],[-0.0763729366746601,-0.4214933324022432,1.5869240198367816]],n=[[1,.3963377773761749,.2158037573099136],[1,-0.1055613458156586,-0.0638541728258133],[1,-0.0894841775298119,-1.2914855480194092]],c=N3(n,t);return N3(r,c.map(s=>s**3))}var Rot,ag,m4=Cn(()=>{As();xb();xv();Rot=(...t)=>{t=Li(t,"lab");let[r,n,c,...s]=t,[e,i,o]=wot([r,n,c]),[p,E,b]=tb(e,i,o);return [p,E,b,...s.length>0&&s[0]<1?[s[0]]:[]]};ag=Rot;});function Dot(t){let r=[[.819022437996703,.3619062600528904,-0.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],n=[[.210454268309314,.7936177747023054,-0.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-0.8086757549230774]],c=N3(r,t);return N3(n,c.map(s=>Math.cbrt(s)))}var Iot,ug,g4=Cn(()=>{As();xb();mv();Iot=(...t)=>{let[r,n,c,...s]=Li(t,"rgb"),e=rb(r,n,c);return [...Dot(e),...s.length>0&&s[0]<1?[s[0]]:[]]};ug=Iot;});var Lot,mb=Cn(()=>{As();Cc();lo();Yc();m4();g4();dn.prototype.oklab=function(){return ug(this._rgb)};Lot=(...t)=>new dn(...t,"oklab");Object.assign(Os,{oklab:Lot});rs.format.oklab=ag;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"oklab"),Zi(t)==="array"&&t.length===3)return "oklab"}});});var Pot,kD=Cn(()=>{mb();Ld();lo();Pot=(t,r,n)=>{let c=t.oklab(),s=r.oklab();return new dn(c[0]+n*(s[0]-c[0]),c[1]+n*(s[1]-c[1]),c[2]+n*(s[2]-c[2]),"oklab")};Du.oklab=Pot;});var Mot,FD=Cn(()=>{vv();C3();Ld();Mot=(t,r,n)=>i1(t,r,n,"oklch");Du.oklch=Mot;});var gb,yb,vb,BD,jD,kot,UD,Fot,KD=Cn(()=>{lo();As();(({pow:gb,sqrt:yb,PI:vb,cos:BD,sin:jD,atan2:kot}=Math)),UD=(t,r="lrgb",n=null)=>{let c=t.length;n||(n=Array.from(new Array(c)).map(()=>1));let s=c/n.reduce(function(y,m){return y+m});if(n.forEach((y,m)=>{n[m]*=s;}),t=t.map(y=>new dn(y)),r==="lrgb")return Fot(t,n);let e=t.shift(),i=e.get(r),o=[],p=0,E=0;for(let y=0;y<i.length;y++)if(i[y]=(i[y]||0)*n[0],o.push(isNaN(i[y])?0:n[0]),r.charAt(y)==="h"&&!isNaN(i[y])){let m=i[y]/180*vb;p+=BD(m)*n[0],E+=jD(m)*n[0];}let b=e.alpha()*n[0];t.forEach((y,m)=>{let a=y.get(r);b+=y.alpha()*n[m+1];for(let l=0;l<i.length;l++)if(!isNaN(a[l]))if(o[l]+=n[m+1],r.charAt(l)==="h"){let u=a[l]/180*vb;p+=BD(u)*n[m+1],E+=jD(u)*n[m+1];}else i[l]+=a[l]*n[m+1];});for(let y=0;y<i.length;y++)if(r.charAt(y)==="h"){let m=kot(E/o[y],p/o[y])/vb*180;for(;m<0;)m+=360;for(;m>=360;)m-=360;i[y]=m;}else i[y]=i[y]/o[y];return b/=c,new dn(i,r).alpha(b>.99999?1:b,true)},Fot=(t,r)=>{let n=t.length,c=[0,0,0,0];for(let s=0;s<t.length;s++){let e=t[s],i=r[s]/n,o=e._rgb;c[0]+=gb(o[0],2)*i,c[1]+=gb(o[1],2)*i,c[2]+=gb(o[2],2)*i,c[3]+=o[3]*i;}return c[0]=yb(c[0]),c[1]=yb(c[1]),c[2]=yb(c[2]),c[3]>.9999999&&(c[3]=1),new dn(S3(c))};});function R3(t){let r="rgb",n=Os("#ccc"),c=0,s=[0,1],e=[0,1],i=[],o=[0,0],p=false,E=[],b=false,y=0,m=1,a=false,l={},u=true,h=1,d=function(G){if(G=G||["#fff","#000"],G&&Zi(G)==="string"&&Os.brewer&&Os.brewer[G.toLowerCase()]&&(G=Os.brewer[G.toLowerCase()]),Zi(G)==="array"){G.length===1&&(G=[G[0],G[0]]),G=G.slice(0);for(let j=0;j<G.length;j++)G[j]=Os(G[j]);i.length=0;for(let j=0;j<G.length;j++)i.push(j/(G.length-1));}return T(),E=G},g=function(G){if(p!=null){let j=p.length-1,B=0;for(;B<j&&G>=p[B];)B++;return B-1}return 0},_=G=>G,S=G=>G,v=function(G,j){let B,J;if(j==null&&(j=false),isNaN(G)||G===null)return n;j?J=G:p&&p.length>2?J=g(G)/(p.length-2):m!==y?J=(G-y)/(m-y):J=1,J=S(J),j||(J=_(J)),h!==1&&(J=Bot(J,h)),J=o[0]+J*(1-o[0]-o[1]),J=e1(J,0,1);let w=Math.floor(J*1e4);if(u&&l[w])B=l[w];else {if(Zi(E)==="array")for(let $=0;$<i.length;$++){let z=i[$];if(J<=z){B=E[$];break}if(J>=z&&$===i.length-1){B=E[$];break}if(J>z&&J<i[$+1]){J=(J-z)/(i[$+1]-z),B=Os.interpolate(E[$],E[$+1],J,r);break}}else Zi(E)==="function"&&(B=E(J));u&&(l[w]=B);}return B};var T=()=>l={};d(t);let q=function(G){let j=Os(v(G));return b&&j[b]?j[b]():j};return q.classes=function(G){if(G!=null){if(Zi(G)==="array")p=G,s=[G[0],G[G.length-1]];else {let j=Os.analyze(s);G===0?p=[j.min,j.max]:p=Os.limits(j,"e",G);}return q}return p},q.domain=function(G){if(!arguments.length)return e;e=G.slice(0),y=G[0],m=G[G.length-1],i=[];let j=E.length;if(G.length===j&&y!==m)for(let B of Array.from(G))i.push((B-y)/(m-y));else {for(let B=0;B<j;B++)i.push(B/(j-1));if(G.length>2){let B=G.map((w,$)=>$/(G.length-1)),J=G.map(w=>(w-y)/(m-y));J.every((w,$)=>B[$]===w)||(S=w=>{if(w<=0||w>=1)return w;let $=0;for(;w>=J[$+1];)$++;let z=(w-J[$])/(J[$+1]-J[$]);return B[$]+z*(B[$+1]-B[$])});}}return s=[y,m],q},q.mode=function(G){return arguments.length?(r=G,T(),q):r},q.range=function(G,j){return d(G),q},q.out=function(G){return b=G,q},q.spread=function(G){return arguments.length?(c=G,q):c},q.correctLightness=function(G){return G==null&&(G=true),a=G,T(),a?_=function(j){let B=v(0,true).lab()[0],J=v(1,true).lab()[0],w=B>J,$=v(j,true).lab()[0],z=B+(J-B)*j,tt=$-z,pt=0,Z=1,dt=20;for(;Math.abs(tt)>.01&&dt-- >0;)(function(){return w&&(tt*=-1),tt<0?(pt=j,j+=(Z-j)*.5):(Z=j,j+=(pt-j)*.5),$=v(j,true).lab()[0],tt=$-z})();return j}:_=j=>j,q},q.padding=function(G){return G!=null?(Zi(G)==="number"&&(G=[G,G]),o=G,q):o},q.colors=function(G,j){arguments.length<2&&(j="hex");let B=[];if(arguments.length===0)B=E.slice(0);else if(G===1)B=[q(.5)];else if(G>1){let J=s[0],w=s[1]-J;B=jot(0,G).map($=>q(J+$/(G-1)*w));}else {t=[];let J=[];if(p&&p.length>2)for(let w=1,$=p.length,z=1<=$;z?w<$:w>$;z?w++:w--)J.push((p[w-1]+p[w])*.5);else J=s;B=J.map(w=>q(w));}return Os[j]&&(B=B.map(J=>J[j]())),B},q.cache=function(G){return G!=null?(u=G,q):u},q.gamma=function(G){return G!=null?(h=G,q):h},q.nodata=function(G){return G!=null?(n=Os(G),q):n},q}function jot(t,r,n){let c=[],s=t<r,e=r;for(let i=t;s?i<e:i>e;s?i++:i--)c.push(i);return c}var Bot,y4=Cn(()=>{Cc();As();({pow:Bot}=Math);});var Uot,Kot,$D,HD=Cn(()=>{lo();ng();y4();Uot=function(t){let r=[1,1];for(let n=1;n<t;n++){let c=[1];for(let s=1;s<=r.length;s++)c[s]=(r[s]||0)+r[s-1];r=c;}return r},Kot=function(t){let r,n,c,s;if(t=t.map(e=>new dn(e)),t.length===2)[n,c]=t.map(e=>e.lab()),r=function(e){let i=[0,1,2].map(o=>n[o]+e*(c[o]-n[o]));return new dn(i,"lab")};else if(t.length===3)[n,c,s]=t.map(e=>e.lab()),r=function(e){let i=[0,1,2].map(o=>(1-e)*(1-e)*n[o]+2*(1-e)*e*c[o]+e*e*s[o]);return new dn(i,"lab")};else if(t.length===4){let e;[n,c,s,e]=t.map(i=>i.lab()),r=function(i){let o=[0,1,2].map(p=>(1-i)*(1-i)*(1-i)*n[p]+3*(1-i)*(1-i)*i*c[p]+3*(1-i)*i*i*s[p]+i*i*i*e[p]);return new dn(o,"lab")};}else if(t.length>=5){let e,i,o;e=t.map(p=>p.lab()),o=t.length-1,i=Uot(o),r=function(p){let E=1-p,b=[0,1,2].map(y=>e.reduce((m,a,l)=>m+i[l]*E**(o-l)*p**l*a[y],0));return new dn(b,"lab")};}else throw new RangeError("No point in running bezier with only one color.");return r},$D=t=>{let r=Kot(t);return r.scale=()=>R3(r),r};});var GD,$ot,Eb=Cn(()=>{Cc();lo();Yc();As();({round:GD}=Math);dn.prototype.rgb=function(t=true){return t===false?this._rgb.slice(0,3):this._rgb.slice(0,3).map(GD)};dn.prototype.rgba=function(t=true){return this._rgb.slice(0,4).map((r,n)=>n<3?t===false?r:GD(r):r)};$ot=(...t)=>new dn(...t,"rgb");Object.assign(Os,{rgb:$ot});rs.format.rgb=(...t)=>{let r=Li(t,"rgba");return r[3]===void 0&&(r[3]=1),r};rs.autodetect.push({p:3,test:(...t)=>{if(t=Li(t,"rgba"),Zi(t)==="array"&&(t.length===3||t.length===4&&Zi(t[3])=="number"&&t[3]>=0&&t[3]<=1))return "rgb"}});});var I1,rx,nx,Hot,Got,qot,zot,Vot,Yot,Wot,Xot,qD,zD=Cn(()=>{Eb();Cc();I1=(t,r,n)=>{if(!I1[n])throw new Error("unknown blend mode "+n);return I1[n](t,r)},rx=t=>(r,n)=>{let c=Os(n).rgb(),s=Os(r).rgb();return Os.rgb(t(c,s))},nx=t=>(r,n)=>{let c=[];return c[0]=t(r[0],n[0]),c[1]=t(r[1],n[1]),c[2]=t(r[2],n[2]),c},Hot=t=>t,Got=(t,r)=>t*r/255,qot=(t,r)=>t>r?r:t,zot=(t,r)=>t>r?t:r,Vot=(t,r)=>255*(1-(1-t/255)*(1-r/255)),Yot=(t,r)=>r<128?2*t*r/255:255*(1-2*(1-t/255)*(1-r/255)),Wot=(t,r)=>255*(1-(1-r/255)/(t/255)),Xot=(t,r)=>t===255?255:(t=255*(r/255)/(1-t/255),t>255?255:t);I1.normal=rx(nx(Hot));I1.multiply=rx(nx(Got));I1.screen=rx(nx(Vot));I1.overlay=rx(nx(Yot));I1.darken=rx(nx(qot));I1.lighten=rx(nx(zot));I1.dodge=rx(nx(Xot));I1.burn=rx(nx(Wot));qD=I1;});function VD(t=300,r=-1.5,n=1,c=1,s=[0,1]){let e=0,i;Zi(s)==="array"?i=s[1]-s[0]:(i=0,s=[s,s]);let o=function(p){let E=r1*((t+120)/360+r*p),b=Qot(s[0]+i*p,c),m=(e!==0?n[0]+p*e:n)*b*(1-b)/2,a=Zot(E),l=Jot(E),u=b+m*(-0.14861*a+1.78277*l),h=b+m*(-0.29227*a-.90649*l),d=b+m*(1.97294*a);return Os(S3([u*255,h*255,d*255,1]))};return o.start=function(p){return p==null?t:(t=p,o)},o.rotations=function(p){return p==null?r:(r=p,o)},o.gamma=function(p){return p==null?c:(c=p,o)},o.hue=function(p){return p==null?n:(n=p,Zi(n)==="array"?(e=n[1]-n[0],e===0&&(n=n[1])):e=0,o)},o.lightness=function(p){return p==null?s:(Zi(p)==="array"?(s=p,i=p[1]-p[0]):(s=[p,p],i=0),o)},o.scale=()=>Os.scale(o),o.hue(n),o}var Qot,Jot,Zot,YD=Cn(()=>{As();Cc();({pow:Qot,sin:Jot,cos:Zot}=Math);});var tat,eat,rat,WD,XD=Cn(()=>{lo();tat="0123456789abcdef",{floor:eat,random:rat}=Math,WD=(t=rat)=>{let r="#";for(let n=0;n<6;n++)r+=tat.charAt(eat(t()*16));return new dn(r,"hex")};});function _b(t,r=null){let n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return Zi(t)==="object"&&(t=Object.values(t)),t.forEach(c=>{r&&Zi(c)==="object"&&(c=c[r]),c!=null&&!isNaN(c)&&(n.values.push(c),n.sum+=c,c<n.min&&(n.min=c),c>n.max&&(n.max=c),n.count+=1);}),n.domain=[n.min,n.max],n.limits=(c,s)=>Tb(n,c,s),n}function Tb(t,r="equal",n=7){Zi(t)=="array"&&(t=_b(t));let{min:c,max:s}=t,e=t.values.sort((o,p)=>o-p);if(n===1)return [c,s];let i=[];if(r.substr(0,1)==="c"&&(i.push(c),i.push(s)),r.substr(0,1)==="e"){i.push(c);for(let o=1;o<n;o++)i.push(c+o/n*(s-c));i.push(s);}else if(r.substr(0,1)==="l"){if(c<=0)throw new Error("Logarithmic scales are only possible for values > 0");let o=Math.LOG10E*QD(c),p=Math.LOG10E*QD(s);i.push(c);for(let E=1;E<n;E++)i.push(nat(10,o+E/n*(p-o)));i.push(s);}else if(r.substr(0,1)==="q"){i.push(c);for(let o=1;o<n;o++){let p=(e.length-1)*o/n,E=iat(p);if(E===p)i.push(e[E]);else {let b=p-E;i.push(e[E]*(1-b)+e[E+1]*b);}}i.push(s);}else if(r.substr(0,1)==="k"){let o,p=e.length,E=new Array(p),b=new Array(n),y=true,m=0,a=null;a=[],a.push(c);for(let h=1;h<n;h++)a.push(c+h/n*(s-c));for(a.push(s);y;){for(let d=0;d<n;d++)b[d]=0;for(let d=0;d<p;d++){let g=e[d],_=Number.MAX_VALUE,S;for(let v=0;v<n;v++){let T=sat(a[v]-g);T<_&&(_=T,S=v),b[S]++,E[d]=S;}}let h=new Array(n);for(let d=0;d<n;d++)h[d]=null;for(let d=0;d<p;d++)o=E[d],h[o]===null?h[o]=e[d]:h[o]+=e[d];for(let d=0;d<n;d++)h[d]*=1/b[d];y=false;for(let d=0;d<n;d++)if(h[d]!==a[d]){y=true;break}a=h,m++,m>200&&(y=false);}let l={};for(let h=0;h<n;h++)l[h]=[];for(let h=0;h<p;h++)o=E[h],l[o].push(e[h]);let u=[];for(let h=0;h<n;h++)u.push(l[h][0]),u.push(l[h][l[h].length-1]);u=u.sort((h,d)=>h-d),i.push(u[0]);for(let h=1;h<u.length;h+=2){let d=u[h];!isNaN(d)&&i.indexOf(d)===-1&&i.push(d);}}return i}var QD,nat,iat,sat,bb=Cn(()=>{fv();({log:QD,pow:nat,floor:iat,abs:sat}=Math);});var JD,ZD=Cn(()=>{lo();ib();JD=(t,r)=>{t=new dn(t),r=new dn(r);let n=t.luminance(),c=r.luminance();return n>c?(n+.05)/(c+.05):(c+.05)/(n+.05)};});function nL(t,r,n){return .2126729*Math.pow(t/255,2.4)+.7151522*Math.pow(r/255,2.4)+.072175*Math.pow(n/255,2.4)}var tL,oat,aat,eL,v4,rL,iL,sL=Cn(()=>{lo();gv();tL=.027,oat=5e-4,aat=.1,eL=1.14,v4=.022,rL=1.414,iL=(t,r)=>{t=new dn(t),r=new dn(r),t.alpha()<1&&(t=hp(r,t,t.alpha(),"rgb"));let n=nL(...t.rgb()),c=nL(...r.rgb()),s=n>=v4?n:n+Math.pow(v4-n,rL),e=c>=v4?c:c+Math.pow(v4-c,rL),i=Math.pow(e,.56)-Math.pow(s,.57),o=Math.pow(e,.65)-Math.pow(s,.62),p=Math.abs(e-s)<oat?0:s<e?i*eL:o*eL;return (Math.abs(p)<aat?0:p>0?p-tL:p+tL)*100};});function cL(t,r,n=1,c=1,s=1){var e=function(Zt){return 360*Zt/(2*lL)},i=function(Zt){return 2*lL*Zt/360};t=new dn(t),r=new dn(r);let[o,p,E]=Array.from(t.lab()),[b,y,m]=Array.from(r.lab()),a=(o+b)/2,l=Gp(Wc(p,2)+Wc(E,2)),u=Gp(Wc(y,2)+Wc(m,2)),h=(l+u)/2,d=.5*(1-Gp(Wc(h,7)/(Wc(h,7)+Wc(25,7)))),g=p*(1+d),_=y*(1+d),S=Gp(Wc(g,2)+Wc(E,2)),v=Gp(Wc(_,2)+Wc(m,2)),T=(S+v)/2,q=e(oL(E,g)),G=e(oL(m,_)),j=q>=0?q:q+360,B=G>=0?G:G+360,J=aL(j-B)>180?(j+B+360)/2:(j+B)/2,w=1-.17*E4(i(J-30))+.24*E4(i(2*J))+.32*E4(i(3*J+6))-.2*E4(i(4*J-63)),$=B-j;$=aL($)<=180?$:B<=j?$+360:$-360,$=2*Gp(S*v)*uL(i($)/2);let z=b-o,tt=v-S,pt=1+.015*Wc(a-50,2)/Gp(20+Wc(a-50,2)),Z=1+.045*T,dt=1+.015*T*w,gt=30*cat(-Wc((J-275)/25,2)),mt=-(2*Gp(Wc(T,7)/(Wc(T,7)+Wc(25,7))))*uL(2*i(gt)),St=Gp(Wc(z/(n*pt),2)+Wc(tt/(c*Z),2)+Wc($/(s*dt),2)+mt*(tt/(c*Z))*($/(s*dt)));return lat(0,uat(100,St))}var Gp,Wc,uat,lat,oL,aL,E4,uL,cat,lL,hL=Cn(()=>{lo();({sqrt:Gp,pow:Wc,min:uat,max:lat,atan2:oL,abs:aL,cos:E4,sin:uL,exp:cat,PI:lL}=Math);});function fL(t,r,n="lab"){t=new dn(t),r=new dn(r);let c=t.get(n),s=r.get(n),e=0;for(let i in c){let o=(c[i]||0)-(s[i]||0);e+=o*o;}return Math.sqrt(e)}var dL=Cn(()=>{lo();});var pL,xL=Cn(()=>{lo();pL=(...t)=>{try{return new dn(...t),!0}catch{return false}};});var mL,gL=Cn(()=>{Cc();x4();y4();mL={cool(){return R3([Os.hsl(180,1,.9),Os.hsl(250,.7,.4)])},hot(){return R3(["#000","#f00","#ff0","#fff"]).mode("rgb")}};});var Ab,vL,yL,hat,EL,_L=Cn(()=>{Ab={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},vL=Object.keys(Ab),yL=new Map(vL.map(t=>[t.toLowerCase(),t])),hat=typeof Proxy=="function"?new Proxy(Ab,{get(t,r){let n=r.toLowerCase();if(yL.has(n))return t[yL.get(n)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(vL)}}):Ab,EL=hat;});var fat,TL,bL=Cn(()=>{As();fat=(...t)=>{t=Li(t,"cmyk");let[r,n,c,s]=t,e=t.length>4?t[4]:1;return s===1?[0,0,0,e]:[r>=1?0:255*(1-r)*(1-s),n>=1?0:255*(1-n)*(1-s),c>=1?0:255*(1-c)*(1-s),e]},TL=fat;});var AL,dat,OL,SL=Cn(()=>{As();(({max:AL}=Math)),dat=(...t)=>{let[r,n,c]=Li(t,"rgb");r=r/255,n=n/255,c=c/255;let s=1-AL(r,AL(n,c)),e=s<1?1/(1-s):0,i=(1-r-s)*e,o=(1-n-s)*e,p=(1-c-s)*e;return [i,o,p,s]},OL=dat;});var pat,CL=Cn(()=>{Cc();lo();Yc();As();bL();SL();dn.prototype.cmyk=function(){return OL(this._rgb)};pat=(...t)=>new dn(...t,"cmyk");Object.assign(Os,{cmyk:pat});rs.format.cmyk=TL;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"cmyk"),Zi(t)==="array"&&t.length===4)return "cmyk"}});});var xat,NL,RL=Cn(()=>{As();xat=(...t)=>{let r=Li(t,"hsla"),n=Dd(t)||"lsa";return r[0]=x0(r[0]||0)+"deg",r[1]=x0(r[1]*100)+"%",r[2]=x0(r[2]*100)+"%",n==="hsla"||r.length>3&&r[3]<1?(r[3]="/ "+(r.length>3?r[3]:1),n="hsla"):r.length=3,`${n.substr(0,3)}(${r.join(" ")})`},NL=xat;});var mat,wL,IL=Cn(()=>{As();mat=(...t)=>{let r=Li(t,"lab"),n=Dd(t)||"lab";return r[0]=x0(r[0])+"%",r[1]=x0(r[1]),r[2]=x0(r[2]),n==="laba"||r.length>3&&r[3]<1?r[3]="/ "+(r.length>3?r[3]:1):r.length=3,`lab(${r.join(" ")})`},wL=mat;});var gat,DL,LL=Cn(()=>{As();gat=(...t)=>{let r=Li(t,"lch"),n=Dd(t)||"lab";return r[0]=x0(r[0])+"%",r[1]=x0(r[1]),r[2]=isNaN(r[2])?"none":x0(r[2])+"deg",n==="lcha"||r.length>3&&r[3]<1?r[3]="/ "+(r.length>3?r[3]:1):r.length=3,`lch(${r.join(" ")})`},DL=gat;});var yat,PL,ML=Cn(()=>{As();yat=(...t)=>{let r=Li(t,"lab");return r[0]=x0(r[0]*100)+"%",r[1]=dv(r[1]),r[2]=dv(r[2]),r.length>3&&r[3]<1?r[3]="/ "+(r.length>3?r[3]:1):r.length=3,`oklab(${r.join(" ")})`},PL=yat;});var vat,_4,Ob=Cn(()=>{As();g4();ob();vat=(...t)=>{let[r,n,c,...s]=Li(t,"rgb"),[e,i,o]=ug(r,n,c),[p,E,b]=d4(e,i,o);return [p,E,b,...s.length>0&&s[0]<1?[s[0]]:[]]},_4=vat;});var Eat,kL,FL=Cn(()=>{As();Eat=(...t)=>{let r=Li(t,"lch");return r[0]=x0(r[0]*100)+"%",r[1]=dv(r[1]),r[2]=isNaN(r[2])?"none":x0(r[2])+"deg",r.length>3&&r[3]<1?r[3]="/ "+(r.length>3?r[3]:1):r.length=3,`oklch(${r.join(" ")})`},kL=Eat;});var Sb,_at,BL,jL=Cn(()=>{As();RL();db();IL();mv();LL();ab();g4();ML();Ob();FL();ex();(({round:Sb}=Math)),_at=(...t)=>{let r=Li(t,"rgba"),n=Dd(t)||"rgb";if(n.substr(0,3)==="hsl")return NL(p4(r),n);if(n.substr(0,3)==="lab"){let c=tx();n1("d50");let s=wL(rg(r),n);return n1(c),s}if(n.substr(0,3)==="lch"){let c=tx();n1("d50");let s=DL(yv(r),n);return n1(c),s}return n.substr(0,5)==="oklab"?PL(ug(r)):n.substr(0,5)==="oklch"?kL(_4(r)):(r[0]=Sb(r[0]),r[1]=Sb(r[1]),r[2]=Sb(r[2]),(n==="rgba"||r.length>3&&r[3]<1)&&(r[3]="/ "+(r.length>3?r[3]:1),n="rgba"),`${n.substr(0,3)}(${r.slice(0,n==="rgb"?3:4).join(" ")})`)},BL=_at;});var Tat,T4,Cb=Cn(()=>{As();sb();m4();Tat=(...t)=>{t=Li(t,"lch");let[r,n,c,...s]=t,[e,i,o]=h4(r,n,c),[p,E,b]=ag(e,i,o);return [p,E,b,...s.length>0&&s[0]<1?[s[0]]:[]]},T4=Tat;});var qp,D1,b4,s1,cg,Nb,A4,hg,UL,KL,$L,HL,GL,qL,zL,VL,YL,WL,XL,lg,Xc,Af,QL,Rb,JL=Cn(()=>{fb();xv();f4();m4();Cb();Yc();r4();ex();qp=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,D1=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,b4=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,s1=/\s*/.source,cg=/\s+/.source,Nb=/\s*,\s*/.source,A4=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,hg=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,UL=new RegExp("^rgba?\\("+s1+[qp,qp,qp].join(cg)+hg+"\\)$"),KL=new RegExp("^rgb\\("+s1+[qp,qp,qp].join(Nb)+s1+"\\)$"),$L=new RegExp("^rgba\\("+s1+[qp,qp,qp,D1].join(Nb)+s1+"\\)$"),HL=new RegExp("^hsla?\\("+s1+[A4,b4,b4].join(cg)+hg+"\\)$"),GL=new RegExp("^hsl?\\("+s1+[A4,b4,b4].join(Nb)+s1+"\\)$"),qL=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,zL=new RegExp("^lab\\("+s1+[D1,D1,D1].join(cg)+hg+"\\)$"),VL=new RegExp("^lch\\("+s1+[D1,D1,A4].join(cg)+hg+"\\)$"),YL=new RegExp("^oklab\\("+s1+[D1,D1,D1].join(cg)+hg+"\\)$"),WL=new RegExp("^oklch\\("+s1+[D1,D1,A4].join(cg)+hg+"\\)$"),{round:XL}=Math,lg=t=>t.map((r,n)=>n<=2?e1(XL(r),0,255):r),Xc=(t,r=0,n=100,c=false)=>(typeof t=="string"&&t.endsWith("%")&&(t=parseFloat(t.substring(0,t.length-1))/100,c?t=r+(t+1)*.5*(n-r):t=r+t*(n-r)),+t),Af=(t,r)=>t==="none"?r:t,QL=t=>{if(t=t.toLowerCase().trim(),t==="transparent")return [0,0,0,0];let r;if(rs.format.named)try{return rs.format.named(t)}catch{}if((r=t.match(UL))||(r=t.match(KL))){let n=r.slice(1,4);for(let s=0;s<3;s++)n[s]=+Xc(Af(n[s],0),0,255);n=lg(n);let c=r[4]!==void 0?+Xc(r[4],0,1):1;return n[3]=c,n}if(r=t.match($L)){let n=r.slice(1,5);for(let c=0;c<4;c++)n[c]=+Xc(n[c],0,255);return n}if((r=t.match(HL))||(r=t.match(GL))){let n=r.slice(1,4);n[0]=+Af(n[0].replace("deg",""),0),n[1]=+Xc(Af(n[1],0),0,100)*.01,n[2]=+Xc(Af(n[2],0),0,100)*.01;let c=lg(Ev(n)),s=r[4]!==void 0?+Xc(r[4],0,1):1;return c[3]=s,c}if(r=t.match(qL)){let n=r.slice(1,4);n[1]*=.01,n[2]*=.01;let c=Ev(n);for(let s=0;s<3;s++)c[s]=XL(c[s]);return c[3]=+r[4],c}if(r=t.match(zL)){let n=r.slice(1,4);n[0]=Xc(Af(n[0],0),0,100),n[1]=Xc(Af(n[1],0),-125,125,true),n[2]=Xc(Af(n[2],0),-125,125,true);let c=tx();n1("d50");let s=lg(eg(n));n1(c);let e=r[4]!==void 0?+Xc(r[4],0,1):1;return s[3]=e,s}if(r=t.match(VL)){let n=r.slice(1,4);n[0]=Xc(n[0],0,100),n[1]=Xc(Af(n[1],0),0,150,false),n[2]=+Af(n[2].replace("deg",""),0);let c=tx();n1("d50");let s=lg(ig(n));n1(c);let e=r[4]!==void 0?+Xc(r[4],0,1):1;return s[3]=e,s}if(r=t.match(YL)){let n=r.slice(1,4);n[0]=Xc(Af(n[0],0),0,1),n[1]=Xc(Af(n[1],0),-0.4,.4,true),n[2]=Xc(Af(n[2],0),-0.4,.4,true);let c=lg(ag(n)),s=r[4]!==void 0?+Xc(r[4],0,1):1;return c[3]=s,c}if(r=t.match(WL)){let n=r.slice(1,4);n[0]=Xc(Af(n[0],0),0,1),n[1]=Xc(Af(n[1],0),0,.4,false),n[2]=+Af(n[2].replace("deg",""),0);let c=lg(T4(n)),s=r[4]!==void 0?+Xc(r[4],0,1):1;return c[3]=s,c}};QL.test=t=>UL.test(t)||HL.test(t)||zL.test(t)||VL.test(t)||YL.test(t)||WL.test(t)||KL.test(t)||$L.test(t)||GL.test(t)||qL.test(t)||t==="transparent";Rb=QL;});var bat,ZL=Cn(()=>{Cc();lo();Yc();As();jL();JL();dn.prototype.css=function(t){return BL(this._rgb,t)};bat=(...t)=>new dn(...t,"css");Os.css=bat;rs.format.css=Rb;rs.autodetect.push({p:5,test:(t,...r)=>{if(!r.length&&Zi(t)==="string"&&Rb.test(t))return "css"}});});var Aat,tP=Cn(()=>{lo();Cc();Yc();As();rs.format.gl=(...t)=>{let r=Li(t,"rgba");return r[0]*=255,r[1]*=255,r[2]*=255,r};Aat=(...t)=>new dn(...t,"gl");Os.gl=Aat;dn.prototype.gl=function(){let t=this._rgb;return [t[0]/255,t[1]/255,t[2]/255,t[3]]};});var Oat,eP=Cn(()=>{lo();Cc();As();Yc();QT();JT();dn.prototype.hex=function(t){return c4(this._rgb,t)};Oat=(...t)=>new dn(...t,"hex");Os.hex=Oat;rs.format.hex=u4;rs.autodetect.push({p:4,test:(t,...r)=>{if(!r.length&&Zi(t)==="string"&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return "hex"}});});var O4,Sat,S4,wb=Cn(()=>{(({log:O4}=Math)),Sat=t=>{let r=t/100,n,c,s;return r<66?(n=255,c=r<6?0:-155.25485562709179-.44596950469579133*(c=r-2)+104.49216199393888*O4(c),s=r<20?0:-254.76935184120902+.8274096064007395*(s=r-10)+115.67994401066147*O4(s)):(n=351.97690566805693+.114206453784165*(n=r-55)-40.25366309332127*O4(n),c=325.4494125711974+.07943456536662342*(c=r-50)-28.0852963507957*O4(c),s=255),[n,c,s,1]},S4=Sat;});var Cat,Nat,rP,nP=Cn(()=>{wb();As();(({round:Cat}=Math)),Nat=(...t)=>{let r=Li(t,"rgb"),n=r[0],c=r[2],s=1e3,e=4e4,i=.4,o;for(;e-s>i;){o=(e+s)*.5;let p=S4(o);p[2]/p[0]>=c/n?e=o:s=o;}return Cat(o)},rP=Nat;});var Ib,iP=Cn(()=>{Cc();lo();Yc();wb();nP();dn.prototype.temp=dn.prototype.kelvin=dn.prototype.temperature=function(){return rP(this._rgb)};Ib=(...t)=>new dn(...t,"temp");Object.assign(Os,{temp:Ib,kelvin:Ib,temperature:Ib});rs.format.temp=rs.format.kelvin=rs.format.temperature=S4;});var Rat,sP=Cn(()=>{As();Cc();lo();Yc();Cb();Ob();dn.prototype.oklch=function(){return _4(this._rgb)};Rat=(...t)=>new dn(...t,"oklch");Object.assign(Os,{oklch:Rat});rs.format.oklch=T4;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"oklch"),Zi(t)==="array"&&t.length===3)return "oklch"}});});var oP,aP=Cn(()=>{Cc();JI();ZI();tD();eD();rD();ib();nD();iD();aD();uD();lD();cD();hD();fD();pD();vD();AD();RD();wD();MD();kD();FD();KD();HD();zD();YD();gv();XD();y4();bb();ZD();sL();hL();dL();bb();xL();Yc();gL();XT();_L();lo();CL();ZL();tP();cb();eP();hb();x4();pb();ng();vv();lb();Eb();iP();mb();sP();Object.assign(Os,{analyze:_b,average:UD,bezier:$D,blend:qD,brewer:EL,Color:dn,colors:Z2,contrast:JD,contrastAPCA:iL,cubehelix:VD,deltaE:cL,distance:fL,input:rs,interpolate:hp,limits:Tb,mix:hp,random:WD,scale:R3,scales:mL,valid:pL});oP=Os;});var _v,Db=Cn(()=>{aP();_v=class{constructor(r){this.colors=this.generateColors(r),this.index=0;}generateColors(r){let n=[];for(let c=0;c<r;c++)n.push(this.phyllotacticColor(c));return n}getNextColor(){return this.index>=this.colors.length&&(this.index=0),this.colors[this.index++]}phyllotacticColor(r){let n=137.5*(Math.PI/180),c=100,s=r*n,e=c*Math.cos(s),i=c*Math.sin(s),o=50,p=e,E=i,b=oP.lab(o,p,E).rgb(),y=1,m=Math.round(b[0]*y),a=Math.round(b[1]*y),l=Math.round(b[2]*y);return `rgb(${m}, ${a}, ${l})`}};});function ix(){return new wat}var wat,uP,Lb=Cn(()=>{wat=(function(){function t(){this.index={},this.array=[];}return t.prototype.size=function(){return this.array.length},t.prototype.empty=function(){return this.array.length===0},t.prototype.itemAt=function(r){return this.array[r]},t.prototype.contains=function(r){return this.index[r.id()]!==void 0},t.prototype.find=function(r){var n=this.index[r.id()];return n===void 0?void 0:this.array[n]},t.prototype.setDefault=function(r,n){var c=this.index[r.id()];if(c===void 0){var s=new uP(r,n());return this.index[r.id()]=this.array.length,this.array.push(s),s}else return this.array[c]},t.prototype.insert=function(r,n){var c=new uP(r,n),s=this.index[r.id()];return s===void 0?(this.index[r.id()]=this.array.length,this.array.push(c)):this.array[s]=c,c},t.prototype.erase=function(r){var n=this.index[r.id()];if(n!==void 0){this.index[r.id()]=void 0;var c=this.array[n],s=this.array.pop();return c!==s&&(this.array[n]=s,this.index[s.first.id()]=n),c}},t.prototype.copy=function(){for(var r=new t,n=0;n<this.array.length;n++){var c=this.array[n].copy();r.array[n]=c,r.index[c.first.id()]=n;}return r},t})(),uP=(function(){function t(r,n){this.first=r,this.second=n;}return t.prototype.copy=function(){return new t(this.first,this.second)},t})();});var rd,Iat,Pb=Cn(()=>{Tv();rd=(function(){function t(r){r===void 0&&(r=""),this._value=0,this._context=null,this._id=Iat++,this._name=r;}return t.prototype.id=function(){return this._id},t.prototype.name=function(){return this._name},t.prototype.setName=function(r){this._name=r;},t.prototype.context=function(){return this._context},t.prototype.setContext=function(r){this._context=r;},t.prototype.value=function(){return this._value},t.prototype.setValue=function(r){this._value=r;},t.prototype.plus=function(r){return new L1(this,r)},t.prototype.minus=function(r){return new L1(this,typeof r=="number"?-r:[-1,r])},t.prototype.multiply=function(r){return new L1([r,this])},t.prototype.divide=function(r){return new L1([1/r,this])},t.prototype.toJSON=function(){return {name:this._name,value:this._value}},t.prototype.toString=function(){return this._context+"["+this._name+":"+this._value+"]"},t})(),Iat=0;});function Dat(t){for(var r=0,n=function(){return 0},c=ix(),s=0,e=t.length;s<e;++s){var i=t[s];if(typeof i=="number")r+=i;else if(i instanceof rd)c.setDefault(i,n).second+=1;else if(i instanceof L1){r+=i.constant();for(var o=i.terms(),p=0,E=o.size();p<E;p++){var b=o.itemAt(p);c.setDefault(b.first,n).second+=b.second;}}else if(i instanceof Array){if(i.length!==2)throw new Error("array must have length 2");var y=i[0],m=i[1];if(typeof y!="number")throw new Error("array item 0 must be a number");if(m instanceof rd)c.setDefault(m,n).second+=y;else if(m instanceof L1){r+=m.constant()*y;for(var o=m.terms(),p=0,E=o.size();p<E;p++){var b=o.itemAt(p);c.setDefault(b.first,n).second+=b.second*y;}}else throw new Error("array item 1 must be a variable or expression")}else throw new Error("invalid Expression argument: "+i)}return {terms:c,constant:r}}var L1,Tv=Cn(()=>{Lb();Pb();L1=(function(){function t(){var r=Dat(arguments);this._terms=r.terms,this._constant=r.constant;}return t.prototype.terms=function(){return this._terms},t.prototype.constant=function(){return this._constant},t.prototype.value=function(){for(var r=this._constant,n=0,c=this._terms.size();n<c;n++){var s=this._terms.itemAt(n);r+=s.first.value()*s.second;}return r},t.prototype.plus=function(r){return new t(this,r)},t.prototype.minus=function(r){return new t(this,typeof r=="number"?-r:[-1,r])},t.prototype.multiply=function(r){return new t([r,this])},t.prototype.divide=function(r){return new t([1/r,this])},t.prototype.isConstant=function(){return this._terms.size()==0},t.prototype.toString=function(){var r=this._terms.array.map(function(n){return n.second+"*"+n.first.toString()}).join(" + ");return !this.isConstant()&&this._constant!==0&&(r+=" + "),r+=this._constant,r},t})();});var xu,C4=Cn(()=>{xu=(function(){function t(){}return t.create=function(r,n,c,s){s===void 0&&(s=1);var e=0;return e+=Math.max(0,Math.min(1e3,r*s))*1e6,e+=Math.max(0,Math.min(1e3,n*s))*1e3,e+=Math.max(0,Math.min(1e3,c*s)),e},t.clip=function(r){return Math.max(0,Math.min(t.required,r))},t.required=t.create(1e3,1e3,1e3),t.strong=t.create(1,0,0),t.medium=t.create(0,1,0),t.weak=t.create(0,0,1),t})();});var Lu,Vl,Lat,Mb=Cn(()=>{Tv();C4();(function(t){t[t.Le=0]="Le",t[t.Ge=1]="Ge",t[t.Eq=2]="Eq";})(Lu||(Lu={}));Vl=(function(){function t(r,n,c,s){s===void 0&&(s=xu.required),this._id=Lat++,this._operator=n,this._strength=xu.clip(s),c===void 0&&r instanceof L1?this._expression=r:this._expression=r.minus(c);}return t.prototype.id=function(){return this._id},t.prototype.expression=function(){return this._expression},t.prototype.op=function(){return this._operator},t.prototype.strength=function(){return this._strength},t.prototype.toString=function(){return this._expression.toString()+" "+["<=",">=","="][this._operator]+" 0 ("+this._strength.toString()+")"},t})(),Lat=0;});function N4(t){var r=1e-8;return t<0?-t<r:t<r}function Pat(){return ix()}function Mat(){return ix()}function kat(){return ix()}function Fat(){return ix()}var R4,Da,cP,sx,lP,hP=Cn(()=>{Mb();Tv();Lb();C4();R4=(function(){function t(){this._cnMap=Pat(),this._rowMap=Mat(),this._varMap=kat(),this._editMap=Fat(),this._infeasibleRows=[],this._objective=new lP,this._artificial=null,this._idTick=0;}return t.prototype.createConstraint=function(r,n,c,s){s===void 0&&(s=xu.required);var e=new Vl(r,n,c,s);return this.addConstraint(e),e},t.prototype.addConstraint=function(r){var n=this._cnMap.find(r);if(n!==void 0)throw new Error("duplicate constraint");var c=this._createRow(r),s=c.row,e=c.tag,i=this._chooseSubject(s,e);if(i.type()===Da.Invalid&&s.allDummies())if(N4(s.constant()))i=e.marker;else throw new Error("unsatisfiable constraint");if(i.type()===Da.Invalid){if(!this._addWithArtificialVariable(s))throw new Error("unsatisfiable constraint")}else s.solveFor(i),this._substitute(i,s),this._rowMap.insert(i,s);this._cnMap.insert(r,e),this._optimize(this._objective);},t.prototype.removeConstraint=function(r){var n=this._cnMap.erase(r);if(n===void 0)throw new Error("unknown constraint");this._removeConstraintEffects(r,n.second);var c=n.second.marker,s=this._rowMap.erase(c);if(s===void 0){var e=this._getMarkerLeavingSymbol(c);if(e.type()===Da.Invalid)throw new Error("failed to find leaving row");s=this._rowMap.erase(e),s.second.solveForEx(e,c),this._substitute(c,s.second);}this._optimize(this._objective);},t.prototype.hasConstraint=function(r){return this._cnMap.contains(r)},t.prototype.addEditVariable=function(r,n){var c=this._editMap.find(r);if(c!==void 0)throw new Error("duplicate edit variable");if(n=xu.clip(n),n===xu.required)throw new Error("bad required strength");var s=new L1(r),e=new Vl(s,Lu.Eq,void 0,n);this.addConstraint(e);var i=this._cnMap.find(e).second,o={tag:i,constraint:e,constant:0};this._editMap.insert(r,o);},t.prototype.removeEditVariable=function(r){var n=this._editMap.erase(r);if(n===void 0)throw new Error("unknown edit variable");this.removeConstraint(n.second.constraint);},t.prototype.hasEditVariable=function(r){return this._editMap.contains(r)},t.prototype.suggestValue=function(r,n){var c=this._editMap.find(r);if(c===void 0)throw new Error("unknown edit variable");var s=this._rowMap,e=c.second,i=n-e.constant;e.constant=n;var o=e.tag.marker,p=s.find(o);if(p!==void 0){p.second.add(-i)<0&&this._infeasibleRows.push(o),this._dualOptimize();return}var E=e.tag.other;if(p=s.find(E),p!==void 0){p.second.add(i)<0&&this._infeasibleRows.push(E),this._dualOptimize();return}for(var b=0,y=s.size();b<y;++b){var m=s.itemAt(b),a=m.second,l=a.coefficientFor(o);l!==0&&a.add(i*l)<0&&m.first.type()!==Da.External&&this._infeasibleRows.push(m.first);}this._dualOptimize();},t.prototype.updateVariables=function(){for(var r=this._varMap,n=this._rowMap,c=0,s=r.size();c<s;++c){var e=r.itemAt(c),i=n.find(e.second);i!==void 0?e.first.setValue(i.second.constant()):e.first.setValue(0);}},t.prototype._getVarSymbol=function(r){var n=this,c=function(){return n._makeSymbol(Da.External)};return this._varMap.setDefault(r,c).second},t.prototype._createRow=function(r){for(var n=r.expression(),c=new lP(n.constant()),s=n.terms(),e=0,i=s.size();e<i;++e){var o=s.itemAt(e);if(!N4(o.second)){var p=this._getVarSymbol(o.first),E=this._rowMap.find(p);E!==void 0?c.insertRow(E.second,o.second):c.insertSymbol(p,o.second);}}var b=this._objective,y=r.strength(),m={marker:sx,other:sx};switch(r.op()){case Lu.Le:case Lu.Ge:{var a=r.op()===Lu.Le?1:-1,l=this._makeSymbol(Da.Slack);if(m.marker=l,c.insertSymbol(l,a),y<xu.required){var u=this._makeSymbol(Da.Error);m.other=u,c.insertSymbol(u,-a),b.insertSymbol(u,y);}break}case Lu.Eq:{if(y<xu.required){var h=this._makeSymbol(Da.Error),d=this._makeSymbol(Da.Error);m.marker=h,m.other=d,c.insertSymbol(h,-1),c.insertSymbol(d,1),b.insertSymbol(h,y),b.insertSymbol(d,y);}else {var g=this._makeSymbol(Da.Dummy);m.marker=g,c.insertSymbol(g);}break}}return c.constant()<0&&c.reverseSign(),{row:c,tag:m}},t.prototype._chooseSubject=function(r,n){for(var c=r.cells(),s=0,e=c.size();s<e;++s){var i=c.itemAt(s);if(i.first.type()===Da.External)return i.first}var o=n.marker.type();return (o===Da.Slack||o===Da.Error)&&r.coefficientFor(n.marker)<0?n.marker:(o=n.other.type(),(o===Da.Slack||o===Da.Error)&&r.coefficientFor(n.other)<0?n.other:sx)},t.prototype._addWithArtificialVariable=function(r){var n=this._makeSymbol(Da.Slack);this._rowMap.insert(n,r.copy()),this._artificial=r.copy(),this._optimize(this._artificial);var c=N4(this._artificial.constant());this._artificial=null;var s=this._rowMap.erase(n);if(s!==void 0){var e=s.second;if(e.isConstant())return c;var i=this._anyPivotableSymbol(e);if(i.type()===Da.Invalid)return false;e.solveForEx(n,i),this._substitute(i,e),this._rowMap.insert(i,e);}for(var o=this._rowMap,p=0,E=o.size();p<E;++p)o.itemAt(p).second.removeSymbol(n);return this._objective.removeSymbol(n),c},t.prototype._substitute=function(r,n){for(var c=this._rowMap,s=0,e=c.size();s<e;++s){var i=c.itemAt(s);i.second.substitute(r,n),i.second.constant()<0&&i.first.type()!==Da.External&&this._infeasibleRows.push(i.first);}this._objective.substitute(r,n),this._artificial&&this._artificial.substitute(r,n);},t.prototype._optimize=function(r){for(;;){var n=this._getEnteringSymbol(r);if(n.type()===Da.Invalid)return;var c=this._getLeavingSymbol(n);if(c.type()===Da.Invalid)throw new Error("the objective is unbounded");var s=this._rowMap.erase(c).second;s.solveForEx(c,n),this._substitute(n,s),this._rowMap.insert(n,s);}},t.prototype._dualOptimize=function(){for(var r=this._rowMap,n=this._infeasibleRows;n.length!==0;){var c=n.pop(),s=r.find(c);if(s!==void 0&&s.second.constant()<0){var e=this._getDualEnteringSymbol(s.second);if(e.type()===Da.Invalid)throw new Error("dual optimize failed");var i=s.second;r.erase(c),i.solveForEx(c,e),this._substitute(e,i),r.insert(e,i);}}},t.prototype._getEnteringSymbol=function(r){for(var n=r.cells(),c=0,s=n.size();c<s;++c){var e=n.itemAt(c),i=e.first;if(e.second<0&&i.type()!==Da.Dummy)return i}return sx},t.prototype._getDualEnteringSymbol=function(r){for(var n=Number.MAX_VALUE,c=sx,s=r.cells(),e=0,i=s.size();e<i;++e){var o=s.itemAt(e),p=o.first,E=o.second;if(E>0&&p.type()!==Da.Dummy){var b=this._objective.coefficientFor(p),y=b/E;y<n&&(n=y,c=p);}}return c},t.prototype._getLeavingSymbol=function(r){for(var n=Number.MAX_VALUE,c=sx,s=this._rowMap,e=0,i=s.size();e<i;++e){var o=s.itemAt(e),p=o.first;if(p.type()!==Da.External){var E=o.second,b=E.coefficientFor(r);if(b<0){var y=-E.constant()/b;y<n&&(n=y,c=p);}}}return c},t.prototype._getMarkerLeavingSymbol=function(r){for(var n=Number.MAX_VALUE,c=n,s=n,e=sx,i=e,o=e,p=e,E=this._rowMap,b=0,y=E.size();b<y;++b){var m=E.itemAt(b),a=m.second,l=a.coefficientFor(r);if(l!==0){var u=m.first;if(u.type()===Da.External)p=u;else if(l<0){var h=-a.constant()/l;h<c&&(c=h,i=u);}else {var h=a.constant()/l;h<s&&(s=h,o=u);}}}return i!==e?i:o!==e?o:p},t.prototype._removeConstraintEffects=function(r,n){n.marker.type()===Da.Error&&this._removeMarkerEffects(n.marker,r.strength()),n.other.type()===Da.Error&&this._removeMarkerEffects(n.other,r.strength());},t.prototype._removeMarkerEffects=function(r,n){var c=this._rowMap.find(r);c!==void 0?this._objective.insertRow(c.second,-n):this._objective.insertSymbol(r,-n);},t.prototype._anyPivotableSymbol=function(r){for(var n=r.cells(),c=0,s=n.size();c<s;++c){var e=n.itemAt(c),i=e.first.type();if(i===Da.Slack||i===Da.Error)return e.first}return sx},t.prototype._makeSymbol=function(r){return new cP(r,this._idTick++)},t})();(function(t){t[t.Invalid=0]="Invalid",t[t.External=1]="External",t[t.Slack=2]="Slack",t[t.Error=3]="Error",t[t.Dummy=4]="Dummy";})(Da||(Da={}));cP=(function(){function t(r,n){this._id=n,this._type=r;}return t.prototype.id=function(){return this._id},t.prototype.type=function(){return this._type},t})(),sx=new cP(Da.Invalid,-1),lP=(function(){function t(r){r===void 0&&(r=0),this._cellMap=ix(),this._constant=r;}return t.prototype.cells=function(){return this._cellMap},t.prototype.constant=function(){return this._constant},t.prototype.isConstant=function(){return this._cellMap.empty()},t.prototype.allDummies=function(){for(var r=this._cellMap,n=0,c=r.size();n<c;++n){var s=r.itemAt(n);if(s.first.type()!==Da.Dummy)return false}return true},t.prototype.copy=function(){var r=new t(this._constant);return r._cellMap=this._cellMap.copy(),r},t.prototype.add=function(r){return this._constant+=r},t.prototype.insertSymbol=function(r,n){n===void 0&&(n=1);var c=this._cellMap.setDefault(r,function(){return 0});N4(c.second+=n)&&this._cellMap.erase(r);},t.prototype.insertRow=function(r,n){n===void 0&&(n=1),this._constant+=r._constant*n;for(var c=r._cellMap,s=0,e=c.size();s<e;++s){var i=c.itemAt(s);this.insertSymbol(i.first,i.second*n);}},t.prototype.removeSymbol=function(r){this._cellMap.erase(r);},t.prototype.reverseSign=function(){this._constant=-this._constant;for(var r=this._cellMap,n=0,c=r.size();n<c;++n){var s=r.itemAt(n);s.second=-s.second;}},t.prototype.solveFor=function(r){var n=this._cellMap,c=n.erase(r),s=-1/c.second;this._constant*=s;for(var e=0,i=n.size();e<i;++e)n.itemAt(e).second*=s;},t.prototype.solveForEx=function(r,n){this.insertSymbol(r,-1),this.solveFor(n);},t.prototype.coefficientFor=function(r){var n=this._cellMap.find(r);return n!==void 0?n.second:0},t.prototype.substitute=function(r,n){var c=this._cellMap.erase(r);c!==void 0&&this.insertRow(n,c.second);},t})();});var fP=Cn(()=>{Mb();Tv();hP();C4();Pb();});function Bat(t){return t.type==="positional-conflict"}function jat(t){return t.type==="group-overlap"}function Uat(t){return t?.type==="hidden-node-conflict"}function fg(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function kb(t){if(t.attributes&&Object.entries(t.attributes).some(([n,c])=>c&&c.length>0)){let n=t.attributes||{},c=Object.entries(n).sort(([o],[p])=>o.localeCompare(p)),s=[],e=2,i=20;for(let o=0;o<Math.min(c.length,e);o++){let[p,E]=c[o];if(E&&E.length>0){let b=E[0];b.length>i&&(b=b.substring(0,i)+"..."),s.push(`${fg(p)}: ${fg(b)}`);}}if(c.length>e&&s.push("..."),s.length>0)return `${fg(t.label)} (${s.join(", ")})`}return t.label&&t.label!==t.id?`<span title="${dP}">${fg(t.label)} (id = ${fg(t.id)})</span>`:`<span title="${dP}">${fg(t.id)}</span>`}function ox(t){let r=kb;if(Uh(t)){let n=t;return `${r(n.top)} must be above ${r(n.bottom)}`}else if(Kh(t)){let n=t;return `${r(n.left)} must be to the left of ${r(n.right)}`}else if(W0(t)){let n=t,c=n.axis,s=n.node1,e=n.node2;return c==="x"?`${r(s)} must be vertically aligned with ${r(e)}`:c==="y"?`${r(s)} must be horizontally aligned with ${r(e)}`:`${r(s)} must be aligned with ${r(e)} along the ${c} axis`}else if(mh(t)){let n=t;return `${r(n.node)} cannot be in group "${n.group.name}".`}else if(w1(t)){let n=t,c={left:"to the left of",right:"to the right of",top:"above",bottom:"below"};return `Group "${n.groupA.name}" must be ${c[n.side]} group "${n.groupB.name}"`}return `Unknown constraint type: ${t}`}var dP,bv,Fb=Cn(()=>{fP();Wm();O3();dP="This is a unique identifier in the graph. Hover over graph nodes to see their IDs.";bv=class{constructor(r){this.kiwiConstraintCache=new Map;this.expressionCache=new Map;this.boundingBoxMemberConstraints=[];this.minPadding=15;this.horizontallyAligned=[];this.verticallyAligned=[];this.horizontalAlignmentMap=new Map;this.verticalAlignmentMap=new Map;this.layout=r,this.solver=new R4,this.nodes=r.nodes,this.edges=r.edges,this.orientationConstraints=r.constraints,this.variables={},this.groupBoundingBoxes=new Map,this.groups=r.groups,this.added_constraints=[];}validateConstraints(){return this.validateGroupConstraints()||this.validatePositionalConstraints()}validatePositionalConstraints(){this.nodes.forEach(p=>{let E=this.getNodeIndex(p.id);this.variables[E]={x:new rd(`${p.id}_x`),y:new rd(`${p.id}_y`)};});for(let p=0;p<this.orientationConstraints.length;p++){let E=this.orientationConstraints[p],b=this.addConstraintToSolver(E);if(b)return b}let r=this.added_constraints.length,{dedupedGroups:n,groupMap:c}=this.deduplicateGroups(this.groups),s=this.groups;this.groups=n;try{let p=this.addGroupBoundingBoxConstraints();if(p)return p}finally{this.groups=s;}let e=this.layout.disjunctiveConstraints||[];if(e.length>0){let p=this.solveDisjunctiveConstraints(e);if(!p.satisfiable)return p.error||null;let E=this.added_constraints.slice(r);console.assert(E.length>0,"Disjunctive solver succeeded but no constraints were added"),this.layout.constraints=this.layout.constraints.concat(E);}this.solver.updateVariables();let i=this.getAlignmentOrders(),o=this.detectNodeOverlaps();return o||(this.layout.constraints=this.layout.constraints.concat(i),null)}solveDisjunctiveConstraints(r){let n=this.added_constraints.length,c=this.backtrackDisjunctions(r,0);return c.satisfiable&&this.added_constraints.length-n>0,c}getChosenDisjunctiveConstraints(r){return this.added_constraints.slice(r)}hasObviousConflict(r){let n=new Set,c=new Set;for(let s of this.added_constraints)Kh(s)?n.add(`${s.left.id}:${s.right.id}`):Uh(s)&&c.add(`${s.top.id}:${s.bottom.id}`);for(let s of r)if(Kh(s)){let e=`${s.right.id}:${s.left.id}`;if(n.has(e))return true}else if(Uh(s)){let e=`${s.bottom.id}:${s.top.id}`;if(c.has(e))return true}return false}orderAlternativesByHeuristic(r){let n=[...r];return n.sort((c,s)=>{if(c.length!==s.length)return c.length-s.length;let e=c.some(o=>mh(o)&&(o.side==="left"||o.side==="right")),i=s.some(o=>mh(o)&&(o.side==="left"||o.side==="right"));return e&&!i?-1:!e&&i?1:0}),n}backtrackDisjunctions(r,n){if(n>=r.length)return {satisfiable:true};let c=r[n],s=this.orderAlternativesByHeuristic(c.alternatives),e=0,i=0,o=0,p;for(let S=0;S<s.length;S++){let v=s[S];if(this.hasObviousConflict(v))continue;let T=this.cloneSolver(),q=[...this.added_constraints],G=this.added_constraints.length,j=null,B=0;for(let $ of v){let z=this.addConstraintToSolver($);if(z){j=z;break}B++;}let J=0,w;if(!j){let $=this.backtrackDisjunctions(r,n+1);if($.satisfiable)return {satisfiable:true};J=this.added_constraints.length-G,w=$.error;}(J>o||J===o&&B>i)&&(e=S,i=B,o=J,w&&(p=w)),this.restoreSolver(T),this.added_constraints=q,console.assert(this.added_constraints.length===G,`Backtracking failed: expected ${G} constraints, got ${this.added_constraints.length}`);}if(p&&o>0)return {satisfiable:false,error:p};let E=s[e],b=this.getMinimalDisjunctiveConflict(this.added_constraints,E,c.sourceConstraint),y=E[0];if(E.some(S=>mh(S))&&b.existingConstraints.length>0){let S=new Set;E.forEach(T=>{mh(T)&&T.group.nodeIds.forEach(q=>S.add(q));});let v=b.existingConstraints.find(T=>Kh(T)?S.has(T.left.id)||S.has(T.right.id):Uh(T)?S.has(T.top.id)||S.has(T.bottom.id):W0(T)?S.has(T.node1.id)||S.has(T.node2.id):false);v&&(y=v);}let a=new Map,l=[...b.existingConstraints,...b.disjunctiveConstraints],u=new Map;for(let S of l){let v=this.getConstraintKey(S);u.has(v)||u.set(v,S);}let h=this.removeTransitiveConstraints(Array.from(u.values()));for(let S of h){let v=S.sourceConstraint;a.has(v)||a.set(v,[]),a.get(v).push(S);}let d=ox(y),g=new Map;for(let[S,v]of a.entries()){let T=S.toHTML();g.has(T)||g.set(T,[]),v.forEach(q=>{g.get(T).push(ox(q));});}return {satisfiable:false,error:{name:"PositionalConstraintError",type:"positional-conflict",message:`Constraint "${d}" conflicts with existing constraints`,conflictingConstraint:y,conflictingSourceConstraint:c.sourceConstraint,minimalConflictingSet:a,errorMessages:{conflictingConstraint:d,conflictingSourceConstraint:c.sourceConstraint.toHTML(),minimalConflictingConstraints:g}}}}getVarPlusConstant(r,n){let c=`${r.name()}_plus_${n}`,s=this.expressionCache.get(c);return s||(s=r.plus(n),this.expressionCache.set(c,s)),s}getConstraintKey(r){if(Kh(r))return `left:${r.left.id}:${r.right.id}`;if(Uh(r))return `top:${r.top.id}:${r.bottom.id}`;if(W0(r)){let[n,c]=[r.node1.id,r.node2.id].sort();return `align:${n}:${c}:${r.axis}`}return mh(r)?`bbox:${r.node.id}:${r.group.name}:${r.side}`:w1(r)?`groupbound:${r.groupA.name}:${r.groupB.name}:${r.side}`:`unknown:${JSON.stringify(r)}`}areAlignmentsIdentical(r,n){return r.axis===n.axis&&(r.node1.id===n.node1.id&&r.node2.id===n.node2.id||r.node1.id===n.node2.id&&r.node2.id===n.node1.id)}areConstraintsIdentical(r,n){return r===n?true:Kh(r)&&Kh(n)?r.left.id===n.left.id&&r.right.id===n.right.id:Uh(r)&&Uh(n)?r.top.id===n.top.id&&r.bottom.id===n.bottom.id:W0(r)&&W0(n)?this.areAlignmentsIdentical(r,n):mh(r)&&mh(n)?r.node.id===n.node.id&&r.group.name===n.group.name&&r.side===n.side:w1(r)&&w1(n)?r.groupA.name===n.groupA.name&&r.groupB.name===n.groupB.name&&r.side===n.side:false}cloneSolver(){let r=new R4;this.addBoundingBoxMemberConstraintsToSolver(r);for(let n of this.added_constraints)this.constraintToKiwi(n).forEach(s=>{r.addConstraint(s);});return r}restoreSolver(r){this.solver=r;}validateGroupConstraints(){for(let r=0;r<this.groups.length;r++){let n=this.groups[r];for(let c=r+1;c<this.groups.length;c++){let s=this.groups[c];if(this.isSubGroup(n,s)||this.isSubGroup(s,n))continue;let e=this.groupIntersection(n,s);if(e.length>0){let i=e.map(E=>this.nodes.find(b=>b.id===E)).filter(E=>E!==void 0),o=i.map(E=>E.label&&E.label!==E.id?`${E.label} (${E.id})`:E.id);return {name:"GroupOverlapError",type:"group-overlap",message:`Groups <b>"${n.name}"</b> and <b>"${s.name}"</b> overlap with nodes: ${o.join(", ")}`,group1:n,group2:s,overlappingNodes:i}}}}return null}addGroupBoundingBoxConstraints(){let r=new Map;for(let n of this.nodes)r.set(n.id,new Set);for(let n of this.groups)if(n.nodeIds.length>1&&n.sourceConstraint)for(let c of n.nodeIds)r.get(c)?.add(n);for(let n of this.groups){if(n.nodeIds.length<=1||!n.sourceConstraint)continue;let c=n.nodeIds.map(E=>this.nodes.find(b=>b.id===E)).filter(E=>E!==void 0);if(c.length===0)continue;let s=new Set(n.nodeIds),e=new rd(`${n.name}_bbox_left`),i=new rd(`${n.name}_bbox_right`),o=new rd(`${n.name}_bbox_top`),p=new rd(`${n.name}_bbox_bottom`);this.groupBoundingBoxes.set(n.name,{left:e,right:i,top:o,bottom:p});for(let E of c){let b=this.getNodeIndex(E.id),y=this.variables[b].x,m=this.variables[b].y,a=new Vl(y,Lu.Ge,e,xu.required),l=new Vl(y,Lu.Le,i,xu.required),u=new Vl(m,Lu.Ge,o,xu.required),h=new Vl(m,Lu.Le,p,xu.required);this.boundingBoxMemberConstraints.push(a,l,u,h),this.solver.addConstraint(a),this.solver.addConstraint(l),this.solver.addConstraint(u),this.solver.addConstraint(h);}for(let E of this.nodes){if(s.has(E.id))continue;let b=r.get(E.id);if(b&&b.size>0)continue;let y=n.sourceConstraint,m={group:n,node:E,side:"left",minDistance:this.minPadding,sourceConstraint:y},a={group:n,node:E,side:"right",minDistance:this.minPadding,sourceConstraint:y},l={group:n,node:E,side:"top",minDistance:this.minPadding,sourceConstraint:y},u={group:n,node:E,side:"bottom",minDistance:this.minPadding,sourceConstraint:y},h=new $p(y,[[m],[a],[l],[u]]);this.layout.disjunctiveConstraints||(this.layout.disjunctiveConstraints=[]),this.layout.disjunctiveConstraints.push(h);}}for(let n=0;n<this.groups.length;n++)for(let c=n+1;c<this.groups.length;c++){let s=this.groups[n],e=this.groups[c];if(s.nodeIds.length<=1||e.nodeIds.length<=1||this.isSubGroup(s,e)||this.isSubGroup(e,s)||this.groupIntersection(s,e).length>0)continue;let o={groupA:s,groupB:e,side:"left",minDistance:this.minPadding,sourceConstraint:s.sourceConstraint||e.sourceConstraint},p={groupA:s,groupB:e,side:"right",minDistance:this.minPadding,sourceConstraint:s.sourceConstraint||e.sourceConstraint},E={groupA:s,groupB:e,side:"top",minDistance:this.minPadding,sourceConstraint:s.sourceConstraint||e.sourceConstraint},b={groupA:s,groupB:e,side:"bottom",minDistance:this.minPadding,sourceConstraint:s.sourceConstraint||e.sourceConstraint},y=new $p(s.sourceConstraint||e.sourceConstraint,[[o],[p],[E],[b]]);this.layout.disjunctiveConstraints||(this.layout.disjunctiveConstraints=[]),this.layout.disjunctiveConstraints.push(y);}return null}getNodeIndex(r){return this.nodes.findIndex(n=>n.id===r)}deduplicateGroups(r){let n=new Map;for(let e of r){if(e.nodeIds.length<=1){let p=`_singleton_${e.nodeIds[0]||"empty"}_${Math.random()}`;n.set(p,[e]);continue}let o=[...e.nodeIds].sort().join("|");n.has(o)||n.set(o,[]),n.get(o).push(e);}let c=[],s=new Map;for(let e of n.values()){let i=e[0];c.push(i),s.set(i,e),e.length>1&&console.log(`Deduplicating ${e.length} groups with identical members: ${e.map(o=>o.name).join(", ")}`);}return {dedupedGroups:c,groupMap:s}}addBoundingBoxMemberConstraintsToSolver(r,n=true){if(n&&this.boundingBoxMemberConstraints.length>0)for(let c of this.boundingBoxMemberConstraints)try{r.addConstraint(c);}catch{}else for(let c of this.groups){if(c.nodeIds.length<=1||!c.sourceConstraint)continue;let s=this.groupBoundingBoxes.get(c.name);if(!s)continue;let e=c.nodeIds.map(i=>this.nodes.find(o=>o.id===i)).filter(i=>i!==void 0);for(let i of e){let o=this.getNodeIndex(i.id),p=this.variables[o].x,E=this.variables[o].y;try{r.addConstraint(new Vl(p,Lu.Ge,s.left,xu.required)),r.addConstraint(new Vl(p,Lu.Le,s.right,xu.required)),r.addConstraint(new Vl(E,Lu.Ge,s.top,xu.required)),r.addConstraint(new Vl(E,Lu.Le,s.bottom,xu.required));}catch{}}}}getMinimalDisjunctiveConflict(r,n,c){return n.some(e=>mh(e))||r.some(e=>mh(e))?this.getMinimalGroupingConflict(r,n):this.getMinimalSimpleConflict(r,n)}getMinimalGroupingConflict(r,n){let c=[...r];if(n.length>0){let s=n[0],e=[...r,s];this.isConflictingSet(e)?c=this.getMinimalConflictingConstraints(r,s):c=[];}if(c.length<=1&&n.some(s=>mh(s))){let s=new Set;for(let i of n)mh(i)&&(s.add(i.node.id),i.group.nodeIds.forEach(o=>s.add(o)));let e=r.filter(i=>Kh(i)?s.has(i.left.id)||s.has(i.right.id):Uh(i)?s.has(i.top.id)||s.has(i.bottom.id):W0(i)?s.has(i.node1.id)||s.has(i.node2.id):false);e.length>0&&(c=e);}return {existingConstraints:c,disjunctiveConstraints:n}}getMinimalSimpleConflict(r,n){let c=[...r],s=[...n];if(!this.isConflicting(c,s))return {existingConstraints:[],disjunctiveConstraints:n.length>0?[n[0]]:[]};let e=true;for(;e&&c.length>0;){e=false;for(let i=c.length-1;i>=0;i--){let o=c.slice(0,i).concat(c.slice(i+1));this.isConflicting(o,s)&&(c=o,e=true);}}for(e=true;e&&s.length>0;){e=false;for(let i=s.length-1;i>=0;i--){let o=s.slice(0,i).concat(s.slice(i+1));this.isConflicting(c,o)&&(s=o,e=true);}}for(e=true;e&&c.length>0;){e=false;for(let i=c.length-1;i>=0;i--){let o=c.slice(0,i).concat(c.slice(i+1));this.isConflicting(o,s)&&(c=o,e=true);}}return c.length===0&&s.length===0&&(c=r.length>0?[r[0]]:[],s=n.length>0?[n[0]]:[]),{existingConstraints:c,disjunctiveConstraints:s}}isConflicting(r,n){return this.isConflictingSet([...r,...n])}isConflictingSet(r){let n=new R4;try{if(r.some(s=>mh(s)||w1(s))){let s=new Map,e=new Set;r.forEach(o=>{mh(o)?e.add(o.group.name):w1(o)&&(e.add(o.groupA.name),e.add(o.groupB.name));}),e.forEach(o=>{s.set(o,{left:new rd(`test_${o}_bbox_left`),right:new rd(`test_${o}_bbox_right`),top:new rd(`test_${o}_bbox_top`),bottom:new rd(`test_${o}_bbox_bottom`)});});let i=this.groupBoundingBoxes;this.groupBoundingBoxes=s;try{this.addBoundingBoxMemberConstraintsToSolver(n,!1);for(let o of r)this.constraintToKiwi(o).forEach(E=>n.addConstraint(E));return n.updateVariables(),!1}finally{this.groupBoundingBoxes=i;}}else {for(let s of r)this.constraintToKiwi(s).forEach(i=>n.addConstraint(i));return n.updateVariables(),!1}}catch{return true}}getMinimalConflictingConstraints(r,n){let c=[...r,n];if(!this.isConflictingSet(c))return [];let s=[...r],e=true;for(;e&&s.length>0;){e=false;for(let i=s.length-1;i>=0;i--){let o=s.slice(0,i).concat(s.slice(i+1)),p=[...o,n];this.isConflictingSet(p)&&(s=o,e=true);}}return s=this.removeTransitiveConstraints(s),s}removeTransitiveConstraints(r){let n=this.removeTransitiveAlignments(r);return n=this.removeTransitiveOrderings(n),n}removeTransitiveOrderings(r){let n=r.filter(i=>Kh(i)),c=r.filter(i=>Uh(i)),e=[...r.filter(i=>!Kh(i)&&!Uh(i))];return n.length>0&&e.push(...this.transitiveReduction(n,i=>i.left.id,i=>i.right.id)),c.length>0&&e.push(...this.transitiveReduction(c,i=>i.top.id,i=>i.bottom.id)),e}transitiveReduction(r,n,c){if(r.length<=1)return r;let s=new Map,e=new Map;for(let b of r){let y=n(b),m=c(b);s.has(y)||s.set(y,new Set),s.get(y).add(m),e.set(`${y}->${m}`,b);}let i=new Set;for(let[b,y]of s.entries())i.add(b),y.forEach(m=>i.add(m));let o=Array.from(i),p=new Map;for(let b of o)p.set(b,new Set(s.get(b)||[]));for(let b of o)for(let y of o)for(let m of o)p.get(y)?.has(b)&&p.get(b)?.has(m)&&p.get(y).add(m);let E=[];for(let b of r){let y=n(b),m=c(b),a=false,l=s.get(y);if(l&&l.size>1){for(let u of l)if(u!==m&&p.get(u)?.has(m)){a=true;break}}a||E.push(b);}return E}removeTransitiveAlignments(r){let n=r.filter(i=>W0(i)),c=r.filter(i=>!W0(i));if(n.length<=2)return r;let s=new Map;for(let i of n)s.has(i.axis)||s.set(i.axis,[]),s.get(i.axis).push(i);let e=[...c];for(let[i,o]of s.entries()){if(o.length<=2){e.push(...o);continue}let p=new Map;for(let a of o){let l=a.node1.id,u=a.node2.id;p.has(l)||p.set(l,new Set),p.has(u)||p.set(u,new Set),p.get(l).add(u),p.get(u).add(l);}let E=Array.from(p.keys());if(E.length===0)continue;let b=new Set,y=[E[0]];b.add(E[0]);let m=[];for(;y.length>0&&b.size<E.length;){let a=y.shift(),l=p.get(a);if(l){for(let u of l)if(!b.has(u)){b.add(u),y.push(u);let h=o.find(d=>d.node1.id===a&&d.node2.id===u||d.node2.id===a&&d.node1.id===u);h&&m.push(h);}}}e.push(...m);}return e}constraintToKiwi(r){let n=this.kiwiConstraintCache.get(r);if(n)return n;let c=this.convertConstraintToKiwi(r);return this.kiwiConstraintCache.set(r,c),c}convertConstraintToKiwi(r){if(Uh(r)){let n=r,c=n.top,s=n.bottom,e=c.height,i=this.getNodeIndex(c.id),o=this.getNodeIndex(s.id),p=this.variables[i].y,E=this.variables[o].y,b=this.getVarPlusConstant(p,e);return [new Vl(b,Lu.Le,E,xu.required)]}else if(Kh(r)){let n=r,c=n.left,s=n.right,e=c.width,i=this.getNodeIndex(c.id),o=this.getNodeIndex(s.id),p=this.variables[i].x,E=this.variables[o].x,b=this.getVarPlusConstant(p,e);return [new Vl(b,Lu.Le,E,xu.required)]}else if(W0(r)){let n=r,c=n.axis,s=n.node1,e=n.node2,i=this.getNodeIndex(s.id),o=this.getNodeIndex(e.id),p=this.variables[i][c],E=this.variables[o][c],b=this.getNodePairKey(s.id,e.id);return c==="x"?(this.verticallyAligned.push([s,e]),this.verticalAlignmentMap.has(b)||this.verticalAlignmentMap.set(b,[]),this.verticalAlignmentMap.get(b).push(n)):c==="y"&&(this.horizontallyAligned.push([s,e]),this.horizontalAlignmentMap.has(b)||this.horizontalAlignmentMap.set(b,[]),this.horizontalAlignmentMap.get(b).push(n)),[new Vl(p,Lu.Eq,E,xu.required)]}else if(mh(r)){let n=r,c=this.groupBoundingBoxes.get(n.group.name);if(!c)return console.error(`Bounding box not found for group ${n.group.name}`),[];let s=this.getNodeIndex(n.node.id),e=this.variables[s].x,i=this.variables[s].y;n.node.width||n.minDistance;n.node.height||n.minDistance;switch(n.side){case "left":return [new Vl(this.getVarPlusConstant(e,n.minDistance),Lu.Le,c.left,xu.required)];case "right":return [new Vl(e,Lu.Ge,this.getVarPlusConstant(c.right,n.minDistance),xu.required)];case "top":return [new Vl(this.getVarPlusConstant(i,n.minDistance),Lu.Le,c.top,xu.required)];case "bottom":return [new Vl(i,Lu.Ge,this.getVarPlusConstant(c.bottom,n.minDistance),xu.required)];default:return console.error(`Unknown bounding box side: ${n.side}`),[]}}else if(w1(r)){let n=r,c=this.groupBoundingBoxes.get(n.groupA.name),s=this.groupBoundingBoxes.get(n.groupB.name);if(!c||!s)return console.error(`Bounding box not found for groups ${n.groupA.name} or ${n.groupB.name}`),[];switch(n.side){case "left":return [new Vl(this.getVarPlusConstant(c.right,n.minDistance),Lu.Le,s.left,xu.required)];case "right":return [new Vl(this.getVarPlusConstant(s.right,n.minDistance),Lu.Le,c.left,xu.required)];case "top":return [new Vl(this.getVarPlusConstant(c.bottom,n.minDistance),Lu.Le,s.top,xu.required)];case "bottom":return [new Vl(this.getVarPlusConstant(s.bottom,n.minDistance),Lu.Le,c.top,xu.required)];default:return console.error(`Unknown group boundary side: ${n.side}`),[]}}else return []}addConstraintToSolver(r){try{this.constraintToKiwi(r).forEach(c=>{this.solver.addConstraint(c);}),this.added_constraints.push(r);}catch{let c=this.getMinimalConflictingConstraints(this.added_constraints,r),s=new Map,e=new Map;return c.forEach(o=>{let p=o.sourceConstraint;s.has(p)||s.set(p,[]),e.has(p.toHTML())||e.set(p.toHTML(),[]),s.get(p).push(o),e.get(p.toHTML()).push(ox(o));}),{name:"PositionalConstraintError",type:"positional-conflict",message:`Constraint "${ox(r)}" conflicts with existing constraints`,conflictingConstraint:r,conflictingSourceConstraint:r.sourceConstraint,minimalConflictingSet:s,errorMessages:{conflictingConstraint:`${ox(r)}`,conflictingSourceConstraint:`${r.sourceConstraint.toHTML()}`,minimalConflictingConstraints:e}}}return null}getAlignmentOrders(){this.solver.updateVariables(),this.horizontallyAligned=this.normalizeAlignment(this.horizontallyAligned),this.verticallyAligned=this.normalizeAlignment(this.verticallyAligned);let r=[];for(let n=0;n<this.horizontallyAligned.length;n++)this.horizontallyAligned[n].sort((c,s)=>{let e=this.variables[this.getNodeIndex(c.id)].x.value(),i=this.variables[this.getNodeIndex(s.id)].x.value();return e-i});this.horizontallyAligned.forEach(n=>{for(let c=0;c<n.length-1;c++){let s=n[c],e=n[c+1],i=new A3(["directlyLeft"],`${s.id}->${e.id}`),o=new Ym(i,"Preventing Overlap"),p={left:s,right:e,minDistance:this.minPadding,sourceConstraint:o};r.push(p);}});for(let n=0;n<this.verticallyAligned.length;n++)this.verticallyAligned[n].sort((c,s)=>{let e=this.variables[this.getNodeIndex(c.id)].y.value(),i=this.variables[this.getNodeIndex(s.id)].y.value();return e-i});return this.verticallyAligned.forEach(n=>{for(let c=0;c<n.length-1;c++){let s=n[c],e=n[c+1],i=new A3(["directlyAbove"],`${s.id}->${e.id}`),o=new Ym(i,"Preventing Overlap"),p={top:s,bottom:e,minDistance:this.minPadding,sourceConstraint:o};r.push(p);}}),r}normalizeAlignment(r){let n=[];for(let s of r){let e=false;for(let i of n)if(s.some(o=>i.includes(o))){i.push(...s.filter(o=>!i.includes(o))),e=true;break}e||n.push([...s]);}let c=true;for(;c;){c=false;for(let s=0;s<n.length;s++){for(let e=s+1;e<n.length;e++)if(n[s].some(i=>n[e].includes(i))){n[s].push(...n[e].filter(i=>!n[s].includes(i))),n.splice(e,1),c=true;break}if(c)break}}return n}isSubGroup(r,n){let c=r.nodeIds,s=n.nodeIds;return c.every(e=>s.includes(e))}groupIntersection(r,n){let c=r.nodeIds,s=n.nodeIds;return c.filter(i=>s.includes(i))}getNodePairKey(r,n){return r<n?`${r}|${n}`:`${n}|${r}`}detectNodeOverlaps(){let r=[],n=new Set;for(let p of this.horizontallyAligned){let E=new Set(p.map(b=>b.id));for(let b of this.verticallyAligned){let y=new Set(b.map(a=>a.id)),m=[];for(let a of E)y.has(a)&&m.push(a);if(m.length>=2)for(let a=0;a<m.length;a++)for(let l=a+1;l<m.length;l++){let u=this.nodes.find(_=>_.id===m[a]),h=this.nodes.find(_=>_.id===m[l]);r.push({node1:u,node2:h,overlappingNodeIds:m});let d=this.findAlignmentChain(u,h,this.horizontalAlignmentMap),g=this.findAlignmentChain(u,h,this.verticalAlignmentMap);d.forEach(_=>n.add(_)),g.forEach(_=>n.add(_));}}}if(r.length===0)return null;let c=new Map;for(let p of n){let E=p.sourceConstraint;c.has(E)||c.set(E,[]),c.get(E).push(p);}let s=new Map;for(let[p,E]of c.entries()){let b=p.toHTML();s.has(b)||s.set(b,[]);for(let y of E)s.get(b).push(ox(y));}let e=r.map(({node1:p,node2:E})=>`${kb(p)} and ${kb(E)}`),i=r.length===1?`Alignment constraints force ${e[0]} to occupy the same position`:`Alignment constraints force multiple node pairs to overlap: ${e.join("; ")}`,o=Array.from(n)[0];return {name:"PositionalConstraintError",type:"positional-conflict",message:i,conflictingConstraint:o,conflictingSourceConstraint:o.sourceConstraint,minimalConflictingSet:c,errorMessages:{conflictingConstraint:ox(o),conflictingSourceConstraint:o.sourceConstraint.toHTML(),minimalConflictingConstraints:s}}}findAlignmentChain(r,n,c){let s=new Map;for(let[o,p]of c.entries()){let[E,b]=o.split("|");s.has(E)||s.set(E,new Map),s.has(b)||s.set(b,new Map),s.get(E).set(b,p),s.get(b).set(E,p);}let e=new Set,i=[{nodeId:r.id,path:[]}];for(;i.length>0;){let{nodeId:o,path:p}=i.shift();if(o===n.id)return p;if(e.has(o))continue;e.add(o);let E=s.get(o);if(E)for(let[b,y]of E.entries())e.has(b)||i.push({nodeId:b,path:[...p,y[0]]});}return []}dispose(){this.kiwiConstraintCache.clear(),this.expressionCache.clear(),this.solver=null,this.variables={},this.groupBoundingBoxes.clear();}getMemoryStats(){return {cachedConstraints:this.kiwiConstraintCache.size,cachedExpressions:this.expressionCache.size,variables:Object.keys(this.variables).length,groupBoundingBoxes:this.groupBoundingBoxes.size,addedConstraints:this.added_constraints?.length||0}}};});function $at(t){return t instanceof w4}function Hat(t){let r=[],n=new Set;for(let c of t){let s;if(Kh(c))s=`left|${c.left.id}|${c.right.id}|${c.minDistance}`;else if(Uh(c))s=`top|${c.top.id}|${c.bottom.id}|${c.minDistance}`;else if(W0(c)){let[e,i]=[c.node1.id,c.node2.id].sort();s=`align|${c.axis}|${e}|${i}`;}else s=`unknown|${JSON.stringify(c)}`;n.has(s)||(n.add(s),r.push(c));}return r}function Gat(t,r,n){switch(n){case "left":return `${t} must be to the left of ${r}`;case "right":return `${t} must be to the right of ${r}`;case "above":return `${t} must be above ${r}`;case "below":return `${t} must be below ${r}`;case "directlyLeft":return `${t} must be directly to the left of ${r}`;case "directlyRight":return `${t} must be directly to the right of ${r}`;case "directlyAbove":return `${t} must be directly above ${r}`;case "directlyBelow":return `${t} must be directly below ${r}`;default:return `${t} is constrained relative to ${r} (${n})`}}var Kat,w4,pP,Av,I4;exports.LayoutInstance=void 0;var Ov=Cn(()=>{$I();YT();Wm();EE();Db();Fb();Kat="univ",w4=class t extends Error{constructor(n,c){let s=c&&"selector"in c?c.selector:void 0,e=s?` Selector: ${s}.`:"";super(`Constraint references node "${n}" that is missing from the layout (it may be hidden).${e}`);this.type="unknown-constraint";this.name="MissingNodeConstraintError",this.missingNodeId=n,this.sourceConstraint=c,Object.setPrototypeOf(this,t.prototype);}};pP=(c=>(c.NEVER="never",c.DIRECT="direct",c.CONNECTED="connected",c))(pP||{});Av=class{constructor(r,n){this.Path=r;this.LoopsTo=n;}expand(r){let n=this.Path.map(i=>i.id);if(!this.LoopsTo)return n;let c=n.findIndex(i=>i===this.LoopsTo.id);if(c===-1)return n;let s=n.slice(0,c),e=n.slice(c);return s.concat(...Array(r).fill(e))}isSubpathOf(r){let n=this.expand(2),c=r.expand(1);if(c.length>n.length)return false;for(let s=0;s<=n.length-c.length;s++)if(c.every((e,i)=>e===n[s+i]))return true;return false}static areEquivalent(r,n){return r.isSubpathOf(n)&&n.isSubpathOf(r)}},I4=class I4{constructor(r,n,c=0,s=true,e){this.hideThisEdge="_h_";this.DEFAULT_NODE_ICON_PATH="";this.DEFAULT_NODE_HEIGHT=60;this.DEFAULT_NODE_WIDTH=100;this.minSepHeight=15;this.minSepWidth=15;this.selectorErrors=[];this.hiddenNodeSelectors=new Map;this.hiddenNodeConflicts=new Map;this.conflictedHiddenNodes=new Set;this.instanceNum=c,this.evaluator=n,this._layoutSpec=r,e!==void 0?this.alignmentEdgeStrategy=e:this.alignmentEdgeStrategy=s?"connected":"never";}recordSelectorError(r,n,c){let s=c instanceof Error?c.message:String(c);this.selectorErrors.push({selector:r,context:n,errorMessage:s});}checkSelectorArity(r,n,c,s){let e=r.maxArity();return e===0?true:c==="binary"&&e<2?(this.recordSelectorError(n,s,new exports.SelectorArityError(n,"binary","unary")),false):c==="unary"&&e>1?(this.recordSelectorError(n,s,new exports.SelectorArityError(n,"unary","binary")),false):true}isNodeHiddenByDirective(r){return this.hiddenNodeSelectors.has(r)}recordHiddenNodeConflict(r,n,c){let s=r.toHTML();this.hiddenNodeConflicts.has(s)||this.hiddenNodeConflicts.set(s,[]),this.hiddenNodeConflicts.get(s).push(n),this.conflictedHiddenNodes.add(c);}get hideDisconnected(){return this._layoutSpec.directives.hideDisconnected||false}get hideDisconnectedBuiltIns(){return this._layoutSpec.directives.hideDisconnectedBuiltIns||false}getConstraintsRelatedToField(r,n,c){return this._layoutSpec.constraints.grouping.byfield.filter(i=>{if(i.field!==r)return false;if(!i.selector)return true;try{return this.evaluator.evaluate(i.selector,{instanceIndex:this.instanceNum}).selectedAtoms().includes(n)}catch(o){return this.recordSelectorError(i.selector,"group by field selector",o),false}})}isAttributeField(r,n,c){let s=this._layoutSpec.directives.attributes.filter(e=>e.field===r);if(s.length===0)return false;if(!n||!c)return s.some(e=>!e.selector&&!e.filter);for(let e of s){let i=true;if(e.selector)try{i=this.evaluator.evaluate(e.selector,{instanceIndex:this.instanceNum}).selectedAtoms().includes(n);}catch(p){this.recordSelectorError(e.selector,"attribute selector",p),i=false;}if(!i)continue;let o=true;if(e.filter)try{o=this.evaluator.evaluate(e.filter,{instanceIndex:this.instanceNum}).selectedTwoples().some(b=>b[0]===n&&b[1]===c);}catch(p){this.recordSelectorError(e.filter,"attribute filter",p),o=false;}if(i&&o)return true}return false}isHiddenField(r,n,c){let s=this._layoutSpec.directives.hiddenFields.filter(e=>e.field===r);if(s.length>0)if(!n||!c){if(s.some(e=>!e.selector&&!e.filter))return true}else for(let e of s){let i=true;if(e.selector)try{i=this.evaluator.evaluate(e.selector,{instanceIndex:this.instanceNum}).selectedAtoms().includes(n);}catch(p){this.recordSelectorError(e.selector,"hidden field selector",p),i=false;}if(!i)continue;let o=true;if(e.filter)try{o=this.evaluator.evaluate(e.filter,{instanceIndex:this.instanceNum}).selectedTwoples().some(b=>b[0]===n&&b[1]===c);}catch(p){this.recordSelectorError(e.filter,"hidden field filter",p),o=false;}if(i&&o)return true}return !!(n&&c&&this.findEdgeDirective(r,n,c)?.hidden===true)}generateGroups(r,n){let c=this._layoutSpec.constraints.grouping.byfield,s=this._layoutSpec.constraints.grouping.byselector;if(!c&&!s)return [];let e=[];for(var i of s){let b=i.selector,y;try{y=this.evaluator.evaluate(b,{instanceIndex:this.instanceNum});}catch(a){this.recordSelectorError(b,"groupBySelector selector",a);continue}if(y.maxArity()>1){let l=function(u,h,d){return "_g_0_1_"+u+":"+h+"->"+d};let a=y.selectedTwoples();for(var o of a){let u=o[0],h=o[1],d=r.node(u)?.label||u;d!=u&&(d=d+":"+u);let g=`${i.name}[${d}]`,_=e.find(S=>S.name===g);if(_)_.nodeIds.push(h);else {let S={name:g,nodeIds:[h],keyNodeId:u,showLabel:true,sourceConstraint:i};if(e.push(S),i.addEdge){let v=l(g,u,h);r.setEdge(u,h,g,v);}}}}else {let a=y.selectedAtoms();if(a.length===0)continue;let l=a[0],u={name:i.name,nodeIds:a,keyNodeId:l,showLabel:true,sourceConstraint:i};e.push(u);}}return [...r.edges()].forEach(b=>{let y=b.name,m=this.getRelationName(r,b),a=this.getConstraintsRelatedToField(m,b.v,b.w);a.length!==0&&a.forEach(l=>{let u=l.groupOn,h=l.addToGroup,d=this.getFieldTuplesForSourceAndTarget(n,m,b.v,b.w);if(!(!d||d.length===0))for(var g of d){let _=g?.length||0;if(_<2||u<0||u>=_||h<0||h>=_)throw new Error(`Invalid grouping. groupOn=${u} and addToGroup=${h} for ${_}-ary relation ${m}. These must be between 0 and ${_-1}.`);let S=g[u],v=g[h],T=g.map((j,B)=>B===u?j:"_").join(","),q=`${m}[${T}]`,G=e.find(j=>j.name===q);if(G)G.nodeIds.push(v),r.removeEdge(b.v,b.w,y);else {let j={name:q,nodeIds:[v],keyNodeId:S,showLabel:true,sourceConstraint:l};e.push(j);let J=`_g_${u}_${h}_`+y;r.removeEdge(b.v,b.w,y),r.setEdge(b.v,b.w,q,J);}}});}),e}generateAttributesAndRemoveEdges(r){let n={};return [...r.edges()].forEach(s=>{let e=s.name,i=this.getRelationName(r,s),o=s.v,p=s.w,E=this.isAttributeField(i,o,p),b=this.isHiddenField(i,o,p);if(b&&E)throw new Error(`${i} cannot be both an attribute and a hidden field.`);if(b){r.removeEdge(s.v,s.w,e);return}if(E){let y=this.getEdgeLabel(r,s),m=s.v,a=s.w,l=r.node(a)?.label||a,u=n[m]||{};u[y]||(u[y]=[],n[m]=u),u[y].push(l),r.removeEdge(s.v,s.w,e);}}),n}generateTagsForNodes(r,n){let c=this._layoutSpec.directives.tags;if(!c||c.length===0)return n;let s={...n},e=new Set(r.nodes());for(let i of c)try{let p=this.evaluator.evaluate(i.toTag,{instanceIndex:this.instanceNum}).selectedAtoms(),b=this.evaluator.evaluate(i.value,{instanceIndex:this.instanceNum}).selectedTuplesAll();for(let y of p){if(!e.has(y))continue;s[y]||(s[y]={});let m=b.filter(a=>a[0]===y);if(m.length!==0)for(let a of m)if(a.length===1){let l=i.name;s[y][l]||(s[y][l]=[]);let u=r.node(y)?.label||y;s[y][l].push(String(u));}else if(a.length===2){let l=i.name;s[y][l]||(s[y][l]=[]);let u=a[a.length-1],h=e.has(String(u))&&r.node(String(u))?.label||String(u);s[y][l].push(h);}else {let l=a.slice(1,-1),u=a[a.length-1],h=l.map(_=>{let S=String(_);return `[${e.has(S)&&r.node(S)?.label||S}]`}).join(""),d=`${i.name}${h}`;s[y][d]||(s[y][d]=[]);let g=e.has(String(u))&&r.node(String(u))?.label||String(u);s[y][d].push(g);}}}catch(o){this.recordSelectorError(`name: ${i.name}, toTag: ${i.toTag}, value: ${i.value}`,"tag directive",o);}return s}ensureNoExtraNodes(r,n){let c=[...r.nodes()],s=this._layoutSpec.directives.hiddenAtoms,e=[];for(let i of s)try{let o=this.evaluator.evaluate(i.selector,{instanceIndex:this.instanceNum});if(!this.checkSelectorArity(o,i.selector,"unary","hideAtom selector"))continue;let p=o.selectedAtoms();e.push({selector:i.selector,hiddenSet:new Set(p)});}catch(o){this.recordSelectorError(i.selector,"hideAtom selector",o);}c.forEach(i=>{try{let p=n.getAtomType(i)?.isBuiltin||!1,E=r.inEdges(i)||[],b=r.outEdges(i)||[],m=E.length===0&&b.length===0&&(this.hideDisconnectedBuiltIns&&p||this.hideDisconnected),a=!1,l;for(let h of e)if(h.hiddenSet.has(i)){a=!0,l=h.selector;break}(m||a)&&(r.removeNode(i),a&&l&&this.hiddenNodeSelectors.set(i,l));}catch(o){console.error("Failed to identify node type. Defaulting to showing node.",o);}});}getMostSpecificType(r,n){return this.getNodeTypes(r,n)[0]}getNodeTypes(r,n){let s=n.getAtomType(r)?.types||[];return s=s.concat(Kat),s}getRelationName(r,n){let c=this.getEdgeLabel(r,n);try{return c.split("[")[0]}catch{return console.warn(`Failed to parse relation name from edge label: ${c}. Defaulting to empty string.`),c}}getEdgeLabel(r,n){return r.edge(n.v,n.w,n.name)}generateLayout(r){this.selectorErrors=[],this.hiddenNodeSelectors=new Map,this.hiddenNodeConflicts=new Map,this.conflictedHiddenNodes=new Set;let n=r,c=n.generateGraph(this.hideDisconnected,false),s=this.generateAttributesAndRemoveEdges(c);s=this.generateTagsForNodes(c,s),this.addinferredEdges(c);let e=this.generateGroups(c,r);this.ensureNoExtraNodes(c,r);let i=this.getNodeIconMap(c),o=this.getNodeColorMap(c,n),p=this.getNodeSizeMap(c),E=this.getDisconnectedNodes(c),b=c.nodes().map(_=>{let v=c.node(_)?.label||_,T=o[_]||"black",q=i[_],G=q.path,j=q.showLabels,{height:B,width:J}=p[_]||{height:this.DEFAULT_NODE_HEIGHT,width:this.DEFAULT_NODE_WIDTH},w=this.getMostSpecificType(_,r),$=this.getNodeTypes(_,r),z=e.filter(gt=>gt.nodeIds.includes(_)).map(gt=>gt.name),tt=s[_]||{},pt,dt=n.getAtoms().find(gt=>gt.id===_);return dt?.labels&&(pt=dt.labels),{id:_,label:v,name:v,color:T,groups:z,attributes:tt,labels:pt,icon:G,height:B,width:J,mostSpecificType:w,types:$,showLabels:j,disconnected:E.includes(_)}}),y=[],m=0,a=0,l=[],u=[];try{y=this.applyRelativeOrientationConstraints(b,c),m=y.length,y=y.concat(this.applyAlignConstraints(b,c)),a=y.length-m,console.log(`Generated ${m} orientation constraints and ${a} alignment constraints (deduped + transitive reduction applied)`),this.pruneRedundantAlignmentEdges(c),y=Hat(y),l=this.buildLayoutEdges(c,b),u=this.buildCyclicDisjunctions(b);}catch(_){if($at(_))return this.handleMissingNodeConstraintError(_,{layoutNodes:b,graph:c,groups:e,disconnectedNodes:E,constraints:y});throw _}let h={nodes:b,edges:l,constraints:y,groups:e,disjunctiveConstraints:u};if(this.hiddenNodeConflicts.size>0)return this.handleHiddenNodeConflictError(h);let g=new bv(h).validateConstraints();if(g){if(g.minimalConflictingSet)return this.handlePositionalConstraintError(g,h);if(g.overlappingNodes)return this.handleGroupOverlapError(g,h);throw g}return y=h.constraints,l=this.filterHiddenEdges(l),h.nodes=b,h.edges=l,h.constraints=y,h.groups=e,{layout:h,error:null,selectorErrors:this.selectorErrors}}handleMissingNodeConstraintError(r,n){let c=this.filterHiddenEdges(this.buildLayoutEdges(n.graph,n.layoutNodes)),s=n.groups;return {layout:{nodes:n.layoutNodes,edges:c,constraints:n.constraints,groups:s,disjunctiveConstraints:[]},error:r,selectorErrors:this.selectorErrors}}handleHiddenNodeConflictError(r){let n=new Map,c=new Set;for(let[b,y]of this.hiddenNodeConflicts.entries())n.set(b,y);for(let b of this.conflictedHiddenNodes){let y=this.hiddenNodeSelectors.get(b);y&&c.add(y);}for(let b of c){let y=`hideAtom with selector <code>${b}</code>`,m=[];for(let[a,l]of this.hiddenNodeSelectors.entries())l===b&&m.push(`${a} is hidden`);m.length>0&&n.set(y,m);}let s=[...this.hiddenNodeSelectors.keys()],e=[...this.hiddenNodeConflicts.keys()][0],o={conflictingConstraint:this.hiddenNodeConflicts.get(e)?.[0]||"",conflictingSourceConstraint:e,minimalConflictingConstraints:n},p={name:"HiddenNodeConflictError",type:"hidden-node-conflict",message:`Constraints reference hidden nodes [${s.join(", ")}]. These constraints have been dropped from the layout.`,hiddenNodes:this.hiddenNodeSelectors,droppedConstraints:this.hiddenNodeConflicts,errorMessages:o};return {layout:{...r,edges:this.filterHiddenEdges(r.edges)},error:p,selectorErrors:this.selectorErrors}}handlePositionalConstraintError(r,n){let c=r.minimalConflictingSet;return {layout:{nodes:n.nodes,edges:n.edges,constraints:n.constraints.filter(e=>![...c.values()].flat().includes(e)),groups:n.groups,conflictingConstraints:[...c.values()].flat()},error:r,selectorErrors:this.selectorErrors}}handleGroupOverlapError(r,n){let c=r.overlappingNodes.map(E=>E.groups).flat(),s=n.groups.filter(E=>c.includes(E.name)),e=s.flatMap(E=>E.nodeIds),i=n.nodes.filter(E=>e.includes(E.id)),o=n.edges.filter(E=>i.some(b=>E.source.id===b.id)&&i.some(b=>E.target.id===b.id));return {layout:{nodes:i,edges:o,constraints:n.constraints,groups:s,overlappingNodes:r.overlappingNodes},error:r,selectorErrors:this.selectorErrors}}buildCyclicDisjunctions(r){let n=this._layoutSpec.constraints.orientation.cyclic,c=[];for(let[,s]of n.entries()){let e;try{e=this.evaluator.evaluate(s.selector,{instanceIndex:this.instanceNum});}catch(b){this.recordSelectorError(s.selector,"cyclic orientation selector",b);continue}if(!this.checkSelectorArity(e,s.selector,"binary","cyclic orientation selector"))continue;let i=e.selectedTwoples(),o=new Map;i.forEach(b=>{let y=b[0],m=b[1],a=r.find(u=>u.id===y),l=r.find(u=>u.id===m);!a||!l||(o.has(a)?o.get(a).push(l):o.set(a,[l]));});let E=this.getFragmentsToConstrain(o).map(b=>b.Path.map(y=>y.id));s.direction==="counterclockwise"&&(E=E.map(b=>b.reverse())),E.forEach(b=>{let y=b.length;if(y<=2)return;let m=[];for(let l=0;l<y;l++){let u=this.getCyclicConstraintForFragment(b,r,l,s);m.push(u);}let a=new $p(s,m);c.push(a);});}return c}getCyclicConstraintForFragment(r,n,c,s){if(r.length<=2)return [];let i=2*Math.PI/r.length,o={};for(var p=0;p<r.length;p++){let m=(p+c)*i,a=100*Math.cos(m),l=100*Math.sin(m);o[r[p]]={x:a,y:l};}let E=[];for(var b=0;b<r.length;b++)for(var y=0;y<r.length;y++)if(b!==y){let m=r[b],a=r[y],l=o[m],u=o[a];l.x>u.x?E.push(this.leftConstraint(a,m,this.minSepWidth,n,s)):l.x<u.x?E.push(this.leftConstraint(m,a,this.minSepWidth,n,s)):E.push(this.ensureSameXConstraint(m,a,n,s)),l.y>u.y?E.push(this.topConstraint(a,m,this.minSepHeight,n,s)):l.y<u.y?E.push(this.topConstraint(m,a,this.minSepHeight,n,s)):E.push(this.ensureSameYConstraint(m,a,n,s));}return E}getAllPaths(r){let n=[],c=new Set;function s(e,i){i.push(e);let o=r.get(e);if(!r.has(e)||!o||o.length===0){let p=new Av(i,void 0);n.push(p);}else for(let p of o)if(!i.includes(p))s(p,[...i]);else {let E=new Av(i,p);n.push(E);}}for(let e of r.keys())c.has(e)||s(e,[]);return n}getFragmentsToConstrain(r){let n=this.getAllPaths(r),c=n.filter((e,i)=>!n.some((o,p)=>p<i&&Av.areEquivalent(e,o)));return c.filter((e,i)=>!c.some((o,p)=>i!==p&&o.isSubpathOf(e)))}applyRelativeOrientationConstraints(r,n){let c=[],s=this._layoutSpec.constraints.orientation.relative,e=new Set,i=new Map,o=new Map;return s.forEach(p=>{let E=p.directions,b=p.selector,y;try{y=this.evaluator.evaluate(b,{instanceIndex:this.instanceNum});}catch(a){this.recordSelectorError(b,"orientation selector",a);return}if(!this.checkSelectorArity(y,b,"binary","orientation selector"))return;y.selectedTwoples().forEach(a=>{let l=a[0],u=a[1],h=this.isNodeHiddenByDirective(l),d=this.isNodeHiddenByDirective(u);if(h||d){let g=h?l:u;for(let _ of E){let S=Gat(l,u,_);this.recordHiddenNodeConflict(p,S,g);}return}E.forEach(g=>{if(this.shouldAddAlignmentEdge(n,l,u)){let _=`_alignment_${l}_${u}_`;n.setEdge(l,u,_,_);}if(g=="left"){let _=`left:${u}:${l}:${this.minSepWidth}`;!e.has(_)&&!this.hasTransitivePath(i,u,l)&&(e.add(_),this.addToTransitiveGraph(i,u,l),c.push(this.leftConstraint(u,l,this.minSepWidth,r,p)));}else if(g=="above"){let _=`top:${u}:${l}:${this.minSepHeight}`;!e.has(_)&&!this.hasTransitivePath(o,u,l)&&(e.add(_),this.addToTransitiveGraph(o,u,l),c.push(this.topConstraint(u,l,this.minSepHeight,r,p)));}else if(g=="right"){let _=`left:${l}:${u}:${this.minSepWidth}`;!e.has(_)&&!this.hasTransitivePath(i,l,u)&&(e.add(_),this.addToTransitiveGraph(i,l,u),c.push(this.leftConstraint(l,u,this.minSepWidth,r,p)));}else if(g=="below"){let _=`top:${l}:${u}:${this.minSepHeight}`;!e.has(_)&&!this.hasTransitivePath(o,l,u)&&(e.add(_),this.addToTransitiveGraph(o,l,u),c.push(this.topConstraint(l,u,this.minSepHeight,r,p)));}else if(g=="directlyLeft"){let _=`left:${u}:${l}:${this.minSepWidth}`,S=`align-y:${u}:${l}`;!e.has(_)&&!this.hasTransitivePath(i,u,l)&&(e.add(_),this.addToTransitiveGraph(i,u,l),c.push(this.leftConstraint(u,l,this.minSepWidth,r,p))),e.has(S)||(e.add(S),c.push(this.ensureSameYConstraint(u,l,r,p)));}else if(g=="directlyAbove"){let _=`top:${u}:${l}:${this.minSepHeight}`,S=`align-x:${u}:${l}`;!e.has(_)&&!this.hasTransitivePath(o,u,l)&&(e.add(_),this.addToTransitiveGraph(o,u,l),c.push(this.topConstraint(u,l,this.minSepHeight,r,p))),e.has(S)||(e.add(S),c.push(this.ensureSameXConstraint(u,l,r,p)));}else if(g=="directlyRight"){let _=`left:${l}:${u}:${this.minSepWidth}`,S=`align-y:${u}:${l}`;!e.has(_)&&!this.hasTransitivePath(i,l,u)&&(e.add(_),this.addToTransitiveGraph(i,l,u),c.push(this.leftConstraint(l,u,this.minSepWidth,r,p))),e.has(S)||(e.add(S),c.push(this.ensureSameYConstraint(u,l,r,p)));}else if(g=="directlyBelow"){let _=`top:${l}:${u}:${this.minSepHeight}`,S=`align-x:${u}:${l}`;!e.has(_)&&!this.hasTransitivePath(o,l,u)&&(e.add(_),this.addToTransitiveGraph(o,l,u),c.push(this.topConstraint(l,u,this.minSepHeight,r,p))),e.has(S)||(e.add(S),c.push(this.ensureSameXConstraint(u,l,r,p)));}});});}),c}hasTransitivePath(r,n,c){let s=r.get(n);if(!s)return false;if(s.has(c))return true;let e=new Set([n]),i=Array.from(s);for(;i.length>0;){let o=i.shift();if(o===c)return true;if(e.has(o))continue;e.add(o);let p=r.get(o);if(p)for(let E of p)e.has(E)||i.push(E);}return false}addToTransitiveGraph(r,n,c){r.has(n)||r.set(n,new Set),r.get(n).add(c);let s=r.get(c)||new Set;for(let[e,i]of r.entries())if(e===n||i.has(n)){i.add(c);for(let o of s)i.add(o);}}applyAlignConstraints(r,n){let c=[],s=this._layoutSpec.constraints.alignment,e=new Set;return s.forEach(i=>{let o=i.direction,p=i.selector,E;try{E=this.evaluator.evaluate(p,{instanceIndex:this.instanceNum});}catch(y){this.recordSelectorError(p,"align selector",y);return}if(!this.checkSelectorArity(E,p,"binary","align selector"))return;E.selectedTwoples().forEach(y=>{let m=y[0],a=y[1],l=this.isNodeHiddenByDirective(m),u=this.isNodeHiddenByDirective(a);if(l||u){let h=l?m:a,g=`${m} is ${o==="horizontal"?"horizontally":"vertically"} aligned with ${a}`;this.recordHiddenNodeConflict(i,g,h);return}if(this.shouldAddAlignmentEdge(n,m,a)){let h=`_alignment_${m}_${a}_`;n.setEdge(m,a,h,h);}if(o==="horizontal"){let[h,d]=[m,a].sort(),g=`align-y:${h}:${d}`;e.has(g)||(e.add(g),c.push(this.ensureSameYConstraint(m,a,r,i)));}else if(o==="vertical"){let[h,d]=[m,a].sort(),g=`align-x:${h}:${d}`;e.has(g)||(e.add(g),c.push(this.ensureSameXConstraint(m,a,r,i)));}});}),c}shouldAddAlignmentEdge(r,n,c){if(this.alignmentEdgeStrategy==="never")return false;let s=this.hasDirectEdgeBetween(r,n,c);return this.alignmentEdgeStrategy==="direct"?!s:s?false:!this.isConnectedViaPath(r,n,c)}hasDirectEdgeBetween(r,n,c){return typeof r.hasEdge=="function"&&(r.hasEdge(n,c)||r.hasEdge(c,n))||(r.inEdges(n)||[]).some(s=>s.v===c)||(r.outEdges(n)||[]).some(s=>s.w===c)||(r.inEdges(c)||[]).some(s=>s.v===n)||(r.outEdges(c)||[]).some(s=>s.w===n)}isConnectedViaPath(r,n,c,s){let e=new Set,i=[n];for(;i.length>0;){let o=i.shift();if(o===c)return true;if(e.has(o))continue;e.add(o);let p=r.outEdges(o)||[],E=r.inEdges(o)||[];for(let b of [...p,...E]){if(s&&(b.v===s.v&&b.w===s.w&&b.name===s.name||b.v===s.w&&b.w===s.v&&b.name===s.name))continue;let y=b.v===o?b.w:b.v;e.has(y)||i.push(y);}}return false}pruneRedundantAlignmentEdges(r){if(this.alignmentEdgeStrategy!=="connected")return;let n=r.edges().filter(s=>{let e=s.name;return e&&e.includes("_alignment_")}),c=[];for(let s of n)this.isConnectedViaPath(r,s.v,s.w,s)&&(r.removeEdge(s.v,s.w,s.name),c.push(s));c.length>0&&console.log(`Pruned ${c.length} redundant alignment edges out of ${n.length} total alignment edges`);}getDisconnectedNodes(r){let n=r.edges().map(o=>o.w),c=r.edges().map(o=>o.v),s=new Set(r.nodes()),e=new Set([...n,...c]);return [...s].filter(o=>!e.has(o))}buildLayoutEdges(r,n){return r.edges().map(c=>{let s=c.name,e=r.edge(c.v,c.w,s),i=n.find(l=>l.id===c.v),o=n.find(l=>l.id===c.w),p=this.getRelationName(r,c),E=this.getEdgeColor(p,c.v,c.w,s),b=this.getEdgeStyle(p,c.v,c.w,s),y=this.getEdgeWeight(p,c.v,c.w,s),m=this.getEdgeShowLabel(p,c.v,c.w,s);return !i||!o||!s?null:{source:i,target:o,label:e,relationName:p,id:s,color:E,style:b,weight:y,showLabel:m,groupId:s.startsWith("_g_")?e:void 0,keyNodeId:s.startsWith("_g_")?c.v:void 0}}).filter(c=>c!==null)}filterHiddenEdges(r){return r.filter(n=>!n.id.startsWith(this.hideThisEdge))}getNodeFromId(r,n,c){let s=n.find(e=>e.id===r);if(!s)throw new w4(r,c);return s}leftConstraint(r,n,c,s,e){let i=this.getNodeFromId(r,s,e),o=this.getNodeFromId(n,s,e);return {left:i,right:o,minDistance:c,sourceConstraint:e}}topConstraint(r,n,c,s,e){let i=this.getNodeFromId(r,s,e),o=this.getNodeFromId(n,s,e);return {top:i,bottom:o,minDistance:c,sourceConstraint:e}}ensureSameYConstraint(r,n,c,s){let e=this.getNodeFromId(r,c,s),i=this.getNodeFromId(n,c,s);return {axis:"y",node1:e,node2:i,sourceConstraint:s}}ensureSameXConstraint(r,n,c,s){let e=this.getNodeFromId(r,c,s),i=this.getNodeFromId(n,c,s);return {axis:"x",node1:e,node2:i,sourceConstraint:s}}singletonGroup(r){return {name:`${I4.DISCONNECTED_PREFIX}${r}`,nodeIds:[r],keyNodeId:r,showLabel:false}}getNodeSizeMap(r){let n={},c={width:this.DEFAULT_NODE_WIDTH,height:this.DEFAULT_NODE_HEIGHT};return this._layoutSpec.directives.sizes.forEach(i=>{let o;try{let b=this.evaluator.evaluate(i.selector,{instanceIndex:this.instanceNum});if(!this.checkSelectorArity(b,i.selector,"unary","size selector"))return;o=b.selectedAtoms();}catch(b){this.recordSelectorError(i.selector,"size selector",b);return}let p=i.width,E=i.height;o.forEach(b=>{if(n[b]){let y=n[b];if(y.width!==p||y.height!==E)throw new Error(`Size Conflict: "${b}" cannot have multiple sizes: ${JSON.stringify(y)}, ${JSON.stringify({width:p,height:E})}.`)}n[b]={width:p,height:E};});}),[...r.nodes()].forEach(i=>{n[i]||(n[i]=c);}),n}getNodeColorMap(r,n){let c={},s=this.getSigColors(n);return this._layoutSpec.directives.atomColors.forEach(o=>{let p;try{let b=this.evaluator.evaluate(o.selector,{instanceIndex:this.instanceNum});if(!this.checkSelectorArity(b,o.selector,"unary","color selector"))return;p=b.selectedAtoms();}catch(b){this.recordSelectorError(o.selector,"color selector",b);return}let E=o.color;p.forEach(b=>{if(c[b]){let y=c[b];if(y!==E)throw new Error(`Color Conflict: "${b}" cannot have multiple colors: ${y}, ${E}.`)}c[b]=E;});}),[...r.nodes()].forEach(o=>{if(!c[o]){let p=this.getMostSpecificType(o,n);c[o]=s[p];}}),c}getNodeIconMap(r){let n={},c=this.DEFAULT_NODE_ICON_PATH;return this._layoutSpec.directives.icons.forEach(i=>{let o;try{let E=this.evaluator.evaluate(i.selector,{instanceIndex:this.instanceNum});if(!this.checkSelectorArity(E,i.selector,"unary","icon selector"))return;o=E.selectedAtoms();}catch(E){this.recordSelectorError(i.selector,"icon selector",E);return}let p=i.path;o.forEach(E=>{let b=VT(p);if(n[E]){let y=n[E];if(y.path!==b||y.showLabels!==i.showLabels)throw new Error(`Icon Conflict: "${E}" cannot have multiple icons: ${JSON.stringify(y)}, ${JSON.stringify({path:b,showLabels:i.showLabels})}.`)}n[E]={path:b,showLabels:i.showLabels};});}),[...r.nodes()].forEach(i=>{n[i]||(n[i]={path:c,showLabels:true});}),n}getEdgeColor(r,n,c,s){let e=this.getInferredEdgeDirective(s);if(e?.color)return e.color;let i=this.findEdgeDirective(r,n,c);return i?.color?i.color:"black"}getEdgeStyle(r,n,c,s){let e=this.getInferredEdgeDirective(s),i=GT(e?.style);if(i)return i;let o=this.findEdgeDirective(r,n,c);return GT(o?.style)}getEdgeWeight(r,n,c,s){let e=this.getInferredEdgeDirective(s),i=this.normalizeEdgeWeight(e?.weight,"inferred edge");if(i!==void 0)return i;let o=this.findEdgeDirective(r,n,c);return this.normalizeEdgeWeight(o?.weight,"edge")}getEdgeShowLabel(r,n,c,s){return this.findEdgeDirective(r,n,c)?.showLabel}getInferredEdgeDirective(r){let n="_inferred_";return !r||!r.includes(n)?void 0:this._layoutSpec.directives.inferredEdges.find(s=>r.includes(`${n}<:${s.name}`))}findEdgeDirective(r,n,c){let s=this._layoutSpec.directives.edgeColors;for(let e of s){if(e.field!==r)continue;let i=true;if(e.selector)try{i=this.evaluator.evaluate(e.selector,{instanceIndex:this.instanceNum}).selectedAtoms().includes(n);}catch(p){this.recordSelectorError(e.selector,"edge selector",p),i=false;}if(!i)continue;let o=true;if(e.filter&&c)try{o=this.evaluator.evaluate(e.filter,{instanceIndex:this.instanceNum}).selectedTwoples().some(b=>b[0]===n&&b[1]===c);}catch(p){this.recordSelectorError(e.filter,"edge filter",p),o=false;}if(i&&o)return e}}normalizeEdgeWeight(r,n){if(r!=null){if(typeof r!="number"||Number.isNaN(r)||r<=0){console.warn(`Ignoring ${n} weight because it is not a positive number: ${r}`);return}return r}}getSigColors(r){let n={},c=r.getTypes(),s=new _v(c.length);return c.forEach(e=>{n[e.id]=s.getNextColor();}),n}getFieldTuples(r,n){let c=r.getRelations();Object.values(c);let e=Object.values(c).find(o=>o.name===n);return e?e.tuples.map(o=>o.atoms):[]}getFieldTuplesForSourceAndTarget(r,n,c,s){return this.getFieldTuples(r,n).filter(o=>{let p=o.length;return p<1?false:o[0]===c&&o[p-1]===s})}addinferredEdges(r){let n="_inferred_";this._layoutSpec.directives.inferredEdges.forEach(s=>{let e;try{e=this.evaluator.evaluate(s.selector,{instanceIndex:this.instanceNum});}catch(p){this.recordSelectorError(s.selector,"inferredEdge selector",p);return}let i=e.selectedTuplesAll(),o=`${n}<:${s.name}`;i.forEach(p=>{let E=p.length,b=p[0],y=p[E-1],m=s.name;if(E>2){let u=p.slice(1,E-1).map(h=>r.node(h)?.label||h).join(",");m=`${m}[${u}]`;}let a=p.join("->"),l=`${o}<:${a}`;r.setEdge(b,y,m,l);});});}};I4.DISCONNECTED_PREFIX="_d_";exports.LayoutInstance=I4;});var o1=Te((U6t,gP)=>{var D4;if(typeof _f=="function")try{D4=Up();}catch{}D4||(D4=window.graphlib);gP.exports=D4;});var vP=Te(($6t,yP)=>{var qat=g_(),zat=1,Vat=4;function Yat(t){return qat(t,zat|Vat)}yP.exports=Yat;});var Sv=Te((H6t,EP)=>{var Wat=r3(),Xat=rp(),Qat=hy(),Jat=Nd();function Zat(t,r,n){if(!Jat(n))return false;var c=typeof r;return (c=="number"?Xat(n)&&Qat(r,n.length):c=="string"&&r in n)?Wat(n[r],t):false}EP.exports=Zat;});var bP=Te((G6t,TP)=>{var tut=Ty(),eut=r3(),rut=Sv(),nut=$2(),_P=Object.prototype,iut=_P.hasOwnProperty,sut=tut(function(t,r){t=Object(t);var n=-1,c=r.length,s=c>2?r[2]:void 0;for(s&&rut(r[0],r[1],s)&&(c=1);++n<c;)for(var e=r[n],i=nut(e),o=-1,p=i.length;++o<p;){var E=i[o],b=t[E];(b===void 0||eut(b,_P[E])&&!iut.call(t,E))&&(t[E]=e[E]);}return t});TP.exports=sut;});var OP=Te((q6t,AP)=>{var out=np(),aut=rp(),uut=jp();function lut(t){return function(r,n,c){var s=Object(r);if(!aut(r)){var e=out(n,3);r=uut(r),n=function(o){return e(s[o],o,s)};}var i=t(r,n,c);return i>-1?s[e?r[i]:i]:void 0}}AP.exports=lut;});var CP=Te((z6t,SP)=>{var cut=/\s/;function hut(t){for(var r=t.length;r--&&cut.test(t.charAt(r)););return r}SP.exports=hut;});var RP=Te((V6t,NP)=>{var fut=CP(),dut=/^\s+/;function put(t){return t&&t.slice(0,fut(t)+1).replace(dut,"")}NP.exports=put;});var LP=Te((Y6t,DP)=>{var xut=RP(),wP=Nd(),mut=a3(),IP=NaN,gut=/^[-+]0x[0-9a-f]+$/i,yut=/^0b[01]+$/i,vut=/^0o[0-7]+$/i,Eut=parseInt;function _ut(t){if(typeof t=="number")return t;if(mut(t))return IP;if(wP(t)){var r=typeof t.valueOf=="function"?t.valueOf():t;t=wP(r)?r+"":r;}if(typeof t!="string")return t===0?t:+t;t=xut(t);var n=yut.test(t);return n||vut.test(t)?Eut(t.slice(2),n?2:8):gut.test(t)?IP:+t}DP.exports=_ut;});var Bb=Te((W6t,MP)=>{var Tut=LP(),PP=1/0,but=17976931348623157e292;function Aut(t){if(!t)return t===0?t:0;if(t=Tut(t),t===PP||t===-PP){var r=t<0?-1:1;return r*but}return t===t?t:0}MP.exports=Aut;});var FP=Te((X6t,kP)=>{var Out=Bb();function Sut(t){var r=Out(t),n=r%1;return r===r?n?r-n:r:0}kP.exports=Sut;});var jP=Te((Q6t,BP)=>{var Cut=G_(),Nut=np(),Rut=FP(),wut=Math.max;function Iut(t,r,n){var c=t==null?0:t.length;if(!c)return -1;var s=n==null?0:Rut(n);return s<0&&(s=wut(c+s,0)),Cut(t,Nut(r,3),s)}BP.exports=Iut;});var KP=Te((J6t,UP)=>{var Dut=OP(),Lut=jP(),Put=Dut(Lut);UP.exports=Put;});var jb=Te((Z6t,$P)=>{var Mut=pE();function kut(t){var r=t==null?0:t.length;return r?Mut(t,1):[]}$P.exports=kut;});var GP=Te((t8t,HP)=>{var Fut=uE(),But=y_(),jut=$2();function Uut(t,r){return t==null?t:Fut(t,But(r),jut)}HP.exports=Uut;});var zP=Te((e8t,qP)=>{function Kut(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}qP.exports=Kut;});var YP=Te((r8t,VP)=>{var $ut=uy(),Hut=lE(),Gut=np();function qut(t,r){var n={};return r=Gut(r,3),Hut(t,function(c,s,e){$ut(n,s,r(c,s,e));}),n}VP.exports=qut;});var L4=Te((n8t,WP)=>{var zut=a3();function Vut(t,r,n){for(var c=-1,s=t.length;++c<s;){var e=t[c],i=r(e);if(i!=null&&(o===void 0?i===i&&!zut(i):n(i,o)))var o=i,p=e;}return p}WP.exports=Vut;});var QP=Te((i8t,XP)=>{function Yut(t,r){return t>r}XP.exports=Yut;});var ZP=Te((s8t,JP)=>{var Wut=L4(),Xut=QP(),Qut=H2();function Jut(t){return t&&t.length?Wut(t,Qut,Xut):void 0}JP.exports=Jut;});var Ub=Te((o8t,tM)=>{var Zut=uy(),tlt=r3();function elt(t,r,n){(n!==void 0&&!tlt(t[r],n)||n===void 0&&!(r in t))&&Zut(t,r,n);}tM.exports=elt;});var nM=Te((a8t,rM)=>{var rlt=U2(),nlt=gy(),ilt=N1(),slt="[object Object]",olt=Function.prototype,alt=Object.prototype,eM=olt.toString,ult=alt.hasOwnProperty,llt=eM.call(Object);function clt(t){if(!ilt(t)||rlt(t)!=slt)return false;var r=nlt(t);if(r===null)return true;var n=ult.call(r,"constructor")&&r.constructor;return typeof n=="function"&&n instanceof n&&eM.call(n)==llt}rM.exports=clt;});var Kb=Te((u8t,iM)=>{function hlt(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}iM.exports=hlt;});var oM=Te((l8t,sM)=>{var flt=Am(),dlt=$2();function plt(t){return flt(t,dlt(t))}sM.exports=plt;});var fM=Te((c8t,hM)=>{var aM=Ub(),xlt=t_(),mlt=p_(),glt=e_(),ylt=m_(),uM=Om(),lM=Oc(),vlt=z_(),Elt=i3(),_lt=Em(),Tlt=Nd(),blt=nM(),Alt=Nm(),cM=Kb(),Olt=oM();function Slt(t,r,n,c,s,e,i){var o=cM(t,n),p=cM(r,n),E=i.get(p);if(E){aM(t,n,E);return}var b=e?e(o,p,n+"",t,r,i):void 0,y=b===void 0;if(y){var m=lM(p),a=!m&&Elt(p),l=!m&&!a&&Alt(p);b=p,m||a||l?lM(o)?b=o:vlt(o)?b=glt(o):a?(y=false,b=xlt(p,true)):l?(y=false,b=mlt(p,true)):b=[]:blt(p)||uM(p)?(b=o,uM(o)?b=Olt(o):(!Tlt(o)||_lt(o))&&(b=ylt(p))):y=false;}y&&(i.set(p,b),s(b,p,c,e,i),i.delete(p)),aM(t,n,b);}hM.exports=Slt;});var xM=Te((h8t,pM)=>{var Clt=ay(),Nlt=Ub(),Rlt=uE(),wlt=fM(),Ilt=Nd(),Dlt=$2(),Llt=Kb();function dM(t,r,n,c,s){t!==r&&Rlt(r,function(e,i){if(s||(s=new Clt),Ilt(e))wlt(t,r,i,n,dM,c,s);else {var o=c?c(Llt(t,i),e,i+"",t,r,s):void 0;o===void 0&&(o=e),Nlt(t,i,o);}},Dlt);}pM.exports=dM;});var gM=Te((f8t,mM)=>{var Plt=Ty(),Mlt=Sv();function klt(t){return Plt(function(r,n){var c=-1,s=n.length,e=s>1?n[s-1]:void 0,i=s>2?n[2]:void 0;for(e=t.length>3&&typeof e=="function"?(s--,e):void 0,i&&Mlt(n[0],n[1],i)&&(e=s<3?void 0:e,s=1),r=Object(r);++c<s;){var o=n[c];o&&t(r,o,c,e);}return r})}mM.exports=klt;});var vM=Te((d8t,yM)=>{var Flt=xM(),Blt=gM(),jlt=Blt(function(t,r,n){Flt(t,r,n);});yM.exports=jlt;});var $b=Te((p8t,EM)=>{function Ult(t,r){return t<r}EM.exports=Ult;});var TM=Te((x8t,_M)=>{var Klt=L4(),$lt=$b(),Hlt=H2();function Glt(t){return t&&t.length?Klt(t,Hlt,$lt):void 0}_M.exports=Glt;});var AM=Te((m8t,bM)=>{var qlt=L4(),zlt=np(),Vlt=$b();function Ylt(t,r){return t&&t.length?qlt(t,zlt(r,2),Vlt):void 0}bM.exports=Ylt;});var SM=Te((g8t,OM)=>{var Wlt=Qd(),Xlt=function(){return Wlt.Date.now()};OM.exports=Xlt;});var RM=Te((y8t,NM)=>{var Qlt=ly(),Jlt=Ey(),Zlt=hy(),CM=Nd(),tct=Im();function ect(t,r,n,c){if(!CM(t))return t;r=Jlt(r,t);for(var s=-1,e=r.length,i=e-1,o=t;o!=null&&++s<e;){var p=tct(r[s]),E=n;if(p==="__proto__"||p==="constructor"||p==="prototype")return t;if(s!=i){var b=o[p];E=c?c(b,p,o):void 0,E===void 0&&(E=CM(b)?b:Zlt(r[s+1])?[]:{});}Qlt(o,p,E),o=o[p];}return t}NM.exports=ect;});var IM=Te((v8t,wM)=>{var rct=_y(),nct=RM(),ict=Ey();function sct(t,r,n){for(var c=-1,s=r.length,e={};++c<s;){var i=r[c],o=rct(t,i);n(o,i)&&nct(e,ict(i,t),o);}return e}wM.exports=sct;});var LM=Te((E8t,DM)=>{var oct=IM(),act=D_();function uct(t,r){return oct(t,r,function(n,c){return act(t,c)})}DM.exports=uct;});var MM=Te((_8t,PM)=>{var lct=jb(),cct=$_(),hct=H_();function fct(t){return hct(cct(t,void 0,lct),t+"")}PM.exports=fct;});var FM=Te((T8t,kM)=>{var dct=LM(),pct=MM(),xct=pct(function(t,r){return t==null?{}:dct(t,r)});kM.exports=xct;});var jM=Te((b8t,BM)=>{var mct=Math.ceil,gct=Math.max;function yct(t,r,n,c){for(var s=-1,e=gct(mct((r-t)/(n||1)),0),i=Array(e);e--;)i[c?e:++s]=t,t+=n;return i}BM.exports=yct;});var KM=Te((A8t,UM)=>{var vct=jM(),Ect=Sv(),Hb=Bb();function _ct(t){return function(r,n,c){return c&&typeof c!="number"&&Ect(r,n,c)&&(n=c=void 0),r=Hb(r),n===void 0?(n=r,r=0):n=Hb(n),c=c===void 0?r<n?1:-1:Hb(c),vct(r,n,c,t)}}UM.exports=_ct;});var HM=Te((O8t,$M)=>{var Tct=KM(),bct=Tct();$M.exports=bct;});var qM=Te((S8t,GM)=>{function Act(t,r){var n=t.length;for(t.sort(r);n--;)t[n]=t[n].value;return t}GM.exports=Act;});var YM=Te((C8t,VM)=>{var zM=a3();function Oct(t,r){if(t!==r){var n=t!==void 0,c=t===null,s=t===t,e=zM(t),i=r!==void 0,o=r===null,p=r===r,E=zM(r);if(!o&&!E&&!e&&t>r||e&&i&&p&&!o&&!E||c&&i&&p||!n&&p||!s)return 1;if(!c&&!e&&!E&&t<r||E&&n&&s&&!c&&!e||o&&n&&s||!i&&s||!p)return -1}return 0}VM.exports=Oct;});var XM=Te((N8t,WM)=>{var Sct=YM();function Cct(t,r,n){for(var c=-1,s=t.criteria,e=r.criteria,i=s.length,o=n.length;++c<i;){var p=Sct(s[c],e[c]);if(p){if(c>=o)return p;var E=n[c];return p*(E=="desc"?-1:1)}}return t.index-r.index}WM.exports=Cct;});var JM=Te((R8t,QM)=>{var Gb=vy(),Nct=_y(),Rct=np(),wct=F_(),Ict=qM(),Dct=fy(),Lct=XM(),Pct=H2(),Mct=Oc();function kct(t,r,n){r.length?r=Gb(r,function(e){return Mct(e)?function(i){return Nct(i,e.length===1?e[0]:e)}:e}):r=[Pct];var c=-1;r=Gb(r,Dct(Rct));var s=wct(t,function(e,i,o){var p=Gb(r,function(E){return E(e)});return {criteria:p,index:++c,value:e}});return Ict(s,function(e,i){return Lct(e,i,n)})}QM.exports=kct;});var ek=Te((w8t,tk)=>{var Fct=pE(),Bct=JM(),jct=Ty(),ZM=Sv(),Uct=jct(function(t,r){if(t==null)return [];var n=r.length;return n>1&&ZM(t,r[0],r[1])?r=[]:n>2&&ZM(r[0],r[1],r[2])&&(r=[r[0]]),Bct(t,Fct(r,1),[])});tk.exports=Uct;});var nk=Te((I8t,rk)=>{var Kct=w_(),$ct=0;function Hct(t){var r=++$ct;return Kct(t)+r}rk.exports=Hct;});var sk=Te((D8t,ik)=>{function Gct(t,r,n){for(var c=-1,s=t.length,e=r.length,i={};++c<s;){var o=c<e?r[c]:void 0;n(i,t[c],o);}return i}ik.exports=Gct;});var ak=Te((L8t,ok)=>{var qct=ly(),zct=sk();function Vct(t,r){return zct(t||[],r||[],qct)}ok.exports=Vct;});var yl=Te((P8t,uk)=>{var P4;if(typeof _f=="function")try{P4={cloneDeep:vP(),constant:aE(),defaults:bP(),each:E_(),filter:P_(),find:KP(),flatten:jb(),forEach:v_(),forIn:GP(),has:M_(),isUndefined:k_(),last:zP(),map:B_(),mapValues:YP(),max:ZP(),merge:vM(),min:TM(),minBy:AM(),now:SM(),pick:FM(),range:HM(),reduce:j_(),sortBy:ek(),uniqueId:nk(),values:V_(),zipObject:ak()};}catch{}P4||(P4=window._);uk.exports=P4;});var hk=Te((k8t,ck)=>{ck.exports=M4;function M4(){var t={};t._next=t._prev=t,this._sentinel=t;}M4.prototype.dequeue=function(){var t=this._sentinel,r=t._prev;if(r!==t)return lk(r),r};M4.prototype.enqueue=function(t){var r=this._sentinel;t._prev&&t._next&&lk(t),t._next=r._next,r._next._prev=t,r._next=t,t._prev=r;};M4.prototype.toString=function(){for(var t=[],r=this._sentinel,n=r._prev;n!==r;)t.push(JSON.stringify(n,Yct)),n=n._prev;return "["+t.join(", ")+"]"};function lk(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev;}function Yct(t,r){if(t!=="_next"&&t!=="_prev")return r}});var dk=Te((F8t,fk)=>{var zp=yl(),Wct=o1().Graph,Xct=hk();fk.exports=Jct;var Qct=zp.constant(1);function Jct(t,r){if(t.nodeCount()<=1)return [];var n=tht(t,r||Qct),c=Zct(n.graph,n.buckets,n.zeroIdx);return zp.flatten(zp.map(c,function(s){return t.outEdges(s.v,s.w)}),true)}function Zct(t,r,n){for(var c=[],s=r[r.length-1],e=r[0],i;t.nodeCount();){for(;i=e.dequeue();)qb(t,r,n,i);for(;i=s.dequeue();)qb(t,r,n,i);if(t.nodeCount()){for(var o=r.length-2;o>0;--o)if(i=r[o].dequeue(),i){c=c.concat(qb(t,r,n,i,true));break}}}return c}function qb(t,r,n,c,s){var e=s?[]:void 0;return zp.forEach(t.inEdges(c.v),function(i){var o=t.edge(i),p=t.node(i.v);s&&e.push({v:i.v,w:i.w}),p.out-=o,zb(r,n,p);}),zp.forEach(t.outEdges(c.v),function(i){var o=t.edge(i),p=i.w,E=t.node(p);E.in-=o,zb(r,n,E);}),t.removeNode(c.v),e}function tht(t,r){var n=new Wct,c=0,s=0;zp.forEach(t.nodes(),function(o){n.setNode(o,{v:o,in:0,out:0});}),zp.forEach(t.edges(),function(o){var p=n.edge(o.v,o.w)||0,E=r(o),b=p+E;n.setEdge(o.v,o.w,b),s=Math.max(s,n.node(o.v).out+=E),c=Math.max(c,n.node(o.w).in+=E);});var e=zp.range(s+c+3).map(function(){return new Xct}),i=c+1;return zp.forEach(n.nodes(),function(o){zb(e,i,n.node(o));}),{graph:n,buckets:e,zeroIdx:i}}function zb(t,r,n){n.out?n.in?t[n.out-n.in+r].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n);}});var xk=Te((B8t,pk)=>{var w3=yl(),eht=dk();pk.exports={run:rht,undo:iht};function rht(t){var r=t.graph().acyclicer==="greedy"?eht(t,n(t)):nht(t);w3.forEach(r,function(c){var s=t.edge(c);t.removeEdge(c),s.forwardName=c.name,s.reversed=true,t.setEdge(c.w,c.v,s,w3.uniqueId("rev"));});function n(c){return function(s){return c.edge(s).weight}}}function nht(t){var r=[],n={},c={};function s(e){w3.has(c,e)||(c[e]=true,n[e]=true,w3.forEach(t.outEdges(e),function(i){w3.has(n,i.w)?r.push(i):s(i.w);}),delete n[e]);}return w3.forEach(t.nodes(),s),r}function iht(t){w3.forEach(t.edges(),function(r){var n=t.edge(r);if(n.reversed){t.removeEdge(r);var c=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(r.w,r.v,n,c);}});}});var Of=Te((j8t,vk)=>{var za=yl(),mk=o1().Graph;vk.exports={addDummyNode:gk,simplify:sht,asNonCompoundGraph:oht,successorWeights:aht,predecessorWeights:uht,intersectRect:lht,buildLayerMatrix:cht,normalizeRanks:hht,removeEmptyRanks:fht,addBorderNode:dht,maxRank:yk,partition:pht,time:xht,notime:mht};function gk(t,r,n,c){var s;do s=za.uniqueId(c);while(t.hasNode(s));return n.dummy=r,t.setNode(s,n),s}function sht(t){var r=new mk().setGraph(t.graph());return za.forEach(t.nodes(),function(n){r.setNode(n,t.node(n));}),za.forEach(t.edges(),function(n){var c=r.edge(n.v,n.w)||{weight:0,minlen:1},s=t.edge(n);r.setEdge(n.v,n.w,{weight:c.weight+s.weight,minlen:Math.max(c.minlen,s.minlen)});}),r}function oht(t){var r=new mk({multigraph:t.isMultigraph()}).setGraph(t.graph());return za.forEach(t.nodes(),function(n){t.children(n).length||r.setNode(n,t.node(n));}),za.forEach(t.edges(),function(n){r.setEdge(n,t.edge(n));}),r}function aht(t){var r=za.map(t.nodes(),function(n){var c={};return za.forEach(t.outEdges(n),function(s){c[s.w]=(c[s.w]||0)+t.edge(s).weight;}),c});return za.zipObject(t.nodes(),r)}function uht(t){var r=za.map(t.nodes(),function(n){var c={};return za.forEach(t.inEdges(n),function(s){c[s.v]=(c[s.v]||0)+t.edge(s).weight;}),c});return za.zipObject(t.nodes(),r)}function lht(t,r){var n=t.x,c=t.y,s=r.x-n,e=r.y-c,i=t.width/2,o=t.height/2;if(!s&&!e)throw new Error("Not possible to find intersection inside of the rectangle");var p,E;return Math.abs(e)*i>Math.abs(s)*o?(e<0&&(o=-o),p=o*s/e,E=o):(s<0&&(i=-i),p=i,E=i*e/s),{x:n+p,y:c+E}}function cht(t){var r=za.map(za.range(yk(t)+1),function(){return []});return za.forEach(t.nodes(),function(n){var c=t.node(n),s=c.rank;za.isUndefined(s)||(r[s][c.order]=n);}),r}function hht(t){var r=za.min(za.map(t.nodes(),function(n){return t.node(n).rank}));za.forEach(t.nodes(),function(n){var c=t.node(n);za.has(c,"rank")&&(c.rank-=r);});}function fht(t){var r=za.min(za.map(t.nodes(),function(e){return t.node(e).rank})),n=[];za.forEach(t.nodes(),function(e){var i=t.node(e).rank-r;n[i]||(n[i]=[]),n[i].push(e);});var c=0,s=t.graph().nodeRankFactor;za.forEach(n,function(e,i){za.isUndefined(e)&&i%s!==0?--c:c&&za.forEach(e,function(o){t.node(o).rank+=c;});});}function dht(t,r,n,c){var s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=c),gk(t,"border",s,r)}function yk(t){return za.max(za.map(t.nodes(),function(r){var n=t.node(r).rank;if(!za.isUndefined(n))return n}))}function pht(t,r){var n={lhs:[],rhs:[]};return za.forEach(t,function(c){r(c)?n.lhs.push(c):n.rhs.push(c);}),n}function xht(t,r){var n=za.now();try{return r()}finally{console.log(t+" time: "+(za.now()-n)+"ms");}}function mht(t,r){return r()}});var Tk=Te((U8t,_k)=>{var Ek=yl(),ght=Of();_k.exports={run:yht,undo:Eht};function yht(t){t.graph().dummyChains=[],Ek.forEach(t.edges(),function(r){vht(t,r);});}function vht(t,r){var n=r.v,c=t.node(n).rank,s=r.w,e=t.node(s).rank,i=r.name,o=t.edge(r),p=o.labelRank;if(e!==c+1){t.removeEdge(r);var E,b,y;for(y=0,++c;c<e;++y,++c)o.points=[],b={width:0,height:0,edgeLabel:o,edgeObj:r,rank:c},E=ght.addDummyNode(t,"edge",b,"_d"),c===p&&(b.width=o.width,b.height=o.height,b.dummy="edge-label",b.labelpos=o.labelpos),t.setEdge(n,E,{weight:o.weight},i),y===0&&t.graph().dummyChains.push(E),n=E;t.setEdge(n,s,{weight:o.weight},i);}}function Eht(t){Ek.forEach(t.graph().dummyChains,function(r){var n=t.node(r),c=n.edgeLabel,s;for(t.setEdge(n.edgeObj,c);n.dummy;)s=t.successors(r)[0],t.removeNode(r),c.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(c.x=n.x,c.y=n.y,c.width=n.width,c.height=n.height),r=s,n=t.node(r);});}});var Cv=Te((K8t,bk)=>{var k4=yl();bk.exports={longestPath:_ht,slack:Tht};function _ht(t){var r={};function n(c){var s=t.node(c);if(k4.has(r,c))return s.rank;r[c]=true;var e=k4.min(k4.map(t.outEdges(c),function(i){return n(i.w)-t.edge(i).minlen}));return (e===Number.POSITIVE_INFINITY||e===void 0||e===null)&&(e=0),s.rank=e}k4.forEach(t.sources(),n);}function Tht(t,r){return t.node(r.w).rank-t.node(r.v).rank-t.edge(r).minlen}});var Vb=Te(($8t,Ak)=>{var F4=yl(),bht=o1().Graph,B4=Cv().slack;Ak.exports=Aht;function Aht(t){var r=new bht({directed:false}),n=t.nodes()[0],c=t.nodeCount();r.setNode(n,{});for(var s,e;Oht(r,t)<c;)s=Sht(r,t),e=r.hasNode(s.v)?B4(t,s):-B4(t,s),Cht(r,t,e);return r}function Oht(t,r){function n(c){F4.forEach(r.nodeEdges(c),function(s){var e=s.v,i=c===e?s.w:e;!t.hasNode(i)&&!B4(r,s)&&(t.setNode(i,{}),t.setEdge(c,i,{}),n(i));});}return F4.forEach(t.nodes(),n),t.nodeCount()}function Sht(t,r){return F4.minBy(r.edges(),function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return B4(r,n)})}function Cht(t,r,n){F4.forEach(t.nodes(),function(c){r.node(c).rank+=n;});}});var Dk=Te((H8t,Ik)=>{var Vp=yl(),Nht=Vb(),Rht=Cv().slack,wht=Cv().longestPath,Iht=o1().alg.preorder,Dht=o1().alg.postorder,Lht=Of().simplify;Ik.exports=I3;I3.initLowLimValues=Wb;I3.initCutValues=Yb;I3.calcCutValue=Sk;I3.leaveEdge=Nk;I3.enterEdge=Rk;I3.exchangeEdges=wk;function I3(t){t=Lht(t),wht(t);var r=Nht(t);Wb(r),Yb(r,t);for(var n,c;n=Nk(r);)c=Rk(r,t,n),wk(r,t,n,c);}function Yb(t,r){var n=Dht(t,t.nodes());n=n.slice(0,n.length-1),Vp.forEach(n,function(c){Pht(t,r,c);});}function Pht(t,r,n){var c=t.node(n),s=c.parent;t.edge(n,s).cutvalue=Sk(t,r,n);}function Sk(t,r,n){var c=t.node(n),s=c.parent,e=true,i=r.edge(n,s),o=0;return i||(e=false,i=r.edge(s,n)),o=i.weight,Vp.forEach(r.nodeEdges(n),function(p){var E=p.v===n,b=E?p.w:p.v;if(b!==s){var y=E===e,m=r.edge(p).weight;if(o+=y?m:-m,kht(t,n,b)){var a=t.edge(n,b).cutvalue;o+=y?-a:a;}}}),o}function Wb(t,r){arguments.length<2&&(r=t.nodes()[0]),Ck(t,{},1,r);}function Ck(t,r,n,c,s){var e=n,i=t.node(c);return r[c]=true,Vp.forEach(t.neighbors(c),function(o){Vp.has(r,o)||(n=Ck(t,r,n,o,c));}),i.low=e,i.lim=n++,s?i.parent=s:delete i.parent,n}function Nk(t){return Vp.find(t.edges(),function(r){return t.edge(r).cutvalue<0})}function Rk(t,r,n){var c=n.v,s=n.w;r.hasEdge(c,s)||(c=n.w,s=n.v);var e=t.node(c),i=t.node(s),o=e,p=false;e.lim>i.lim&&(o=i,p=true);var E=Vp.filter(r.edges(),function(b){return p===Ok(t,t.node(b.v),o)&&p!==Ok(t,t.node(b.w),o)});return Vp.minBy(E,function(b){return Rht(r,b)})}function wk(t,r,n,c){var s=n.v,e=n.w;t.removeEdge(s,e),t.setEdge(c.v,c.w,{}),Wb(t),Yb(t,r),Mht(t,r);}function Mht(t,r){var n=Vp.find(t.nodes(),function(s){return !r.node(s).parent}),c=Iht(t,n);c=c.slice(1),Vp.forEach(c,function(s){var e=t.node(s).parent,i=r.edge(s,e),o=false;i||(i=r.edge(e,s),o=true),r.node(s).rank=r.node(e).rank+(o?i.minlen:-i.minlen);});}function kht(t,r,n){return t.hasEdge(r,n)}function Ok(t,r,n){return n.low<=r.lim&&r.lim<=n.lim}});var kk=Te((G8t,Mk)=>{var Fht=Cv(),Pk=Fht.longestPath,Bht=Vb(),jht=Dk();Mk.exports=Uht;function Uht(t){switch(t.graph().ranker){case "network-simplex":Lk(t);break;case "tight-tree":$ht(t);break;case "longest-path":Kht(t);break;default:Lk(t);}}var Kht=Pk;function $ht(t){Pk(t),Bht(t);}function Lk(t){jht(t);}});var Bk=Te((q8t,Fk)=>{var Xb=yl();Fk.exports=Hht;function Hht(t){var r=qht(t);Xb.forEach(t.graph().dummyChains,function(n){for(var c=t.node(n),s=c.edgeObj,e=Ght(t,r,s.v,s.w),i=e.path,o=e.lca,p=0,E=i[p],b=true;n!==s.w;){if(c=t.node(n),b){for(;(E=i[p])!==o&&t.node(E).maxRank<c.rank;)p++;E===o&&(b=false);}if(!b){for(;p<i.length-1&&t.node(E=i[p+1]).minRank<=c.rank;)p++;E=i[p];}t.setParent(n,E),n=t.successors(n)[0];}});}function Ght(t,r,n,c){var s=[],e=[],i=Math.min(r[n].low,r[c].low),o=Math.max(r[n].lim,r[c].lim),p,E;p=n;do p=t.parent(p),s.push(p);while(p&&(r[p].low>i||o>r[p].lim));for(E=p,p=c;(p=t.parent(p))!==E;)e.push(p);return {path:s.concat(e.reverse()),lca:E}}function qht(t){var r={},n=0;function c(s){var e=n;Xb.forEach(t.children(s),c),r[s]={low:e,lim:n++};}return Xb.forEach(t.children(),c),r}});var Kk=Te((z8t,Uk)=>{var Yp=yl(),Qb=Of();Uk.exports={run:zht,cleanup:Wht};function zht(t){var r=Qb.addDummyNode(t,"root",{},"_root"),n=Vht(t),c=Yp.max(Yp.values(n))-1,s=2*c+1;t.graph().nestingRoot=r,Yp.forEach(t.edges(),function(i){t.edge(i).minlen*=s;});var e=Yht(t)+1;Yp.forEach(t.children(),function(i){jk(t,r,s,e,c,n,i);}),t.graph().nodeRankFactor=s;}function jk(t,r,n,c,s,e,i){var o=t.children(i);if(!o.length){i!==r&&t.setEdge(r,i,{weight:0,minlen:n});return}var p=Qb.addBorderNode(t,"_bt"),E=Qb.addBorderNode(t,"_bb"),b=t.node(i);t.setParent(p,i),b.borderTop=p,t.setParent(E,i),b.borderBottom=E,Yp.forEach(o,function(y){jk(t,r,n,c,s,e,y);var m=t.node(y),a=m.borderTop?m.borderTop:y,l=m.borderBottom?m.borderBottom:y,u=m.borderTop?c:2*c,h=a!==l?1:s-e[i]+1;t.setEdge(p,a,{weight:u,minlen:h,nestingEdge:true}),t.setEdge(l,E,{weight:u,minlen:h,nestingEdge:true});}),t.parent(i)||t.setEdge(r,p,{weight:0,minlen:s+e[i]});}function Vht(t){var r={};function n(c,s){var e=t.children(c);e&&e.length&&Yp.forEach(e,function(i){n(i,s+1);}),r[c]=s;}return Yp.forEach(t.children(),function(c){n(c,1);}),r}function Yht(t){return Yp.reduce(t.edges(),function(r,n){return r+t.edge(n).weight},0)}function Wht(t){var r=t.graph();t.removeNode(r.nestingRoot),delete r.nestingRoot,Yp.forEach(t.edges(),function(n){var c=t.edge(n);c.nestingEdge&&t.removeEdge(n);});}});var Gk=Te((V8t,Hk)=>{var Jb=yl(),Xht=Of();Hk.exports=Qht;function Qht(t){function r(n){var c=t.children(n),s=t.node(n);if(c.length&&Jb.forEach(c,r),Jb.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var e=s.minRank,i=s.maxRank+1;e<i;++e)$k(t,"borderLeft","_bl",n,s,e),$k(t,"borderRight","_br",n,s,e);}}Jb.forEach(t.children(),r);}function $k(t,r,n,c,s,e){var i={width:0,height:0,rank:e,borderType:r},o=s[r][e-1],p=Xht.addDummyNode(t,"border",i,n);s[r][e]=p,t.setParent(p,c),o&&t.setEdge(o,p,{weight:1});}});var Yk=Te((Y8t,Vk)=>{var fp=yl();Vk.exports={adjust:Jht,undo:Zht};function Jht(t){var r=t.graph().rankdir.toLowerCase();(r==="lr"||r==="rl")&&zk(t);}function Zht(t){var r=t.graph().rankdir.toLowerCase();(r==="bt"||r==="rl")&&t0t(t),(r==="lr"||r==="rl")&&(e0t(t),zk(t));}function zk(t){fp.forEach(t.nodes(),function(r){qk(t.node(r));}),fp.forEach(t.edges(),function(r){qk(t.edge(r));});}function qk(t){var r=t.width;t.width=t.height,t.height=r;}function t0t(t){fp.forEach(t.nodes(),function(r){Zb(t.node(r));}),fp.forEach(t.edges(),function(r){var n=t.edge(r);fp.forEach(n.points,Zb),fp.has(n,"y")&&Zb(n);});}function Zb(t){t.y=-t.y;}function e0t(t){fp.forEach(t.nodes(),function(r){t6(t.node(r));}),fp.forEach(t.edges(),function(r){var n=t.edge(r);fp.forEach(n.points,t6),fp.has(n,"x")&&t6(n);});}function t6(t){var r=t.x;t.x=t.y,t.y=r;}});var Xk=Te((W8t,Wk)=>{var Wp=yl();Wk.exports=r0t;function r0t(t){var r={},n=Wp.filter(t.nodes(),function(o){return !t.children(o).length}),c=Wp.max(Wp.map(n,function(o){return t.node(o).rank})),s=Wp.map(Wp.range(c+1),function(){return []});function e(o){if(!Wp.has(r,o)){r[o]=true;var p=t.node(o);s[p.rank].push(o),Wp.forEach(t.successors(o),e);}}var i=Wp.sortBy(n,function(o){return t.node(o).rank});return Wp.forEach(i,e),s}});var Jk=Te((X8t,Qk)=>{var ux=yl();Qk.exports=n0t;function n0t(t,r){for(var n=0,c=1;c<r.length;++c)n+=i0t(t,r[c-1],r[c]);return n}function i0t(t,r,n){for(var c=ux.zipObject(n,ux.map(n,function(E,b){return b})),s=ux.flatten(ux.map(r,function(E){return ux.sortBy(ux.map(t.outEdges(E),function(b){return {pos:c[b.w],weight:t.edge(b).weight}}),"pos")}),true),e=1;e<n.length;)e<<=1;var i=2*e-1;e-=1;var o=ux.map(new Array(i),function(){return 0}),p=0;return ux.forEach(s.forEach(function(E){var b=E.pos+e;o[b]+=E.weight;for(var y=0;b>0;)b%2&&(y+=o[b+1]),b=b-1>>1,o[b]+=E.weight;p+=E.weight*y;})),p}});var eF=Te((Q8t,tF)=>{var Zk=yl();tF.exports=s0t;function s0t(t,r){return Zk.map(r,function(n){var c=t.inEdges(n);if(c.length){var s=Zk.reduce(c,function(e,i){var o=t.edge(i),p=t.node(i.v);return {sum:e.sum+o.weight*p.order,weight:e.weight+o.weight}},{sum:0,weight:0});return {v:n,barycenter:s.sum/s.weight,weight:s.weight}}else return {v:n}})}});var nF=Te((J8t,rF)=>{var Pd=yl();rF.exports=o0t;function o0t(t,r){var n={};Pd.forEach(t,function(s,e){var i=n[s.v]={indegree:0,in:[],out:[],vs:[s.v],i:e};Pd.isUndefined(s.barycenter)||(i.barycenter=s.barycenter,i.weight=s.weight);}),Pd.forEach(r.edges(),function(s){var e=n[s.v],i=n[s.w];!Pd.isUndefined(e)&&!Pd.isUndefined(i)&&(i.indegree++,e.out.push(n[s.w]));});var c=Pd.filter(n,function(s){return !s.indegree});return a0t(c)}function a0t(t){var r=[];function n(e){return function(i){i.merged||(Pd.isUndefined(i.barycenter)||Pd.isUndefined(e.barycenter)||i.barycenter>=e.barycenter)&&u0t(e,i);}}function c(e){return function(i){i.in.push(e),--i.indegree===0&&t.push(i);}}for(;t.length;){var s=t.pop();r.push(s),Pd.forEach(s.in.reverse(),n(s)),Pd.forEach(s.out,c(s));}return Pd.map(Pd.filter(r,function(e){return !e.merged}),function(e){return Pd.pick(e,["vs","i","barycenter","weight"])})}function u0t(t,r){var n=0,c=0;t.weight&&(n+=t.barycenter*t.weight,c+=t.weight),r.weight&&(n+=r.barycenter*r.weight,c+=r.weight),t.vs=r.vs.concat(t.vs),t.barycenter=n/c,t.weight=c,t.i=Math.min(r.i,t.i),r.merged=true;}});var oF=Te((Z8t,sF)=>{var Nv=yl(),l0t=Of();sF.exports=c0t;function c0t(t,r){var n=l0t.partition(t,function(b){return Nv.has(b,"barycenter")}),c=n.lhs,s=Nv.sortBy(n.rhs,function(b){return -b.i}),e=[],i=0,o=0,p=0;c.sort(h0t(!!r)),p=iF(e,s,p),Nv.forEach(c,function(b){p+=b.vs.length,e.push(b.vs),i+=b.barycenter*b.weight,o+=b.weight,p=iF(e,s,p);});var E={vs:Nv.flatten(e,true)};return o&&(E.barycenter=i/o,E.weight=o),E}function iF(t,r,n){for(var c;r.length&&(c=Nv.last(r)).i<=n;)r.pop(),t.push(c.vs),n++;return n}function h0t(t){return function(r,n){return r.barycenter<n.barycenter?-1:r.barycenter>n.barycenter?1:t?n.i-r.i:r.i-n.i}}});var lF=Te((tAt,uF)=>{var lx=yl(),f0t=eF(),d0t=nF(),p0t=oF();uF.exports=aF;function aF(t,r,n,c){var s=t.children(r),e=t.node(r),i=e?e.borderLeft:void 0,o=e?e.borderRight:void 0,p={};i&&(s=lx.filter(s,function(l){return l!==i&&l!==o}));var E=f0t(t,s);lx.forEach(E,function(l){if(t.children(l.v).length){var u=aF(t,l.v,n,c);p[l.v]=u,lx.has(u,"barycenter")&&m0t(l,u);}});var b=d0t(E,n);x0t(b,p);var y=p0t(b,c);if(i&&(y.vs=lx.flatten([i,y.vs,o],true),t.predecessors(i).length)){var m=t.node(t.predecessors(i)[0]),a=t.node(t.predecessors(o)[0]);lx.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+a.order)/(y.weight+2),y.weight+=2;}return y}function x0t(t,r){lx.forEach(t,function(n){n.vs=lx.flatten(n.vs.map(function(c){return r[c]?r[c].vs:c}),true);});}function m0t(t,r){lx.isUndefined(t.barycenter)?(t.barycenter=r.barycenter,t.weight=r.weight):(t.barycenter=(t.barycenter*t.weight+r.barycenter*r.weight)/(t.weight+r.weight),t.weight+=r.weight);}});var hF=Te((eAt,cF)=>{var Rv=yl(),g0t=o1().Graph;cF.exports=y0t;function y0t(t,r,n){var c=v0t(t),s=new g0t({compound:true}).setGraph({root:c}).setDefaultNodeLabel(function(e){return t.node(e)});return Rv.forEach(t.nodes(),function(e){var i=t.node(e),o=t.parent(e);(i.rank===r||i.minRank<=r&&r<=i.maxRank)&&(s.setNode(e),s.setParent(e,o||c),Rv.forEach(t[n](e),function(p){var E=p.v===e?p.w:p.v,b=s.edge(E,e),y=Rv.isUndefined(b)?0:b.weight;s.setEdge(E,e,{weight:t.edge(p).weight+y});}),Rv.has(i,"minRank")&&s.setNode(e,{borderLeft:i.borderLeft[r],borderRight:i.borderRight[r]}));}),s}function v0t(t){for(var r;t.hasNode(r=Rv.uniqueId("_root")););return r}});var dF=Te((rAt,fF)=>{var E0t=yl();fF.exports=_0t;function _0t(t,r,n){var c={},s;E0t.forEach(n,function(e){for(var i=t.parent(e),o,p;i;){if(o=t.parent(i),o?(p=c[o],c[o]=i):(p=s,s=i),p&&p!==i){r.setEdge(p,i);return}i=o;}});}});var yF=Te((nAt,gF)=>{var cx=yl(),T0t=Xk(),b0t=Jk(),A0t=lF(),O0t=hF(),S0t=dF(),C0t=o1().Graph,pF=Of();gF.exports=N0t;function N0t(t){var r=pF.maxRank(t),n=xF(t,cx.range(1,r+1),"inEdges"),c=xF(t,cx.range(r-1,-1,-1),"outEdges"),s=T0t(t);mF(t,s);for(var e=Number.POSITIVE_INFINITY,i,o=0,p=0;p<4;++o,++p){R0t(o%2?n:c,o%4>=2),s=pF.buildLayerMatrix(t);var E=b0t(t,s);E<e&&(p=0,i=cx.cloneDeep(s),e=E);}mF(t,i);}function xF(t,r,n){return cx.map(r,function(c){return O0t(t,c,n)})}function R0t(t,r){var n=new C0t;cx.forEach(t,function(c){var s=c.graph().root,e=A0t(c,s,n,r);cx.forEach(e.vs,function(i,o){c.node(i).order=o;}),S0t(c,n,e.vs);});}function mF(t,r){cx.forEach(r,function(n){cx.forEach(n,function(c,s){t.node(c).order=s;});});}});var NF=Te((iAt,CF)=>{var co=yl(),w0t=o1().Graph,I0t=Of();CF.exports={positionX:P0t,findType1Conflicts:vF,findType2Conflicts:EF,addConflict:e6,hasConflict:_F,verticalAlignment:TF,horizontalCompaction:bF,alignCoordinates:OF,findSmallestWidthAlignment:AF,balance:SF};function vF(t,r){var n={};function c(s,e){var i=0,o=0,p=s.length,E=co.last(e);return co.forEach(e,function(b,y){var m=D0t(t,b),a=m?t.node(m).order:p;(m||b===E)&&(co.forEach(e.slice(o,y+1),function(l){co.forEach(t.predecessors(l),function(u){var h=t.node(u),d=h.order;(d<i||a<d)&&!(h.dummy&&t.node(l).dummy)&&e6(n,u,l);});}),o=y+1,i=a);}),e}return co.reduce(r,c),n}function EF(t,r){var n={};function c(e,i,o,p,E){var b;co.forEach(co.range(i,o),function(y){b=e[y],t.node(b).dummy&&co.forEach(t.predecessors(b),function(m){var a=t.node(m);a.dummy&&(a.order<p||a.order>E)&&e6(n,m,b);});});}function s(e,i){var o=-1,p,E=0;return co.forEach(i,function(b,y){if(t.node(b).dummy==="border"){var m=t.predecessors(b);m.length&&(p=t.node(m[0]).order,c(i,E,y,o,p),E=y,o=p);}c(i,E,i.length,p,e.length);}),i}return co.reduce(r,s),n}function D0t(t,r){if(t.node(r).dummy)return co.find(t.predecessors(r),function(n){return t.node(n).dummy})}function e6(t,r,n){if(r>n){var c=r;r=n,n=c;}var s=t[r];s||(t[r]=s={}),s[n]=true;}function _F(t,r,n){if(r>n){var c=r;r=n,n=c;}return co.has(t[r],n)}function TF(t,r,n,c){var s={},e={},i={};return co.forEach(r,function(o){co.forEach(o,function(p,E){s[p]=p,e[p]=p,i[p]=E;});}),co.forEach(r,function(o){var p=-1;co.forEach(o,function(E){var b=c(E);if(b.length){b=co.sortBy(b,function(u){return i[u]});for(var y=(b.length-1)/2,m=Math.floor(y),a=Math.ceil(y);m<=a;++m){var l=b[m];e[E]===E&&p<i[l]&&!_F(n,E,l)&&(e[l]=E,e[E]=s[E]=s[l],p=i[l]);}}});}),{root:s,align:e}}function bF(t,r,n,c,s){var e={},i=L0t(t,r,n,s),o=s?"borderLeft":"borderRight";function p(y,m){for(var a=i.nodes(),l=a.pop(),u={};l;)u[l]?y(l):(u[l]=true,a.push(l),a=a.concat(m(l))),l=a.pop();}function E(y){e[y]=i.inEdges(y).reduce(function(m,a){return Math.max(m,e[a.v]+i.edge(a))},0);}function b(y){var m=i.outEdges(y).reduce(function(l,u){return Math.min(l,e[u.w]-i.edge(u))},Number.POSITIVE_INFINITY),a=t.node(y);m!==Number.POSITIVE_INFINITY&&a.borderType!==o&&(e[y]=Math.max(e[y],m));}return p(E,i.predecessors.bind(i)),p(b,i.successors.bind(i)),co.forEach(c,function(y){e[y]=e[n[y]];}),e}function L0t(t,r,n,c){var s=new w0t,e=t.graph(),i=M0t(e.nodesep,e.edgesep,c);return co.forEach(r,function(o){var p;co.forEach(o,function(E){var b=n[E];if(s.setNode(b),p){var y=n[p],m=s.edge(y,b);s.setEdge(y,b,Math.max(i(t,E,p),m||0));}p=E;});}),s}function AF(t,r){return co.minBy(co.values(r),function(n){var c=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY;return co.forIn(n,function(e,i){var o=k0t(t,i)/2;c=Math.max(e+o,c),s=Math.min(e-o,s);}),c-s})}function OF(t,r){var n=co.values(r),c=co.min(n),s=co.max(n);co.forEach(["u","d"],function(e){co.forEach(["l","r"],function(i){var o=e+i,p=t[o],E;if(p!==r){var b=co.values(p);E=i==="l"?c-co.min(b):s-co.max(b),E&&(t[o]=co.mapValues(p,function(y){return y+E}));}});});}function SF(t,r){return co.mapValues(t.ul,function(n,c){if(r)return t[r.toLowerCase()][c];var s=co.sortBy(co.map(t,c));return (s[1]+s[2])/2})}function P0t(t){var r=I0t.buildLayerMatrix(t),n=co.merge(vF(t,r),EF(t,r)),c={},s;co.forEach(["u","d"],function(i){s=i==="u"?r:co.values(r).reverse(),co.forEach(["l","r"],function(o){o==="r"&&(s=co.map(s,function(y){return co.values(y).reverse()}));var p=(i==="u"?t.predecessors:t.successors).bind(t),E=TF(t,s,n,p),b=bF(t,s,E.root,E.align,o==="r");o==="r"&&(b=co.mapValues(b,function(y){return -y})),c[i+o]=b;});});var e=AF(t,c);return OF(c,e),SF(c,t.graph().align)}function M0t(t,r,n){return function(c,s,e){var i=c.node(s),o=c.node(e),p=0,E;if(p+=i.width/2,co.has(i,"labelpos"))switch(i.labelpos.toLowerCase()){case "l":E=-i.width/2;break;case "r":E=i.width/2;break}if(E&&(p+=n?E:-E),E=0,p+=(i.dummy?r:t)/2,p+=(o.dummy?r:t)/2,p+=o.width/2,co.has(o,"labelpos"))switch(o.labelpos.toLowerCase()){case "l":E=o.width/2;break;case "r":E=-o.width/2;break}return E&&(p+=n?E:-E),E=0,p}}function k0t(t,r){return t.node(r).width}});var IF=Te((sAt,wF)=>{var wv=yl(),RF=Of(),F0t=NF().positionX;wF.exports=B0t;function B0t(t){t=RF.asNonCompoundGraph(t),j0t(t),wv.forEach(F0t(t),function(r,n){t.node(n).x=r;});}function j0t(t){var r=RF.buildLayerMatrix(t),n=t.graph().ranksep,c=0;wv.forEach(r,function(s){var e=wv.max(wv.map(s,function(i){return t.node(i).height}));wv.forEach(s,function(i){t.node(i).y=c+e/2;}),c+=e+n;});}});var FF=Te((oAt,kF)=>{var Uo=yl(),DF=xk(),LF=Tk(),U0t=kk(),K0t=Of().normalizeRanks,$0t=Bk(),H0t=Of().removeEmptyRanks,PF=Kk(),G0t=Gk(),MF=Yk(),q0t=yF(),z0t=IF(),hx=Of(),V0t=o1().Graph;kF.exports=Y0t;function Y0t(t,r){var n=r&&r.debugTiming?hx.time:hx.notime;n("layout",function(){var c=n(" buildLayoutGraph",function(){return sft(t)});n(" runLayout",function(){W0t(c,n);}),n(" updateInputGraph",function(){X0t(t,c);});});}function W0t(t,r){r(" makeSpaceForEdgeLabels",function(){oft(t);}),r(" removeSelfEdges",function(){xft(t);}),r(" acyclic",function(){DF.run(t);}),r(" nestingGraph.run",function(){PF.run(t);}),r(" rank",function(){U0t(hx.asNonCompoundGraph(t));}),r(" injectEdgeLabelProxies",function(){aft(t);}),r(" removeEmptyRanks",function(){H0t(t);}),r(" nestingGraph.cleanup",function(){PF.cleanup(t);}),r(" normalizeRanks",function(){K0t(t);}),r(" assignRankMinMax",function(){uft(t);}),r(" removeEdgeLabelProxies",function(){lft(t);}),r(" normalize.run",function(){LF.run(t);}),r(" parentDummyChains",function(){$0t(t);}),r(" addBorderSegments",function(){G0t(t);}),r(" order",function(){q0t(t);}),r(" insertSelfEdges",function(){mft(t);}),r(" adjustCoordinateSystem",function(){MF.adjust(t);}),r(" position",function(){z0t(t);}),r(" positionSelfEdges",function(){gft(t);}),r(" removeBorderNodes",function(){pft(t);}),r(" normalize.undo",function(){LF.undo(t);}),r(" fixupEdgeLabelCoords",function(){fft(t);}),r(" undoCoordinateSystem",function(){MF.undo(t);}),r(" translateGraph",function(){cft(t);}),r(" assignNodeIntersects",function(){hft(t);}),r(" reversePoints",function(){dft(t);}),r(" acyclic.undo",function(){DF.undo(t);});}function X0t(t,r){Uo.forEach(t.nodes(),function(n){var c=t.node(n),s=r.node(n);c&&(c.x=s.x,c.y=s.y,r.children(n).length&&(c.width=s.width,c.height=s.height));}),Uo.forEach(t.edges(),function(n){var c=t.edge(n),s=r.edge(n);c.points=s.points,Uo.has(s,"x")&&(c.x=s.x,c.y=s.y);}),t.graph().width=r.graph().width,t.graph().height=r.graph().height;}var Q0t=["nodesep","edgesep","ranksep","marginx","marginy"],J0t={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Z0t=["acyclicer","ranker","rankdir","align"],tft=["width","height"],eft={width:0,height:0},rft=["minlen","weight","width","height","labeloffset"],nft={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},ift=["labelpos"];function sft(t){var r=new V0t({multigraph:true,compound:true}),n=n6(t.graph());return r.setGraph(Uo.merge({},J0t,r6(n,Q0t),Uo.pick(n,Z0t))),Uo.forEach(t.nodes(),function(c){var s=n6(t.node(c));r.setNode(c,Uo.defaults(r6(s,tft),eft)),r.setParent(c,t.parent(c));}),Uo.forEach(t.edges(),function(c){var s=n6(t.edge(c));r.setEdge(c,Uo.merge({},nft,r6(s,rft),Uo.pick(s,ift)));}),r}function oft(t){var r=t.graph();r.ranksep/=2,Uo.forEach(t.edges(),function(n){var c=t.edge(n);c.minlen*=2,c.labelpos.toLowerCase()!=="c"&&(r.rankdir==="TB"||r.rankdir==="BT"?c.width+=c.labeloffset:c.height+=c.labeloffset);});}function aft(t){Uo.forEach(t.edges(),function(r){var n=t.edge(r);if(n.width&&n.height){var c=t.node(r.v),s=t.node(r.w),e={rank:(s.rank-c.rank)/2+c.rank,e:r};hx.addDummyNode(t,"edge-proxy",e,"_ep");}});}function uft(t){var r=0;Uo.forEach(t.nodes(),function(n){var c=t.node(n);c.borderTop&&(c.minRank=t.node(c.borderTop).rank,c.maxRank=t.node(c.borderBottom).rank,r=Uo.max(r,c.maxRank));}),t.graph().maxRank=r;}function lft(t){Uo.forEach(t.nodes(),function(r){var n=t.node(r);n.dummy==="edge-proxy"&&(t.edge(n.e).labelRank=n.rank,t.removeNode(r));});}function cft(t){var r=Number.POSITIVE_INFINITY,n=0,c=Number.POSITIVE_INFINITY,s=0,e=t.graph(),i=e.marginx||0,o=e.marginy||0;function p(E){var b=E.x,y=E.y,m=E.width,a=E.height;r=Math.min(r,b-m/2),n=Math.max(n,b+m/2),c=Math.min(c,y-a/2),s=Math.max(s,y+a/2);}Uo.forEach(t.nodes(),function(E){p(t.node(E));}),Uo.forEach(t.edges(),function(E){var b=t.edge(E);Uo.has(b,"x")&&p(b);}),r-=i,c-=o,Uo.forEach(t.nodes(),function(E){var b=t.node(E);b.x-=r,b.y-=c;}),Uo.forEach(t.edges(),function(E){var b=t.edge(E);Uo.forEach(b.points,function(y){y.x-=r,y.y-=c;}),Uo.has(b,"x")&&(b.x-=r),Uo.has(b,"y")&&(b.y-=c);}),e.width=n-r+i,e.height=s-c+o;}function hft(t){Uo.forEach(t.edges(),function(r){var n=t.edge(r),c=t.node(r.v),s=t.node(r.w),e,i;n.points?(e=n.points[0],i=n.points[n.points.length-1]):(n.points=[],e=s,i=c),n.points.unshift(hx.intersectRect(c,e)),n.points.push(hx.intersectRect(s,i));});}function fft(t){Uo.forEach(t.edges(),function(r){var n=t.edge(r);if(Uo.has(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case "l":n.x-=n.width/2+n.labeloffset;break;case "r":n.x+=n.width/2+n.labeloffset;break}});}function dft(t){Uo.forEach(t.edges(),function(r){var n=t.edge(r);n.reversed&&n.points.reverse();});}function pft(t){Uo.forEach(t.nodes(),function(r){if(t.children(r).length){var n=t.node(r),c=t.node(n.borderTop),s=t.node(n.borderBottom),e=t.node(Uo.last(n.borderLeft)),i=t.node(Uo.last(n.borderRight));n.width=Math.abs(i.x-e.x),n.height=Math.abs(s.y-c.y),n.x=e.x+n.width/2,n.y=c.y+n.height/2;}}),Uo.forEach(t.nodes(),function(r){t.node(r).dummy==="border"&&t.removeNode(r);});}function xft(t){Uo.forEach(t.edges(),function(r){if(r.v===r.w){var n=t.node(r.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:r,label:t.edge(r)}),t.removeEdge(r);}});}function mft(t){var r=hx.buildLayerMatrix(t);Uo.forEach(r,function(n){var c=0;Uo.forEach(n,function(s,e){var i=t.node(s);i.order=e+c,Uo.forEach(i.selfEdges,function(o){hx.addDummyNode(t,"selfedge",{width:o.label.width,height:o.label.height,rank:i.rank,order:e+ ++c,e:o.e,label:o.label},"_se");}),delete i.selfEdges;});});}function gft(t){Uo.forEach(t.nodes(),function(r){var n=t.node(r);if(n.dummy==="selfedge"){var c=t.node(n.e.v),s=c.x+c.width/2,e=c.y,i=n.x-s,o=c.height/2;t.setEdge(n.e,n.label),t.removeNode(r),n.label.points=[{x:s+2*i/3,y:e-o},{x:s+5*i/6,y:e-o},{x:s+i,y:e},{x:s+5*i/6,y:e+o},{x:s+2*i/3,y:e+o}],n.label.x=n.x,n.label.y=n.y;}});}function r6(t,r){return Uo.mapValues(Uo.pick(t,r),Number)}function n6(t){var r={};return Uo.forEach(t,function(n,c){r[c.toLowerCase()]=n;}),r}});var jF=Te((aAt,BF)=>{var j4=yl(),yft=Of(),vft=o1().Graph;BF.exports={debugOrdering:Eft};function Eft(t){var r=yft.buildLayerMatrix(t),n=new vft({compound:true,multigraph:true}).setGraph({});return j4.forEach(t.nodes(),function(c){n.setNode(c,{label:c}),n.setParent(c,"layer"+t.node(c).rank);}),j4.forEach(t.edges(),function(c){n.setEdge(c.v,c.w,{},c.name);}),j4.forEach(r,function(c,s){var e="layer"+s;n.setNode(e,{rank:"same"}),j4.reduce(c,function(i,o){return n.setEdge(i,o,{style:"invis"}),o});}),n}});var KF=Te((uAt,UF)=>{UF.exports="0.8.5";});var HF=Te((lAt,$F)=>{$F.exports={graphlib:o1(),layout:FF(),debug:jF(),util:{time:Of().time,notime:Of().notime},version:KF()};});var U4,GF,qF,i6;exports.WebColaTranslator=void 0;var s6=Cn(()=>{Wm();U4=Di(HF()),GF=8,qF=20,i6=class{constructor(r,n=800,c=800,s){if(this.FIG_HEIGHT=n,this.FIG_WIDTH=c,this.DEFAULT_X=c/2,this.DEFAULT_Y=n/2,this.instanceLayout=r,this.priorPositionMap=new Map,s?.priorPositions?.positions)for(let p of s.priorPositions.positions)this.priorPositionMap.set(p.id,p);try{let p=new U4.graphlib.Graph({multigraph:!0});p.setGraph({nodesep:50,ranksep:100,rankdir:"TB"}),p.setDefaultEdgeLabel(()=>({})),r.nodes.forEach(E=>{p.setNode(E.id,{width:E.width,height:E.height});}),r.edges.forEach(E=>{p.setEdge(E.source.id,E.target.id);}),U4.layout(p),this.dagre_graph=p;}catch(p){console.log(p),this.dagre_graph=null;}this.colaNodes=r.nodes.map(p=>this.toColaNode(p)),this.colaEdges=r.edges.map(p=>this.toColaEdge(p)),this.colaEdges=this.collapseSymmetricEdges(this.colaEdges);let e=this.collapseIdenticalGroups(r.groups);this.groupDefinitions=this.determineGroups(e),this.conflictingConstraints=r.conflictingConstraints||[],this.overlappingNodesData=r.overlappingNodes||[],this.colaConstraints=r.constraints.map(p=>this.toColaConstraint(p)),this.colaConstraints.length>100&&(this.colaConstraints=this.optimizeConstraints(this.colaConstraints)),this.colaConstraints.length===0&&this.dagre_graph&&this.colaNodes.forEach(p=>p.fixed=1);}optimizeConstraints(r){let n=[],c=[],s=[];for(let o of r)if(o.type==="separation"){let p=o;p.axis==="x"&&!p.equality?n.push(p):p.axis==="y"&&!p.equality?c.push(p):s.push(o);}else s.push(o);let e=this.transitiveReductionForSeparation(n),i=this.transitiveReductionForSeparation(c);return [...e,...i,...s]}transitiveReductionForSeparation(r){if(r.length===0)return r;let n=this.colaNodes.length,c=Array(n).fill(null).map(()=>Array(n).fill(null));for(let i of r){let o=i.left,p=i.right;typeof o=="number"&&typeof p=="number"&&o>=0&&o<n&&p>=0&&p<n&&Number.isInteger(o)&&Number.isInteger(p)&&(c[o][p]=i);}let s=Array(n).fill(false).map(()=>Array(n).fill(false));for(let i=0;i<n;i++)for(let o=0;o<n;o++)s[i][o]=c[i][o]!==null;for(let i=0;i<n;i++)for(let o=0;o<n;o++)for(let p=0;p<n;p++)s[o][i]&&s[i][p]&&(s[o][p]=true);let e=[];for(let i of r){let o=i.left,p=i.right,E=false;for(let b=0;b<n;b++)if(b!==o&&b!==p&&c[o][b]!==null&&c[b][p]!==null){E=true;break}E||e.push(i);}return e}getNodeIndex(r){return this.colaNodes.findIndex(n=>n.id===r)}computeHorizontalSeparation(r,n,c){let s=r.visualWidth??r.width??100,e=n.visualWidth??n.width??100,i=s/2+e/2+c,o=Math.max(s,e),p=Math.min(o*.1,20);return i+p}computeVerticalSeparation(r,n,c){let s=r.visualHeight??r.height??60,e=n.visualHeight??n.height??60,i=s/2+e/2+c,o=Math.max(s,e),p=Math.min(o*.1,15);return i+p}leftConstraint(r,n,c){return {type:"separation",axis:"x",left:r,right:n,gap:c}}topConstraint(r,n,c){return {type:"separation",axis:"y",left:r,right:n,gap:c}}heirarchyConstraint(r,n,c){return {type:"hierarchy",parent:r,child:n,gap:c}}toColaNode(r){let n=this.DEFAULT_X,c=this.DEFAULT_Y,s=0,e=this.priorPositionMap.get(r.id);if(e)n=e.x,c=e.y;else if(this.priorPositionMap.size>0){if(console.log(`Node ${r.id}: No prior position found (available: ${Array.from(this.priorPositionMap.keys()).join(", ")})`),this.dagre_graph){let i=this.dagre_graph.node(r.id);i&&(n=i.x,c=i.y);}}else if(this.dagre_graph){let i=this.dagre_graph.node(r.id);i&&(n=i.x,c=i.y);}return {id:r.id,color:r.color,attributes:r.attributes||{},labels:r.labels,width:r.width+2*(r.disconnected?qF:GF),height:r.height+2*(r.disconnected?qF:GF),visualWidth:r.width,visualHeight:r.height,x:n,y:c,icon:r.icon||"",fixed:s,mostSpecificType:r.mostSpecificType,showLabels:r.showLabels,label:r.label}}toColaEdge(r){let n=this.getNodeIndex(r.source.id),c=this.getNodeIndex(r.target.id);return {source:n,target:c,relName:r.relationName,id:r.id,label:r.label,color:r.color,style:r.style,weight:r.weight,showLabel:r.showLabel,groupId:r.groupId,keyNodeId:r.keyNodeId}}collapseSymmetricEdges(r){let n=new Map,c=new Set;for(let s of r){if(c.has(s.id))continue;let e=Math.min(s.source,s.target),i=Math.max(s.source,s.target),o=`${e}-${i}-${s.label}`,p=r.find(E=>E.source===s.target&&E.target===s.source&&E.label===s.label&&!c.has(E.id));if(p){let E=s.source<s.target?s:p;n.set(o,{...E,bidirectional:true}),c.add(s.id),c.add(p.id);}else n.set(s.id,s),c.add(s.id);}return Array.from(n.values())}toColaConstraint(r){if(Kh(r)){let n=this.colaNodes[this.getNodeIndex(r.left.id)],c=this.colaNodes[this.getNodeIndex(r.right.id)];n.fixed=0,c.fixed=0;let s=this.computeHorizontalSeparation(n,c,r.minDistance);return this.leftConstraint(this.getNodeIndex(r.left.id),this.getNodeIndex(r.right.id),s)}if(Uh(r)){let n=this.colaNodes[this.getNodeIndex(r.top.id)],c=this.colaNodes[this.getNodeIndex(r.bottom.id)];n.fixed=0,c.fixed=0;let s=this.computeVerticalSeparation(n,c,r.minDistance);return this.topConstraint(this.getNodeIndex(r.top.id),this.getNodeIndex(r.bottom.id),s)}if(W0(r)){let n={type:"separation",axis:r.axis,left:this.getNodeIndex(r.node1.id),right:this.getNodeIndex(r.node2.id),gap:0,equality:true},c=this.colaNodes[this.getNodeIndex(r.node1.id)],s=this.colaNodes[this.getNodeIndex(r.node2.id)];return c.fixed=0,s.fixed=0,n}if(mh(r))return console.log("BoundingBoxConstraint detected."),{type:"noop"};if(w1(r))return console.log("GroupBoundaryConstraint detected."),{type:"noop"};throw new Error("Constraint type not recognized")}collapseIdenticalGroups(r){if(r.length===0)return r;let n=new Map;for(let e of r){let i=[...e.nodeIds].sort().join(",");n.has(i)||n.set(i,[]),n.get(i).push(e);}let c=[],s=0;for(let[e,i]of n)if(i.length===1)c.push(i[0]);else {s+=i.length-1;let o={...i[0],name:i.map(p=>p.name).join(" / "),showLabel:i.some(p=>p.showLabel)};c.push(o);}return c}determineGroups(r){let n={};r.forEach(s=>{n[s.name]=s.nodeIds;});let c=this.determineGroupsAndSubgroups(n);return c.forEach(s=>{let e=r.find(p=>p.name===s.name),i=e.keyNodeId,o=this.getNodeIndex(i);s.keyNode=o,s.id=e.name,s.showLabel=e.showLabel;}),c}isSubGroup(r,n){return r.every(c=>n.includes(c))}determineGroupsAndSubgroups(r){let n={};Object.entries(r).forEach(([e,i])=>{Object.entries(r).forEach(([o,p])=>{e!==o&&(!n[o]||!n[o].includes(e))&&this.isSubGroup(p,i)&&(n[e]?n[e].push(o):n[e]=[o]);});});let c=Object.entries(r).map(([e,i])=>({leaves:i.map(b=>this.getNodeIndex(b)),padding:10,name:e}));return Object.entries(c).map(([e,i])=>{let o=i.leaves,p=i.padding,E=i.name;if(!n[E])return {leaves:o,padding:p,name:E,groups:[]};let b=n[E].map(y=>c.findIndex(a=>a.name===y));return b.forEach(y=>{let m=c[y];o=o.filter(a=>!m.leaves.includes(a));}),{leaves:o,padding:p,name:E,groups:b}})}get nodes(){return this.colaNodes}get links(){return this.colaEdges}get constraints(){return this.colaConstraints}get groups(){return this.groupDefinitions}get conflictingNodes(){let r=[];return this.conflictingConstraints.forEach(n=>{Kh(n)?(r.push(n.left),r.push(n.right)):Uh(n)?(r.push(n.top),r.push(n.bottom)):W0(n)&&(r.push(n.node1),r.push(n.node2));}),r}get overlappingNodes(){return this.overlappingNodesData}get overlappingGroups(){if(this.overlappingNodesData.length===0)return [];let r=new Set;return this.groupDefinitions.forEach(n=>{n.leaves.some(s=>this.overlappingNodesData.some(e=>e.id===s.id))&&r.add(n);}),Array.from(r)}dispose(){this.dagre_graph&&(this.dagre_graph=null);}getMemoryStats(){return {nodeCount:this.colaNodes?.length||0,edgeCount:this.colaEdges?.length||0,groupCount:this.groupDefinitions?.length||0,constraintCount:this.colaConstraints?.length||0,hasDagreGraph:!!this.dagre_graph}}},exports.WebColaTranslator=class{async translate(r,n=800,c=800,s){return new i6(r,c,n,s)}};});var VF={};Qx(VF,{WebColaCnDGraph:()=>fx});function _ft(t,r){function n(e){return e&&typeof e=="object"&&"getBBox"in e}let c=n(t)?t.getBBox():{x:0,y:0,width:0,height:0},s=n(r)?r.getBBox():{x:0,y:0,width:0,height:0};return !(s.x>c.x+c.width||s.x+s.width<c.x||s.y>c.y+c.height||s.y+s.height<c.y)}var Co,Md,zF,qi,fx,K4=Cn(()=>{s6();Wm();Co=window.d3v4||window.d3,Md=window.cola;zF=5,qi=class qi extends HTMLElement{constructor(n=false){super();this.edgeRouteIdx=0;this.edgeRoutingCache={edgesBetweenNodes:new Map,alignmentEdges:new Set};this.isGridifyingInProgress=false;this.userHasManuallyZoomed=false;this.isInitialRender=true;this.dragStartPositions=new Map;this.isInputModeActive=false;this.inputModeEnabled=true;this.inputModeListenersAttached=false;this.handleInputModeKeydown=n=>{(n.metaKey||n.ctrlKey)&&!this.isInputModeActive&&this.activateInputMode();};this.handleInputModeKeyup=n=>{!n.metaKey&&!n.ctrlKey&&this.isInputModeActive&&this.deactivateInputMode();};this.handleInputModeBlur=()=>{this.isInputModeActive&&this.deactivateInputMode();};this.edgeCreationState={isCreating:false,sourceNode:null,temporaryEdge:null};this.edgeDragState={isDragging:false,edge:null,endpoint:null,dragMarker:null};this.textMeasurementCanvas=null;this.attachShadow({mode:"open"}),this.initializeDOM(),this.initializeD3(),this.lineFunction=Co.line().x(c=>c.x).y(c=>c.y).curve(Co.curveBasis),this.gridLineFunction=Co.line().x(c=>c.x).y(c=>c.y).curve(Co.curveLinear),this.inputModeEnabled=n,this.initializeInputModeHandlers();}get layoutFormat(){return this.getAttribute("layoutFormat")}get isUnsatCore(){return this.hasAttribute("unsat")}isAlignmentEdge(n){return this.edgeRoutingCache.alignmentEdges.size>0?this.edgeRoutingCache.alignmentEdges.has(n.id):n.id.startsWith("_alignment_")}isHiddenNode(n){let c=n.name||n.id;return c?c.startsWith("_"):false}isErrorNode(n){let c=this.currentLayout.conflictingNodes,s=this.currentLayout.overlappingNodes;if(c.length>0&&s.length>0){let i=c.map(p=>p.id),o=s.map(p=>p.id);throw new Error(`Layout cannot have both conflictingConstraints (${i}) and overlappingNodes ${o}`)}return [...c,...s].some(i=>i.id===n.id)}isSmallNode(n){let s=1;if(this.svg&&this.svg.node())try{s=Co.zoomTransform(this.svg.node()).k;}catch{s=1;}let e=(n.visualWidth??n.width??0)*s,i=(n.visualHeight??n.height??0)*s;return e<30||i<30}updateSmallNodeClasses(){this.container&&this.container.selectAll(".error-node").each((n,c,s)=>{let e=Co.select(s[c]);this.isSmallNode(n)?e.classed("small-error-node")||e.classed("small-error-node",true):e.classed("small-error-node")&&e.classed("small-error-node",false);});}getCurrentZoomScale(){if(this.svg&&this.svg.node())try{return Co.zoomTransform(this.svg.node()).k}catch{return 1}return 1}isErrorGroup(n){let c=this.currentLayout.overlappingGroups;if(!c)throw console.error("Overlapping groups data not available in current layout"),new Error("Overlapping groups data not available in current layout");return c.some(s=>s.name===n.name)}isInferredEdge(n){return n.id?n.id.includes("_inferred_"):false}isDisconnectedGroup(n){return n.name.startsWith(qi.DISCONNECTED_NODE_PREFIX)}computeAdaptiveLinkLength(n,c,s){if(!n||n.length===0)return 150;let e=0,i=0,o=0;if(n.forEach(_=>{_&&!this.isHiddenNode(_)&&(e+=_.visualWidth??_.width??100,i+=_.visualHeight??_.height??60,o++);}),o===0)return 150;let p=e/o,E=i/o,b=Math.max(p,E),y=0;s&&s.length>0&&s.forEach(S=>{if(S&&S.label){let v=this.measureTextWidth(S.label,12,"system-ui");y=Math.max(y,v);}});let m=15,a=50,l=y+m+20,u=Math.max(b+a+l,120),h=Math.max(.7,1-Math.log10(o)*.1);u*=h;let d=c/5,g=u/d;return Math.max(60,Math.min(g,350))}getScaledDetails(n,c=zF,s,e,i){let o=c/5,p=this.calculateAdaptiveGroupCompactness(e||[],s?.length||0,o),E;s&&s.length>0?E=this.computeAdaptiveLinkLength(s,c,i):E=250/o;function b(y){return y.map(m=>{if(m.type==="separation"&&typeof m.gap=="number"){let l=m.gap/o;return {...m,gap:l}}return m})}return {scaledConstraints:b(n),linkLength:E,groupCompactness:p}}calculateAdaptiveGroupCompactness(n,c,s){let e=qi.DEFAULT_GROUP_COMPACTNESS*s;if(!n||n.length===0)return e;let i=this.calculateMaxGroupDepth(n),o=n.length/Math.max(c,1),p=e;return i>2?p*=10:i>1&&(p*=5),o>.3&&(p*=2),p}getViewportBoundsInLayoutSpace(n){let c=this.shadowRoot?.querySelector("#svg-container"),s=c?.clientWidth||qi.DEFAULT_SVG_WIDTH,e=c?.clientHeight||qi.DEFAULT_SVG_HEIGHT;if(s<=0||e<=0)return;let i=n.k;if(!Number.isFinite(i)||i===0)return;let o=Number.isFinite(n.x)?n.x:0,p=Number.isFinite(n.y)?n.y:0;return {minX:(0-o)/i,maxX:(s-o)/i,minY:(0-p)/i,maxY:(e-p)/i}}calculateMaxGroupDepth(n){if(!n||n.length===0)return 0;let c=1;for(let s of n)if(s.groups&&Array.isArray(s.groups)&&s.groups.length>0){let e=s.groups.filter(i=>typeof i=="number"&&i>=0&&i<n.length).map(i=>n[i]).filter(i=>i!=null);if(e.length>0){let i=1+this.calculateMaxGroupDepth(e);c=Math.max(c,i);}}return c}initializeDOM(){let n=this.getBoundingClientRect(),c=n.width||800,s=n.height||600;this.shadowRoot.innerHTML=`
|
|
811
|
+
adding to group index <pre>${this.addToGroup}</pre>${r}.`}},e4=class extends tg{constructor(r,n){super(n),this.direction=r;}inconsistencyMessage(){return `Cyclic constraint with direction [${this.direction}] with selector <code>${this.selector}</code> is inconsistent.`}toHTML(){return `Cyclic constraint with direction [${this.direction}] and selector <code>${this.selector}</code>`}};});function GT(t){if(typeof t!="string")return;let r=t.trim().toLowerCase();if(r==="solid"||r==="dashed"||r==="dotted")return r}var $I=Cn(()=>{});function VT(t){if(!t)return "";if(t.startsWith("http")||t.startsWith("data:")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../"))return t;let r=t.indexOf(":");if(r>0){let c=t.substring(0,r),s=t.substring(r+1),e=zT[c];if(e)return e(s)}let n=qT[t];return n||t}function Est(){return Object.keys(qT)}function _st(){return Object.keys(zT)}function Tst(t){return t in qT}function bst(t){let r=t.indexOf(":");return r<=0?false:t.substring(0,r)in zT}var qT,zT,YT=Cn(()=>{qT={person:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z"/></svg>')}`,"person-fill":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/></svg>')}`,people:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M15 14s1 0 1-1-1-4-5-4-5 3-5 4 1 1 1 1zm-7.978-1L7 12.996c.001-.264.167-1.03.76-1.72C8.312 10.629 9.282 10 11 10c1.717 0 2.687.63 3.24 1.276.593.69.758 1.457.76 1.72l-.008.002-.014.002zM11 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4m3-2a3 3 0 1 1-6 0 3 3 0 0 1 6 0M6.936 9.28a6 6 0 0 0-1.23-.247A7 7 0 0 0 5 9c-4 0-5 3-5 4q0 1 1 1h4.216A2.24 2.24 0 0 1 5 13c0-1.01.377-2.042 1.09-2.904.243-.294.526-.569.846-.816M4.92 10A5.5 5.5 0 0 0 4 13H1c0-.26.164-1.03.76-1.724.545-.636 1.492-1.256 3.16-1.275ZM1.5 5.5a3 3 0 1 1 6 0 3 3 0 0 1-6 0m3-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4"/></svg>')}`,home:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5z"/></svg>')}`,house:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5z"/></svg>')}`,building:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M4 2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5zM4 5.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zM7.5 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5zm2.5.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zM4.5 8a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5zm2.5.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5z"/><path d="M2 1a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1zm11 0H3v14h3v-2.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5V15h3z"/></svg>')}`,star:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M2.866 14.85c-.078.444.36.791.746.593l4.39-2.256 4.389 2.256c.386.198.824-.149.746-.592l-.83-4.73 3.522-3.356c.33-.314.16-.888-.282-.95l-4.898-.696L8.465.792a.513.513 0 0 0-.927 0L5.354 5.12l-4.898.696c-.441.062-.612.636-.283.95l3.523 3.356-.83 4.73zm4.905-2.767-3.686 1.894.694-3.957a.56.56 0 0 0-.163-.505L1.71 6.745l4.052-.576a.53.53 0 0 0 .393-.288L8 2.223l1.847 3.658a.53.53 0 0 0 .393.288l4.052.575-2.906 2.77a.56.56 0 0 0-.163.506l.694 3.957-3.686-1.894a.5.5 0 0 0-.461 0z"/></svg>')}`,"star-fill":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/></svg>')}`,heart:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143q.09.083.176.171a3 3 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15"/></svg>')}`,"heart-fill":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314"/></svg>')}`,circle:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><circle cx="8" cy="8" r="8"/></svg>')}`,square:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><rect width="16" height="16"/></svg>')}`,triangle:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M7.022 1.566a1.13 1.13 0 0 1 1.96 0l6.857 11.667c.457.778-.092 1.767-.98 1.767H1.144c-.889 0-1.437-.99-.98-1.767z"/></svg>')}`,"tic-x":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="2" y1="2" x2="14" y2="14"/><line x1="14" y1="2" x2="2" y2="14"/></svg>')}`,"tic-o":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><circle cx="8" cy="8" r="6"/></svg>')}`,"arrow-right":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8"/></svg>')}`,"arrow-left":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/></svg>')}`,"arrow-up":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5"/></svg>')}`,"arrow-down":`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1"/></svg>')}`,check:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z"/></svg>')}`,x:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/></svg>')}`,plus:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/></svg>')}`,minus:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8"/></svg>')}`,warning:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.15.15 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.2.2 0 0 1-.054.06.1.1 0 0 1-.066.017H1.146a.1.1 0 0 1-.066-.017.2.2 0 0 1-.054-.06.18.18 0 0 1 .002-.183L7.884 2.073a.15.15 0 0 1 .054-.057m1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767z"/><path d="M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/></svg>')}`,info:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/></svg>')}`,gear:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"/><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"/></svg>')}`,database:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M4.318 2.687C5.234 2.271 6.536 2 8 2s2.766.27 3.682.687C12.644 3.125 13 3.627 13 4c0 .374-.356.875-1.318 1.313C10.766 5.729 9.464 6 8 6s-2.766-.27-3.682-.687C3.356 4.875 3 4.373 3 4c0-.374.356-.875 1.318-1.313M13 5.698V7c0 .374-.356.875-1.318 1.313C10.766 8.729 9.464 9 8 9s-2.766-.27-3.682-.687C3.356 7.875 3 7.373 3 7V5.698c.271.202.58.378.904.525C4.978 6.711 6.427 7 8 7s3.022-.289 4.096-.777A5 5 0 0 0 13 5.698M14 4c0-1.007-.875-1.755-1.904-2.223C11.022 1.289 9.573 1 8 1s-3.022.289-4.096.777C2.875 2.245 2 2.993 2 4v9c0 1.007.875 1.755 1.904 2.223C4.978 15.71 6.427 16 8 16s3.022-.289 4.096-.777C13.125 14.755 14 14.007 14 13zm-1 4.698V10c0 .374-.356.875-1.318 1.313C10.766 11.729 9.464 12 8 12s-2.766-.27-3.682-.687C3.356 10.875 3 10.373 3 10V8.698c.271.202.58.378.904.525C4.978 9.71 6.427 10 8 10s3.022-.289 4.096-.777A5 5 0 0 0 13 8.698m0 3V13c0 .374-.356.875-1.318 1.313C10.766 14.729 9.464 15 8 15s-2.766-.27-3.682-.687C3.356 13.875 3 13.373 3 13v-1.302c.271.202.58.378.904.525C4.978 12.71 6.427 13 8 13s3.022-.289 4.096-.777c.324-.147.633-.323.904-.525"/></svg>')}`,folder:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3H14.5A1.5 1.5 0 0 1 16 4.5v1.384l-.195-.131a1 1 0 0 0-.163-.084l-.022-.01-.053-.021A.5.5 0 0 0 15.5 5H.5a.5.5 0 0 0-.5.5v.01c.053-.01.108-.017.164-.022L.162 5.5zm-.11 2.13H15.57a.5.5 0 0 1 .49.6l-1.037 5.184A1.5 1.5 0 0 1 13.549 13H2.451a1.5 1.5 0 0 1-1.474-1.22L-.06 6.6a.5.5 0 0 1 .49-.6"/></svg>')}`,file:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm0 1h8a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1"/></svg>')}`,tree:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8.416.223a.5.5 0 0 0-.832 0l-3 4.5A.5.5 0 0 0 5 5.5h.098L3.076 8.735A.5.5 0 0 0 3.5 9.5h.191l-1.638 3.276a.5.5 0 0 0 .447.724H7V16h2v-2.5h4.5a.5.5 0 0 0 .447-.724L12.31 9.5h.191a.5.5 0 0 0 .424-.765L10.902 5.5H11a.5.5 0 0 0 .416-.777z"/></svg>')}`,flower:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 1a4 4 0 0 0-4 4v.2A4.5 4.5 0 0 0 5.52 14h4.96A4.5 4.5 0 0 0 12 5.2V5a4 4 0 0 0-4-4"/></svg>')}`,car:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M2.52 3.515A2.5 2.5 0 0 1 4.82 2h6.36a2.5 2.5 0 0 1 2.3 1.515l1.34 3.147a.5.5 0 0 1-.068.51A.5.5 0 0 1 14.5 7H14v3a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-.5H5V10a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7h-.5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .034-.18zM4 8.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1m8 0a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1M4.82 3a1.5 1.5 0 0 0-1.38.91L2.46 6h11.08l-.98-2.09A1.5 1.5 0 0 0 11.18 3z"/></svg>')}`,envelope:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1zm13 2.383-4.708 2.825L15 11.105zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741M1 11.105l4.708-2.897L1 5.383z"/></svg>')}`,phone:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M3.654 1.328a.678.678 0 0 0-1.015-.063L1.605 2.3c-.483.484-.661 1.169-.45 1.77a17.6 17.6 0 0 0 4.168 6.608 17.6 17.6 0 0 0 6.608 4.168c.601.211 1.286.033 1.77-.45l1.034-1.034a.678.678 0 0 0-.063-1.015l-2.307-1.794a.68.68 0 0 0-.58-.122l-2.19.547a1.75 1.75 0 0 1-1.657-.459L5.482 8.062a1.75 1.75 0 0 1-.46-1.657l.548-2.19a.68.68 0 0 0-.122-.58zM1.884.511a1.745 1.745 0 0 1 2.612.163L6.29 2.98c.329.423.445.974.315 1.494l-.547 2.19a.68.68 0 0 0 .178.643l2.457 2.457a.68.68 0 0 0 .644.178l2.189-.547a1.75 1.75 0 0 1 1.494.315l2.306 1.794c.829.645.905 1.87.163 2.611l-1.034 1.034c-.74.74-1.846 1.065-2.877.702a18.6 18.6 0 0 1-7.01-4.42 18.6 18.6 0 0 1-4.42-7.009c-.362-1.03-.037-2.137.703-2.877z"/></svg>')}`,flag:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M14.778.085A.5.5 0 0 1 15 .5V8a.5.5 0 0 1-.314.464L14.5 8l.186.464-.003.001-.006.003-.023.009a12 12 0 0 1-.397.15c-.264.095-.631.223-1.047.35-.816.252-1.879.523-2.71.523-.847 0-1.548-.28-2.158-.525l-.028-.01C7.68 8.71 7.14 8.5 6.5 8.5c-.7 0-1.638.23-2.437.477A20 20 0 0 0 3 9.342V15.5a.5.5 0 0 1-1 0V.5a.5.5 0 0 1 1 0v.282c.226-.079.496-.17.79-.26C4.606.272 5.67 0 6.5 0c.84 0 1.524.277 2.121.519l.043.018C9.286.788 9.828 1 10.5 1c.7 0 1.638-.23 2.437-.477a20 20 0 0 0 1.349-.476l.019-.007.004-.002h.001"/></svg>')}`,lock:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2m3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2M5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1"/></svg>')}`,key:`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8a4 4 0 0 1 7.465-2H14a.5.5 0 0 1 .354.146l1.5 1.5a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0L13 9.207l-.646.647a.5.5 0 0 1-.708 0L11 9.207l-.646.647a.5.5 0 0 1-.708 0L9 9.207l-.646.647A.5.5 0 0 1 8 10h-.535A4 4 0 0 1 0 8m4-3a3 3 0 1 0 2.712 4.285A.5.5 0 0 1 7.163 9h.63l.853-.854a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.793-.793-1-1h-6.63a.5.5 0 0 1-.451-.285A3 3 0 0 0 4 5m-1.5 3a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0"/></svg>')}`},zT={bi:t=>`https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/icons/${t}.svg`,fa:t=>`https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/svgs/solid/${t}.svg`,"fa-solid":t=>`https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/svgs/solid/${t}.svg`,"fa-regular":t=>`https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/svgs/regular/${t}.svg`,"fa-brands":t=>`https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/svgs/brands/${t}.svg`,lucide:t=>`https://cdn.jsdelivr.net/npm/lucide-static@0.300.0/icons/${t}.svg`,heroicons:t=>`https://cdn.jsdelivr.net/npm/heroicons@2.1.1/24/outline/${t}.svg`,"heroicons-solid":t=>`https://cdn.jsdelivr.net/npm/heroicons@2.1.1/24/solid/${t}.svg`,tabler:t=>`https://cdn.jsdelivr.net/npm/@tabler/icons@2.44.0/icons/${t}.svg`,simple:t=>`https://cdn.jsdelivr.net/npm/simple-icons@10.4.0/icons/${t}.svg`};});var Ast,Ost,e1,r4=Cn(()=>{(({min:Ast,max:Ost}=Math)),e1=(t,r=0,n=1)=>Ast(Ost(r,t),n);});var S3,HI=Cn(()=>{r4();S3=t=>{t._clipped=false,t._unclipped=t.slice(0);for(let r=0;r<=3;r++)r<3?((t[r]<0||t[r]>255)&&(t._clipped=true),t[r]=e1(t[r],0,255)):r===3&&(t[r]=e1(t[r],0,1));return t};});function Zi(t){return GI[Object.prototype.toString.call(t)]||"object"}var GI,fv=Cn(()=>{GI={};for(let t of ["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])GI[`[object ${t}]`]=t.toLowerCase();});var Li,qI=Cn(()=>{fv();Li=(t,r=null)=>t.length>=3?Array.prototype.slice.call(t):Zi(t[0])=="object"&&r?r.split("").filter(n=>t[0][n]!==void 0).map(n=>t[0][n]):t[0].slice(0);});var Dd,zI=Cn(()=>{fv();Dd=t=>{if(t.length<2)return null;let r=t.length-1;return Zi(t[r])=="string"?t[r].toLowerCase():null};});function a4(t){return [...t.slice(0,3).reverse(),...t.slice(3)]}var n4,i4,s4,x0,dv,r1,o4,VI,YI,As=Cn(()=>{HI();r4();fv();qI();zI();(({PI:n4,min:i4,max:s4}=Math)),x0=t=>Math.round(t*100)/100,dv=t=>Math.round(t*100)/100,r1=n4*2,o4=n4/3,VI=n4/180,YI=180/n4;});var rs,Yc=Cn(()=>{rs={format:{},autodetect:[]};});var WT,dn,lo=Cn(()=>{As();Yc();WT=class{constructor(...r){let n=this;if(Zi(r[0])==="object"&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];let c=Dd(r),s=false;if(!c){s=true,rs.sorted||(rs.autodetect=rs.autodetect.sort((e,i)=>i.p-e.p),rs.sorted=true);for(let e of rs.autodetect)if(c=e.test(...r),c)break}if(rs.format[c]){let e=rs.format[c].apply(null,s?r:r.slice(0,-1));n._rgb=S3(e);}else throw new Error("unknown format: "+r);n._rgb.length===3&&n._rgb.push(1);}toString(){return Zi(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}},dn=WT;});var WI,XI=Cn(()=>{WI="3.2.0";});var QI,Os,Cc=Cn(()=>{lo();XI();QI=(...t)=>new dn(...t);QI.version=WI;Os=QI;});var Sst,Z2,XT=Cn(()=>{Sst={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},Z2=Sst;});var Cst,Nst,Rst,u4,QT=Cn(()=>{Cst=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Nst=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Rst=t=>{if(t.match(Cst)){(t.length===4||t.length===7)&&(t=t.substr(1)),t.length===3&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let r=parseInt(t,16),n=r>>16,c=r>>8&255,s=r&255;return [n,c,s,1]}if(t.match(Nst)){(t.length===5||t.length===9)&&(t=t.substr(1)),t.length===4&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);let r=parseInt(t,16),n=r>>24&255,c=r>>16&255,s=r>>8&255,e=Math.round((r&255)/255*100)/100;return [n,c,s,e]}throw new Error(`unknown hex color: ${t}`)},u4=Rst;});var l4,wst,c4,JT=Cn(()=>{As();(({round:l4}=Math)),wst=(...t)=>{let[r,n,c,s]=Li(t,"rgba"),e=Dd(t)||"auto";s===void 0&&(s=1),e==="auto"&&(e=s<1?"rgba":"rgb"),r=l4(r),n=l4(n),c=l4(c);let o="000000"+(r<<16|n<<8|c).toString(16);o=o.substr(o.length-6);let p="0"+l4(s*255).toString(16);switch(p=p.substr(p.length-2),e.toLowerCase()){case "rgba":return `#${o}${p}`;case "argb":return `#${p}${o}`;default:return `#${o}`}},c4=wst;});var JI=Cn(()=>{lo();Yc();As();XT();QT();JT();dn.prototype.name=function(){let t=c4(this._rgb,"rgb");for(let r of Object.keys(Z2))if(Z2[r]===t)return r.toLowerCase();return t};rs.format.named=t=>{if(t=t.toLowerCase(),Z2[t])return u4(Z2[t]);throw new Error("unknown color name: "+t)};rs.autodetect.push({p:5,test:(t,...r)=>{if(!r.length&&Zi(t)==="string"&&Z2[t.toLowerCase()])return "named"}});});var ZI=Cn(()=>{lo();As();dn.prototype.alpha=function(t,r=false){return t!==void 0&&Zi(t)==="number"?r?(this._rgb[3]=t,this):new dn([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]};});var tD=Cn(()=>{lo();dn.prototype.clipped=function(){return this._rgb._clipped||false};});function n1(t){let r=Ist.get(String(t).toLowerCase());if(!r)throw new Error("unknown Lab illuminant "+t);pv.labWhitePoint=t,pv.Xn=r[0],pv.Zn=r[1];}function tx(){return pv.labWhitePoint}var pv,cp,Ist,ex=Cn(()=>{pv={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:.008856451679035631,kKE:8,kK:903.2962962962963,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-0.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-0.2040259135167538,m20:-0.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-0.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-0.0685,m20:-0.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-0.008528664575177328,m10:-0.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},cp=pv,Ist=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);});var Dst,Lst,ZT,tb,eg,xv=Cn(()=>{ex();As();Dst=(...t)=>{t=Li(t,"lab");let[r,n,c]=t,[s,e,i]=Lst(r,n,c),[o,p,E]=tb(s,e,i);return [o,p,E,t.length>3?t[3]:1]},Lst=(t,r,n)=>{let{kE:c,kK:s,kKE:e,Xn:i,Yn:o,Zn:p}=cp,E=(t+16)/116,b=.002*r+E,y=E-.005*n,m=b*b*b,a=y*y*y,l=m>c?m:(116*b-16)/s,u=t>e?Math.pow((t+16)/116,3):t/s,h=a>c?a:(116*y-16)/s,d=l*i,g=u*o,_=h*p;return [d,g,_]},ZT=t=>{let r=Math.sign(t);return t=Math.abs(t),(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*r},tb=(t,r,n)=>{let{MtxAdaptMa:c,MtxAdaptMaI:s,MtxXYZ2RGB:e,RefWhiteRGB:i,Xn:o,Yn:p,Zn:E}=cp,b=o*c.m00+p*c.m10+E*c.m20,y=o*c.m01+p*c.m11+E*c.m21,m=o*c.m02+p*c.m12+E*c.m22,a=i.X*c.m00+i.Y*c.m10+i.Z*c.m20,l=i.X*c.m01+i.Y*c.m11+i.Z*c.m21,u=i.X*c.m02+i.Y*c.m12+i.Z*c.m22,h=(t*c.m00+r*c.m10+n*c.m20)*(a/b),d=(t*c.m01+r*c.m11+n*c.m21)*(l/y),g=(t*c.m02+r*c.m12+n*c.m22)*(u/m),_=h*s.m00+d*s.m10+g*s.m20,S=h*s.m01+d*s.m11+g*s.m21,v=h*s.m02+d*s.m12+g*s.m22,T=ZT(_*e.m00+S*e.m10+v*e.m20),q=ZT(_*e.m01+S*e.m11+v*e.m21),G=ZT(_*e.m02+S*e.m12+v*e.m22);return [T*255,q*255,G*255]},eg=Dst;});function Mst(t,r,n){let{Xn:c,Yn:s,Zn:e,kE:i,kK:o}=cp,p=t/c,E=r/s,b=n/e,y=p>i?Math.pow(p,1/3):(o*p+16)/116,m=E>i?Math.pow(E,1/3):(o*E+16)/116,a=b>i?Math.pow(b,1/3):(o*b+16)/116;return [116*m-16,500*(y-m),200*(m-a)]}function eb(t){let r=Math.sign(t);return t=Math.abs(t),(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*r}var Pst,rb,rg,mv=Cn(()=>{ex();As();Pst=(...t)=>{let[r,n,c,...s]=Li(t,"rgb"),[e,i,o]=rb(r,n,c),[p,E,b]=Mst(e,i,o);return [p,E,b,...s.length>0&&s[0]<1?[s[0]]:[]]};rb=(t,r,n)=>{t=eb(t/255),r=eb(r/255),n=eb(n/255);let{MtxRGB2XYZ:c,MtxAdaptMa:s,MtxAdaptMaI:e,Xn:i,Yn:o,Zn:p,As:E,Bs:b,Cs:y}=cp,m=t*c.m00+r*c.m10+n*c.m20,a=t*c.m01+r*c.m11+n*c.m21,l=t*c.m02+r*c.m12+n*c.m22,u=i*s.m00+o*s.m10+p*s.m20,h=i*s.m01+o*s.m11+p*s.m21,d=i*s.m02+o*s.m12+p*s.m22,g=m*s.m00+a*s.m10+l*s.m20,_=m*s.m01+a*s.m11+l*s.m21,S=m*s.m02+a*s.m12+l*s.m22;return g*=u/E,_*=h/b,S*=d/y,m=g*e.m00+_*e.m10+S*e.m20,a=g*e.m01+_*e.m11+S*e.m21,l=g*e.m02+_*e.m12+S*e.m22,[m,a,l]},rg=Pst;});var kst,ng=Cn(()=>{As();Cc();lo();Yc();xv();mv();ex();dn.prototype.lab=function(){return rg(this._rgb)};kst=(...t)=>new dn(...t,"lab");Object.assign(Os,{lab:kst,getLabWhitePoint:tx,setLabWhitePoint:n1});rs.format.lab=eg;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"lab"),Zi(t)==="array"&&t.length===3)return "lab"}});});var eD=Cn(()=>{ng();lo();ex();dn.prototype.darken=function(t=1){let r=this,n=r.lab();return n[0]-=cp.Kn*t,new dn(n,"lab").alpha(r.alpha(),true)};dn.prototype.brighten=function(t=1){return this.darken(-t)};dn.prototype.darker=dn.prototype.darken;dn.prototype.brighter=dn.prototype.brighten;});var rD=Cn(()=>{lo();dn.prototype.get=function(t){let[r,n]=t.split("."),c=this[r]();if(n){let s=r.indexOf(n)-(r.substr(0,2)==="ok"?2:0);if(s>-1)return c[s];throw new Error(`unknown channel ${n} in mode ${r}`)}else return c};});var Fst,Bst,jst,Ust,nb,ib=Cn(()=>{lo();As();(({pow:Fst}=Math)),Bst=1e-7,jst=20;dn.prototype.luminance=function(t,r="rgb"){if(t!==void 0&&Zi(t)==="number"){if(t===0)return new dn([0,0,0,this._rgb[3]],"rgb");if(t===1)return new dn([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),c=jst,s=(i,o)=>{let p=i.interpolate(o,.5,r),E=p.luminance();return Math.abs(t-E)<Bst||!c--?p:E>t?s(i,p):s(p,o)},e=(n>t?s(new dn([0,0,0]),this):s(this,new dn([255,255,255]))).rgb();return new dn([...e,this._rgb[3]])}return Ust(...this._rgb.slice(0,3))};Ust=(t,r,n)=>(t=nb(t),r=nb(r),n=nb(n),.2126*t+.7152*r+.0722*n),nb=t=>(t/=255,t<=.03928?t/12.92:Fst((t+.055)/1.055,2.4));});var Du,Ld=Cn(()=>{Du={};});var hp,gv=Cn(()=>{lo();As();Ld();hp=(t,r,n=.5,...c)=>{let s=c[0]||"lrgb";if(!Du[s]&&!c.length&&(s=Object.keys(Du)[0]),!Du[s])throw new Error(`interpolation mode ${s} is not defined`);return Zi(t)!=="object"&&(t=new dn(t)),Zi(r)!=="object"&&(r=new dn(r)),Du[s](t,r,n).alpha(t.alpha()+n*(r.alpha()-t.alpha()))};});var nD=Cn(()=>{lo();gv();dn.prototype.mix=dn.prototype.interpolate=function(t,r=.5,...n){return hp(this,t,r,...n)};});var iD=Cn(()=>{lo();dn.prototype.premultiply=function(t=false){let r=this._rgb,n=r[3];return t?(this._rgb=[r[0]*n,r[1]*n,r[2]*n,n],this):new dn([r[0]*n,r[1]*n,r[2]*n,n],"rgb")};});var Kst,$st,Hst,h4,sb=Cn(()=>{As();(({sin:Kst,cos:$st}=Math)),Hst=(...t)=>{let[r,n,c]=Li(t,"lch");return isNaN(c)&&(c=0),c=c*VI,[r,$st(c)*n,Kst(c)*n]},h4=Hst;});var Gst,ig,f4=Cn(()=>{As();sb();xv();Gst=(...t)=>{t=Li(t,"lch");let[r,n,c]=t,[s,e,i]=h4(r,n,c),[o,p,E]=eg(s,e,i);return [o,p,E,t.length>3?t[3]:1]},ig=Gst;});var qst,sD,oD=Cn(()=>{As();f4();qst=(...t)=>{let r=a4(Li(t,"hcl"));return ig(...r)},sD=qst;});var zst,Vst,Yst,Wst,d4,ob=Cn(()=>{As();(({sqrt:zst,atan2:Vst,round:Yst}=Math)),Wst=(...t)=>{let[r,n,c]=Li(t,"lab"),s=zst(n*n+c*c),e=(Vst(c,n)*YI+360)%360;return Yst(s*1e4)===0&&(e=Number.NaN),[r,s,e]},d4=Wst;});var Xst,yv,ab=Cn(()=>{As();mv();ob();Xst=(...t)=>{let[r,n,c,...s]=Li(t,"rgb"),[e,i,o]=rg(r,n,c),[p,E,b]=d4(e,i,o);return [p,E,b,...s.length>0&&s[0]<1?[s[0]]:[]]},yv=Xst;});var Qst,Jst,vv=Cn(()=>{As();Cc();lo();Yc();f4();oD();ab();dn.prototype.lch=function(){return yv(this._rgb)};dn.prototype.hcl=function(){return a4(yv(this._rgb))};Qst=(...t)=>new dn(...t,"lch"),Jst=(...t)=>new dn(...t,"hcl");Object.assign(Os,{lch:Qst,hcl:Jst});rs.format.lch=ig;rs.format.hcl=sD;["lch","hcl"].forEach(t=>rs.autodetect.push({p:2,test:(...r)=>{if(r=Li(r,t),Zi(r)==="array"&&r.length===3)return t}}));});var aD=Cn(()=>{vv();lo();ex();dn.prototype.saturate=function(t=1){let r=this,n=r.lch();return n[1]+=cp.Kn*t,n[1]<0&&(n[1]=0),new dn(n,"lch").alpha(r.alpha(),true)};dn.prototype.desaturate=function(t=1){return this.saturate(-t)};});var uD=Cn(()=>{lo();As();dn.prototype.set=function(t,r,n=false){let[c,s]=t.split("."),e=this[c]();if(s){let i=c.indexOf(s)-(c.substr(0,2)==="ok"?2:0);if(i>-1){if(Zi(r)=="string")switch(r.charAt(0)){case "+":e[i]+=+r;break;case "-":e[i]+=+r;break;case "*":e[i]*=+r.substr(1);break;case "/":e[i]/=+r.substr(1);break;default:e[i]=+r;}else if(Zi(r)==="number")e[i]=r;else throw new Error("unsupported value for Color.set");let o=new dn(e,c);return n?(this._rgb=o._rgb,this):o}throw new Error(`unknown channel ${s} in mode ${c}`)}else return e};});var lD=Cn(()=>{ng();lo();gv();dn.prototype.tint=function(t=.5,...r){return hp(this,"white",t,...r)};dn.prototype.shade=function(t=.5,...r){return hp(this,"black",t,...r)};});var Zst,cD=Cn(()=>{lo();Ld();Zst=(t,r,n)=>{let c=t._rgb,s=r._rgb;return new dn(c[0]+n*(s[0]-c[0]),c[1]+n*(s[1]-c[1]),c[2]+n*(s[2]-c[2]),"rgb")};Du.rgb=Zst;});var ub,sg,tot,hD=Cn(()=>{lo();Ld();(({sqrt:ub,pow:sg}=Math)),tot=(t,r,n)=>{let[c,s,e]=t._rgb,[i,o,p]=r._rgb;return new dn(ub(sg(c,2)*(1-n)+sg(i,2)*n),ub(sg(s,2)*(1-n)+sg(o,2)*n),ub(sg(e,2)*(1-n)+sg(p,2)*n),"rgb")};Du.lrgb=tot;});var eot,fD=Cn(()=>{ng();Ld();lo();eot=(t,r,n)=>{let c=t.lab(),s=r.lab();return new dn(c[0]+n*(s[0]-c[0]),c[1]+n*(s[1]-c[1]),c[2]+n*(s[2]-c[2]),"lab")};Du.lab=eot;});var i1,C3=Cn(()=>{lo();i1=(t,r,n,c)=>{let s,e;c==="hsl"?(s=t.hsl(),e=r.hsl()):c==="hsv"?(s=t.hsv(),e=r.hsv()):c==="hcg"?(s=t.hcg(),e=r.hcg()):c==="hsi"?(s=t.hsi(),e=r.hsi()):c==="lch"||c==="hcl"?(c="hcl",s=t.hcl(),e=r.hcl()):c==="oklch"&&(s=t.oklch().reverse(),e=r.oklch().reverse());let i,o,p,E,b,y;(c.substr(0,1)==="h"||c==="oklch")&&([i,p,b]=s,[o,E,y]=e);let m,a,l,u;return !isNaN(i)&&!isNaN(o)?(o>i&&o-i>180?u=o-(i+360):o<i&&i-o>180?u=o+360-i:u=o-i,a=i+n*u):isNaN(i)?isNaN(o)?a=Number.NaN:(a=o,(b==1||b==0)&&c!="hsv"&&(m=E)):(a=i,(y==1||y==0)&&c!="hsv"&&(m=p)),m===void 0&&(m=p+n*(E-p)),l=b+n*(y-b),c==="oklch"?new dn([l,m,a],c):new dn([a,m,l],c)};});var dD,pD=Cn(()=>{vv();C3();Ld();dD=(t,r,n)=>i1(t,r,n,"lch");Du.lch=dD;Du.hcl=dD;});var rot,xD,mD=Cn(()=>{As();rot=t=>{if(Zi(t)=="number"&&t>=0&&t<=16777215){let r=t>>16,n=t>>8&255,c=t&255;return [r,n,c,1]}throw new Error("unknown num color: "+t)},xD=rot;});var not,gD,yD=Cn(()=>{As();not=(...t)=>{let[r,n,c]=Li(t,"rgb");return (r<<16)+(n<<8)+c},gD=not;});var iot,lb=Cn(()=>{Cc();lo();Yc();As();mD();yD();dn.prototype.num=function(){return gD(this._rgb)};iot=(...t)=>new dn(...t,"num");Object.assign(Os,{num:iot});rs.format.num=xD;rs.autodetect.push({p:5,test:(...t)=>{if(t.length===1&&Zi(t[0])==="number"&&t[0]>=0&&t[0]<=16777215)return "num"}});});var sot,vD=Cn(()=>{lb();Ld();lo();sot=(t,r,n)=>{let c=t.num(),s=r.num();return new dn(c+n*(s-c),"num")};Du.num=sot;});var oot,aot,ED,_D=Cn(()=>{As();(({floor:oot}=Math)),aot=(...t)=>{t=Li(t,"hcg");let[r,n,c]=t,s,e,i;c=c*255;let o=n*255;if(n===0)s=e=i=c;else {r===360&&(r=0),r>360&&(r-=360),r<0&&(r+=360),r/=60;let p=oot(r),E=r-p,b=c*(1-n),y=b+o*(1-E),m=b+o*E,a=b+o;switch(p){case 0:[s,e,i]=[a,m,b];break;case 1:[s,e,i]=[y,a,b];break;case 2:[s,e,i]=[b,a,m];break;case 3:[s,e,i]=[b,y,a];break;case 4:[s,e,i]=[m,b,a];break;case 5:[s,e,i]=[a,b,y];break}}return [s,e,i,t.length>3?t[3]:1]},ED=aot;});var uot,TD,bD=Cn(()=>{As();uot=(...t)=>{let[r,n,c]=Li(t,"rgb"),s=i4(r,n,c),e=s4(r,n,c),i=e-s,o=i*100/255,p=s/(255-i)*100,E;return i===0?E=Number.NaN:(r===e&&(E=(n-c)/i),n===e&&(E=2+(c-r)/i),c===e&&(E=4+(r-n)/i),E*=60,E<0&&(E+=360)),[E,o,p]},TD=uot;});var lot,cb=Cn(()=>{As();Cc();lo();Yc();_D();bD();dn.prototype.hcg=function(){return TD(this._rgb)};lot=(...t)=>new dn(...t,"hcg");Os.hcg=lot;rs.format.hcg=ED;rs.autodetect.push({p:1,test:(...t)=>{if(t=Li(t,"hcg"),Zi(t)==="array"&&t.length===3)return "hcg"}});});var cot,AD=Cn(()=>{cb();C3();Ld();cot=(t,r,n)=>i1(t,r,n,"hcg");Du.hcg=cot;});var og,hot,OD,SD=Cn(()=>{As();(({cos:og}=Math)),hot=(...t)=>{t=Li(t,"hsi");let[r,n,c]=t,s,e,i;return isNaN(r)&&(r=0),isNaN(n)&&(n=0),r>360&&(r-=360),r<0&&(r+=360),r/=360,r<1/3?(i=(1-n)/3,s=(1+n*og(r1*r)/og(o4-r1*r))/3,e=1-(i+s)):r<2/3?(r-=1/3,s=(1-n)/3,e=(1+n*og(r1*r)/og(o4-r1*r))/3,i=1-(s+e)):(r-=2/3,e=(1-n)/3,i=(1+n*og(r1*r)/og(o4-r1*r))/3,s=1-(e+i)),s=e1(c*s*3),e=e1(c*e*3),i=e1(c*i*3),[s*255,e*255,i*255,t.length>3?t[3]:1]},OD=hot;});var fot,dot,pot,xot,CD,ND=Cn(()=>{As();(({min:fot,sqrt:dot,acos:pot}=Math)),xot=(...t)=>{let[r,n,c]=Li(t,"rgb");r/=255,n/=255,c/=255;let s,e=fot(r,n,c),i=(r+n+c)/3,o=i>0?1-e/i:0;return o===0?s=NaN:(s=(r-n+(r-c))/2,s/=dot((r-n)*(r-n)+(r-c)*(n-c)),s=pot(s),c>n&&(s=r1-s),s/=r1),[s*360,o,i]},CD=xot;});var mot,hb=Cn(()=>{As();Cc();lo();Yc();SD();ND();dn.prototype.hsi=function(){return CD(this._rgb)};mot=(...t)=>new dn(...t,"hsi");Os.hsi=mot;rs.format.hsi=OD;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"hsi"),Zi(t)==="array"&&t.length===3)return "hsi"}});});var got,RD=Cn(()=>{hb();C3();Ld();got=(t,r,n)=>i1(t,r,n,"hsi");Du.hsi=got;});var yot,Ev,fb=Cn(()=>{As();yot=(...t)=>{t=Li(t,"hsl");let[r,n,c]=t,s,e,i;if(n===0)s=e=i=c*255;else {let o=[0,0,0],p=[0,0,0],E=c<.5?c*(1+n):c+n-c*n,b=2*c-E,y=r/360;o[0]=y+1/3,o[1]=y,o[2]=y-1/3;for(let m=0;m<3;m++)o[m]<0&&(o[m]+=1),o[m]>1&&(o[m]-=1),6*o[m]<1?p[m]=b+(E-b)*6*o[m]:2*o[m]<1?p[m]=E:3*o[m]<2?p[m]=b+(E-b)*(2/3-o[m])*6:p[m]=b;[s,e,i]=[p[0]*255,p[1]*255,p[2]*255];}return t.length>3?[s,e,i,t[3]]:[s,e,i,1]},Ev=yot;});var vot,p4,db=Cn(()=>{As();vot=(...t)=>{t=Li(t,"rgba");let[r,n,c]=t;r/=255,n/=255,c/=255;let s=i4(r,n,c),e=s4(r,n,c),i=(e+s)/2,o,p;return e===s?(o=0,p=Number.NaN):o=i<.5?(e-s)/(e+s):(e-s)/(2-e-s),r==e?p=(n-c)/(e-s):n==e?p=2+(c-r)/(e-s):c==e&&(p=4+(r-n)/(e-s)),p*=60,p<0&&(p+=360),t.length>3&&t[3]!==void 0?[p,o,i,t[3]]:[p,o,i]},p4=vot;});var Eot,x4=Cn(()=>{As();Cc();lo();Yc();fb();db();dn.prototype.hsl=function(){return p4(this._rgb)};Eot=(...t)=>new dn(...t,"hsl");Os.hsl=Eot;rs.format.hsl=Ev;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"hsl"),Zi(t)==="array"&&t.length===3)return "hsl"}});});var _ot,wD=Cn(()=>{x4();C3();Ld();_ot=(t,r,n)=>i1(t,r,n,"hsl");Du.hsl=_ot;});var Tot,bot,ID,DD=Cn(()=>{As();(({floor:Tot}=Math)),bot=(...t)=>{t=Li(t,"hsv");let[r,n,c]=t,s,e,i;if(c*=255,n===0)s=e=i=c;else {r===360&&(r=0),r>360&&(r-=360),r<0&&(r+=360),r/=60;let o=Tot(r),p=r-o,E=c*(1-n),b=c*(1-n*p),y=c*(1-n*(1-p));switch(o){case 0:[s,e,i]=[c,y,E];break;case 1:[s,e,i]=[b,c,E];break;case 2:[s,e,i]=[E,c,y];break;case 3:[s,e,i]=[E,b,c];break;case 4:[s,e,i]=[y,E,c];break;case 5:[s,e,i]=[c,E,b];break}}return [s,e,i,t.length>3?t[3]:1]},ID=bot;});var Aot,Oot,Sot,LD,PD=Cn(()=>{As();(({min:Aot,max:Oot}=Math)),Sot=(...t)=>{t=Li(t,"rgb");let[r,n,c]=t,s=Aot(r,n,c),e=Oot(r,n,c),i=e-s,o,p,E;return E=e/255,e===0?(o=Number.NaN,p=0):(p=i/e,r===e&&(o=(n-c)/i),n===e&&(o=2+(c-r)/i),c===e&&(o=4+(r-n)/i),o*=60,o<0&&(o+=360)),[o,p,E]},LD=Sot;});var Cot,pb=Cn(()=>{As();Cc();lo();Yc();DD();PD();dn.prototype.hsv=function(){return LD(this._rgb)};Cot=(...t)=>new dn(...t,"hsv");Os.hsv=Cot;rs.format.hsv=ID;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"hsv"),Zi(t)==="array"&&t.length===3)return "hsv"}});});var Not,MD=Cn(()=>{pb();C3();Ld();Not=(t,r,n)=>i1(t,r,n,"hsv");Du.hsv=Not;});function N3(t,r){let n=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(r[0])||(r=r.map(i=>[i]));let c=r[0].length,s=r[0].map((i,o)=>r.map(p=>p[o])),e=t.map(i=>s.map(o=>Array.isArray(i)?i.reduce((p,E,b)=>p+E*(o[b]||0),0):o.reduce((p,E)=>p+E*i,0)));return n===1&&(e=e[0]),c===1?e.map(i=>i[0]):e}var xb=Cn(()=>{});function wot(t){var r=[[1.2268798758459243,-0.5578149944602171,.2813910456659647],[-0.0405757452148008,1.112286803280317,-0.0717110580655164],[-0.0763729366746601,-0.4214933324022432,1.5869240198367816]],n=[[1,.3963377773761749,.2158037573099136],[1,-0.1055613458156586,-0.0638541728258133],[1,-0.0894841775298119,-1.2914855480194092]],c=N3(n,t);return N3(r,c.map(s=>s**3))}var Rot,ag,m4=Cn(()=>{As();xb();xv();Rot=(...t)=>{t=Li(t,"lab");let[r,n,c,...s]=t,[e,i,o]=wot([r,n,c]),[p,E,b]=tb(e,i,o);return [p,E,b,...s.length>0&&s[0]<1?[s[0]]:[]]};ag=Rot;});function Dot(t){let r=[[.819022437996703,.3619062600528904,-0.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],n=[[.210454268309314,.7936177747023054,-0.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-0.8086757549230774]],c=N3(r,t);return N3(n,c.map(s=>Math.cbrt(s)))}var Iot,ug,g4=Cn(()=>{As();xb();mv();Iot=(...t)=>{let[r,n,c,...s]=Li(t,"rgb"),e=rb(r,n,c);return [...Dot(e),...s.length>0&&s[0]<1?[s[0]]:[]]};ug=Iot;});var Lot,mb=Cn(()=>{As();Cc();lo();Yc();m4();g4();dn.prototype.oklab=function(){return ug(this._rgb)};Lot=(...t)=>new dn(...t,"oklab");Object.assign(Os,{oklab:Lot});rs.format.oklab=ag;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"oklab"),Zi(t)==="array"&&t.length===3)return "oklab"}});});var Pot,kD=Cn(()=>{mb();Ld();lo();Pot=(t,r,n)=>{let c=t.oklab(),s=r.oklab();return new dn(c[0]+n*(s[0]-c[0]),c[1]+n*(s[1]-c[1]),c[2]+n*(s[2]-c[2]),"oklab")};Du.oklab=Pot;});var Mot,FD=Cn(()=>{vv();C3();Ld();Mot=(t,r,n)=>i1(t,r,n,"oklch");Du.oklch=Mot;});var gb,yb,vb,BD,jD,kot,UD,Fot,KD=Cn(()=>{lo();As();(({pow:gb,sqrt:yb,PI:vb,cos:BD,sin:jD,atan2:kot}=Math)),UD=(t,r="lrgb",n=null)=>{let c=t.length;n||(n=Array.from(new Array(c)).map(()=>1));let s=c/n.reduce(function(y,m){return y+m});if(n.forEach((y,m)=>{n[m]*=s;}),t=t.map(y=>new dn(y)),r==="lrgb")return Fot(t,n);let e=t.shift(),i=e.get(r),o=[],p=0,E=0;for(let y=0;y<i.length;y++)if(i[y]=(i[y]||0)*n[0],o.push(isNaN(i[y])?0:n[0]),r.charAt(y)==="h"&&!isNaN(i[y])){let m=i[y]/180*vb;p+=BD(m)*n[0],E+=jD(m)*n[0];}let b=e.alpha()*n[0];t.forEach((y,m)=>{let a=y.get(r);b+=y.alpha()*n[m+1];for(let l=0;l<i.length;l++)if(!isNaN(a[l]))if(o[l]+=n[m+1],r.charAt(l)==="h"){let u=a[l]/180*vb;p+=BD(u)*n[m+1],E+=jD(u)*n[m+1];}else i[l]+=a[l]*n[m+1];});for(let y=0;y<i.length;y++)if(r.charAt(y)==="h"){let m=kot(E/o[y],p/o[y])/vb*180;for(;m<0;)m+=360;for(;m>=360;)m-=360;i[y]=m;}else i[y]=i[y]/o[y];return b/=c,new dn(i,r).alpha(b>.99999?1:b,true)},Fot=(t,r)=>{let n=t.length,c=[0,0,0,0];for(let s=0;s<t.length;s++){let e=t[s],i=r[s]/n,o=e._rgb;c[0]+=gb(o[0],2)*i,c[1]+=gb(o[1],2)*i,c[2]+=gb(o[2],2)*i,c[3]+=o[3]*i;}return c[0]=yb(c[0]),c[1]=yb(c[1]),c[2]=yb(c[2]),c[3]>.9999999&&(c[3]=1),new dn(S3(c))};});function R3(t){let r="rgb",n=Os("#ccc"),c=0,s=[0,1],e=[0,1],i=[],o=[0,0],p=false,E=[],b=false,y=0,m=1,a=false,l={},u=true,h=1,d=function(G){if(G=G||["#fff","#000"],G&&Zi(G)==="string"&&Os.brewer&&Os.brewer[G.toLowerCase()]&&(G=Os.brewer[G.toLowerCase()]),Zi(G)==="array"){G.length===1&&(G=[G[0],G[0]]),G=G.slice(0);for(let j=0;j<G.length;j++)G[j]=Os(G[j]);i.length=0;for(let j=0;j<G.length;j++)i.push(j/(G.length-1));}return T(),E=G},g=function(G){if(p!=null){let j=p.length-1,B=0;for(;B<j&&G>=p[B];)B++;return B-1}return 0},_=G=>G,S=G=>G,v=function(G,j){let B,J;if(j==null&&(j=false),isNaN(G)||G===null)return n;j?J=G:p&&p.length>2?J=g(G)/(p.length-2):m!==y?J=(G-y)/(m-y):J=1,J=S(J),j||(J=_(J)),h!==1&&(J=Bot(J,h)),J=o[0]+J*(1-o[0]-o[1]),J=e1(J,0,1);let w=Math.floor(J*1e4);if(u&&l[w])B=l[w];else {if(Zi(E)==="array")for(let $=0;$<i.length;$++){let z=i[$];if(J<=z){B=E[$];break}if(J>=z&&$===i.length-1){B=E[$];break}if(J>z&&J<i[$+1]){J=(J-z)/(i[$+1]-z),B=Os.interpolate(E[$],E[$+1],J,r);break}}else Zi(E)==="function"&&(B=E(J));u&&(l[w]=B);}return B};var T=()=>l={};d(t);let q=function(G){let j=Os(v(G));return b&&j[b]?j[b]():j};return q.classes=function(G){if(G!=null){if(Zi(G)==="array")p=G,s=[G[0],G[G.length-1]];else {let j=Os.analyze(s);G===0?p=[j.min,j.max]:p=Os.limits(j,"e",G);}return q}return p},q.domain=function(G){if(!arguments.length)return e;e=G.slice(0),y=G[0],m=G[G.length-1],i=[];let j=E.length;if(G.length===j&&y!==m)for(let B of Array.from(G))i.push((B-y)/(m-y));else {for(let B=0;B<j;B++)i.push(B/(j-1));if(G.length>2){let B=G.map((w,$)=>$/(G.length-1)),J=G.map(w=>(w-y)/(m-y));J.every((w,$)=>B[$]===w)||(S=w=>{if(w<=0||w>=1)return w;let $=0;for(;w>=J[$+1];)$++;let z=(w-J[$])/(J[$+1]-J[$]);return B[$]+z*(B[$+1]-B[$])});}}return s=[y,m],q},q.mode=function(G){return arguments.length?(r=G,T(),q):r},q.range=function(G,j){return d(G),q},q.out=function(G){return b=G,q},q.spread=function(G){return arguments.length?(c=G,q):c},q.correctLightness=function(G){return G==null&&(G=true),a=G,T(),a?_=function(j){let B=v(0,true).lab()[0],J=v(1,true).lab()[0],w=B>J,$=v(j,true).lab()[0],z=B+(J-B)*j,tt=$-z,pt=0,Z=1,dt=20;for(;Math.abs(tt)>.01&&dt-- >0;)(function(){return w&&(tt*=-1),tt<0?(pt=j,j+=(Z-j)*.5):(Z=j,j+=(pt-j)*.5),$=v(j,true).lab()[0],tt=$-z})();return j}:_=j=>j,q},q.padding=function(G){return G!=null?(Zi(G)==="number"&&(G=[G,G]),o=G,q):o},q.colors=function(G,j){arguments.length<2&&(j="hex");let B=[];if(arguments.length===0)B=E.slice(0);else if(G===1)B=[q(.5)];else if(G>1){let J=s[0],w=s[1]-J;B=jot(0,G).map($=>q(J+$/(G-1)*w));}else {t=[];let J=[];if(p&&p.length>2)for(let w=1,$=p.length,z=1<=$;z?w<$:w>$;z?w++:w--)J.push((p[w-1]+p[w])*.5);else J=s;B=J.map(w=>q(w));}return Os[j]&&(B=B.map(J=>J[j]())),B},q.cache=function(G){return G!=null?(u=G,q):u},q.gamma=function(G){return G!=null?(h=G,q):h},q.nodata=function(G){return G!=null?(n=Os(G),q):n},q}function jot(t,r,n){let c=[],s=t<r,e=r;for(let i=t;s?i<e:i>e;s?i++:i--)c.push(i);return c}var Bot,y4=Cn(()=>{Cc();As();({pow:Bot}=Math);});var Uot,Kot,$D,HD=Cn(()=>{lo();ng();y4();Uot=function(t){let r=[1,1];for(let n=1;n<t;n++){let c=[1];for(let s=1;s<=r.length;s++)c[s]=(r[s]||0)+r[s-1];r=c;}return r},Kot=function(t){let r,n,c,s;if(t=t.map(e=>new dn(e)),t.length===2)[n,c]=t.map(e=>e.lab()),r=function(e){let i=[0,1,2].map(o=>n[o]+e*(c[o]-n[o]));return new dn(i,"lab")};else if(t.length===3)[n,c,s]=t.map(e=>e.lab()),r=function(e){let i=[0,1,2].map(o=>(1-e)*(1-e)*n[o]+2*(1-e)*e*c[o]+e*e*s[o]);return new dn(i,"lab")};else if(t.length===4){let e;[n,c,s,e]=t.map(i=>i.lab()),r=function(i){let o=[0,1,2].map(p=>(1-i)*(1-i)*(1-i)*n[p]+3*(1-i)*(1-i)*i*c[p]+3*(1-i)*i*i*s[p]+i*i*i*e[p]);return new dn(o,"lab")};}else if(t.length>=5){let e,i,o;e=t.map(p=>p.lab()),o=t.length-1,i=Uot(o),r=function(p){let E=1-p,b=[0,1,2].map(y=>e.reduce((m,a,l)=>m+i[l]*E**(o-l)*p**l*a[y],0));return new dn(b,"lab")};}else throw new RangeError("No point in running bezier with only one color.");return r},$D=t=>{let r=Kot(t);return r.scale=()=>R3(r),r};});var GD,$ot,Eb=Cn(()=>{Cc();lo();Yc();As();({round:GD}=Math);dn.prototype.rgb=function(t=true){return t===false?this._rgb.slice(0,3):this._rgb.slice(0,3).map(GD)};dn.prototype.rgba=function(t=true){return this._rgb.slice(0,4).map((r,n)=>n<3?t===false?r:GD(r):r)};$ot=(...t)=>new dn(...t,"rgb");Object.assign(Os,{rgb:$ot});rs.format.rgb=(...t)=>{let r=Li(t,"rgba");return r[3]===void 0&&(r[3]=1),r};rs.autodetect.push({p:3,test:(...t)=>{if(t=Li(t,"rgba"),Zi(t)==="array"&&(t.length===3||t.length===4&&Zi(t[3])=="number"&&t[3]>=0&&t[3]<=1))return "rgb"}});});var I1,rx,nx,Hot,Got,qot,zot,Vot,Yot,Wot,Xot,qD,zD=Cn(()=>{Eb();Cc();I1=(t,r,n)=>{if(!I1[n])throw new Error("unknown blend mode "+n);return I1[n](t,r)},rx=t=>(r,n)=>{let c=Os(n).rgb(),s=Os(r).rgb();return Os.rgb(t(c,s))},nx=t=>(r,n)=>{let c=[];return c[0]=t(r[0],n[0]),c[1]=t(r[1],n[1]),c[2]=t(r[2],n[2]),c},Hot=t=>t,Got=(t,r)=>t*r/255,qot=(t,r)=>t>r?r:t,zot=(t,r)=>t>r?t:r,Vot=(t,r)=>255*(1-(1-t/255)*(1-r/255)),Yot=(t,r)=>r<128?2*t*r/255:255*(1-2*(1-t/255)*(1-r/255)),Wot=(t,r)=>255*(1-(1-r/255)/(t/255)),Xot=(t,r)=>t===255?255:(t=255*(r/255)/(1-t/255),t>255?255:t);I1.normal=rx(nx(Hot));I1.multiply=rx(nx(Got));I1.screen=rx(nx(Vot));I1.overlay=rx(nx(Yot));I1.darken=rx(nx(qot));I1.lighten=rx(nx(zot));I1.dodge=rx(nx(Xot));I1.burn=rx(nx(Wot));qD=I1;});function VD(t=300,r=-1.5,n=1,c=1,s=[0,1]){let e=0,i;Zi(s)==="array"?i=s[1]-s[0]:(i=0,s=[s,s]);let o=function(p){let E=r1*((t+120)/360+r*p),b=Qot(s[0]+i*p,c),m=(e!==0?n[0]+p*e:n)*b*(1-b)/2,a=Zot(E),l=Jot(E),u=b+m*(-0.14861*a+1.78277*l),h=b+m*(-0.29227*a-.90649*l),d=b+m*(1.97294*a);return Os(S3([u*255,h*255,d*255,1]))};return o.start=function(p){return p==null?t:(t=p,o)},o.rotations=function(p){return p==null?r:(r=p,o)},o.gamma=function(p){return p==null?c:(c=p,o)},o.hue=function(p){return p==null?n:(n=p,Zi(n)==="array"?(e=n[1]-n[0],e===0&&(n=n[1])):e=0,o)},o.lightness=function(p){return p==null?s:(Zi(p)==="array"?(s=p,i=p[1]-p[0]):(s=[p,p],i=0),o)},o.scale=()=>Os.scale(o),o.hue(n),o}var Qot,Jot,Zot,YD=Cn(()=>{As();Cc();({pow:Qot,sin:Jot,cos:Zot}=Math);});var tat,eat,rat,WD,XD=Cn(()=>{lo();tat="0123456789abcdef",{floor:eat,random:rat}=Math,WD=(t=rat)=>{let r="#";for(let n=0;n<6;n++)r+=tat.charAt(eat(t()*16));return new dn(r,"hex")};});function _b(t,r=null){let n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return Zi(t)==="object"&&(t=Object.values(t)),t.forEach(c=>{r&&Zi(c)==="object"&&(c=c[r]),c!=null&&!isNaN(c)&&(n.values.push(c),n.sum+=c,c<n.min&&(n.min=c),c>n.max&&(n.max=c),n.count+=1);}),n.domain=[n.min,n.max],n.limits=(c,s)=>Tb(n,c,s),n}function Tb(t,r="equal",n=7){Zi(t)=="array"&&(t=_b(t));let{min:c,max:s}=t,e=t.values.sort((o,p)=>o-p);if(n===1)return [c,s];let i=[];if(r.substr(0,1)==="c"&&(i.push(c),i.push(s)),r.substr(0,1)==="e"){i.push(c);for(let o=1;o<n;o++)i.push(c+o/n*(s-c));i.push(s);}else if(r.substr(0,1)==="l"){if(c<=0)throw new Error("Logarithmic scales are only possible for values > 0");let o=Math.LOG10E*QD(c),p=Math.LOG10E*QD(s);i.push(c);for(let E=1;E<n;E++)i.push(nat(10,o+E/n*(p-o)));i.push(s);}else if(r.substr(0,1)==="q"){i.push(c);for(let o=1;o<n;o++){let p=(e.length-1)*o/n,E=iat(p);if(E===p)i.push(e[E]);else {let b=p-E;i.push(e[E]*(1-b)+e[E+1]*b);}}i.push(s);}else if(r.substr(0,1)==="k"){let o,p=e.length,E=new Array(p),b=new Array(n),y=true,m=0,a=null;a=[],a.push(c);for(let h=1;h<n;h++)a.push(c+h/n*(s-c));for(a.push(s);y;){for(let d=0;d<n;d++)b[d]=0;for(let d=0;d<p;d++){let g=e[d],_=Number.MAX_VALUE,S;for(let v=0;v<n;v++){let T=sat(a[v]-g);T<_&&(_=T,S=v),b[S]++,E[d]=S;}}let h=new Array(n);for(let d=0;d<n;d++)h[d]=null;for(let d=0;d<p;d++)o=E[d],h[o]===null?h[o]=e[d]:h[o]+=e[d];for(let d=0;d<n;d++)h[d]*=1/b[d];y=false;for(let d=0;d<n;d++)if(h[d]!==a[d]){y=true;break}a=h,m++,m>200&&(y=false);}let l={};for(let h=0;h<n;h++)l[h]=[];for(let h=0;h<p;h++)o=E[h],l[o].push(e[h]);let u=[];for(let h=0;h<n;h++)u.push(l[h][0]),u.push(l[h][l[h].length-1]);u=u.sort((h,d)=>h-d),i.push(u[0]);for(let h=1;h<u.length;h+=2){let d=u[h];!isNaN(d)&&i.indexOf(d)===-1&&i.push(d);}}return i}var QD,nat,iat,sat,bb=Cn(()=>{fv();({log:QD,pow:nat,floor:iat,abs:sat}=Math);});var JD,ZD=Cn(()=>{lo();ib();JD=(t,r)=>{t=new dn(t),r=new dn(r);let n=t.luminance(),c=r.luminance();return n>c?(n+.05)/(c+.05):(c+.05)/(n+.05)};});function nL(t,r,n){return .2126729*Math.pow(t/255,2.4)+.7151522*Math.pow(r/255,2.4)+.072175*Math.pow(n/255,2.4)}var tL,oat,aat,eL,v4,rL,iL,sL=Cn(()=>{lo();gv();tL=.027,oat=5e-4,aat=.1,eL=1.14,v4=.022,rL=1.414,iL=(t,r)=>{t=new dn(t),r=new dn(r),t.alpha()<1&&(t=hp(r,t,t.alpha(),"rgb"));let n=nL(...t.rgb()),c=nL(...r.rgb()),s=n>=v4?n:n+Math.pow(v4-n,rL),e=c>=v4?c:c+Math.pow(v4-c,rL),i=Math.pow(e,.56)-Math.pow(s,.57),o=Math.pow(e,.65)-Math.pow(s,.62),p=Math.abs(e-s)<oat?0:s<e?i*eL:o*eL;return (Math.abs(p)<aat?0:p>0?p-tL:p+tL)*100};});function cL(t,r,n=1,c=1,s=1){var e=function(Zt){return 360*Zt/(2*lL)},i=function(Zt){return 2*lL*Zt/360};t=new dn(t),r=new dn(r);let[o,p,E]=Array.from(t.lab()),[b,y,m]=Array.from(r.lab()),a=(o+b)/2,l=Gp(Wc(p,2)+Wc(E,2)),u=Gp(Wc(y,2)+Wc(m,2)),h=(l+u)/2,d=.5*(1-Gp(Wc(h,7)/(Wc(h,7)+Wc(25,7)))),g=p*(1+d),_=y*(1+d),S=Gp(Wc(g,2)+Wc(E,2)),v=Gp(Wc(_,2)+Wc(m,2)),T=(S+v)/2,q=e(oL(E,g)),G=e(oL(m,_)),j=q>=0?q:q+360,B=G>=0?G:G+360,J=aL(j-B)>180?(j+B+360)/2:(j+B)/2,w=1-.17*E4(i(J-30))+.24*E4(i(2*J))+.32*E4(i(3*J+6))-.2*E4(i(4*J-63)),$=B-j;$=aL($)<=180?$:B<=j?$+360:$-360,$=2*Gp(S*v)*uL(i($)/2);let z=b-o,tt=v-S,pt=1+.015*Wc(a-50,2)/Gp(20+Wc(a-50,2)),Z=1+.045*T,dt=1+.015*T*w,gt=30*cat(-Wc((J-275)/25,2)),mt=-(2*Gp(Wc(T,7)/(Wc(T,7)+Wc(25,7))))*uL(2*i(gt)),St=Gp(Wc(z/(n*pt),2)+Wc(tt/(c*Z),2)+Wc($/(s*dt),2)+mt*(tt/(c*Z))*($/(s*dt)));return lat(0,uat(100,St))}var Gp,Wc,uat,lat,oL,aL,E4,uL,cat,lL,hL=Cn(()=>{lo();({sqrt:Gp,pow:Wc,min:uat,max:lat,atan2:oL,abs:aL,cos:E4,sin:uL,exp:cat,PI:lL}=Math);});function fL(t,r,n="lab"){t=new dn(t),r=new dn(r);let c=t.get(n),s=r.get(n),e=0;for(let i in c){let o=(c[i]||0)-(s[i]||0);e+=o*o;}return Math.sqrt(e)}var dL=Cn(()=>{lo();});var pL,xL=Cn(()=>{lo();pL=(...t)=>{try{return new dn(...t),!0}catch{return false}};});var mL,gL=Cn(()=>{Cc();x4();y4();mL={cool(){return R3([Os.hsl(180,1,.9),Os.hsl(250,.7,.4)])},hot(){return R3(["#000","#f00","#ff0","#fff"]).mode("rgb")}};});var Ab,vL,yL,hat,EL,_L=Cn(()=>{Ab={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},vL=Object.keys(Ab),yL=new Map(vL.map(t=>[t.toLowerCase(),t])),hat=typeof Proxy=="function"?new Proxy(Ab,{get(t,r){let n=r.toLowerCase();if(yL.has(n))return t[yL.get(n)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(vL)}}):Ab,EL=hat;});var fat,TL,bL=Cn(()=>{As();fat=(...t)=>{t=Li(t,"cmyk");let[r,n,c,s]=t,e=t.length>4?t[4]:1;return s===1?[0,0,0,e]:[r>=1?0:255*(1-r)*(1-s),n>=1?0:255*(1-n)*(1-s),c>=1?0:255*(1-c)*(1-s),e]},TL=fat;});var AL,dat,OL,SL=Cn(()=>{As();(({max:AL}=Math)),dat=(...t)=>{let[r,n,c]=Li(t,"rgb");r=r/255,n=n/255,c=c/255;let s=1-AL(r,AL(n,c)),e=s<1?1/(1-s):0,i=(1-r-s)*e,o=(1-n-s)*e,p=(1-c-s)*e;return [i,o,p,s]},OL=dat;});var pat,CL=Cn(()=>{Cc();lo();Yc();As();bL();SL();dn.prototype.cmyk=function(){return OL(this._rgb)};pat=(...t)=>new dn(...t,"cmyk");Object.assign(Os,{cmyk:pat});rs.format.cmyk=TL;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"cmyk"),Zi(t)==="array"&&t.length===4)return "cmyk"}});});var xat,NL,RL=Cn(()=>{As();xat=(...t)=>{let r=Li(t,"hsla"),n=Dd(t)||"lsa";return r[0]=x0(r[0]||0)+"deg",r[1]=x0(r[1]*100)+"%",r[2]=x0(r[2]*100)+"%",n==="hsla"||r.length>3&&r[3]<1?(r[3]="/ "+(r.length>3?r[3]:1),n="hsla"):r.length=3,`${n.substr(0,3)}(${r.join(" ")})`},NL=xat;});var mat,wL,IL=Cn(()=>{As();mat=(...t)=>{let r=Li(t,"lab"),n=Dd(t)||"lab";return r[0]=x0(r[0])+"%",r[1]=x0(r[1]),r[2]=x0(r[2]),n==="laba"||r.length>3&&r[3]<1?r[3]="/ "+(r.length>3?r[3]:1):r.length=3,`lab(${r.join(" ")})`},wL=mat;});var gat,DL,LL=Cn(()=>{As();gat=(...t)=>{let r=Li(t,"lch"),n=Dd(t)||"lab";return r[0]=x0(r[0])+"%",r[1]=x0(r[1]),r[2]=isNaN(r[2])?"none":x0(r[2])+"deg",n==="lcha"||r.length>3&&r[3]<1?r[3]="/ "+(r.length>3?r[3]:1):r.length=3,`lch(${r.join(" ")})`},DL=gat;});var yat,PL,ML=Cn(()=>{As();yat=(...t)=>{let r=Li(t,"lab");return r[0]=x0(r[0]*100)+"%",r[1]=dv(r[1]),r[2]=dv(r[2]),r.length>3&&r[3]<1?r[3]="/ "+(r.length>3?r[3]:1):r.length=3,`oklab(${r.join(" ")})`},PL=yat;});var vat,_4,Ob=Cn(()=>{As();g4();ob();vat=(...t)=>{let[r,n,c,...s]=Li(t,"rgb"),[e,i,o]=ug(r,n,c),[p,E,b]=d4(e,i,o);return [p,E,b,...s.length>0&&s[0]<1?[s[0]]:[]]},_4=vat;});var Eat,kL,FL=Cn(()=>{As();Eat=(...t)=>{let r=Li(t,"lch");return r[0]=x0(r[0]*100)+"%",r[1]=dv(r[1]),r[2]=isNaN(r[2])?"none":x0(r[2])+"deg",r.length>3&&r[3]<1?r[3]="/ "+(r.length>3?r[3]:1):r.length=3,`oklch(${r.join(" ")})`},kL=Eat;});var Sb,_at,BL,jL=Cn(()=>{As();RL();db();IL();mv();LL();ab();g4();ML();Ob();FL();ex();(({round:Sb}=Math)),_at=(...t)=>{let r=Li(t,"rgba"),n=Dd(t)||"rgb";if(n.substr(0,3)==="hsl")return NL(p4(r),n);if(n.substr(0,3)==="lab"){let c=tx();n1("d50");let s=wL(rg(r),n);return n1(c),s}if(n.substr(0,3)==="lch"){let c=tx();n1("d50");let s=DL(yv(r),n);return n1(c),s}return n.substr(0,5)==="oklab"?PL(ug(r)):n.substr(0,5)==="oklch"?kL(_4(r)):(r[0]=Sb(r[0]),r[1]=Sb(r[1]),r[2]=Sb(r[2]),(n==="rgba"||r.length>3&&r[3]<1)&&(r[3]="/ "+(r.length>3?r[3]:1),n="rgba"),`${n.substr(0,3)}(${r.slice(0,n==="rgb"?3:4).join(" ")})`)},BL=_at;});var Tat,T4,Cb=Cn(()=>{As();sb();m4();Tat=(...t)=>{t=Li(t,"lch");let[r,n,c,...s]=t,[e,i,o]=h4(r,n,c),[p,E,b]=ag(e,i,o);return [p,E,b,...s.length>0&&s[0]<1?[s[0]]:[]]},T4=Tat;});var qp,D1,b4,s1,cg,Nb,A4,hg,UL,KL,$L,HL,GL,qL,zL,VL,YL,WL,XL,lg,Xc,Af,QL,Rb,JL=Cn(()=>{fb();xv();f4();m4();Cb();Yc();r4();ex();qp=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,D1=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,b4=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,s1=/\s*/.source,cg=/\s+/.source,Nb=/\s*,\s*/.source,A4=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,hg=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,UL=new RegExp("^rgba?\\("+s1+[qp,qp,qp].join(cg)+hg+"\\)$"),KL=new RegExp("^rgb\\("+s1+[qp,qp,qp].join(Nb)+s1+"\\)$"),$L=new RegExp("^rgba\\("+s1+[qp,qp,qp,D1].join(Nb)+s1+"\\)$"),HL=new RegExp("^hsla?\\("+s1+[A4,b4,b4].join(cg)+hg+"\\)$"),GL=new RegExp("^hsl?\\("+s1+[A4,b4,b4].join(Nb)+s1+"\\)$"),qL=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,zL=new RegExp("^lab\\("+s1+[D1,D1,D1].join(cg)+hg+"\\)$"),VL=new RegExp("^lch\\("+s1+[D1,D1,A4].join(cg)+hg+"\\)$"),YL=new RegExp("^oklab\\("+s1+[D1,D1,D1].join(cg)+hg+"\\)$"),WL=new RegExp("^oklch\\("+s1+[D1,D1,A4].join(cg)+hg+"\\)$"),{round:XL}=Math,lg=t=>t.map((r,n)=>n<=2?e1(XL(r),0,255):r),Xc=(t,r=0,n=100,c=false)=>(typeof t=="string"&&t.endsWith("%")&&(t=parseFloat(t.substring(0,t.length-1))/100,c?t=r+(t+1)*.5*(n-r):t=r+t*(n-r)),+t),Af=(t,r)=>t==="none"?r:t,QL=t=>{if(t=t.toLowerCase().trim(),t==="transparent")return [0,0,0,0];let r;if(rs.format.named)try{return rs.format.named(t)}catch{}if((r=t.match(UL))||(r=t.match(KL))){let n=r.slice(1,4);for(let s=0;s<3;s++)n[s]=+Xc(Af(n[s],0),0,255);n=lg(n);let c=r[4]!==void 0?+Xc(r[4],0,1):1;return n[3]=c,n}if(r=t.match($L)){let n=r.slice(1,5);for(let c=0;c<4;c++)n[c]=+Xc(n[c],0,255);return n}if((r=t.match(HL))||(r=t.match(GL))){let n=r.slice(1,4);n[0]=+Af(n[0].replace("deg",""),0),n[1]=+Xc(Af(n[1],0),0,100)*.01,n[2]=+Xc(Af(n[2],0),0,100)*.01;let c=lg(Ev(n)),s=r[4]!==void 0?+Xc(r[4],0,1):1;return c[3]=s,c}if(r=t.match(qL)){let n=r.slice(1,4);n[1]*=.01,n[2]*=.01;let c=Ev(n);for(let s=0;s<3;s++)c[s]=XL(c[s]);return c[3]=+r[4],c}if(r=t.match(zL)){let n=r.slice(1,4);n[0]=Xc(Af(n[0],0),0,100),n[1]=Xc(Af(n[1],0),-125,125,true),n[2]=Xc(Af(n[2],0),-125,125,true);let c=tx();n1("d50");let s=lg(eg(n));n1(c);let e=r[4]!==void 0?+Xc(r[4],0,1):1;return s[3]=e,s}if(r=t.match(VL)){let n=r.slice(1,4);n[0]=Xc(n[0],0,100),n[1]=Xc(Af(n[1],0),0,150,false),n[2]=+Af(n[2].replace("deg",""),0);let c=tx();n1("d50");let s=lg(ig(n));n1(c);let e=r[4]!==void 0?+Xc(r[4],0,1):1;return s[3]=e,s}if(r=t.match(YL)){let n=r.slice(1,4);n[0]=Xc(Af(n[0],0),0,1),n[1]=Xc(Af(n[1],0),-0.4,.4,true),n[2]=Xc(Af(n[2],0),-0.4,.4,true);let c=lg(ag(n)),s=r[4]!==void 0?+Xc(r[4],0,1):1;return c[3]=s,c}if(r=t.match(WL)){let n=r.slice(1,4);n[0]=Xc(Af(n[0],0),0,1),n[1]=Xc(Af(n[1],0),0,.4,false),n[2]=+Af(n[2].replace("deg",""),0);let c=lg(T4(n)),s=r[4]!==void 0?+Xc(r[4],0,1):1;return c[3]=s,c}};QL.test=t=>UL.test(t)||HL.test(t)||zL.test(t)||VL.test(t)||YL.test(t)||WL.test(t)||KL.test(t)||$L.test(t)||GL.test(t)||qL.test(t)||t==="transparent";Rb=QL;});var bat,ZL=Cn(()=>{Cc();lo();Yc();As();jL();JL();dn.prototype.css=function(t){return BL(this._rgb,t)};bat=(...t)=>new dn(...t,"css");Os.css=bat;rs.format.css=Rb;rs.autodetect.push({p:5,test:(t,...r)=>{if(!r.length&&Zi(t)==="string"&&Rb.test(t))return "css"}});});var Aat,tP=Cn(()=>{lo();Cc();Yc();As();rs.format.gl=(...t)=>{let r=Li(t,"rgba");return r[0]*=255,r[1]*=255,r[2]*=255,r};Aat=(...t)=>new dn(...t,"gl");Os.gl=Aat;dn.prototype.gl=function(){let t=this._rgb;return [t[0]/255,t[1]/255,t[2]/255,t[3]]};});var Oat,eP=Cn(()=>{lo();Cc();As();Yc();QT();JT();dn.prototype.hex=function(t){return c4(this._rgb,t)};Oat=(...t)=>new dn(...t,"hex");Os.hex=Oat;rs.format.hex=u4;rs.autodetect.push({p:4,test:(t,...r)=>{if(!r.length&&Zi(t)==="string"&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return "hex"}});});var O4,Sat,S4,wb=Cn(()=>{(({log:O4}=Math)),Sat=t=>{let r=t/100,n,c,s;return r<66?(n=255,c=r<6?0:-155.25485562709179-.44596950469579133*(c=r-2)+104.49216199393888*O4(c),s=r<20?0:-254.76935184120902+.8274096064007395*(s=r-10)+115.67994401066147*O4(s)):(n=351.97690566805693+.114206453784165*(n=r-55)-40.25366309332127*O4(n),c=325.4494125711974+.07943456536662342*(c=r-50)-28.0852963507957*O4(c),s=255),[n,c,s,1]},S4=Sat;});var Cat,Nat,rP,nP=Cn(()=>{wb();As();(({round:Cat}=Math)),Nat=(...t)=>{let r=Li(t,"rgb"),n=r[0],c=r[2],s=1e3,e=4e4,i=.4,o;for(;e-s>i;){o=(e+s)*.5;let p=S4(o);p[2]/p[0]>=c/n?e=o:s=o;}return Cat(o)},rP=Nat;});var Ib,iP=Cn(()=>{Cc();lo();Yc();wb();nP();dn.prototype.temp=dn.prototype.kelvin=dn.prototype.temperature=function(){return rP(this._rgb)};Ib=(...t)=>new dn(...t,"temp");Object.assign(Os,{temp:Ib,kelvin:Ib,temperature:Ib});rs.format.temp=rs.format.kelvin=rs.format.temperature=S4;});var Rat,sP=Cn(()=>{As();Cc();lo();Yc();Cb();Ob();dn.prototype.oklch=function(){return _4(this._rgb)};Rat=(...t)=>new dn(...t,"oklch");Object.assign(Os,{oklch:Rat});rs.format.oklch=T4;rs.autodetect.push({p:2,test:(...t)=>{if(t=Li(t,"oklch"),Zi(t)==="array"&&t.length===3)return "oklch"}});});var oP,aP=Cn(()=>{Cc();JI();ZI();tD();eD();rD();ib();nD();iD();aD();uD();lD();cD();hD();fD();pD();vD();AD();RD();wD();MD();kD();FD();KD();HD();zD();YD();gv();XD();y4();bb();ZD();sL();hL();dL();bb();xL();Yc();gL();XT();_L();lo();CL();ZL();tP();cb();eP();hb();x4();pb();ng();vv();lb();Eb();iP();mb();sP();Object.assign(Os,{analyze:_b,average:UD,bezier:$D,blend:qD,brewer:EL,Color:dn,colors:Z2,contrast:JD,contrastAPCA:iL,cubehelix:VD,deltaE:cL,distance:fL,input:rs,interpolate:hp,limits:Tb,mix:hp,random:WD,scale:R3,scales:mL,valid:pL});oP=Os;});var _v,Db=Cn(()=>{aP();_v=class{constructor(r){this.colors=this.generateColors(r),this.index=0;}generateColors(r){let n=[];for(let c=0;c<r;c++)n.push(this.phyllotacticColor(c));return n}getNextColor(){return this.index>=this.colors.length&&(this.index=0),this.colors[this.index++]}phyllotacticColor(r){let n=137.5*(Math.PI/180),c=100,s=r*n,e=c*Math.cos(s),i=c*Math.sin(s),o=50,p=e,E=i,b=oP.lab(o,p,E).rgb(),y=1,m=Math.round(b[0]*y),a=Math.round(b[1]*y),l=Math.round(b[2]*y);return `rgb(${m}, ${a}, ${l})`}};});function ix(){return new wat}var wat,uP,Lb=Cn(()=>{wat=(function(){function t(){this.index={},this.array=[];}return t.prototype.size=function(){return this.array.length},t.prototype.empty=function(){return this.array.length===0},t.prototype.itemAt=function(r){return this.array[r]},t.prototype.contains=function(r){return this.index[r.id()]!==void 0},t.prototype.find=function(r){var n=this.index[r.id()];return n===void 0?void 0:this.array[n]},t.prototype.setDefault=function(r,n){var c=this.index[r.id()];if(c===void 0){var s=new uP(r,n());return this.index[r.id()]=this.array.length,this.array.push(s),s}else return this.array[c]},t.prototype.insert=function(r,n){var c=new uP(r,n),s=this.index[r.id()];return s===void 0?(this.index[r.id()]=this.array.length,this.array.push(c)):this.array[s]=c,c},t.prototype.erase=function(r){var n=this.index[r.id()];if(n!==void 0){this.index[r.id()]=void 0;var c=this.array[n],s=this.array.pop();return c!==s&&(this.array[n]=s,this.index[s.first.id()]=n),c}},t.prototype.copy=function(){for(var r=new t,n=0;n<this.array.length;n++){var c=this.array[n].copy();r.array[n]=c,r.index[c.first.id()]=n;}return r},t})(),uP=(function(){function t(r,n){this.first=r,this.second=n;}return t.prototype.copy=function(){return new t(this.first,this.second)},t})();});var rd,Iat,Pb=Cn(()=>{Tv();rd=(function(){function t(r){r===void 0&&(r=""),this._value=0,this._context=null,this._id=Iat++,this._name=r;}return t.prototype.id=function(){return this._id},t.prototype.name=function(){return this._name},t.prototype.setName=function(r){this._name=r;},t.prototype.context=function(){return this._context},t.prototype.setContext=function(r){this._context=r;},t.prototype.value=function(){return this._value},t.prototype.setValue=function(r){this._value=r;},t.prototype.plus=function(r){return new L1(this,r)},t.prototype.minus=function(r){return new L1(this,typeof r=="number"?-r:[-1,r])},t.prototype.multiply=function(r){return new L1([r,this])},t.prototype.divide=function(r){return new L1([1/r,this])},t.prototype.toJSON=function(){return {name:this._name,value:this._value}},t.prototype.toString=function(){return this._context+"["+this._name+":"+this._value+"]"},t})(),Iat=0;});function Dat(t){for(var r=0,n=function(){return 0},c=ix(),s=0,e=t.length;s<e;++s){var i=t[s];if(typeof i=="number")r+=i;else if(i instanceof rd)c.setDefault(i,n).second+=1;else if(i instanceof L1){r+=i.constant();for(var o=i.terms(),p=0,E=o.size();p<E;p++){var b=o.itemAt(p);c.setDefault(b.first,n).second+=b.second;}}else if(i instanceof Array){if(i.length!==2)throw new Error("array must have length 2");var y=i[0],m=i[1];if(typeof y!="number")throw new Error("array item 0 must be a number");if(m instanceof rd)c.setDefault(m,n).second+=y;else if(m instanceof L1){r+=m.constant()*y;for(var o=m.terms(),p=0,E=o.size();p<E;p++){var b=o.itemAt(p);c.setDefault(b.first,n).second+=b.second*y;}}else throw new Error("array item 1 must be a variable or expression")}else throw new Error("invalid Expression argument: "+i)}return {terms:c,constant:r}}var L1,Tv=Cn(()=>{Lb();Pb();L1=(function(){function t(){var r=Dat(arguments);this._terms=r.terms,this._constant=r.constant;}return t.prototype.terms=function(){return this._terms},t.prototype.constant=function(){return this._constant},t.prototype.value=function(){for(var r=this._constant,n=0,c=this._terms.size();n<c;n++){var s=this._terms.itemAt(n);r+=s.first.value()*s.second;}return r},t.prototype.plus=function(r){return new t(this,r)},t.prototype.minus=function(r){return new t(this,typeof r=="number"?-r:[-1,r])},t.prototype.multiply=function(r){return new t([r,this])},t.prototype.divide=function(r){return new t([1/r,this])},t.prototype.isConstant=function(){return this._terms.size()==0},t.prototype.toString=function(){var r=this._terms.array.map(function(n){return n.second+"*"+n.first.toString()}).join(" + ");return !this.isConstant()&&this._constant!==0&&(r+=" + "),r+=this._constant,r},t})();});var xu,C4=Cn(()=>{xu=(function(){function t(){}return t.create=function(r,n,c,s){s===void 0&&(s=1);var e=0;return e+=Math.max(0,Math.min(1e3,r*s))*1e6,e+=Math.max(0,Math.min(1e3,n*s))*1e3,e+=Math.max(0,Math.min(1e3,c*s)),e},t.clip=function(r){return Math.max(0,Math.min(t.required,r))},t.required=t.create(1e3,1e3,1e3),t.strong=t.create(1,0,0),t.medium=t.create(0,1,0),t.weak=t.create(0,0,1),t})();});var Lu,Vl,Lat,Mb=Cn(()=>{Tv();C4();(function(t){t[t.Le=0]="Le",t[t.Ge=1]="Ge",t[t.Eq=2]="Eq";})(Lu||(Lu={}));Vl=(function(){function t(r,n,c,s){s===void 0&&(s=xu.required),this._id=Lat++,this._operator=n,this._strength=xu.clip(s),c===void 0&&r instanceof L1?this._expression=r:this._expression=r.minus(c);}return t.prototype.id=function(){return this._id},t.prototype.expression=function(){return this._expression},t.prototype.op=function(){return this._operator},t.prototype.strength=function(){return this._strength},t.prototype.toString=function(){return this._expression.toString()+" "+["<=",">=","="][this._operator]+" 0 ("+this._strength.toString()+")"},t})(),Lat=0;});function N4(t){var r=1e-8;return t<0?-t<r:t<r}function Pat(){return ix()}function Mat(){return ix()}function kat(){return ix()}function Fat(){return ix()}var R4,Da,cP,sx,lP,hP=Cn(()=>{Mb();Tv();Lb();C4();R4=(function(){function t(){this._cnMap=Pat(),this._rowMap=Mat(),this._varMap=kat(),this._editMap=Fat(),this._infeasibleRows=[],this._objective=new lP,this._artificial=null,this._idTick=0;}return t.prototype.createConstraint=function(r,n,c,s){s===void 0&&(s=xu.required);var e=new Vl(r,n,c,s);return this.addConstraint(e),e},t.prototype.addConstraint=function(r){var n=this._cnMap.find(r);if(n!==void 0)throw new Error("duplicate constraint");var c=this._createRow(r),s=c.row,e=c.tag,i=this._chooseSubject(s,e);if(i.type()===Da.Invalid&&s.allDummies())if(N4(s.constant()))i=e.marker;else throw new Error("unsatisfiable constraint");if(i.type()===Da.Invalid){if(!this._addWithArtificialVariable(s))throw new Error("unsatisfiable constraint")}else s.solveFor(i),this._substitute(i,s),this._rowMap.insert(i,s);this._cnMap.insert(r,e),this._optimize(this._objective);},t.prototype.removeConstraint=function(r){var n=this._cnMap.erase(r);if(n===void 0)throw new Error("unknown constraint");this._removeConstraintEffects(r,n.second);var c=n.second.marker,s=this._rowMap.erase(c);if(s===void 0){var e=this._getMarkerLeavingSymbol(c);if(e.type()===Da.Invalid)throw new Error("failed to find leaving row");s=this._rowMap.erase(e),s.second.solveForEx(e,c),this._substitute(c,s.second);}this._optimize(this._objective);},t.prototype.hasConstraint=function(r){return this._cnMap.contains(r)},t.prototype.addEditVariable=function(r,n){var c=this._editMap.find(r);if(c!==void 0)throw new Error("duplicate edit variable");if(n=xu.clip(n),n===xu.required)throw new Error("bad required strength");var s=new L1(r),e=new Vl(s,Lu.Eq,void 0,n);this.addConstraint(e);var i=this._cnMap.find(e).second,o={tag:i,constraint:e,constant:0};this._editMap.insert(r,o);},t.prototype.removeEditVariable=function(r){var n=this._editMap.erase(r);if(n===void 0)throw new Error("unknown edit variable");this.removeConstraint(n.second.constraint);},t.prototype.hasEditVariable=function(r){return this._editMap.contains(r)},t.prototype.suggestValue=function(r,n){var c=this._editMap.find(r);if(c===void 0)throw new Error("unknown edit variable");var s=this._rowMap,e=c.second,i=n-e.constant;e.constant=n;var o=e.tag.marker,p=s.find(o);if(p!==void 0){p.second.add(-i)<0&&this._infeasibleRows.push(o),this._dualOptimize();return}var E=e.tag.other;if(p=s.find(E),p!==void 0){p.second.add(i)<0&&this._infeasibleRows.push(E),this._dualOptimize();return}for(var b=0,y=s.size();b<y;++b){var m=s.itemAt(b),a=m.second,l=a.coefficientFor(o);l!==0&&a.add(i*l)<0&&m.first.type()!==Da.External&&this._infeasibleRows.push(m.first);}this._dualOptimize();},t.prototype.updateVariables=function(){for(var r=this._varMap,n=this._rowMap,c=0,s=r.size();c<s;++c){var e=r.itemAt(c),i=n.find(e.second);i!==void 0?e.first.setValue(i.second.constant()):e.first.setValue(0);}},t.prototype._getVarSymbol=function(r){var n=this,c=function(){return n._makeSymbol(Da.External)};return this._varMap.setDefault(r,c).second},t.prototype._createRow=function(r){for(var n=r.expression(),c=new lP(n.constant()),s=n.terms(),e=0,i=s.size();e<i;++e){var o=s.itemAt(e);if(!N4(o.second)){var p=this._getVarSymbol(o.first),E=this._rowMap.find(p);E!==void 0?c.insertRow(E.second,o.second):c.insertSymbol(p,o.second);}}var b=this._objective,y=r.strength(),m={marker:sx,other:sx};switch(r.op()){case Lu.Le:case Lu.Ge:{var a=r.op()===Lu.Le?1:-1,l=this._makeSymbol(Da.Slack);if(m.marker=l,c.insertSymbol(l,a),y<xu.required){var u=this._makeSymbol(Da.Error);m.other=u,c.insertSymbol(u,-a),b.insertSymbol(u,y);}break}case Lu.Eq:{if(y<xu.required){var h=this._makeSymbol(Da.Error),d=this._makeSymbol(Da.Error);m.marker=h,m.other=d,c.insertSymbol(h,-1),c.insertSymbol(d,1),b.insertSymbol(h,y),b.insertSymbol(d,y);}else {var g=this._makeSymbol(Da.Dummy);m.marker=g,c.insertSymbol(g);}break}}return c.constant()<0&&c.reverseSign(),{row:c,tag:m}},t.prototype._chooseSubject=function(r,n){for(var c=r.cells(),s=0,e=c.size();s<e;++s){var i=c.itemAt(s);if(i.first.type()===Da.External)return i.first}var o=n.marker.type();return (o===Da.Slack||o===Da.Error)&&r.coefficientFor(n.marker)<0?n.marker:(o=n.other.type(),(o===Da.Slack||o===Da.Error)&&r.coefficientFor(n.other)<0?n.other:sx)},t.prototype._addWithArtificialVariable=function(r){var n=this._makeSymbol(Da.Slack);this._rowMap.insert(n,r.copy()),this._artificial=r.copy(),this._optimize(this._artificial);var c=N4(this._artificial.constant());this._artificial=null;var s=this._rowMap.erase(n);if(s!==void 0){var e=s.second;if(e.isConstant())return c;var i=this._anyPivotableSymbol(e);if(i.type()===Da.Invalid)return false;e.solveForEx(n,i),this._substitute(i,e),this._rowMap.insert(i,e);}for(var o=this._rowMap,p=0,E=o.size();p<E;++p)o.itemAt(p).second.removeSymbol(n);return this._objective.removeSymbol(n),c},t.prototype._substitute=function(r,n){for(var c=this._rowMap,s=0,e=c.size();s<e;++s){var i=c.itemAt(s);i.second.substitute(r,n),i.second.constant()<0&&i.first.type()!==Da.External&&this._infeasibleRows.push(i.first);}this._objective.substitute(r,n),this._artificial&&this._artificial.substitute(r,n);},t.prototype._optimize=function(r){for(;;){var n=this._getEnteringSymbol(r);if(n.type()===Da.Invalid)return;var c=this._getLeavingSymbol(n);if(c.type()===Da.Invalid)throw new Error("the objective is unbounded");var s=this._rowMap.erase(c).second;s.solveForEx(c,n),this._substitute(n,s),this._rowMap.insert(n,s);}},t.prototype._dualOptimize=function(){for(var r=this._rowMap,n=this._infeasibleRows;n.length!==0;){var c=n.pop(),s=r.find(c);if(s!==void 0&&s.second.constant()<0){var e=this._getDualEnteringSymbol(s.second);if(e.type()===Da.Invalid)throw new Error("dual optimize failed");var i=s.second;r.erase(c),i.solveForEx(c,e),this._substitute(e,i),r.insert(e,i);}}},t.prototype._getEnteringSymbol=function(r){for(var n=r.cells(),c=0,s=n.size();c<s;++c){var e=n.itemAt(c),i=e.first;if(e.second<0&&i.type()!==Da.Dummy)return i}return sx},t.prototype._getDualEnteringSymbol=function(r){for(var n=Number.MAX_VALUE,c=sx,s=r.cells(),e=0,i=s.size();e<i;++e){var o=s.itemAt(e),p=o.first,E=o.second;if(E>0&&p.type()!==Da.Dummy){var b=this._objective.coefficientFor(p),y=b/E;y<n&&(n=y,c=p);}}return c},t.prototype._getLeavingSymbol=function(r){for(var n=Number.MAX_VALUE,c=sx,s=this._rowMap,e=0,i=s.size();e<i;++e){var o=s.itemAt(e),p=o.first;if(p.type()!==Da.External){var E=o.second,b=E.coefficientFor(r);if(b<0){var y=-E.constant()/b;y<n&&(n=y,c=p);}}}return c},t.prototype._getMarkerLeavingSymbol=function(r){for(var n=Number.MAX_VALUE,c=n,s=n,e=sx,i=e,o=e,p=e,E=this._rowMap,b=0,y=E.size();b<y;++b){var m=E.itemAt(b),a=m.second,l=a.coefficientFor(r);if(l!==0){var u=m.first;if(u.type()===Da.External)p=u;else if(l<0){var h=-a.constant()/l;h<c&&(c=h,i=u);}else {var h=a.constant()/l;h<s&&(s=h,o=u);}}}return i!==e?i:o!==e?o:p},t.prototype._removeConstraintEffects=function(r,n){n.marker.type()===Da.Error&&this._removeMarkerEffects(n.marker,r.strength()),n.other.type()===Da.Error&&this._removeMarkerEffects(n.other,r.strength());},t.prototype._removeMarkerEffects=function(r,n){var c=this._rowMap.find(r);c!==void 0?this._objective.insertRow(c.second,-n):this._objective.insertSymbol(r,-n);},t.prototype._anyPivotableSymbol=function(r){for(var n=r.cells(),c=0,s=n.size();c<s;++c){var e=n.itemAt(c),i=e.first.type();if(i===Da.Slack||i===Da.Error)return e.first}return sx},t.prototype._makeSymbol=function(r){return new cP(r,this._idTick++)},t})();(function(t){t[t.Invalid=0]="Invalid",t[t.External=1]="External",t[t.Slack=2]="Slack",t[t.Error=3]="Error",t[t.Dummy=4]="Dummy";})(Da||(Da={}));cP=(function(){function t(r,n){this._id=n,this._type=r;}return t.prototype.id=function(){return this._id},t.prototype.type=function(){return this._type},t})(),sx=new cP(Da.Invalid,-1),lP=(function(){function t(r){r===void 0&&(r=0),this._cellMap=ix(),this._constant=r;}return t.prototype.cells=function(){return this._cellMap},t.prototype.constant=function(){return this._constant},t.prototype.isConstant=function(){return this._cellMap.empty()},t.prototype.allDummies=function(){for(var r=this._cellMap,n=0,c=r.size();n<c;++n){var s=r.itemAt(n);if(s.first.type()!==Da.Dummy)return false}return true},t.prototype.copy=function(){var r=new t(this._constant);return r._cellMap=this._cellMap.copy(),r},t.prototype.add=function(r){return this._constant+=r},t.prototype.insertSymbol=function(r,n){n===void 0&&(n=1);var c=this._cellMap.setDefault(r,function(){return 0});N4(c.second+=n)&&this._cellMap.erase(r);},t.prototype.insertRow=function(r,n){n===void 0&&(n=1),this._constant+=r._constant*n;for(var c=r._cellMap,s=0,e=c.size();s<e;++s){var i=c.itemAt(s);this.insertSymbol(i.first,i.second*n);}},t.prototype.removeSymbol=function(r){this._cellMap.erase(r);},t.prototype.reverseSign=function(){this._constant=-this._constant;for(var r=this._cellMap,n=0,c=r.size();n<c;++n){var s=r.itemAt(n);s.second=-s.second;}},t.prototype.solveFor=function(r){var n=this._cellMap,c=n.erase(r),s=-1/c.second;this._constant*=s;for(var e=0,i=n.size();e<i;++e)n.itemAt(e).second*=s;},t.prototype.solveForEx=function(r,n){this.insertSymbol(r,-1),this.solveFor(n);},t.prototype.coefficientFor=function(r){var n=this._cellMap.find(r);return n!==void 0?n.second:0},t.prototype.substitute=function(r,n){var c=this._cellMap.erase(r);c!==void 0&&this.insertRow(n,c.second);},t})();});var fP=Cn(()=>{Mb();Tv();hP();C4();Pb();});function Bat(t){return t.type==="positional-conflict"}function jat(t){return t.type==="group-overlap"}function Uat(t){return t?.type==="hidden-node-conflict"}function fg(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function kb(t){if(t.attributes&&Object.entries(t.attributes).some(([n,c])=>c&&c.length>0)){let n=t.attributes||{},c=Object.entries(n).sort(([o],[p])=>o.localeCompare(p)),s=[],e=2,i=20;for(let o=0;o<Math.min(c.length,e);o++){let[p,E]=c[o];if(E&&E.length>0){let b=E[0];b.length>i&&(b=b.substring(0,i)+"..."),s.push(`${fg(p)}: ${fg(b)}`);}}if(c.length>e&&s.push("..."),s.length>0)return `${fg(t.label)} (${s.join(", ")})`}return t.label&&t.label!==t.id?`<span title="${dP}">${fg(t.label)} (id = ${fg(t.id)})</span>`:`<span title="${dP}">${fg(t.id)}</span>`}function ox(t){let r=kb;if(Uh(t)){let n=t;return `${r(n.top)} must be above ${r(n.bottom)}`}else if(Kh(t)){let n=t;return `${r(n.left)} must be to the left of ${r(n.right)}`}else if(W0(t)){let n=t,c=n.axis,s=n.node1,e=n.node2;return c==="x"?`${r(s)} must be vertically aligned with ${r(e)}`:c==="y"?`${r(s)} must be horizontally aligned with ${r(e)}`:`${r(s)} must be aligned with ${r(e)} along the ${c} axis`}else if(mh(t)){let n=t;return `${r(n.node)} cannot be in group "${n.group.name}".`}else if(w1(t)){let n=t,c={left:"to the left of",right:"to the right of",top:"above",bottom:"below"};return `Group "${n.groupA.name}" must be ${c[n.side]} group "${n.groupB.name}"`}return `Unknown constraint type: ${t}`}var dP,bv,Fb=Cn(()=>{fP();Wm();O3();dP="This is a unique identifier in the graph. Hover over graph nodes to see their IDs.";bv=class{constructor(r){this.kiwiConstraintCache=new Map;this.expressionCache=new Map;this.boundingBoxMemberConstraints=[];this.minPadding=15;this.horizontallyAligned=[];this.verticallyAligned=[];this.horizontalAlignmentMap=new Map;this.verticalAlignmentMap=new Map;this.layout=r,this.solver=new R4,this.nodes=r.nodes,this.edges=r.edges,this.orientationConstraints=r.constraints,this.variables={},this.groupBoundingBoxes=new Map,this.groups=r.groups,this.added_constraints=[];}validateConstraints(){return this.validateGroupConstraints()||this.validatePositionalConstraints()}validatePositionalConstraints(){this.nodes.forEach(p=>{let E=this.getNodeIndex(p.id);this.variables[E]={x:new rd(`${p.id}_x`),y:new rd(`${p.id}_y`)};});for(let p=0;p<this.orientationConstraints.length;p++){let E=this.orientationConstraints[p],b=this.addConstraintToSolver(E);if(b)return b}let r=this.added_constraints.length,{dedupedGroups:n,groupMap:c}=this.deduplicateGroups(this.groups),s=this.groups;this.groups=n;try{let p=this.addGroupBoundingBoxConstraints();if(p)return p}finally{this.groups=s;}let e=this.layout.disjunctiveConstraints||[];if(e.length>0){let p=this.solveDisjunctiveConstraints(e);if(!p.satisfiable)return p.error||null;let E=this.added_constraints.slice(r);console.assert(E.length>0,"Disjunctive solver succeeded but no constraints were added"),this.layout.constraints=this.layout.constraints.concat(E);}this.solver.updateVariables();let i=this.getAlignmentOrders(),o=this.detectNodeOverlaps();return o||(this.layout.constraints=this.layout.constraints.concat(i),null)}solveDisjunctiveConstraints(r){let n=this.added_constraints.length,c=this.backtrackDisjunctions(r,0);return c.satisfiable&&this.added_constraints.length-n>0,c}getChosenDisjunctiveConstraints(r){return this.added_constraints.slice(r)}hasObviousConflict(r){let n=new Set,c=new Set;for(let s of this.added_constraints)Kh(s)?n.add(`${s.left.id}:${s.right.id}`):Uh(s)&&c.add(`${s.top.id}:${s.bottom.id}`);for(let s of r)if(Kh(s)){let e=`${s.right.id}:${s.left.id}`;if(n.has(e))return true}else if(Uh(s)){let e=`${s.bottom.id}:${s.top.id}`;if(c.has(e))return true}return false}orderAlternativesByHeuristic(r){let n=[...r];return n.sort((c,s)=>{if(c.length!==s.length)return c.length-s.length;let e=c.some(o=>mh(o)&&(o.side==="left"||o.side==="right")),i=s.some(o=>mh(o)&&(o.side==="left"||o.side==="right"));return e&&!i?-1:!e&&i?1:0}),n}backtrackDisjunctions(r,n){if(n>=r.length)return {satisfiable:true};let c=r[n],s=this.orderAlternativesByHeuristic(c.alternatives),e=0,i=0,o=0,p;for(let S=0;S<s.length;S++){let v=s[S];if(this.hasObviousConflict(v))continue;let T=this.cloneSolver(),q=[...this.added_constraints],G=this.added_constraints.length,j=null,B=0;for(let $ of v){let z=this.addConstraintToSolver($);if(z){j=z;break}B++;}let J=0,w;if(!j){let $=this.backtrackDisjunctions(r,n+1);if($.satisfiable)return {satisfiable:true};J=this.added_constraints.length-G,w=$.error;}(J>o||J===o&&B>i)&&(e=S,i=B,o=J,w&&(p=w)),this.restoreSolver(T),this.added_constraints=q,console.assert(this.added_constraints.length===G,`Backtracking failed: expected ${G} constraints, got ${this.added_constraints.length}`);}if(p&&o>0)return {satisfiable:false,error:p};let E=s[e],b=this.getMinimalDisjunctiveConflict(this.added_constraints,E,c.sourceConstraint),y=E[0];if(E.some(S=>mh(S))&&b.existingConstraints.length>0){let S=new Set;E.forEach(T=>{mh(T)&&T.group.nodeIds.forEach(q=>S.add(q));});let v=b.existingConstraints.find(T=>Kh(T)?S.has(T.left.id)||S.has(T.right.id):Uh(T)?S.has(T.top.id)||S.has(T.bottom.id):W0(T)?S.has(T.node1.id)||S.has(T.node2.id):false);v&&(y=v);}let a=new Map,l=[...b.existingConstraints,...b.disjunctiveConstraints],u=new Map;for(let S of l){let v=this.getConstraintKey(S);u.has(v)||u.set(v,S);}let h=this.removeTransitiveConstraints(Array.from(u.values()));for(let S of h){let v=S.sourceConstraint;a.has(v)||a.set(v,[]),a.get(v).push(S);}let d=ox(y),g=new Map;for(let[S,v]of a.entries()){let T=S.toHTML();g.has(T)||g.set(T,[]),v.forEach(q=>{g.get(T).push(ox(q));});}return {satisfiable:false,error:{name:"PositionalConstraintError",type:"positional-conflict",message:`Constraint "${d}" conflicts with existing constraints`,conflictingConstraint:y,conflictingSourceConstraint:c.sourceConstraint,minimalConflictingSet:a,errorMessages:{conflictingConstraint:d,conflictingSourceConstraint:c.sourceConstraint.toHTML(),minimalConflictingConstraints:g}}}}getVarPlusConstant(r,n){let c=`${r.name()}_plus_${n}`,s=this.expressionCache.get(c);return s||(s=r.plus(n),this.expressionCache.set(c,s)),s}getConstraintKey(r){if(Kh(r))return `left:${r.left.id}:${r.right.id}`;if(Uh(r))return `top:${r.top.id}:${r.bottom.id}`;if(W0(r)){let[n,c]=[r.node1.id,r.node2.id].sort();return `align:${n}:${c}:${r.axis}`}return mh(r)?`bbox:${r.node.id}:${r.group.name}:${r.side}`:w1(r)?`groupbound:${r.groupA.name}:${r.groupB.name}:${r.side}`:`unknown:${JSON.stringify(r)}`}areAlignmentsIdentical(r,n){return r.axis===n.axis&&(r.node1.id===n.node1.id&&r.node2.id===n.node2.id||r.node1.id===n.node2.id&&r.node2.id===n.node1.id)}areConstraintsIdentical(r,n){return r===n?true:Kh(r)&&Kh(n)?r.left.id===n.left.id&&r.right.id===n.right.id:Uh(r)&&Uh(n)?r.top.id===n.top.id&&r.bottom.id===n.bottom.id:W0(r)&&W0(n)?this.areAlignmentsIdentical(r,n):mh(r)&&mh(n)?r.node.id===n.node.id&&r.group.name===n.group.name&&r.side===n.side:w1(r)&&w1(n)?r.groupA.name===n.groupA.name&&r.groupB.name===n.groupB.name&&r.side===n.side:false}cloneSolver(){let r=new R4;this.addBoundingBoxMemberConstraintsToSolver(r);for(let n of this.added_constraints)this.constraintToKiwi(n).forEach(s=>{r.addConstraint(s);});return r}restoreSolver(r){this.solver=r;}validateGroupConstraints(){for(let r=0;r<this.groups.length;r++){let n=this.groups[r];for(let c=r+1;c<this.groups.length;c++){let s=this.groups[c];if(this.isSubGroup(n,s)||this.isSubGroup(s,n))continue;let e=this.groupIntersection(n,s);if(e.length>0){let i=e.map(E=>this.nodes.find(b=>b.id===E)).filter(E=>E!==void 0),o=i.map(E=>E.label&&E.label!==E.id?`${E.label} (${E.id})`:E.id);return {name:"GroupOverlapError",type:"group-overlap",message:`Groups <b>"${n.name}"</b> and <b>"${s.name}"</b> overlap with nodes: ${o.join(", ")}`,group1:n,group2:s,overlappingNodes:i}}}}return null}addGroupBoundingBoxConstraints(){let r=new Map;for(let n of this.nodes)r.set(n.id,new Set);for(let n of this.groups)if(n.nodeIds.length>1&&n.sourceConstraint)for(let c of n.nodeIds)r.get(c)?.add(n);for(let n of this.groups){if(n.nodeIds.length<=1||!n.sourceConstraint)continue;let c=n.nodeIds.map(E=>this.nodes.find(b=>b.id===E)).filter(E=>E!==void 0);if(c.length===0)continue;let s=new Set(n.nodeIds),e=new rd(`${n.name}_bbox_left`),i=new rd(`${n.name}_bbox_right`),o=new rd(`${n.name}_bbox_top`),p=new rd(`${n.name}_bbox_bottom`);this.groupBoundingBoxes.set(n.name,{left:e,right:i,top:o,bottom:p});for(let E of c){let b=this.getNodeIndex(E.id),y=this.variables[b].x,m=this.variables[b].y,a=new Vl(y,Lu.Ge,e,xu.required),l=new Vl(y,Lu.Le,i,xu.required),u=new Vl(m,Lu.Ge,o,xu.required),h=new Vl(m,Lu.Le,p,xu.required);this.boundingBoxMemberConstraints.push(a,l,u,h),this.solver.addConstraint(a),this.solver.addConstraint(l),this.solver.addConstraint(u),this.solver.addConstraint(h);}for(let E of this.nodes){if(s.has(E.id))continue;let b=r.get(E.id);if(b&&b.size>0)continue;let y=n.sourceConstraint,m={group:n,node:E,side:"left",minDistance:this.minPadding,sourceConstraint:y},a={group:n,node:E,side:"right",minDistance:this.minPadding,sourceConstraint:y},l={group:n,node:E,side:"top",minDistance:this.minPadding,sourceConstraint:y},u={group:n,node:E,side:"bottom",minDistance:this.minPadding,sourceConstraint:y},h=new $p(y,[[m],[a],[l],[u]]);this.layout.disjunctiveConstraints||(this.layout.disjunctiveConstraints=[]),this.layout.disjunctiveConstraints.push(h);}}for(let n=0;n<this.groups.length;n++)for(let c=n+1;c<this.groups.length;c++){let s=this.groups[n],e=this.groups[c];if(s.nodeIds.length<=1||e.nodeIds.length<=1||this.isSubGroup(s,e)||this.isSubGroup(e,s)||this.groupIntersection(s,e).length>0)continue;let o={groupA:s,groupB:e,side:"left",minDistance:this.minPadding,sourceConstraint:s.sourceConstraint||e.sourceConstraint},p={groupA:s,groupB:e,side:"right",minDistance:this.minPadding,sourceConstraint:s.sourceConstraint||e.sourceConstraint},E={groupA:s,groupB:e,side:"top",minDistance:this.minPadding,sourceConstraint:s.sourceConstraint||e.sourceConstraint},b={groupA:s,groupB:e,side:"bottom",minDistance:this.minPadding,sourceConstraint:s.sourceConstraint||e.sourceConstraint},y=new $p(s.sourceConstraint||e.sourceConstraint,[[o],[p],[E],[b]]);this.layout.disjunctiveConstraints||(this.layout.disjunctiveConstraints=[]),this.layout.disjunctiveConstraints.push(y);}return null}getNodeIndex(r){return this.nodes.findIndex(n=>n.id===r)}deduplicateGroups(r){let n=new Map;for(let e of r){if(e.nodeIds.length<=1){let p=`_singleton_${e.nodeIds[0]||"empty"}_${Math.random()}`;n.set(p,[e]);continue}let o=[...e.nodeIds].sort().join("|");n.has(o)||n.set(o,[]),n.get(o).push(e);}let c=[],s=new Map;for(let e of n.values()){let i=e[0];c.push(i),s.set(i,e),e.length>1&&console.log(`Deduplicating ${e.length} groups with identical members: ${e.map(o=>o.name).join(", ")}`);}return {dedupedGroups:c,groupMap:s}}addBoundingBoxMemberConstraintsToSolver(r,n=true){if(n&&this.boundingBoxMemberConstraints.length>0)for(let c of this.boundingBoxMemberConstraints)try{r.addConstraint(c);}catch{}else for(let c of this.groups){if(c.nodeIds.length<=1||!c.sourceConstraint)continue;let s=this.groupBoundingBoxes.get(c.name);if(!s)continue;let e=c.nodeIds.map(i=>this.nodes.find(o=>o.id===i)).filter(i=>i!==void 0);for(let i of e){let o=this.getNodeIndex(i.id),p=this.variables[o].x,E=this.variables[o].y;try{r.addConstraint(new Vl(p,Lu.Ge,s.left,xu.required)),r.addConstraint(new Vl(p,Lu.Le,s.right,xu.required)),r.addConstraint(new Vl(E,Lu.Ge,s.top,xu.required)),r.addConstraint(new Vl(E,Lu.Le,s.bottom,xu.required));}catch{}}}}getMinimalDisjunctiveConflict(r,n,c){return n.some(e=>mh(e))||r.some(e=>mh(e))?this.getMinimalGroupingConflict(r,n):this.getMinimalSimpleConflict(r,n)}getMinimalGroupingConflict(r,n){let c=[...r];if(n.length>0){let s=n[0],e=[...r,s];this.isConflictingSet(e)?c=this.getMinimalConflictingConstraints(r,s):c=[];}if(c.length<=1&&n.some(s=>mh(s))){let s=new Set;for(let i of n)mh(i)&&(s.add(i.node.id),i.group.nodeIds.forEach(o=>s.add(o)));let e=r.filter(i=>Kh(i)?s.has(i.left.id)||s.has(i.right.id):Uh(i)?s.has(i.top.id)||s.has(i.bottom.id):W0(i)?s.has(i.node1.id)||s.has(i.node2.id):false);e.length>0&&(c=e);}return {existingConstraints:c,disjunctiveConstraints:n}}getMinimalSimpleConflict(r,n){let c=[...r],s=[...n];if(!this.isConflicting(c,s))return {existingConstraints:[],disjunctiveConstraints:n.length>0?[n[0]]:[]};let e=true;for(;e&&c.length>0;){e=false;for(let i=c.length-1;i>=0;i--){let o=c.slice(0,i).concat(c.slice(i+1));this.isConflicting(o,s)&&(c=o,e=true);}}for(e=true;e&&s.length>0;){e=false;for(let i=s.length-1;i>=0;i--){let o=s.slice(0,i).concat(s.slice(i+1));this.isConflicting(c,o)&&(s=o,e=true);}}for(e=true;e&&c.length>0;){e=false;for(let i=c.length-1;i>=0;i--){let o=c.slice(0,i).concat(c.slice(i+1));this.isConflicting(o,s)&&(c=o,e=true);}}return c.length===0&&s.length===0&&(c=r.length>0?[r[0]]:[],s=n.length>0?[n[0]]:[]),{existingConstraints:c,disjunctiveConstraints:s}}isConflicting(r,n){return this.isConflictingSet([...r,...n])}isConflictingSet(r){let n=new R4;try{if(r.some(s=>mh(s)||w1(s))){let s=new Map,e=new Set;r.forEach(o=>{mh(o)?e.add(o.group.name):w1(o)&&(e.add(o.groupA.name),e.add(o.groupB.name));}),e.forEach(o=>{s.set(o,{left:new rd(`test_${o}_bbox_left`),right:new rd(`test_${o}_bbox_right`),top:new rd(`test_${o}_bbox_top`),bottom:new rd(`test_${o}_bbox_bottom`)});});let i=this.groupBoundingBoxes;this.groupBoundingBoxes=s;try{this.addBoundingBoxMemberConstraintsToSolver(n,!1);for(let o of r)this.constraintToKiwi(o).forEach(E=>n.addConstraint(E));return n.updateVariables(),!1}finally{this.groupBoundingBoxes=i;}}else {for(let s of r)this.constraintToKiwi(s).forEach(i=>n.addConstraint(i));return n.updateVariables(),!1}}catch{return true}}getMinimalConflictingConstraints(r,n){let c=[...r,n];if(!this.isConflictingSet(c))return [];let s=[...r],e=true;for(;e&&s.length>0;){e=false;for(let i=s.length-1;i>=0;i--){let o=s.slice(0,i).concat(s.slice(i+1)),p=[...o,n];this.isConflictingSet(p)&&(s=o,e=true);}}return s=this.removeTransitiveConstraints(s),s}removeTransitiveConstraints(r){let n=this.removeTransitiveAlignments(r);return n=this.removeTransitiveOrderings(n),n}removeTransitiveOrderings(r){let n=r.filter(i=>Kh(i)),c=r.filter(i=>Uh(i)),e=[...r.filter(i=>!Kh(i)&&!Uh(i))];return n.length>0&&e.push(...this.transitiveReduction(n,i=>i.left.id,i=>i.right.id)),c.length>0&&e.push(...this.transitiveReduction(c,i=>i.top.id,i=>i.bottom.id)),e}transitiveReduction(r,n,c){if(r.length<=1)return r;let s=new Map,e=new Map;for(let b of r){let y=n(b),m=c(b);s.has(y)||s.set(y,new Set),s.get(y).add(m),e.set(`${y}->${m}`,b);}let i=new Set;for(let[b,y]of s.entries())i.add(b),y.forEach(m=>i.add(m));let o=Array.from(i),p=new Map;for(let b of o)p.set(b,new Set(s.get(b)||[]));for(let b of o)for(let y of o)for(let m of o)p.get(y)?.has(b)&&p.get(b)?.has(m)&&p.get(y).add(m);let E=[];for(let b of r){let y=n(b),m=c(b),a=false,l=s.get(y);if(l&&l.size>1){for(let u of l)if(u!==m&&p.get(u)?.has(m)){a=true;break}}a||E.push(b);}return E}removeTransitiveAlignments(r){let n=r.filter(i=>W0(i)),c=r.filter(i=>!W0(i));if(n.length<=2)return r;let s=new Map;for(let i of n)s.has(i.axis)||s.set(i.axis,[]),s.get(i.axis).push(i);let e=[...c];for(let[i,o]of s.entries()){if(o.length<=2){e.push(...o);continue}let p=new Map;for(let a of o){let l=a.node1.id,u=a.node2.id;p.has(l)||p.set(l,new Set),p.has(u)||p.set(u,new Set),p.get(l).add(u),p.get(u).add(l);}let E=Array.from(p.keys());if(E.length===0)continue;let b=new Set,y=[E[0]];b.add(E[0]);let m=[];for(;y.length>0&&b.size<E.length;){let a=y.shift(),l=p.get(a);if(l){for(let u of l)if(!b.has(u)){b.add(u),y.push(u);let h=o.find(d=>d.node1.id===a&&d.node2.id===u||d.node2.id===a&&d.node1.id===u);h&&m.push(h);}}}e.push(...m);}return e}constraintToKiwi(r){let n=this.kiwiConstraintCache.get(r);if(n)return n;let c=this.convertConstraintToKiwi(r);return this.kiwiConstraintCache.set(r,c),c}convertConstraintToKiwi(r){if(Uh(r)){let n=r,c=n.top,s=n.bottom,e=c.height,i=this.getNodeIndex(c.id),o=this.getNodeIndex(s.id),p=this.variables[i].y,E=this.variables[o].y,b=this.getVarPlusConstant(p,e);return [new Vl(b,Lu.Le,E,xu.required)]}else if(Kh(r)){let n=r,c=n.left,s=n.right,e=c.width,i=this.getNodeIndex(c.id),o=this.getNodeIndex(s.id),p=this.variables[i].x,E=this.variables[o].x,b=this.getVarPlusConstant(p,e);return [new Vl(b,Lu.Le,E,xu.required)]}else if(W0(r)){let n=r,c=n.axis,s=n.node1,e=n.node2,i=this.getNodeIndex(s.id),o=this.getNodeIndex(e.id),p=this.variables[i][c],E=this.variables[o][c],b=this.getNodePairKey(s.id,e.id);return c==="x"?(this.verticallyAligned.push([s,e]),this.verticalAlignmentMap.has(b)||this.verticalAlignmentMap.set(b,[]),this.verticalAlignmentMap.get(b).push(n)):c==="y"&&(this.horizontallyAligned.push([s,e]),this.horizontalAlignmentMap.has(b)||this.horizontalAlignmentMap.set(b,[]),this.horizontalAlignmentMap.get(b).push(n)),[new Vl(p,Lu.Eq,E,xu.required)]}else if(mh(r)){let n=r,c=this.groupBoundingBoxes.get(n.group.name);if(!c)return console.error(`Bounding box not found for group ${n.group.name}`),[];let s=this.getNodeIndex(n.node.id),e=this.variables[s].x,i=this.variables[s].y;n.node.width||n.minDistance;n.node.height||n.minDistance;switch(n.side){case "left":return [new Vl(this.getVarPlusConstant(e,n.minDistance),Lu.Le,c.left,xu.required)];case "right":return [new Vl(e,Lu.Ge,this.getVarPlusConstant(c.right,n.minDistance),xu.required)];case "top":return [new Vl(this.getVarPlusConstant(i,n.minDistance),Lu.Le,c.top,xu.required)];case "bottom":return [new Vl(i,Lu.Ge,this.getVarPlusConstant(c.bottom,n.minDistance),xu.required)];default:return console.error(`Unknown bounding box side: ${n.side}`),[]}}else if(w1(r)){let n=r,c=this.groupBoundingBoxes.get(n.groupA.name),s=this.groupBoundingBoxes.get(n.groupB.name);if(!c||!s)return console.error(`Bounding box not found for groups ${n.groupA.name} or ${n.groupB.name}`),[];switch(n.side){case "left":return [new Vl(this.getVarPlusConstant(c.right,n.minDistance),Lu.Le,s.left,xu.required)];case "right":return [new Vl(this.getVarPlusConstant(s.right,n.minDistance),Lu.Le,c.left,xu.required)];case "top":return [new Vl(this.getVarPlusConstant(c.bottom,n.minDistance),Lu.Le,s.top,xu.required)];case "bottom":return [new Vl(this.getVarPlusConstant(s.bottom,n.minDistance),Lu.Le,c.top,xu.required)];default:return console.error(`Unknown group boundary side: ${n.side}`),[]}}else return []}addConstraintToSolver(r){try{this.constraintToKiwi(r).forEach(c=>{this.solver.addConstraint(c);}),this.added_constraints.push(r);}catch{let c=this.getMinimalConflictingConstraints(this.added_constraints,r),s=new Map,e=new Map;return c.forEach(o=>{let p=o.sourceConstraint;s.has(p)||s.set(p,[]),e.has(p.toHTML())||e.set(p.toHTML(),[]),s.get(p).push(o),e.get(p.toHTML()).push(ox(o));}),{name:"PositionalConstraintError",type:"positional-conflict",message:`Constraint "${ox(r)}" conflicts with existing constraints`,conflictingConstraint:r,conflictingSourceConstraint:r.sourceConstraint,minimalConflictingSet:s,errorMessages:{conflictingConstraint:`${ox(r)}`,conflictingSourceConstraint:`${r.sourceConstraint.toHTML()}`,minimalConflictingConstraints:e}}}return null}getAlignmentOrders(){this.solver.updateVariables(),this.horizontallyAligned=this.normalizeAlignment(this.horizontallyAligned),this.verticallyAligned=this.normalizeAlignment(this.verticallyAligned);let r=[];for(let n=0;n<this.horizontallyAligned.length;n++)this.horizontallyAligned[n].sort((c,s)=>{let e=this.variables[this.getNodeIndex(c.id)].x.value(),i=this.variables[this.getNodeIndex(s.id)].x.value();return e-i});this.horizontallyAligned.forEach(n=>{for(let c=0;c<n.length-1;c++){let s=n[c],e=n[c+1],i=new A3(["directlyLeft"],`${s.id}->${e.id}`),o=new Ym(i,"Preventing Overlap"),p={left:s,right:e,minDistance:this.minPadding,sourceConstraint:o};r.push(p);}});for(let n=0;n<this.verticallyAligned.length;n++)this.verticallyAligned[n].sort((c,s)=>{let e=this.variables[this.getNodeIndex(c.id)].y.value(),i=this.variables[this.getNodeIndex(s.id)].y.value();return e-i});return this.verticallyAligned.forEach(n=>{for(let c=0;c<n.length-1;c++){let s=n[c],e=n[c+1],i=new A3(["directlyAbove"],`${s.id}->${e.id}`),o=new Ym(i,"Preventing Overlap"),p={top:s,bottom:e,minDistance:this.minPadding,sourceConstraint:o};r.push(p);}}),r}normalizeAlignment(r){let n=[];for(let s of r){let e=false;for(let i of n)if(s.some(o=>i.includes(o))){i.push(...s.filter(o=>!i.includes(o))),e=true;break}e||n.push([...s]);}let c=true;for(;c;){c=false;for(let s=0;s<n.length;s++){for(let e=s+1;e<n.length;e++)if(n[s].some(i=>n[e].includes(i))){n[s].push(...n[e].filter(i=>!n[s].includes(i))),n.splice(e,1),c=true;break}if(c)break}}return n}isSubGroup(r,n){let c=r.nodeIds,s=n.nodeIds;return c.every(e=>s.includes(e))}groupIntersection(r,n){let c=r.nodeIds,s=n.nodeIds;return c.filter(i=>s.includes(i))}getNodePairKey(r,n){return r<n?`${r}|${n}`:`${n}|${r}`}detectNodeOverlaps(){let r=[],n=new Set;for(let p of this.horizontallyAligned){let E=new Set(p.map(b=>b.id));for(let b of this.verticallyAligned){let y=new Set(b.map(a=>a.id)),m=[];for(let a of E)y.has(a)&&m.push(a);if(m.length>=2)for(let a=0;a<m.length;a++)for(let l=a+1;l<m.length;l++){let u=this.nodes.find(_=>_.id===m[a]),h=this.nodes.find(_=>_.id===m[l]);r.push({node1:u,node2:h,overlappingNodeIds:m});let d=this.findAlignmentChain(u,h,this.horizontalAlignmentMap),g=this.findAlignmentChain(u,h,this.verticalAlignmentMap);d.forEach(_=>n.add(_)),g.forEach(_=>n.add(_));}}}if(r.length===0)return null;let c=new Map;for(let p of n){let E=p.sourceConstraint;c.has(E)||c.set(E,[]),c.get(E).push(p);}let s=new Map;for(let[p,E]of c.entries()){let b=p.toHTML();s.has(b)||s.set(b,[]);for(let y of E)s.get(b).push(ox(y));}let e=r.map(({node1:p,node2:E})=>`${kb(p)} and ${kb(E)}`),i=r.length===1?`Alignment constraints force ${e[0]} to occupy the same position`:`Alignment constraints force multiple node pairs to overlap: ${e.join("; ")}`,o=Array.from(n)[0];return {name:"PositionalConstraintError",type:"positional-conflict",message:i,conflictingConstraint:o,conflictingSourceConstraint:o.sourceConstraint,minimalConflictingSet:c,errorMessages:{conflictingConstraint:ox(o),conflictingSourceConstraint:o.sourceConstraint.toHTML(),minimalConflictingConstraints:s}}}findAlignmentChain(r,n,c){let s=new Map;for(let[o,p]of c.entries()){let[E,b]=o.split("|");s.has(E)||s.set(E,new Map),s.has(b)||s.set(b,new Map),s.get(E).set(b,p),s.get(b).set(E,p);}let e=new Set,i=[{nodeId:r.id,path:[]}];for(;i.length>0;){let{nodeId:o,path:p}=i.shift();if(o===n.id)return p;if(e.has(o))continue;e.add(o);let E=s.get(o);if(E)for(let[b,y]of E.entries())e.has(b)||i.push({nodeId:b,path:[...p,y[0]]});}return []}dispose(){this.kiwiConstraintCache.clear(),this.expressionCache.clear(),this.solver=null,this.variables={},this.groupBoundingBoxes.clear();}getMemoryStats(){return {cachedConstraints:this.kiwiConstraintCache.size,cachedExpressions:this.expressionCache.size,variables:Object.keys(this.variables).length,groupBoundingBoxes:this.groupBoundingBoxes.size,addedConstraints:this.added_constraints?.length||0}}};});function $at(t){return t instanceof w4}function Hat(t){let r=[],n=new Set;for(let c of t){let s;if(Kh(c))s=`left|${c.left.id}|${c.right.id}|${c.minDistance}`;else if(Uh(c))s=`top|${c.top.id}|${c.bottom.id}|${c.minDistance}`;else if(W0(c)){let[e,i]=[c.node1.id,c.node2.id].sort();s=`align|${c.axis}|${e}|${i}`;}else s=`unknown|${JSON.stringify(c)}`;n.has(s)||(n.add(s),r.push(c));}return r}function Gat(t,r,n){switch(n){case "left":return `${t} must be to the left of ${r}`;case "right":return `${t} must be to the right of ${r}`;case "above":return `${t} must be above ${r}`;case "below":return `${t} must be below ${r}`;case "directlyLeft":return `${t} must be directly to the left of ${r}`;case "directlyRight":return `${t} must be directly to the right of ${r}`;case "directlyAbove":return `${t} must be directly above ${r}`;case "directlyBelow":return `${t} must be directly below ${r}`;default:return `${t} is constrained relative to ${r} (${n})`}}var Kat,w4,pP,Av,I4;exports.LayoutInstance=void 0;var Ov=Cn(()=>{$I();YT();Wm();EE();Db();Fb();Kat="univ",w4=class t extends Error{constructor(n,c){let s=c&&"selector"in c?c.selector:void 0,e=s?` Selector: ${s}.`:"";super(`Constraint references node "${n}" that is missing from the layout (it may be hidden).${e}`);this.type="unknown-constraint";this.name="MissingNodeConstraintError",this.missingNodeId=n,this.sourceConstraint=c,Object.setPrototypeOf(this,t.prototype);}};pP=(c=>(c.NEVER="never",c.DIRECT="direct",c.CONNECTED="connected",c))(pP||{});Av=class{constructor(r,n){this.Path=r;this.LoopsTo=n;}expand(r){let n=this.Path.map(i=>i.id);if(!this.LoopsTo)return n;let c=n.findIndex(i=>i===this.LoopsTo.id);if(c===-1)return n;let s=n.slice(0,c),e=n.slice(c);return s.concat(...Array(r).fill(e))}isSubpathOf(r){let n=this.expand(2),c=r.expand(1);if(c.length>n.length)return false;for(let s=0;s<=n.length-c.length;s++)if(c.every((e,i)=>e===n[s+i]))return true;return false}static areEquivalent(r,n){return r.isSubpathOf(n)&&n.isSubpathOf(r)}},I4=class I4{constructor(r,n,c=0,s=true,e){this.hideThisEdge="_h_";this.DEFAULT_NODE_ICON_PATH="";this.DEFAULT_NODE_HEIGHT=60;this.DEFAULT_NODE_WIDTH=100;this.minSepHeight=15;this.minSepWidth=15;this.selectorErrors=[];this.hiddenNodeSelectors=new Map;this.hiddenNodeConflicts=new Map;this.conflictedHiddenNodes=new Set;this.instanceNum=c,this.evaluator=n,this._layoutSpec=r,e!==void 0?this.alignmentEdgeStrategy=e:this.alignmentEdgeStrategy=s?"connected":"never";}recordSelectorError(r,n,c){let s=c instanceof Error?c.message:String(c);this.selectorErrors.push({selector:r,context:n,errorMessage:s});}checkSelectorArity(r,n,c,s){let e=r.maxArity();return e===0?true:c==="binary"&&e<2?(this.recordSelectorError(n,s,new exports.SelectorArityError(n,"binary","unary")),false):c==="unary"&&e>1?(this.recordSelectorError(n,s,new exports.SelectorArityError(n,"unary","binary")),false):true}isNodeHiddenByDirective(r){return this.hiddenNodeSelectors.has(r)}recordHiddenNodeConflict(r,n,c){let s=r.toHTML();this.hiddenNodeConflicts.has(s)||this.hiddenNodeConflicts.set(s,[]),this.hiddenNodeConflicts.get(s).push(n),this.conflictedHiddenNodes.add(c);}get hideDisconnected(){return this._layoutSpec.directives.hideDisconnected||false}get hideDisconnectedBuiltIns(){return this._layoutSpec.directives.hideDisconnectedBuiltIns||false}getConstraintsRelatedToField(r,n,c){return this._layoutSpec.constraints.grouping.byfield.filter(i=>{if(i.field!==r)return false;if(!i.selector)return true;try{return this.evaluator.evaluate(i.selector,{instanceIndex:this.instanceNum}).selectedAtoms().includes(n)}catch(o){return this.recordSelectorError(i.selector,"group by field selector",o),false}})}isAttributeField(r,n,c){let s=this._layoutSpec.directives.attributes.filter(e=>e.field===r);if(s.length===0)return false;if(!n||!c)return s.some(e=>!e.selector&&!e.filter);for(let e of s){let i=true;if(e.selector)try{i=this.evaluator.evaluate(e.selector,{instanceIndex:this.instanceNum}).selectedAtoms().includes(n);}catch(p){this.recordSelectorError(e.selector,"attribute selector",p),i=false;}if(!i)continue;let o=true;if(e.filter)try{o=this.evaluator.evaluate(e.filter,{instanceIndex:this.instanceNum}).selectedTwoples().some(b=>b[0]===n&&b[1]===c);}catch(p){this.recordSelectorError(e.filter,"attribute filter",p),o=false;}if(i&&o)return true}return false}isHiddenField(r,n,c){let s=this._layoutSpec.directives.hiddenFields.filter(e=>e.field===r);if(s.length>0)if(!n||!c){if(s.some(e=>!e.selector&&!e.filter))return true}else for(let e of s){let i=true;if(e.selector)try{i=this.evaluator.evaluate(e.selector,{instanceIndex:this.instanceNum}).selectedAtoms().includes(n);}catch(p){this.recordSelectorError(e.selector,"hidden field selector",p),i=false;}if(!i)continue;let o=true;if(e.filter)try{o=this.evaluator.evaluate(e.filter,{instanceIndex:this.instanceNum}).selectedTwoples().some(b=>b[0]===n&&b[1]===c);}catch(p){this.recordSelectorError(e.filter,"hidden field filter",p),o=false;}if(i&&o)return true}return !!(n&&c&&this.findEdgeDirective(r,n,c)?.hidden===true)}generateGroups(r,n){let c=this._layoutSpec.constraints.grouping.byfield,s=this._layoutSpec.constraints.grouping.byselector;if(!c&&!s)return [];let e=[];for(var i of s){let b=i.selector,y;try{y=this.evaluator.evaluate(b,{instanceIndex:this.instanceNum});}catch(a){this.recordSelectorError(b,"groupBySelector selector",a);continue}if(y.maxArity()>1){let l=function(u,h,d){return "_g_0_1_"+u+":"+h+"->"+d};let a=y.selectedTwoples();for(var o of a){let u=o[0],h=o[1],d=r.node(u)?.label||u;d!=u&&(d=d+":"+u);let g=`${i.name}[${d}]`,_=e.find(S=>S.name===g);if(_)_.nodeIds.push(h);else {let S={name:g,nodeIds:[h],keyNodeId:u,showLabel:true,sourceConstraint:i};if(e.push(S),i.addEdge){let v=l(g,u,h);r.setEdge(u,h,g,v);}}}}else {let a=y.selectedAtoms();if(a.length===0)continue;let l=a[0],u={name:i.name,nodeIds:a,keyNodeId:l,showLabel:true,sourceConstraint:i};e.push(u);}}return [...r.edges()].forEach(b=>{let y=b.name,m=this.getRelationName(r,b),a=this.getConstraintsRelatedToField(m,b.v,b.w);a.length!==0&&a.forEach(l=>{let u=l.groupOn,h=l.addToGroup,d=this.getFieldTuplesForSourceAndTarget(n,m,b.v,b.w);if(!(!d||d.length===0))for(var g of d){let _=g?.length||0;if(_<2||u<0||u>=_||h<0||h>=_)throw new Error(`Invalid grouping. groupOn=${u} and addToGroup=${h} for ${_}-ary relation ${m}. These must be between 0 and ${_-1}.`);let S=g[u],v=g[h],T=g.map((j,B)=>B===u?j:"_").join(","),q=`${m}[${T}]`,G=e.find(j=>j.name===q);if(G)G.nodeIds.push(v),r.removeEdge(b.v,b.w,y);else {let j={name:q,nodeIds:[v],keyNodeId:S,showLabel:true,sourceConstraint:l};e.push(j);let J=`_g_${u}_${h}_`+y;r.removeEdge(b.v,b.w,y),r.setEdge(b.v,b.w,q,J);}}});}),e}generateAttributesAndRemoveEdges(r){let n={};return [...r.edges()].forEach(s=>{let e=s.name,i=this.getRelationName(r,s),o=s.v,p=s.w,E=this.isAttributeField(i,o,p),b=this.isHiddenField(i,o,p);if(b&&E)throw new Error(`${i} cannot be both an attribute and a hidden field.`);if(b){r.removeEdge(s.v,s.w,e);return}if(E){let y=this.getEdgeLabel(r,s),m=s.v,a=s.w,l=r.node(a)?.label||a,u=n[m]||{};u[y]||(u[y]=[],n[m]=u),u[y].push(l),r.removeEdge(s.v,s.w,e);}}),n}generateTagsForNodes(r,n){let c=this._layoutSpec.directives.tags;if(!c||c.length===0)return n;let s={...n},e=new Set(r.nodes());for(let i of c)try{let p=this.evaluator.evaluate(i.toTag,{instanceIndex:this.instanceNum}).selectedAtoms(),b=this.evaluator.evaluate(i.value,{instanceIndex:this.instanceNum}).selectedTuplesAll();for(let y of p){if(!e.has(y))continue;s[y]||(s[y]={});let m=b.filter(a=>a[0]===y);if(m.length!==0)for(let a of m)if(a.length===1){let l=i.name;s[y][l]||(s[y][l]=[]);let u=r.node(y)?.label||y;s[y][l].push(String(u));}else if(a.length===2){let l=i.name;s[y][l]||(s[y][l]=[]);let u=a[a.length-1],h=e.has(String(u))&&r.node(String(u))?.label||String(u);s[y][l].push(h);}else {let l=a.slice(1,-1),u=a[a.length-1],h=l.map(_=>{let S=String(_);return `[${e.has(S)&&r.node(S)?.label||S}]`}).join(""),d=`${i.name}${h}`;s[y][d]||(s[y][d]=[]);let g=e.has(String(u))&&r.node(String(u))?.label||String(u);s[y][d].push(g);}}}catch(o){this.recordSelectorError(`name: ${i.name}, toTag: ${i.toTag}, value: ${i.value}`,"tag directive",o);}return s}ensureNoExtraNodes(r,n){let c=[...r.nodes()],s=this._layoutSpec.directives.hiddenAtoms,e=[];for(let i of s)try{let o=this.evaluator.evaluate(i.selector,{instanceIndex:this.instanceNum});if(!this.checkSelectorArity(o,i.selector,"unary","hideAtom selector"))continue;let p=o.selectedAtoms();e.push({selector:i.selector,hiddenSet:new Set(p)});}catch(o){this.recordSelectorError(i.selector,"hideAtom selector",o);}c.forEach(i=>{try{let p=n.getAtomType(i)?.isBuiltin||!1,E=r.inEdges(i)||[],b=r.outEdges(i)||[],m=E.length===0&&b.length===0&&(this.hideDisconnectedBuiltIns&&p||this.hideDisconnected),a=!1,l;for(let h of e)if(h.hiddenSet.has(i)){a=!0,l=h.selector;break}(m||a)&&(r.removeNode(i),a&&l&&this.hiddenNodeSelectors.set(i,l));}catch(o){console.error("Failed to identify node type. Defaulting to showing node.",o);}});}getMostSpecificType(r,n){return this.getNodeTypes(r,n)[0]}getNodeTypes(r,n){let s=n.getAtomType(r)?.types||[];return s=s.concat(Kat),s}getRelationName(r,n){let c=this.getEdgeLabel(r,n);try{return c.split("[")[0]}catch{return console.warn(`Failed to parse relation name from edge label: ${c}. Defaulting to empty string.`),c}}getEdgeLabel(r,n){return r.edge(n.v,n.w,n.name)}generateLayout(r){this.selectorErrors=[],this.hiddenNodeSelectors=new Map,this.hiddenNodeConflicts=new Map,this.conflictedHiddenNodes=new Set;let n=r,c=n.generateGraph(this.hideDisconnected,false),s=this.generateAttributesAndRemoveEdges(c);s=this.generateTagsForNodes(c,s),this.addinferredEdges(c);let e=this.generateGroups(c,r);this.ensureNoExtraNodes(c,r);let i=this.getNodeIconMap(c),o=this.getNodeColorMap(c,n),p=this.getNodeSizeMap(c),E=this.getDisconnectedNodes(c),b=c.nodes().map(_=>{let v=c.node(_)?.label||_,T=o[_]||"black",q=i[_],G=q.path,j=q.showLabels,{height:B,width:J}=p[_]||{height:this.DEFAULT_NODE_HEIGHT,width:this.DEFAULT_NODE_WIDTH},w=this.getMostSpecificType(_,r),$=this.getNodeTypes(_,r),z=e.filter(gt=>gt.nodeIds.includes(_)).map(gt=>gt.name),tt=s[_]||{},pt,dt=n.getAtoms().find(gt=>gt.id===_);return dt?.labels&&(pt=dt.labels),{id:_,label:v,name:v,color:T,groups:z,attributes:tt,labels:pt,icon:G,height:B,width:J,mostSpecificType:w,types:$,showLabels:j,disconnected:E.includes(_)}}),y=[],m=0,a=0,l=[],u=[];try{y=this.applyRelativeOrientationConstraints(b,c),m=y.length,y=y.concat(this.applyAlignConstraints(b,c)),a=y.length-m,console.log(`Generated ${m} orientation constraints and ${a} alignment constraints (deduped + transitive reduction applied)`),this.pruneRedundantAlignmentEdges(c),y=Hat(y),u=this.buildCyclicDisjunctions(b,c),l=this.buildLayoutEdges(c,b);}catch(_){if($at(_))return this.handleMissingNodeConstraintError(_,{layoutNodes:b,graph:c,groups:e,disconnectedNodes:E,constraints:y});throw _}let h={nodes:b,edges:l,constraints:y,groups:e,disjunctiveConstraints:u};if(this.hiddenNodeConflicts.size>0)return this.handleHiddenNodeConflictError(h);let g=new bv(h).validateConstraints();if(g){if(g.minimalConflictingSet)return this.handlePositionalConstraintError(g,h);if(g.overlappingNodes)return this.handleGroupOverlapError(g,h);throw g}return y=h.constraints,l=this.filterHiddenEdges(l),h.nodes=b,h.edges=l,h.constraints=y,h.groups=e,{layout:h,error:null,selectorErrors:this.selectorErrors}}handleMissingNodeConstraintError(r,n){let c=this.filterHiddenEdges(this.buildLayoutEdges(n.graph,n.layoutNodes)),s=n.groups;return {layout:{nodes:n.layoutNodes,edges:c,constraints:n.constraints,groups:s,disjunctiveConstraints:[]},error:r,selectorErrors:this.selectorErrors}}handleHiddenNodeConflictError(r){let n=new Map,c=new Set;for(let[b,y]of this.hiddenNodeConflicts.entries())n.set(b,y);for(let b of this.conflictedHiddenNodes){let y=this.hiddenNodeSelectors.get(b);y&&c.add(y);}for(let b of c){let y=`hideAtom with selector <code>${b}</code>`,m=[];for(let[a,l]of this.hiddenNodeSelectors.entries())l===b&&m.push(`${a} is hidden`);m.length>0&&n.set(y,m);}let s=[...this.hiddenNodeSelectors.keys()],e=[...this.hiddenNodeConflicts.keys()][0],o={conflictingConstraint:this.hiddenNodeConflicts.get(e)?.[0]||"",conflictingSourceConstraint:e,minimalConflictingConstraints:n},p={name:"HiddenNodeConflictError",type:"hidden-node-conflict",message:`Constraints reference hidden nodes [${s.join(", ")}]. These constraints have been dropped from the layout.`,hiddenNodes:this.hiddenNodeSelectors,droppedConstraints:this.hiddenNodeConflicts,errorMessages:o};return {layout:{...r,edges:this.filterHiddenEdges(r.edges)},error:p,selectorErrors:this.selectorErrors}}handlePositionalConstraintError(r,n){let c=r.minimalConflictingSet;return {layout:{nodes:n.nodes,edges:n.edges,constraints:n.constraints.filter(e=>![...c.values()].flat().includes(e)),groups:n.groups,conflictingConstraints:[...c.values()].flat()},error:r,selectorErrors:this.selectorErrors}}handleGroupOverlapError(r,n){let c=r.overlappingNodes.map(E=>E.groups).flat(),s=n.groups.filter(E=>c.includes(E.name)),e=s.flatMap(E=>E.nodeIds),i=n.nodes.filter(E=>e.includes(E.id)),o=n.edges.filter(E=>i.some(b=>E.source.id===b.id)&&i.some(b=>E.target.id===b.id));return {layout:{nodes:i,edges:o,constraints:n.constraints,groups:s,overlappingNodes:r.overlappingNodes},error:r,selectorErrors:this.selectorErrors}}buildCyclicDisjunctions(r,n){let c=this._layoutSpec.constraints.orientation.cyclic,s=[];for(let[,e]of c.entries()){let i;try{i=this.evaluator.evaluate(e.selector,{instanceIndex:this.instanceNum});}catch(y){this.recordSelectorError(e.selector,"cyclic orientation selector",y);continue}if(!this.checkSelectorArity(i,e.selector,"binary","cyclic orientation selector"))continue;let o=i.selectedTwoples(),p=new Map;o.forEach(y=>{let m=y[0],a=y[1],l=r.find(h=>h.id===m),u=r.find(h=>h.id===a);if(!(!l||!u)){if(this.shouldAddAlignmentEdge(n,m,a)){let h=`_alignment_${m}_${a}_`;n.setEdge(m,a,h,h);}p.has(l)?p.get(l).push(u):p.set(l,[u]);}});let b=this.getFragmentsToConstrain(p).map(y=>y.Path.map(m=>m.id));e.direction==="counterclockwise"&&(b=b.map(y=>y.reverse())),b.forEach(y=>{let m=y.length;if(m<=2)return;let a=[];for(let u=0;u<m;u++){let h=this.getCyclicConstraintForFragment(y,r,u,e);a.push(h);}let l=new $p(e,a);s.push(l);});}return s}getCyclicConstraintForFragment(r,n,c,s){if(r.length<=2)return [];let i=2*Math.PI/r.length,o={};for(var p=0;p<r.length;p++){let m=(p+c)*i,a=100*Math.cos(m),l=100*Math.sin(m);o[r[p]]={x:a,y:l};}let E=[];for(var b=0;b<r.length;b++)for(var y=0;y<r.length;y++)if(b!==y){let m=r[b],a=r[y],l=o[m],u=o[a];l.x>u.x?E.push(this.leftConstraint(a,m,this.minSepWidth,n,s)):l.x<u.x?E.push(this.leftConstraint(m,a,this.minSepWidth,n,s)):E.push(this.ensureSameXConstraint(m,a,n,s)),l.y>u.y?E.push(this.topConstraint(a,m,this.minSepHeight,n,s)):l.y<u.y?E.push(this.topConstraint(m,a,this.minSepHeight,n,s)):E.push(this.ensureSameYConstraint(m,a,n,s));}return E}getAllPaths(r){let n=[],c=new Set;function s(e,i){i.push(e);let o=r.get(e);if(!r.has(e)||!o||o.length===0){let p=new Av(i,void 0);n.push(p);}else for(let p of o)if(!i.includes(p))s(p,[...i]);else {let E=new Av(i,p);n.push(E);}}for(let e of r.keys())c.has(e)||s(e,[]);return n}getFragmentsToConstrain(r){let n=this.getAllPaths(r),c=n.filter((e,i)=>!n.some((o,p)=>p<i&&Av.areEquivalent(e,o)));return c.filter((e,i)=>!c.some((o,p)=>i!==p&&o.isSubpathOf(e)))}applyRelativeOrientationConstraints(r,n){let c=[],s=this._layoutSpec.constraints.orientation.relative,e=new Set,i=new Map,o=new Map;return s.forEach(p=>{let E=p.directions,b=p.selector,y;try{y=this.evaluator.evaluate(b,{instanceIndex:this.instanceNum});}catch(a){this.recordSelectorError(b,"orientation selector",a);return}if(!this.checkSelectorArity(y,b,"binary","orientation selector"))return;y.selectedTwoples().forEach(a=>{let l=a[0],u=a[1],h=this.isNodeHiddenByDirective(l),d=this.isNodeHiddenByDirective(u);if(h||d){let g=h?l:u;for(let _ of E){let S=Gat(l,u,_);this.recordHiddenNodeConflict(p,S,g);}return}E.forEach(g=>{if(this.shouldAddAlignmentEdge(n,l,u)){let _=`_alignment_${l}_${u}_`;n.setEdge(l,u,_,_);}if(g=="left"){let _=`left:${u}:${l}:${this.minSepWidth}`;!e.has(_)&&!this.hasTransitivePath(i,u,l)&&(e.add(_),this.addToTransitiveGraph(i,u,l),c.push(this.leftConstraint(u,l,this.minSepWidth,r,p)));}else if(g=="above"){let _=`top:${u}:${l}:${this.minSepHeight}`;!e.has(_)&&!this.hasTransitivePath(o,u,l)&&(e.add(_),this.addToTransitiveGraph(o,u,l),c.push(this.topConstraint(u,l,this.minSepHeight,r,p)));}else if(g=="right"){let _=`left:${l}:${u}:${this.minSepWidth}`;!e.has(_)&&!this.hasTransitivePath(i,l,u)&&(e.add(_),this.addToTransitiveGraph(i,l,u),c.push(this.leftConstraint(l,u,this.minSepWidth,r,p)));}else if(g=="below"){let _=`top:${l}:${u}:${this.minSepHeight}`;!e.has(_)&&!this.hasTransitivePath(o,l,u)&&(e.add(_),this.addToTransitiveGraph(o,l,u),c.push(this.topConstraint(l,u,this.minSepHeight,r,p)));}else if(g=="directlyLeft"){let _=`left:${u}:${l}:${this.minSepWidth}`,S=`align-y:${u}:${l}`;!e.has(_)&&!this.hasTransitivePath(i,u,l)&&(e.add(_),this.addToTransitiveGraph(i,u,l),c.push(this.leftConstraint(u,l,this.minSepWidth,r,p))),e.has(S)||(e.add(S),c.push(this.ensureSameYConstraint(u,l,r,p)));}else if(g=="directlyAbove"){let _=`top:${u}:${l}:${this.minSepHeight}`,S=`align-x:${u}:${l}`;!e.has(_)&&!this.hasTransitivePath(o,u,l)&&(e.add(_),this.addToTransitiveGraph(o,u,l),c.push(this.topConstraint(u,l,this.minSepHeight,r,p))),e.has(S)||(e.add(S),c.push(this.ensureSameXConstraint(u,l,r,p)));}else if(g=="directlyRight"){let _=`left:${l}:${u}:${this.minSepWidth}`,S=`align-y:${u}:${l}`;!e.has(_)&&!this.hasTransitivePath(i,l,u)&&(e.add(_),this.addToTransitiveGraph(i,l,u),c.push(this.leftConstraint(l,u,this.minSepWidth,r,p))),e.has(S)||(e.add(S),c.push(this.ensureSameYConstraint(u,l,r,p)));}else if(g=="directlyBelow"){let _=`top:${l}:${u}:${this.minSepHeight}`,S=`align-x:${u}:${l}`;!e.has(_)&&!this.hasTransitivePath(o,l,u)&&(e.add(_),this.addToTransitiveGraph(o,l,u),c.push(this.topConstraint(l,u,this.minSepHeight,r,p))),e.has(S)||(e.add(S),c.push(this.ensureSameXConstraint(u,l,r,p)));}});});}),c}hasTransitivePath(r,n,c){let s=r.get(n);if(!s)return false;if(s.has(c))return true;let e=new Set([n]),i=Array.from(s);for(;i.length>0;){let o=i.shift();if(o===c)return true;if(e.has(o))continue;e.add(o);let p=r.get(o);if(p)for(let E of p)e.has(E)||i.push(E);}return false}addToTransitiveGraph(r,n,c){r.has(n)||r.set(n,new Set),r.get(n).add(c);let s=r.get(c)||new Set;for(let[e,i]of r.entries())if(e===n||i.has(n)){i.add(c);for(let o of s)i.add(o);}}applyAlignConstraints(r,n){let c=[],s=this._layoutSpec.constraints.alignment,e=new Set;return s.forEach(i=>{let o=i.direction,p=i.selector,E;try{E=this.evaluator.evaluate(p,{instanceIndex:this.instanceNum});}catch(y){this.recordSelectorError(p,"align selector",y);return}if(!this.checkSelectorArity(E,p,"binary","align selector"))return;E.selectedTwoples().forEach(y=>{let m=y[0],a=y[1],l=this.isNodeHiddenByDirective(m),u=this.isNodeHiddenByDirective(a);if(l||u){let h=l?m:a,g=`${m} is ${o==="horizontal"?"horizontally":"vertically"} aligned with ${a}`;this.recordHiddenNodeConflict(i,g,h);return}if(this.shouldAddAlignmentEdge(n,m,a)){let h=`_alignment_${m}_${a}_`;n.setEdge(m,a,h,h);}if(o==="horizontal"){let[h,d]=[m,a].sort(),g=`align-y:${h}:${d}`;e.has(g)||(e.add(g),c.push(this.ensureSameYConstraint(m,a,r,i)));}else if(o==="vertical"){let[h,d]=[m,a].sort(),g=`align-x:${h}:${d}`;e.has(g)||(e.add(g),c.push(this.ensureSameXConstraint(m,a,r,i)));}});}),c}shouldAddAlignmentEdge(r,n,c){if(this.alignmentEdgeStrategy==="never")return false;let s=this.hasDirectEdgeBetween(r,n,c);return this.alignmentEdgeStrategy==="direct"?!s:s?false:!this.isConnectedViaPath(r,n,c)}hasDirectEdgeBetween(r,n,c){return typeof r.hasEdge=="function"&&(r.hasEdge(n,c)||r.hasEdge(c,n))||(r.inEdges(n)||[]).some(s=>s.v===c)||(r.outEdges(n)||[]).some(s=>s.w===c)||(r.inEdges(c)||[]).some(s=>s.v===n)||(r.outEdges(c)||[]).some(s=>s.w===n)}isConnectedViaPath(r,n,c,s){let e=new Set,i=[n];for(;i.length>0;){let o=i.shift();if(o===c)return true;if(e.has(o))continue;e.add(o);let p=r.outEdges(o)||[],E=r.inEdges(o)||[];for(let b of [...p,...E]){if(s&&(b.v===s.v&&b.w===s.w&&b.name===s.name||b.v===s.w&&b.w===s.v&&b.name===s.name))continue;let y=b.v===o?b.w:b.v;e.has(y)||i.push(y);}}return false}pruneRedundantAlignmentEdges(r){if(this.alignmentEdgeStrategy!=="connected")return;let n=r.edges().filter(s=>{let e=s.name;return e&&e.includes("_alignment_")}),c=[];for(let s of n)this.isConnectedViaPath(r,s.v,s.w,s)&&(r.removeEdge(s.v,s.w,s.name),c.push(s));c.length>0&&console.log(`Pruned ${c.length} redundant alignment edges out of ${n.length} total alignment edges`);}getDisconnectedNodes(r){let n=r.edges().map(o=>o.w),c=r.edges().map(o=>o.v),s=new Set(r.nodes()),e=new Set([...n,...c]);return [...s].filter(o=>!e.has(o))}buildLayoutEdges(r,n){return r.edges().map(c=>{let s=c.name,e=r.edge(c.v,c.w,s),i=n.find(l=>l.id===c.v),o=n.find(l=>l.id===c.w),p=this.getRelationName(r,c),E=this.getEdgeColor(p,c.v,c.w,s),b=this.getEdgeStyle(p,c.v,c.w,s),y=this.getEdgeWeight(p,c.v,c.w,s),m=this.getEdgeShowLabel(p,c.v,c.w,s);return !i||!o||!s?null:{source:i,target:o,label:e,relationName:p,id:s,color:E,style:b,weight:y,showLabel:m,groupId:s.startsWith("_g_")?e:void 0,keyNodeId:s.startsWith("_g_")?c.v:void 0}}).filter(c=>c!==null)}filterHiddenEdges(r){return r.filter(n=>!n.id.startsWith(this.hideThisEdge))}getNodeFromId(r,n,c){let s=n.find(e=>e.id===r);if(!s)throw new w4(r,c);return s}leftConstraint(r,n,c,s,e){let i=this.getNodeFromId(r,s,e),o=this.getNodeFromId(n,s,e);return {left:i,right:o,minDistance:c,sourceConstraint:e}}topConstraint(r,n,c,s,e){let i=this.getNodeFromId(r,s,e),o=this.getNodeFromId(n,s,e);return {top:i,bottom:o,minDistance:c,sourceConstraint:e}}ensureSameYConstraint(r,n,c,s){let e=this.getNodeFromId(r,c,s),i=this.getNodeFromId(n,c,s);return {axis:"y",node1:e,node2:i,sourceConstraint:s}}ensureSameXConstraint(r,n,c,s){let e=this.getNodeFromId(r,c,s),i=this.getNodeFromId(n,c,s);return {axis:"x",node1:e,node2:i,sourceConstraint:s}}singletonGroup(r){return {name:`${I4.DISCONNECTED_PREFIX}${r}`,nodeIds:[r],keyNodeId:r,showLabel:false}}getNodeSizeMap(r){let n={},c={width:this.DEFAULT_NODE_WIDTH,height:this.DEFAULT_NODE_HEIGHT};return this._layoutSpec.directives.sizes.forEach(i=>{let o;try{let b=this.evaluator.evaluate(i.selector,{instanceIndex:this.instanceNum});if(!this.checkSelectorArity(b,i.selector,"unary","size selector"))return;o=b.selectedAtoms();}catch(b){this.recordSelectorError(i.selector,"size selector",b);return}let p=i.width,E=i.height;o.forEach(b=>{if(n[b]){let y=n[b];if(y.width!==p||y.height!==E)throw new Error(`Size Conflict: "${b}" cannot have multiple sizes: ${JSON.stringify(y)}, ${JSON.stringify({width:p,height:E})}.`)}n[b]={width:p,height:E};});}),[...r.nodes()].forEach(i=>{n[i]||(n[i]=c);}),n}getNodeColorMap(r,n){let c={},s=this.getSigColors(n);return this._layoutSpec.directives.atomColors.forEach(o=>{let p;try{let b=this.evaluator.evaluate(o.selector,{instanceIndex:this.instanceNum});if(!this.checkSelectorArity(b,o.selector,"unary","color selector"))return;p=b.selectedAtoms();}catch(b){this.recordSelectorError(o.selector,"color selector",b);return}let E=o.color;p.forEach(b=>{if(c[b]){let y=c[b];if(y!==E)throw new Error(`Color Conflict: "${b}" cannot have multiple colors: ${y}, ${E}.`)}c[b]=E;});}),[...r.nodes()].forEach(o=>{if(!c[o]){let p=this.getMostSpecificType(o,n);c[o]=s[p];}}),c}getNodeIconMap(r){let n={},c=this.DEFAULT_NODE_ICON_PATH;return this._layoutSpec.directives.icons.forEach(i=>{let o;try{let E=this.evaluator.evaluate(i.selector,{instanceIndex:this.instanceNum});if(!this.checkSelectorArity(E,i.selector,"unary","icon selector"))return;o=E.selectedAtoms();}catch(E){this.recordSelectorError(i.selector,"icon selector",E);return}let p=i.path;o.forEach(E=>{let b=VT(p);if(n[E]){let y=n[E];if(y.path!==b||y.showLabels!==i.showLabels)throw new Error(`Icon Conflict: "${E}" cannot have multiple icons: ${JSON.stringify(y)}, ${JSON.stringify({path:b,showLabels:i.showLabels})}.`)}n[E]={path:b,showLabels:i.showLabels};});}),[...r.nodes()].forEach(i=>{n[i]||(n[i]={path:c,showLabels:true});}),n}getEdgeColor(r,n,c,s){let e=this.getInferredEdgeDirective(s);if(e?.color)return e.color;let i=this.findEdgeDirective(r,n,c);return i?.color?i.color:"black"}getEdgeStyle(r,n,c,s){let e=this.getInferredEdgeDirective(s),i=GT(e?.style);if(i)return i;let o=this.findEdgeDirective(r,n,c);return GT(o?.style)}getEdgeWeight(r,n,c,s){let e=this.getInferredEdgeDirective(s),i=this.normalizeEdgeWeight(e?.weight,"inferred edge");if(i!==void 0)return i;let o=this.findEdgeDirective(r,n,c);return this.normalizeEdgeWeight(o?.weight,"edge")}getEdgeShowLabel(r,n,c,s){return this.findEdgeDirective(r,n,c)?.showLabel}getInferredEdgeDirective(r){let n="_inferred_";return !r||!r.includes(n)?void 0:this._layoutSpec.directives.inferredEdges.find(s=>r.includes(`${n}<:${s.name}`))}findEdgeDirective(r,n,c){let s=this._layoutSpec.directives.edgeColors;for(let e of s){if(e.field!==r)continue;let i=true;if(e.selector)try{i=this.evaluator.evaluate(e.selector,{instanceIndex:this.instanceNum}).selectedAtoms().includes(n);}catch(p){this.recordSelectorError(e.selector,"edge selector",p),i=false;}if(!i)continue;let o=true;if(e.filter&&c)try{o=this.evaluator.evaluate(e.filter,{instanceIndex:this.instanceNum}).selectedTwoples().some(b=>b[0]===n&&b[1]===c);}catch(p){this.recordSelectorError(e.filter,"edge filter",p),o=false;}if(i&&o)return e}}normalizeEdgeWeight(r,n){if(r!=null){if(typeof r!="number"||Number.isNaN(r)||r<=0){console.warn(`Ignoring ${n} weight because it is not a positive number: ${r}`);return}return r}}getSigColors(r){let n={},c=r.getTypes(),s=new _v(c.length);return c.forEach(e=>{n[e.id]=s.getNextColor();}),n}getFieldTuples(r,n){let c=r.getRelations();Object.values(c);let e=Object.values(c).find(o=>o.name===n);return e?e.tuples.map(o=>o.atoms):[]}getFieldTuplesForSourceAndTarget(r,n,c,s){return this.getFieldTuples(r,n).filter(o=>{let p=o.length;return p<1?false:o[0]===c&&o[p-1]===s})}addinferredEdges(r){let n="_inferred_";this._layoutSpec.directives.inferredEdges.forEach(s=>{let e;try{e=this.evaluator.evaluate(s.selector,{instanceIndex:this.instanceNum});}catch(p){this.recordSelectorError(s.selector,"inferredEdge selector",p);return}let i=e.selectedTuplesAll(),o=`${n}<:${s.name}`;i.forEach(p=>{let E=p.length,b=p[0],y=p[E-1],m=s.name;if(E>2){let u=p.slice(1,E-1).map(h=>r.node(h)?.label||h).join(",");m=`${m}[${u}]`;}let a=p.join("->"),l=`${o}<:${a}`;r.setEdge(b,y,m,l);});});}};I4.DISCONNECTED_PREFIX="_d_";exports.LayoutInstance=I4;});var o1=Te((U6t,gP)=>{var D4;if(typeof _f=="function")try{D4=Up();}catch{}D4||(D4=window.graphlib);gP.exports=D4;});var vP=Te(($6t,yP)=>{var qat=g_(),zat=1,Vat=4;function Yat(t){return qat(t,zat|Vat)}yP.exports=Yat;});var Sv=Te((H6t,EP)=>{var Wat=r3(),Xat=rp(),Qat=hy(),Jat=Nd();function Zat(t,r,n){if(!Jat(n))return false;var c=typeof r;return (c=="number"?Xat(n)&&Qat(r,n.length):c=="string"&&r in n)?Wat(n[r],t):false}EP.exports=Zat;});var bP=Te((G6t,TP)=>{var tut=Ty(),eut=r3(),rut=Sv(),nut=$2(),_P=Object.prototype,iut=_P.hasOwnProperty,sut=tut(function(t,r){t=Object(t);var n=-1,c=r.length,s=c>2?r[2]:void 0;for(s&&rut(r[0],r[1],s)&&(c=1);++n<c;)for(var e=r[n],i=nut(e),o=-1,p=i.length;++o<p;){var E=i[o],b=t[E];(b===void 0||eut(b,_P[E])&&!iut.call(t,E))&&(t[E]=e[E]);}return t});TP.exports=sut;});var OP=Te((q6t,AP)=>{var out=np(),aut=rp(),uut=jp();function lut(t){return function(r,n,c){var s=Object(r);if(!aut(r)){var e=out(n,3);r=uut(r),n=function(o){return e(s[o],o,s)};}var i=t(r,n,c);return i>-1?s[e?r[i]:i]:void 0}}AP.exports=lut;});var CP=Te((z6t,SP)=>{var cut=/\s/;function hut(t){for(var r=t.length;r--&&cut.test(t.charAt(r)););return r}SP.exports=hut;});var RP=Te((V6t,NP)=>{var fut=CP(),dut=/^\s+/;function put(t){return t&&t.slice(0,fut(t)+1).replace(dut,"")}NP.exports=put;});var LP=Te((Y6t,DP)=>{var xut=RP(),wP=Nd(),mut=a3(),IP=NaN,gut=/^[-+]0x[0-9a-f]+$/i,yut=/^0b[01]+$/i,vut=/^0o[0-7]+$/i,Eut=parseInt;function _ut(t){if(typeof t=="number")return t;if(mut(t))return IP;if(wP(t)){var r=typeof t.valueOf=="function"?t.valueOf():t;t=wP(r)?r+"":r;}if(typeof t!="string")return t===0?t:+t;t=xut(t);var n=yut.test(t);return n||vut.test(t)?Eut(t.slice(2),n?2:8):gut.test(t)?IP:+t}DP.exports=_ut;});var Bb=Te((W6t,MP)=>{var Tut=LP(),PP=1/0,but=17976931348623157e292;function Aut(t){if(!t)return t===0?t:0;if(t=Tut(t),t===PP||t===-PP){var r=t<0?-1:1;return r*but}return t===t?t:0}MP.exports=Aut;});var FP=Te((X6t,kP)=>{var Out=Bb();function Sut(t){var r=Out(t),n=r%1;return r===r?n?r-n:r:0}kP.exports=Sut;});var jP=Te((Q6t,BP)=>{var Cut=G_(),Nut=np(),Rut=FP(),wut=Math.max;function Iut(t,r,n){var c=t==null?0:t.length;if(!c)return -1;var s=n==null?0:Rut(n);return s<0&&(s=wut(c+s,0)),Cut(t,Nut(r,3),s)}BP.exports=Iut;});var KP=Te((J6t,UP)=>{var Dut=OP(),Lut=jP(),Put=Dut(Lut);UP.exports=Put;});var jb=Te((Z6t,$P)=>{var Mut=pE();function kut(t){var r=t==null?0:t.length;return r?Mut(t,1):[]}$P.exports=kut;});var GP=Te((t8t,HP)=>{var Fut=uE(),But=y_(),jut=$2();function Uut(t,r){return t==null?t:Fut(t,But(r),jut)}HP.exports=Uut;});var zP=Te((e8t,qP)=>{function Kut(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}qP.exports=Kut;});var YP=Te((r8t,VP)=>{var $ut=uy(),Hut=lE(),Gut=np();function qut(t,r){var n={};return r=Gut(r,3),Hut(t,function(c,s,e){$ut(n,s,r(c,s,e));}),n}VP.exports=qut;});var L4=Te((n8t,WP)=>{var zut=a3();function Vut(t,r,n){for(var c=-1,s=t.length;++c<s;){var e=t[c],i=r(e);if(i!=null&&(o===void 0?i===i&&!zut(i):n(i,o)))var o=i,p=e;}return p}WP.exports=Vut;});var QP=Te((i8t,XP)=>{function Yut(t,r){return t>r}XP.exports=Yut;});var ZP=Te((s8t,JP)=>{var Wut=L4(),Xut=QP(),Qut=H2();function Jut(t){return t&&t.length?Wut(t,Qut,Xut):void 0}JP.exports=Jut;});var Ub=Te((o8t,tM)=>{var Zut=uy(),tlt=r3();function elt(t,r,n){(n!==void 0&&!tlt(t[r],n)||n===void 0&&!(r in t))&&Zut(t,r,n);}tM.exports=elt;});var nM=Te((a8t,rM)=>{var rlt=U2(),nlt=gy(),ilt=N1(),slt="[object Object]",olt=Function.prototype,alt=Object.prototype,eM=olt.toString,ult=alt.hasOwnProperty,llt=eM.call(Object);function clt(t){if(!ilt(t)||rlt(t)!=slt)return false;var r=nlt(t);if(r===null)return true;var n=ult.call(r,"constructor")&&r.constructor;return typeof n=="function"&&n instanceof n&&eM.call(n)==llt}rM.exports=clt;});var Kb=Te((u8t,iM)=>{function hlt(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}iM.exports=hlt;});var oM=Te((l8t,sM)=>{var flt=Am(),dlt=$2();function plt(t){return flt(t,dlt(t))}sM.exports=plt;});var fM=Te((c8t,hM)=>{var aM=Ub(),xlt=t_(),mlt=p_(),glt=e_(),ylt=m_(),uM=Om(),lM=Oc(),vlt=z_(),Elt=i3(),_lt=Em(),Tlt=Nd(),blt=nM(),Alt=Nm(),cM=Kb(),Olt=oM();function Slt(t,r,n,c,s,e,i){var o=cM(t,n),p=cM(r,n),E=i.get(p);if(E){aM(t,n,E);return}var b=e?e(o,p,n+"",t,r,i):void 0,y=b===void 0;if(y){var m=lM(p),a=!m&&Elt(p),l=!m&&!a&&Alt(p);b=p,m||a||l?lM(o)?b=o:vlt(o)?b=glt(o):a?(y=false,b=xlt(p,true)):l?(y=false,b=mlt(p,true)):b=[]:blt(p)||uM(p)?(b=o,uM(o)?b=Olt(o):(!Tlt(o)||_lt(o))&&(b=ylt(p))):y=false;}y&&(i.set(p,b),s(b,p,c,e,i),i.delete(p)),aM(t,n,b);}hM.exports=Slt;});var xM=Te((h8t,pM)=>{var Clt=ay(),Nlt=Ub(),Rlt=uE(),wlt=fM(),Ilt=Nd(),Dlt=$2(),Llt=Kb();function dM(t,r,n,c,s){t!==r&&Rlt(r,function(e,i){if(s||(s=new Clt),Ilt(e))wlt(t,r,i,n,dM,c,s);else {var o=c?c(Llt(t,i),e,i+"",t,r,s):void 0;o===void 0&&(o=e),Nlt(t,i,o);}},Dlt);}pM.exports=dM;});var gM=Te((f8t,mM)=>{var Plt=Ty(),Mlt=Sv();function klt(t){return Plt(function(r,n){var c=-1,s=n.length,e=s>1?n[s-1]:void 0,i=s>2?n[2]:void 0;for(e=t.length>3&&typeof e=="function"?(s--,e):void 0,i&&Mlt(n[0],n[1],i)&&(e=s<3?void 0:e,s=1),r=Object(r);++c<s;){var o=n[c];o&&t(r,o,c,e);}return r})}mM.exports=klt;});var vM=Te((d8t,yM)=>{var Flt=xM(),Blt=gM(),jlt=Blt(function(t,r,n){Flt(t,r,n);});yM.exports=jlt;});var $b=Te((p8t,EM)=>{function Ult(t,r){return t<r}EM.exports=Ult;});var TM=Te((x8t,_M)=>{var Klt=L4(),$lt=$b(),Hlt=H2();function Glt(t){return t&&t.length?Klt(t,Hlt,$lt):void 0}_M.exports=Glt;});var AM=Te((m8t,bM)=>{var qlt=L4(),zlt=np(),Vlt=$b();function Ylt(t,r){return t&&t.length?qlt(t,zlt(r,2),Vlt):void 0}bM.exports=Ylt;});var SM=Te((g8t,OM)=>{var Wlt=Qd(),Xlt=function(){return Wlt.Date.now()};OM.exports=Xlt;});var RM=Te((y8t,NM)=>{var Qlt=ly(),Jlt=Ey(),Zlt=hy(),CM=Nd(),tct=Im();function ect(t,r,n,c){if(!CM(t))return t;r=Jlt(r,t);for(var s=-1,e=r.length,i=e-1,o=t;o!=null&&++s<e;){var p=tct(r[s]),E=n;if(p==="__proto__"||p==="constructor"||p==="prototype")return t;if(s!=i){var b=o[p];E=c?c(b,p,o):void 0,E===void 0&&(E=CM(b)?b:Zlt(r[s+1])?[]:{});}Qlt(o,p,E),o=o[p];}return t}NM.exports=ect;});var IM=Te((v8t,wM)=>{var rct=_y(),nct=RM(),ict=Ey();function sct(t,r,n){for(var c=-1,s=r.length,e={};++c<s;){var i=r[c],o=rct(t,i);n(o,i)&&nct(e,ict(i,t),o);}return e}wM.exports=sct;});var LM=Te((E8t,DM)=>{var oct=IM(),act=D_();function uct(t,r){return oct(t,r,function(n,c){return act(t,c)})}DM.exports=uct;});var MM=Te((_8t,PM)=>{var lct=jb(),cct=$_(),hct=H_();function fct(t){return hct(cct(t,void 0,lct),t+"")}PM.exports=fct;});var FM=Te((T8t,kM)=>{var dct=LM(),pct=MM(),xct=pct(function(t,r){return t==null?{}:dct(t,r)});kM.exports=xct;});var jM=Te((b8t,BM)=>{var mct=Math.ceil,gct=Math.max;function yct(t,r,n,c){for(var s=-1,e=gct(mct((r-t)/(n||1)),0),i=Array(e);e--;)i[c?e:++s]=t,t+=n;return i}BM.exports=yct;});var KM=Te((A8t,UM)=>{var vct=jM(),Ect=Sv(),Hb=Bb();function _ct(t){return function(r,n,c){return c&&typeof c!="number"&&Ect(r,n,c)&&(n=c=void 0),r=Hb(r),n===void 0?(n=r,r=0):n=Hb(n),c=c===void 0?r<n?1:-1:Hb(c),vct(r,n,c,t)}}UM.exports=_ct;});var HM=Te((O8t,$M)=>{var Tct=KM(),bct=Tct();$M.exports=bct;});var qM=Te((S8t,GM)=>{function Act(t,r){var n=t.length;for(t.sort(r);n--;)t[n]=t[n].value;return t}GM.exports=Act;});var YM=Te((C8t,VM)=>{var zM=a3();function Oct(t,r){if(t!==r){var n=t!==void 0,c=t===null,s=t===t,e=zM(t),i=r!==void 0,o=r===null,p=r===r,E=zM(r);if(!o&&!E&&!e&&t>r||e&&i&&p&&!o&&!E||c&&i&&p||!n&&p||!s)return 1;if(!c&&!e&&!E&&t<r||E&&n&&s&&!c&&!e||o&&n&&s||!i&&s||!p)return -1}return 0}VM.exports=Oct;});var XM=Te((N8t,WM)=>{var Sct=YM();function Cct(t,r,n){for(var c=-1,s=t.criteria,e=r.criteria,i=s.length,o=n.length;++c<i;){var p=Sct(s[c],e[c]);if(p){if(c>=o)return p;var E=n[c];return p*(E=="desc"?-1:1)}}return t.index-r.index}WM.exports=Cct;});var JM=Te((R8t,QM)=>{var Gb=vy(),Nct=_y(),Rct=np(),wct=F_(),Ict=qM(),Dct=fy(),Lct=XM(),Pct=H2(),Mct=Oc();function kct(t,r,n){r.length?r=Gb(r,function(e){return Mct(e)?function(i){return Nct(i,e.length===1?e[0]:e)}:e}):r=[Pct];var c=-1;r=Gb(r,Dct(Rct));var s=wct(t,function(e,i,o){var p=Gb(r,function(E){return E(e)});return {criteria:p,index:++c,value:e}});return Ict(s,function(e,i){return Lct(e,i,n)})}QM.exports=kct;});var ek=Te((w8t,tk)=>{var Fct=pE(),Bct=JM(),jct=Ty(),ZM=Sv(),Uct=jct(function(t,r){if(t==null)return [];var n=r.length;return n>1&&ZM(t,r[0],r[1])?r=[]:n>2&&ZM(r[0],r[1],r[2])&&(r=[r[0]]),Bct(t,Fct(r,1),[])});tk.exports=Uct;});var nk=Te((I8t,rk)=>{var Kct=w_(),$ct=0;function Hct(t){var r=++$ct;return Kct(t)+r}rk.exports=Hct;});var sk=Te((D8t,ik)=>{function Gct(t,r,n){for(var c=-1,s=t.length,e=r.length,i={};++c<s;){var o=c<e?r[c]:void 0;n(i,t[c],o);}return i}ik.exports=Gct;});var ak=Te((L8t,ok)=>{var qct=ly(),zct=sk();function Vct(t,r){return zct(t||[],r||[],qct)}ok.exports=Vct;});var yl=Te((P8t,uk)=>{var P4;if(typeof _f=="function")try{P4={cloneDeep:vP(),constant:aE(),defaults:bP(),each:E_(),filter:P_(),find:KP(),flatten:jb(),forEach:v_(),forIn:GP(),has:M_(),isUndefined:k_(),last:zP(),map:B_(),mapValues:YP(),max:ZP(),merge:vM(),min:TM(),minBy:AM(),now:SM(),pick:FM(),range:HM(),reduce:j_(),sortBy:ek(),uniqueId:nk(),values:V_(),zipObject:ak()};}catch{}P4||(P4=window._);uk.exports=P4;});var hk=Te((k8t,ck)=>{ck.exports=M4;function M4(){var t={};t._next=t._prev=t,this._sentinel=t;}M4.prototype.dequeue=function(){var t=this._sentinel,r=t._prev;if(r!==t)return lk(r),r};M4.prototype.enqueue=function(t){var r=this._sentinel;t._prev&&t._next&&lk(t),t._next=r._next,r._next._prev=t,r._next=t,t._prev=r;};M4.prototype.toString=function(){for(var t=[],r=this._sentinel,n=r._prev;n!==r;)t.push(JSON.stringify(n,Yct)),n=n._prev;return "["+t.join(", ")+"]"};function lk(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev;}function Yct(t,r){if(t!=="_next"&&t!=="_prev")return r}});var dk=Te((F8t,fk)=>{var zp=yl(),Wct=o1().Graph,Xct=hk();fk.exports=Jct;var Qct=zp.constant(1);function Jct(t,r){if(t.nodeCount()<=1)return [];var n=tht(t,r||Qct),c=Zct(n.graph,n.buckets,n.zeroIdx);return zp.flatten(zp.map(c,function(s){return t.outEdges(s.v,s.w)}),true)}function Zct(t,r,n){for(var c=[],s=r[r.length-1],e=r[0],i;t.nodeCount();){for(;i=e.dequeue();)qb(t,r,n,i);for(;i=s.dequeue();)qb(t,r,n,i);if(t.nodeCount()){for(var o=r.length-2;o>0;--o)if(i=r[o].dequeue(),i){c=c.concat(qb(t,r,n,i,true));break}}}return c}function qb(t,r,n,c,s){var e=s?[]:void 0;return zp.forEach(t.inEdges(c.v),function(i){var o=t.edge(i),p=t.node(i.v);s&&e.push({v:i.v,w:i.w}),p.out-=o,zb(r,n,p);}),zp.forEach(t.outEdges(c.v),function(i){var o=t.edge(i),p=i.w,E=t.node(p);E.in-=o,zb(r,n,E);}),t.removeNode(c.v),e}function tht(t,r){var n=new Wct,c=0,s=0;zp.forEach(t.nodes(),function(o){n.setNode(o,{v:o,in:0,out:0});}),zp.forEach(t.edges(),function(o){var p=n.edge(o.v,o.w)||0,E=r(o),b=p+E;n.setEdge(o.v,o.w,b),s=Math.max(s,n.node(o.v).out+=E),c=Math.max(c,n.node(o.w).in+=E);});var e=zp.range(s+c+3).map(function(){return new Xct}),i=c+1;return zp.forEach(n.nodes(),function(o){zb(e,i,n.node(o));}),{graph:n,buckets:e,zeroIdx:i}}function zb(t,r,n){n.out?n.in?t[n.out-n.in+r].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n);}});var xk=Te((B8t,pk)=>{var w3=yl(),eht=dk();pk.exports={run:rht,undo:iht};function rht(t){var r=t.graph().acyclicer==="greedy"?eht(t,n(t)):nht(t);w3.forEach(r,function(c){var s=t.edge(c);t.removeEdge(c),s.forwardName=c.name,s.reversed=true,t.setEdge(c.w,c.v,s,w3.uniqueId("rev"));});function n(c){return function(s){return c.edge(s).weight}}}function nht(t){var r=[],n={},c={};function s(e){w3.has(c,e)||(c[e]=true,n[e]=true,w3.forEach(t.outEdges(e),function(i){w3.has(n,i.w)?r.push(i):s(i.w);}),delete n[e]);}return w3.forEach(t.nodes(),s),r}function iht(t){w3.forEach(t.edges(),function(r){var n=t.edge(r);if(n.reversed){t.removeEdge(r);var c=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(r.w,r.v,n,c);}});}});var Of=Te((j8t,vk)=>{var za=yl(),mk=o1().Graph;vk.exports={addDummyNode:gk,simplify:sht,asNonCompoundGraph:oht,successorWeights:aht,predecessorWeights:uht,intersectRect:lht,buildLayerMatrix:cht,normalizeRanks:hht,removeEmptyRanks:fht,addBorderNode:dht,maxRank:yk,partition:pht,time:xht,notime:mht};function gk(t,r,n,c){var s;do s=za.uniqueId(c);while(t.hasNode(s));return n.dummy=r,t.setNode(s,n),s}function sht(t){var r=new mk().setGraph(t.graph());return za.forEach(t.nodes(),function(n){r.setNode(n,t.node(n));}),za.forEach(t.edges(),function(n){var c=r.edge(n.v,n.w)||{weight:0,minlen:1},s=t.edge(n);r.setEdge(n.v,n.w,{weight:c.weight+s.weight,minlen:Math.max(c.minlen,s.minlen)});}),r}function oht(t){var r=new mk({multigraph:t.isMultigraph()}).setGraph(t.graph());return za.forEach(t.nodes(),function(n){t.children(n).length||r.setNode(n,t.node(n));}),za.forEach(t.edges(),function(n){r.setEdge(n,t.edge(n));}),r}function aht(t){var r=za.map(t.nodes(),function(n){var c={};return za.forEach(t.outEdges(n),function(s){c[s.w]=(c[s.w]||0)+t.edge(s).weight;}),c});return za.zipObject(t.nodes(),r)}function uht(t){var r=za.map(t.nodes(),function(n){var c={};return za.forEach(t.inEdges(n),function(s){c[s.v]=(c[s.v]||0)+t.edge(s).weight;}),c});return za.zipObject(t.nodes(),r)}function lht(t,r){var n=t.x,c=t.y,s=r.x-n,e=r.y-c,i=t.width/2,o=t.height/2;if(!s&&!e)throw new Error("Not possible to find intersection inside of the rectangle");var p,E;return Math.abs(e)*i>Math.abs(s)*o?(e<0&&(o=-o),p=o*s/e,E=o):(s<0&&(i=-i),p=i,E=i*e/s),{x:n+p,y:c+E}}function cht(t){var r=za.map(za.range(yk(t)+1),function(){return []});return za.forEach(t.nodes(),function(n){var c=t.node(n),s=c.rank;za.isUndefined(s)||(r[s][c.order]=n);}),r}function hht(t){var r=za.min(za.map(t.nodes(),function(n){return t.node(n).rank}));za.forEach(t.nodes(),function(n){var c=t.node(n);za.has(c,"rank")&&(c.rank-=r);});}function fht(t){var r=za.min(za.map(t.nodes(),function(e){return t.node(e).rank})),n=[];za.forEach(t.nodes(),function(e){var i=t.node(e).rank-r;n[i]||(n[i]=[]),n[i].push(e);});var c=0,s=t.graph().nodeRankFactor;za.forEach(n,function(e,i){za.isUndefined(e)&&i%s!==0?--c:c&&za.forEach(e,function(o){t.node(o).rank+=c;});});}function dht(t,r,n,c){var s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=c),gk(t,"border",s,r)}function yk(t){return za.max(za.map(t.nodes(),function(r){var n=t.node(r).rank;if(!za.isUndefined(n))return n}))}function pht(t,r){var n={lhs:[],rhs:[]};return za.forEach(t,function(c){r(c)?n.lhs.push(c):n.rhs.push(c);}),n}function xht(t,r){var n=za.now();try{return r()}finally{console.log(t+" time: "+(za.now()-n)+"ms");}}function mht(t,r){return r()}});var Tk=Te((U8t,_k)=>{var Ek=yl(),ght=Of();_k.exports={run:yht,undo:Eht};function yht(t){t.graph().dummyChains=[],Ek.forEach(t.edges(),function(r){vht(t,r);});}function vht(t,r){var n=r.v,c=t.node(n).rank,s=r.w,e=t.node(s).rank,i=r.name,o=t.edge(r),p=o.labelRank;if(e!==c+1){t.removeEdge(r);var E,b,y;for(y=0,++c;c<e;++y,++c)o.points=[],b={width:0,height:0,edgeLabel:o,edgeObj:r,rank:c},E=ght.addDummyNode(t,"edge",b,"_d"),c===p&&(b.width=o.width,b.height=o.height,b.dummy="edge-label",b.labelpos=o.labelpos),t.setEdge(n,E,{weight:o.weight},i),y===0&&t.graph().dummyChains.push(E),n=E;t.setEdge(n,s,{weight:o.weight},i);}}function Eht(t){Ek.forEach(t.graph().dummyChains,function(r){var n=t.node(r),c=n.edgeLabel,s;for(t.setEdge(n.edgeObj,c);n.dummy;)s=t.successors(r)[0],t.removeNode(r),c.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(c.x=n.x,c.y=n.y,c.width=n.width,c.height=n.height),r=s,n=t.node(r);});}});var Cv=Te((K8t,bk)=>{var k4=yl();bk.exports={longestPath:_ht,slack:Tht};function _ht(t){var r={};function n(c){var s=t.node(c);if(k4.has(r,c))return s.rank;r[c]=true;var e=k4.min(k4.map(t.outEdges(c),function(i){return n(i.w)-t.edge(i).minlen}));return (e===Number.POSITIVE_INFINITY||e===void 0||e===null)&&(e=0),s.rank=e}k4.forEach(t.sources(),n);}function Tht(t,r){return t.node(r.w).rank-t.node(r.v).rank-t.edge(r).minlen}});var Vb=Te(($8t,Ak)=>{var F4=yl(),bht=o1().Graph,B4=Cv().slack;Ak.exports=Aht;function Aht(t){var r=new bht({directed:false}),n=t.nodes()[0],c=t.nodeCount();r.setNode(n,{});for(var s,e;Oht(r,t)<c;)s=Sht(r,t),e=r.hasNode(s.v)?B4(t,s):-B4(t,s),Cht(r,t,e);return r}function Oht(t,r){function n(c){F4.forEach(r.nodeEdges(c),function(s){var e=s.v,i=c===e?s.w:e;!t.hasNode(i)&&!B4(r,s)&&(t.setNode(i,{}),t.setEdge(c,i,{}),n(i));});}return F4.forEach(t.nodes(),n),t.nodeCount()}function Sht(t,r){return F4.minBy(r.edges(),function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return B4(r,n)})}function Cht(t,r,n){F4.forEach(t.nodes(),function(c){r.node(c).rank+=n;});}});var Dk=Te((H8t,Ik)=>{var Vp=yl(),Nht=Vb(),Rht=Cv().slack,wht=Cv().longestPath,Iht=o1().alg.preorder,Dht=o1().alg.postorder,Lht=Of().simplify;Ik.exports=I3;I3.initLowLimValues=Wb;I3.initCutValues=Yb;I3.calcCutValue=Sk;I3.leaveEdge=Nk;I3.enterEdge=Rk;I3.exchangeEdges=wk;function I3(t){t=Lht(t),wht(t);var r=Nht(t);Wb(r),Yb(r,t);for(var n,c;n=Nk(r);)c=Rk(r,t,n),wk(r,t,n,c);}function Yb(t,r){var n=Dht(t,t.nodes());n=n.slice(0,n.length-1),Vp.forEach(n,function(c){Pht(t,r,c);});}function Pht(t,r,n){var c=t.node(n),s=c.parent;t.edge(n,s).cutvalue=Sk(t,r,n);}function Sk(t,r,n){var c=t.node(n),s=c.parent,e=true,i=r.edge(n,s),o=0;return i||(e=false,i=r.edge(s,n)),o=i.weight,Vp.forEach(r.nodeEdges(n),function(p){var E=p.v===n,b=E?p.w:p.v;if(b!==s){var y=E===e,m=r.edge(p).weight;if(o+=y?m:-m,kht(t,n,b)){var a=t.edge(n,b).cutvalue;o+=y?-a:a;}}}),o}function Wb(t,r){arguments.length<2&&(r=t.nodes()[0]),Ck(t,{},1,r);}function Ck(t,r,n,c,s){var e=n,i=t.node(c);return r[c]=true,Vp.forEach(t.neighbors(c),function(o){Vp.has(r,o)||(n=Ck(t,r,n,o,c));}),i.low=e,i.lim=n++,s?i.parent=s:delete i.parent,n}function Nk(t){return Vp.find(t.edges(),function(r){return t.edge(r).cutvalue<0})}function Rk(t,r,n){var c=n.v,s=n.w;r.hasEdge(c,s)||(c=n.w,s=n.v);var e=t.node(c),i=t.node(s),o=e,p=false;e.lim>i.lim&&(o=i,p=true);var E=Vp.filter(r.edges(),function(b){return p===Ok(t,t.node(b.v),o)&&p!==Ok(t,t.node(b.w),o)});return Vp.minBy(E,function(b){return Rht(r,b)})}function wk(t,r,n,c){var s=n.v,e=n.w;t.removeEdge(s,e),t.setEdge(c.v,c.w,{}),Wb(t),Yb(t,r),Mht(t,r);}function Mht(t,r){var n=Vp.find(t.nodes(),function(s){return !r.node(s).parent}),c=Iht(t,n);c=c.slice(1),Vp.forEach(c,function(s){var e=t.node(s).parent,i=r.edge(s,e),o=false;i||(i=r.edge(e,s),o=true),r.node(s).rank=r.node(e).rank+(o?i.minlen:-i.minlen);});}function kht(t,r,n){return t.hasEdge(r,n)}function Ok(t,r,n){return n.low<=r.lim&&r.lim<=n.lim}});var kk=Te((G8t,Mk)=>{var Fht=Cv(),Pk=Fht.longestPath,Bht=Vb(),jht=Dk();Mk.exports=Uht;function Uht(t){switch(t.graph().ranker){case "network-simplex":Lk(t);break;case "tight-tree":$ht(t);break;case "longest-path":Kht(t);break;default:Lk(t);}}var Kht=Pk;function $ht(t){Pk(t),Bht(t);}function Lk(t){jht(t);}});var Bk=Te((q8t,Fk)=>{var Xb=yl();Fk.exports=Hht;function Hht(t){var r=qht(t);Xb.forEach(t.graph().dummyChains,function(n){for(var c=t.node(n),s=c.edgeObj,e=Ght(t,r,s.v,s.w),i=e.path,o=e.lca,p=0,E=i[p],b=true;n!==s.w;){if(c=t.node(n),b){for(;(E=i[p])!==o&&t.node(E).maxRank<c.rank;)p++;E===o&&(b=false);}if(!b){for(;p<i.length-1&&t.node(E=i[p+1]).minRank<=c.rank;)p++;E=i[p];}t.setParent(n,E),n=t.successors(n)[0];}});}function Ght(t,r,n,c){var s=[],e=[],i=Math.min(r[n].low,r[c].low),o=Math.max(r[n].lim,r[c].lim),p,E;p=n;do p=t.parent(p),s.push(p);while(p&&(r[p].low>i||o>r[p].lim));for(E=p,p=c;(p=t.parent(p))!==E;)e.push(p);return {path:s.concat(e.reverse()),lca:E}}function qht(t){var r={},n=0;function c(s){var e=n;Xb.forEach(t.children(s),c),r[s]={low:e,lim:n++};}return Xb.forEach(t.children(),c),r}});var Kk=Te((z8t,Uk)=>{var Yp=yl(),Qb=Of();Uk.exports={run:zht,cleanup:Wht};function zht(t){var r=Qb.addDummyNode(t,"root",{},"_root"),n=Vht(t),c=Yp.max(Yp.values(n))-1,s=2*c+1;t.graph().nestingRoot=r,Yp.forEach(t.edges(),function(i){t.edge(i).minlen*=s;});var e=Yht(t)+1;Yp.forEach(t.children(),function(i){jk(t,r,s,e,c,n,i);}),t.graph().nodeRankFactor=s;}function jk(t,r,n,c,s,e,i){var o=t.children(i);if(!o.length){i!==r&&t.setEdge(r,i,{weight:0,minlen:n});return}var p=Qb.addBorderNode(t,"_bt"),E=Qb.addBorderNode(t,"_bb"),b=t.node(i);t.setParent(p,i),b.borderTop=p,t.setParent(E,i),b.borderBottom=E,Yp.forEach(o,function(y){jk(t,r,n,c,s,e,y);var m=t.node(y),a=m.borderTop?m.borderTop:y,l=m.borderBottom?m.borderBottom:y,u=m.borderTop?c:2*c,h=a!==l?1:s-e[i]+1;t.setEdge(p,a,{weight:u,minlen:h,nestingEdge:true}),t.setEdge(l,E,{weight:u,minlen:h,nestingEdge:true});}),t.parent(i)||t.setEdge(r,p,{weight:0,minlen:s+e[i]});}function Vht(t){var r={};function n(c,s){var e=t.children(c);e&&e.length&&Yp.forEach(e,function(i){n(i,s+1);}),r[c]=s;}return Yp.forEach(t.children(),function(c){n(c,1);}),r}function Yht(t){return Yp.reduce(t.edges(),function(r,n){return r+t.edge(n).weight},0)}function Wht(t){var r=t.graph();t.removeNode(r.nestingRoot),delete r.nestingRoot,Yp.forEach(t.edges(),function(n){var c=t.edge(n);c.nestingEdge&&t.removeEdge(n);});}});var Gk=Te((V8t,Hk)=>{var Jb=yl(),Xht=Of();Hk.exports=Qht;function Qht(t){function r(n){var c=t.children(n),s=t.node(n);if(c.length&&Jb.forEach(c,r),Jb.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var e=s.minRank,i=s.maxRank+1;e<i;++e)$k(t,"borderLeft","_bl",n,s,e),$k(t,"borderRight","_br",n,s,e);}}Jb.forEach(t.children(),r);}function $k(t,r,n,c,s,e){var i={width:0,height:0,rank:e,borderType:r},o=s[r][e-1],p=Xht.addDummyNode(t,"border",i,n);s[r][e]=p,t.setParent(p,c),o&&t.setEdge(o,p,{weight:1});}});var Yk=Te((Y8t,Vk)=>{var fp=yl();Vk.exports={adjust:Jht,undo:Zht};function Jht(t){var r=t.graph().rankdir.toLowerCase();(r==="lr"||r==="rl")&&zk(t);}function Zht(t){var r=t.graph().rankdir.toLowerCase();(r==="bt"||r==="rl")&&t0t(t),(r==="lr"||r==="rl")&&(e0t(t),zk(t));}function zk(t){fp.forEach(t.nodes(),function(r){qk(t.node(r));}),fp.forEach(t.edges(),function(r){qk(t.edge(r));});}function qk(t){var r=t.width;t.width=t.height,t.height=r;}function t0t(t){fp.forEach(t.nodes(),function(r){Zb(t.node(r));}),fp.forEach(t.edges(),function(r){var n=t.edge(r);fp.forEach(n.points,Zb),fp.has(n,"y")&&Zb(n);});}function Zb(t){t.y=-t.y;}function e0t(t){fp.forEach(t.nodes(),function(r){t6(t.node(r));}),fp.forEach(t.edges(),function(r){var n=t.edge(r);fp.forEach(n.points,t6),fp.has(n,"x")&&t6(n);});}function t6(t){var r=t.x;t.x=t.y,t.y=r;}});var Xk=Te((W8t,Wk)=>{var Wp=yl();Wk.exports=r0t;function r0t(t){var r={},n=Wp.filter(t.nodes(),function(o){return !t.children(o).length}),c=Wp.max(Wp.map(n,function(o){return t.node(o).rank})),s=Wp.map(Wp.range(c+1),function(){return []});function e(o){if(!Wp.has(r,o)){r[o]=true;var p=t.node(o);s[p.rank].push(o),Wp.forEach(t.successors(o),e);}}var i=Wp.sortBy(n,function(o){return t.node(o).rank});return Wp.forEach(i,e),s}});var Jk=Te((X8t,Qk)=>{var ux=yl();Qk.exports=n0t;function n0t(t,r){for(var n=0,c=1;c<r.length;++c)n+=i0t(t,r[c-1],r[c]);return n}function i0t(t,r,n){for(var c=ux.zipObject(n,ux.map(n,function(E,b){return b})),s=ux.flatten(ux.map(r,function(E){return ux.sortBy(ux.map(t.outEdges(E),function(b){return {pos:c[b.w],weight:t.edge(b).weight}}),"pos")}),true),e=1;e<n.length;)e<<=1;var i=2*e-1;e-=1;var o=ux.map(new Array(i),function(){return 0}),p=0;return ux.forEach(s.forEach(function(E){var b=E.pos+e;o[b]+=E.weight;for(var y=0;b>0;)b%2&&(y+=o[b+1]),b=b-1>>1,o[b]+=E.weight;p+=E.weight*y;})),p}});var eF=Te((Q8t,tF)=>{var Zk=yl();tF.exports=s0t;function s0t(t,r){return Zk.map(r,function(n){var c=t.inEdges(n);if(c.length){var s=Zk.reduce(c,function(e,i){var o=t.edge(i),p=t.node(i.v);return {sum:e.sum+o.weight*p.order,weight:e.weight+o.weight}},{sum:0,weight:0});return {v:n,barycenter:s.sum/s.weight,weight:s.weight}}else return {v:n}})}});var nF=Te((J8t,rF)=>{var Pd=yl();rF.exports=o0t;function o0t(t,r){var n={};Pd.forEach(t,function(s,e){var i=n[s.v]={indegree:0,in:[],out:[],vs:[s.v],i:e};Pd.isUndefined(s.barycenter)||(i.barycenter=s.barycenter,i.weight=s.weight);}),Pd.forEach(r.edges(),function(s){var e=n[s.v],i=n[s.w];!Pd.isUndefined(e)&&!Pd.isUndefined(i)&&(i.indegree++,e.out.push(n[s.w]));});var c=Pd.filter(n,function(s){return !s.indegree});return a0t(c)}function a0t(t){var r=[];function n(e){return function(i){i.merged||(Pd.isUndefined(i.barycenter)||Pd.isUndefined(e.barycenter)||i.barycenter>=e.barycenter)&&u0t(e,i);}}function c(e){return function(i){i.in.push(e),--i.indegree===0&&t.push(i);}}for(;t.length;){var s=t.pop();r.push(s),Pd.forEach(s.in.reverse(),n(s)),Pd.forEach(s.out,c(s));}return Pd.map(Pd.filter(r,function(e){return !e.merged}),function(e){return Pd.pick(e,["vs","i","barycenter","weight"])})}function u0t(t,r){var n=0,c=0;t.weight&&(n+=t.barycenter*t.weight,c+=t.weight),r.weight&&(n+=r.barycenter*r.weight,c+=r.weight),t.vs=r.vs.concat(t.vs),t.barycenter=n/c,t.weight=c,t.i=Math.min(r.i,t.i),r.merged=true;}});var oF=Te((Z8t,sF)=>{var Nv=yl(),l0t=Of();sF.exports=c0t;function c0t(t,r){var n=l0t.partition(t,function(b){return Nv.has(b,"barycenter")}),c=n.lhs,s=Nv.sortBy(n.rhs,function(b){return -b.i}),e=[],i=0,o=0,p=0;c.sort(h0t(!!r)),p=iF(e,s,p),Nv.forEach(c,function(b){p+=b.vs.length,e.push(b.vs),i+=b.barycenter*b.weight,o+=b.weight,p=iF(e,s,p);});var E={vs:Nv.flatten(e,true)};return o&&(E.barycenter=i/o,E.weight=o),E}function iF(t,r,n){for(var c;r.length&&(c=Nv.last(r)).i<=n;)r.pop(),t.push(c.vs),n++;return n}function h0t(t){return function(r,n){return r.barycenter<n.barycenter?-1:r.barycenter>n.barycenter?1:t?n.i-r.i:r.i-n.i}}});var lF=Te((tAt,uF)=>{var lx=yl(),f0t=eF(),d0t=nF(),p0t=oF();uF.exports=aF;function aF(t,r,n,c){var s=t.children(r),e=t.node(r),i=e?e.borderLeft:void 0,o=e?e.borderRight:void 0,p={};i&&(s=lx.filter(s,function(l){return l!==i&&l!==o}));var E=f0t(t,s);lx.forEach(E,function(l){if(t.children(l.v).length){var u=aF(t,l.v,n,c);p[l.v]=u,lx.has(u,"barycenter")&&m0t(l,u);}});var b=d0t(E,n);x0t(b,p);var y=p0t(b,c);if(i&&(y.vs=lx.flatten([i,y.vs,o],true),t.predecessors(i).length)){var m=t.node(t.predecessors(i)[0]),a=t.node(t.predecessors(o)[0]);lx.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+a.order)/(y.weight+2),y.weight+=2;}return y}function x0t(t,r){lx.forEach(t,function(n){n.vs=lx.flatten(n.vs.map(function(c){return r[c]?r[c].vs:c}),true);});}function m0t(t,r){lx.isUndefined(t.barycenter)?(t.barycenter=r.barycenter,t.weight=r.weight):(t.barycenter=(t.barycenter*t.weight+r.barycenter*r.weight)/(t.weight+r.weight),t.weight+=r.weight);}});var hF=Te((eAt,cF)=>{var Rv=yl(),g0t=o1().Graph;cF.exports=y0t;function y0t(t,r,n){var c=v0t(t),s=new g0t({compound:true}).setGraph({root:c}).setDefaultNodeLabel(function(e){return t.node(e)});return Rv.forEach(t.nodes(),function(e){var i=t.node(e),o=t.parent(e);(i.rank===r||i.minRank<=r&&r<=i.maxRank)&&(s.setNode(e),s.setParent(e,o||c),Rv.forEach(t[n](e),function(p){var E=p.v===e?p.w:p.v,b=s.edge(E,e),y=Rv.isUndefined(b)?0:b.weight;s.setEdge(E,e,{weight:t.edge(p).weight+y});}),Rv.has(i,"minRank")&&s.setNode(e,{borderLeft:i.borderLeft[r],borderRight:i.borderRight[r]}));}),s}function v0t(t){for(var r;t.hasNode(r=Rv.uniqueId("_root")););return r}});var dF=Te((rAt,fF)=>{var E0t=yl();fF.exports=_0t;function _0t(t,r,n){var c={},s;E0t.forEach(n,function(e){for(var i=t.parent(e),o,p;i;){if(o=t.parent(i),o?(p=c[o],c[o]=i):(p=s,s=i),p&&p!==i){r.setEdge(p,i);return}i=o;}});}});var yF=Te((nAt,gF)=>{var cx=yl(),T0t=Xk(),b0t=Jk(),A0t=lF(),O0t=hF(),S0t=dF(),C0t=o1().Graph,pF=Of();gF.exports=N0t;function N0t(t){var r=pF.maxRank(t),n=xF(t,cx.range(1,r+1),"inEdges"),c=xF(t,cx.range(r-1,-1,-1),"outEdges"),s=T0t(t);mF(t,s);for(var e=Number.POSITIVE_INFINITY,i,o=0,p=0;p<4;++o,++p){R0t(o%2?n:c,o%4>=2),s=pF.buildLayerMatrix(t);var E=b0t(t,s);E<e&&(p=0,i=cx.cloneDeep(s),e=E);}mF(t,i);}function xF(t,r,n){return cx.map(r,function(c){return O0t(t,c,n)})}function R0t(t,r){var n=new C0t;cx.forEach(t,function(c){var s=c.graph().root,e=A0t(c,s,n,r);cx.forEach(e.vs,function(i,o){c.node(i).order=o;}),S0t(c,n,e.vs);});}function mF(t,r){cx.forEach(r,function(n){cx.forEach(n,function(c,s){t.node(c).order=s;});});}});var NF=Te((iAt,CF)=>{var co=yl(),w0t=o1().Graph,I0t=Of();CF.exports={positionX:P0t,findType1Conflicts:vF,findType2Conflicts:EF,addConflict:e6,hasConflict:_F,verticalAlignment:TF,horizontalCompaction:bF,alignCoordinates:OF,findSmallestWidthAlignment:AF,balance:SF};function vF(t,r){var n={};function c(s,e){var i=0,o=0,p=s.length,E=co.last(e);return co.forEach(e,function(b,y){var m=D0t(t,b),a=m?t.node(m).order:p;(m||b===E)&&(co.forEach(e.slice(o,y+1),function(l){co.forEach(t.predecessors(l),function(u){var h=t.node(u),d=h.order;(d<i||a<d)&&!(h.dummy&&t.node(l).dummy)&&e6(n,u,l);});}),o=y+1,i=a);}),e}return co.reduce(r,c),n}function EF(t,r){var n={};function c(e,i,o,p,E){var b;co.forEach(co.range(i,o),function(y){b=e[y],t.node(b).dummy&&co.forEach(t.predecessors(b),function(m){var a=t.node(m);a.dummy&&(a.order<p||a.order>E)&&e6(n,m,b);});});}function s(e,i){var o=-1,p,E=0;return co.forEach(i,function(b,y){if(t.node(b).dummy==="border"){var m=t.predecessors(b);m.length&&(p=t.node(m[0]).order,c(i,E,y,o,p),E=y,o=p);}c(i,E,i.length,p,e.length);}),i}return co.reduce(r,s),n}function D0t(t,r){if(t.node(r).dummy)return co.find(t.predecessors(r),function(n){return t.node(n).dummy})}function e6(t,r,n){if(r>n){var c=r;r=n,n=c;}var s=t[r];s||(t[r]=s={}),s[n]=true;}function _F(t,r,n){if(r>n){var c=r;r=n,n=c;}return co.has(t[r],n)}function TF(t,r,n,c){var s={},e={},i={};return co.forEach(r,function(o){co.forEach(o,function(p,E){s[p]=p,e[p]=p,i[p]=E;});}),co.forEach(r,function(o){var p=-1;co.forEach(o,function(E){var b=c(E);if(b.length){b=co.sortBy(b,function(u){return i[u]});for(var y=(b.length-1)/2,m=Math.floor(y),a=Math.ceil(y);m<=a;++m){var l=b[m];e[E]===E&&p<i[l]&&!_F(n,E,l)&&(e[l]=E,e[E]=s[E]=s[l],p=i[l]);}}});}),{root:s,align:e}}function bF(t,r,n,c,s){var e={},i=L0t(t,r,n,s),o=s?"borderLeft":"borderRight";function p(y,m){for(var a=i.nodes(),l=a.pop(),u={};l;)u[l]?y(l):(u[l]=true,a.push(l),a=a.concat(m(l))),l=a.pop();}function E(y){e[y]=i.inEdges(y).reduce(function(m,a){return Math.max(m,e[a.v]+i.edge(a))},0);}function b(y){var m=i.outEdges(y).reduce(function(l,u){return Math.min(l,e[u.w]-i.edge(u))},Number.POSITIVE_INFINITY),a=t.node(y);m!==Number.POSITIVE_INFINITY&&a.borderType!==o&&(e[y]=Math.max(e[y],m));}return p(E,i.predecessors.bind(i)),p(b,i.successors.bind(i)),co.forEach(c,function(y){e[y]=e[n[y]];}),e}function L0t(t,r,n,c){var s=new w0t,e=t.graph(),i=M0t(e.nodesep,e.edgesep,c);return co.forEach(r,function(o){var p;co.forEach(o,function(E){var b=n[E];if(s.setNode(b),p){var y=n[p],m=s.edge(y,b);s.setEdge(y,b,Math.max(i(t,E,p),m||0));}p=E;});}),s}function AF(t,r){return co.minBy(co.values(r),function(n){var c=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY;return co.forIn(n,function(e,i){var o=k0t(t,i)/2;c=Math.max(e+o,c),s=Math.min(e-o,s);}),c-s})}function OF(t,r){var n=co.values(r),c=co.min(n),s=co.max(n);co.forEach(["u","d"],function(e){co.forEach(["l","r"],function(i){var o=e+i,p=t[o],E;if(p!==r){var b=co.values(p);E=i==="l"?c-co.min(b):s-co.max(b),E&&(t[o]=co.mapValues(p,function(y){return y+E}));}});});}function SF(t,r){return co.mapValues(t.ul,function(n,c){if(r)return t[r.toLowerCase()][c];var s=co.sortBy(co.map(t,c));return (s[1]+s[2])/2})}function P0t(t){var r=I0t.buildLayerMatrix(t),n=co.merge(vF(t,r),EF(t,r)),c={},s;co.forEach(["u","d"],function(i){s=i==="u"?r:co.values(r).reverse(),co.forEach(["l","r"],function(o){o==="r"&&(s=co.map(s,function(y){return co.values(y).reverse()}));var p=(i==="u"?t.predecessors:t.successors).bind(t),E=TF(t,s,n,p),b=bF(t,s,E.root,E.align,o==="r");o==="r"&&(b=co.mapValues(b,function(y){return -y})),c[i+o]=b;});});var e=AF(t,c);return OF(c,e),SF(c,t.graph().align)}function M0t(t,r,n){return function(c,s,e){var i=c.node(s),o=c.node(e),p=0,E;if(p+=i.width/2,co.has(i,"labelpos"))switch(i.labelpos.toLowerCase()){case "l":E=-i.width/2;break;case "r":E=i.width/2;break}if(E&&(p+=n?E:-E),E=0,p+=(i.dummy?r:t)/2,p+=(o.dummy?r:t)/2,p+=o.width/2,co.has(o,"labelpos"))switch(o.labelpos.toLowerCase()){case "l":E=o.width/2;break;case "r":E=-o.width/2;break}return E&&(p+=n?E:-E),E=0,p}}function k0t(t,r){return t.node(r).width}});var IF=Te((sAt,wF)=>{var wv=yl(),RF=Of(),F0t=NF().positionX;wF.exports=B0t;function B0t(t){t=RF.asNonCompoundGraph(t),j0t(t),wv.forEach(F0t(t),function(r,n){t.node(n).x=r;});}function j0t(t){var r=RF.buildLayerMatrix(t),n=t.graph().ranksep,c=0;wv.forEach(r,function(s){var e=wv.max(wv.map(s,function(i){return t.node(i).height}));wv.forEach(s,function(i){t.node(i).y=c+e/2;}),c+=e+n;});}});var FF=Te((oAt,kF)=>{var Uo=yl(),DF=xk(),LF=Tk(),U0t=kk(),K0t=Of().normalizeRanks,$0t=Bk(),H0t=Of().removeEmptyRanks,PF=Kk(),G0t=Gk(),MF=Yk(),q0t=yF(),z0t=IF(),hx=Of(),V0t=o1().Graph;kF.exports=Y0t;function Y0t(t,r){var n=r&&r.debugTiming?hx.time:hx.notime;n("layout",function(){var c=n(" buildLayoutGraph",function(){return sft(t)});n(" runLayout",function(){W0t(c,n);}),n(" updateInputGraph",function(){X0t(t,c);});});}function W0t(t,r){r(" makeSpaceForEdgeLabels",function(){oft(t);}),r(" removeSelfEdges",function(){xft(t);}),r(" acyclic",function(){DF.run(t);}),r(" nestingGraph.run",function(){PF.run(t);}),r(" rank",function(){U0t(hx.asNonCompoundGraph(t));}),r(" injectEdgeLabelProxies",function(){aft(t);}),r(" removeEmptyRanks",function(){H0t(t);}),r(" nestingGraph.cleanup",function(){PF.cleanup(t);}),r(" normalizeRanks",function(){K0t(t);}),r(" assignRankMinMax",function(){uft(t);}),r(" removeEdgeLabelProxies",function(){lft(t);}),r(" normalize.run",function(){LF.run(t);}),r(" parentDummyChains",function(){$0t(t);}),r(" addBorderSegments",function(){G0t(t);}),r(" order",function(){q0t(t);}),r(" insertSelfEdges",function(){mft(t);}),r(" adjustCoordinateSystem",function(){MF.adjust(t);}),r(" position",function(){z0t(t);}),r(" positionSelfEdges",function(){gft(t);}),r(" removeBorderNodes",function(){pft(t);}),r(" normalize.undo",function(){LF.undo(t);}),r(" fixupEdgeLabelCoords",function(){fft(t);}),r(" undoCoordinateSystem",function(){MF.undo(t);}),r(" translateGraph",function(){cft(t);}),r(" assignNodeIntersects",function(){hft(t);}),r(" reversePoints",function(){dft(t);}),r(" acyclic.undo",function(){DF.undo(t);});}function X0t(t,r){Uo.forEach(t.nodes(),function(n){var c=t.node(n),s=r.node(n);c&&(c.x=s.x,c.y=s.y,r.children(n).length&&(c.width=s.width,c.height=s.height));}),Uo.forEach(t.edges(),function(n){var c=t.edge(n),s=r.edge(n);c.points=s.points,Uo.has(s,"x")&&(c.x=s.x,c.y=s.y);}),t.graph().width=r.graph().width,t.graph().height=r.graph().height;}var Q0t=["nodesep","edgesep","ranksep","marginx","marginy"],J0t={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Z0t=["acyclicer","ranker","rankdir","align"],tft=["width","height"],eft={width:0,height:0},rft=["minlen","weight","width","height","labeloffset"],nft={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},ift=["labelpos"];function sft(t){var r=new V0t({multigraph:true,compound:true}),n=n6(t.graph());return r.setGraph(Uo.merge({},J0t,r6(n,Q0t),Uo.pick(n,Z0t))),Uo.forEach(t.nodes(),function(c){var s=n6(t.node(c));r.setNode(c,Uo.defaults(r6(s,tft),eft)),r.setParent(c,t.parent(c));}),Uo.forEach(t.edges(),function(c){var s=n6(t.edge(c));r.setEdge(c,Uo.merge({},nft,r6(s,rft),Uo.pick(s,ift)));}),r}function oft(t){var r=t.graph();r.ranksep/=2,Uo.forEach(t.edges(),function(n){var c=t.edge(n);c.minlen*=2,c.labelpos.toLowerCase()!=="c"&&(r.rankdir==="TB"||r.rankdir==="BT"?c.width+=c.labeloffset:c.height+=c.labeloffset);});}function aft(t){Uo.forEach(t.edges(),function(r){var n=t.edge(r);if(n.width&&n.height){var c=t.node(r.v),s=t.node(r.w),e={rank:(s.rank-c.rank)/2+c.rank,e:r};hx.addDummyNode(t,"edge-proxy",e,"_ep");}});}function uft(t){var r=0;Uo.forEach(t.nodes(),function(n){var c=t.node(n);c.borderTop&&(c.minRank=t.node(c.borderTop).rank,c.maxRank=t.node(c.borderBottom).rank,r=Uo.max(r,c.maxRank));}),t.graph().maxRank=r;}function lft(t){Uo.forEach(t.nodes(),function(r){var n=t.node(r);n.dummy==="edge-proxy"&&(t.edge(n.e).labelRank=n.rank,t.removeNode(r));});}function cft(t){var r=Number.POSITIVE_INFINITY,n=0,c=Number.POSITIVE_INFINITY,s=0,e=t.graph(),i=e.marginx||0,o=e.marginy||0;function p(E){var b=E.x,y=E.y,m=E.width,a=E.height;r=Math.min(r,b-m/2),n=Math.max(n,b+m/2),c=Math.min(c,y-a/2),s=Math.max(s,y+a/2);}Uo.forEach(t.nodes(),function(E){p(t.node(E));}),Uo.forEach(t.edges(),function(E){var b=t.edge(E);Uo.has(b,"x")&&p(b);}),r-=i,c-=o,Uo.forEach(t.nodes(),function(E){var b=t.node(E);b.x-=r,b.y-=c;}),Uo.forEach(t.edges(),function(E){var b=t.edge(E);Uo.forEach(b.points,function(y){y.x-=r,y.y-=c;}),Uo.has(b,"x")&&(b.x-=r),Uo.has(b,"y")&&(b.y-=c);}),e.width=n-r+i,e.height=s-c+o;}function hft(t){Uo.forEach(t.edges(),function(r){var n=t.edge(r),c=t.node(r.v),s=t.node(r.w),e,i;n.points?(e=n.points[0],i=n.points[n.points.length-1]):(n.points=[],e=s,i=c),n.points.unshift(hx.intersectRect(c,e)),n.points.push(hx.intersectRect(s,i));});}function fft(t){Uo.forEach(t.edges(),function(r){var n=t.edge(r);if(Uo.has(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case "l":n.x-=n.width/2+n.labeloffset;break;case "r":n.x+=n.width/2+n.labeloffset;break}});}function dft(t){Uo.forEach(t.edges(),function(r){var n=t.edge(r);n.reversed&&n.points.reverse();});}function pft(t){Uo.forEach(t.nodes(),function(r){if(t.children(r).length){var n=t.node(r),c=t.node(n.borderTop),s=t.node(n.borderBottom),e=t.node(Uo.last(n.borderLeft)),i=t.node(Uo.last(n.borderRight));n.width=Math.abs(i.x-e.x),n.height=Math.abs(s.y-c.y),n.x=e.x+n.width/2,n.y=c.y+n.height/2;}}),Uo.forEach(t.nodes(),function(r){t.node(r).dummy==="border"&&t.removeNode(r);});}function xft(t){Uo.forEach(t.edges(),function(r){if(r.v===r.w){var n=t.node(r.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:r,label:t.edge(r)}),t.removeEdge(r);}});}function mft(t){var r=hx.buildLayerMatrix(t);Uo.forEach(r,function(n){var c=0;Uo.forEach(n,function(s,e){var i=t.node(s);i.order=e+c,Uo.forEach(i.selfEdges,function(o){hx.addDummyNode(t,"selfedge",{width:o.label.width,height:o.label.height,rank:i.rank,order:e+ ++c,e:o.e,label:o.label},"_se");}),delete i.selfEdges;});});}function gft(t){Uo.forEach(t.nodes(),function(r){var n=t.node(r);if(n.dummy==="selfedge"){var c=t.node(n.e.v),s=c.x+c.width/2,e=c.y,i=n.x-s,o=c.height/2;t.setEdge(n.e,n.label),t.removeNode(r),n.label.points=[{x:s+2*i/3,y:e-o},{x:s+5*i/6,y:e-o},{x:s+i,y:e},{x:s+5*i/6,y:e+o},{x:s+2*i/3,y:e+o}],n.label.x=n.x,n.label.y=n.y;}});}function r6(t,r){return Uo.mapValues(Uo.pick(t,r),Number)}function n6(t){var r={};return Uo.forEach(t,function(n,c){r[c.toLowerCase()]=n;}),r}});var jF=Te((aAt,BF)=>{var j4=yl(),yft=Of(),vft=o1().Graph;BF.exports={debugOrdering:Eft};function Eft(t){var r=yft.buildLayerMatrix(t),n=new vft({compound:true,multigraph:true}).setGraph({});return j4.forEach(t.nodes(),function(c){n.setNode(c,{label:c}),n.setParent(c,"layer"+t.node(c).rank);}),j4.forEach(t.edges(),function(c){n.setEdge(c.v,c.w,{},c.name);}),j4.forEach(r,function(c,s){var e="layer"+s;n.setNode(e,{rank:"same"}),j4.reduce(c,function(i,o){return n.setEdge(i,o,{style:"invis"}),o});}),n}});var KF=Te((uAt,UF)=>{UF.exports="0.8.5";});var HF=Te((lAt,$F)=>{$F.exports={graphlib:o1(),layout:FF(),debug:jF(),util:{time:Of().time,notime:Of().notime},version:KF()};});var U4,GF,qF,i6;exports.WebColaTranslator=void 0;var s6=Cn(()=>{Wm();U4=Di(HF()),GF=8,qF=20,i6=class{constructor(r,n=800,c=800,s){if(this.FIG_HEIGHT=n,this.FIG_WIDTH=c,this.DEFAULT_X=c/2,this.DEFAULT_Y=n/2,this.instanceLayout=r,this.priorPositionMap=new Map,s?.priorPositions?.positions)for(let p of s.priorPositions.positions)this.priorPositionMap.set(p.id,p);try{let p=new U4.graphlib.Graph({multigraph:!0});p.setGraph({nodesep:50,ranksep:100,rankdir:"TB"}),p.setDefaultEdgeLabel(()=>({})),r.nodes.forEach(E=>{p.setNode(E.id,{width:E.width,height:E.height});}),r.edges.forEach(E=>{p.setEdge(E.source.id,E.target.id);}),U4.layout(p),this.dagre_graph=p;}catch(p){console.log(p),this.dagre_graph=null;}this.colaNodes=r.nodes.map(p=>this.toColaNode(p)),this.colaEdges=r.edges.map(p=>this.toColaEdge(p)),this.colaEdges=this.collapseSymmetricEdges(this.colaEdges);let e=this.collapseIdenticalGroups(r.groups);this.groupDefinitions=this.determineGroups(e),this.conflictingConstraints=r.conflictingConstraints||[],this.overlappingNodesData=r.overlappingNodes||[],this.colaConstraints=r.constraints.map(p=>this.toColaConstraint(p)),this.colaConstraints.length>100&&(this.colaConstraints=this.optimizeConstraints(this.colaConstraints)),this.colaConstraints.length===0&&this.dagre_graph&&this.colaNodes.forEach(p=>p.fixed=1);}optimizeConstraints(r){let n=[],c=[],s=[];for(let o of r)if(o.type==="separation"){let p=o;p.axis==="x"&&!p.equality?n.push(p):p.axis==="y"&&!p.equality?c.push(p):s.push(o);}else s.push(o);let e=this.transitiveReductionForSeparation(n),i=this.transitiveReductionForSeparation(c);return [...e,...i,...s]}transitiveReductionForSeparation(r){if(r.length===0)return r;let n=this.colaNodes.length,c=Array(n).fill(null).map(()=>Array(n).fill(null));for(let i of r){let o=i.left,p=i.right;typeof o=="number"&&typeof p=="number"&&o>=0&&o<n&&p>=0&&p<n&&Number.isInteger(o)&&Number.isInteger(p)&&(c[o][p]=i);}let s=Array(n).fill(false).map(()=>Array(n).fill(false));for(let i=0;i<n;i++)for(let o=0;o<n;o++)s[i][o]=c[i][o]!==null;for(let i=0;i<n;i++)for(let o=0;o<n;o++)for(let p=0;p<n;p++)s[o][i]&&s[i][p]&&(s[o][p]=true);let e=[];for(let i of r){let o=i.left,p=i.right,E=false;for(let b=0;b<n;b++)if(b!==o&&b!==p&&c[o][b]!==null&&c[b][p]!==null){E=true;break}E||e.push(i);}return e}getNodeIndex(r){return this.colaNodes.findIndex(n=>n.id===r)}computeHorizontalSeparation(r,n,c){let s=r.visualWidth??r.width??100,e=n.visualWidth??n.width??100,i=s/2+e/2+c,o=Math.max(s,e),p=Math.min(o*.1,20);return i+p}computeVerticalSeparation(r,n,c){let s=r.visualHeight??r.height??60,e=n.visualHeight??n.height??60,i=s/2+e/2+c,o=Math.max(s,e),p=Math.min(o*.1,15);return i+p}leftConstraint(r,n,c){return {type:"separation",axis:"x",left:r,right:n,gap:c}}topConstraint(r,n,c){return {type:"separation",axis:"y",left:r,right:n,gap:c}}heirarchyConstraint(r,n,c){return {type:"hierarchy",parent:r,child:n,gap:c}}toColaNode(r){let n=this.DEFAULT_X,c=this.DEFAULT_Y,s=0,e=this.priorPositionMap.get(r.id);if(e)n=e.x,c=e.y;else if(this.priorPositionMap.size>0){if(console.log(`Node ${r.id}: No prior position found (available: ${Array.from(this.priorPositionMap.keys()).join(", ")})`),this.dagre_graph){let i=this.dagre_graph.node(r.id);i&&(n=i.x,c=i.y);}}else if(this.dagre_graph){let i=this.dagre_graph.node(r.id);i&&(n=i.x,c=i.y);}return {id:r.id,color:r.color,attributes:r.attributes||{},labels:r.labels,width:r.width+2*(r.disconnected?qF:GF),height:r.height+2*(r.disconnected?qF:GF),visualWidth:r.width,visualHeight:r.height,x:n,y:c,icon:r.icon||"",fixed:s,mostSpecificType:r.mostSpecificType,showLabels:r.showLabels,label:r.label}}toColaEdge(r){let n=this.getNodeIndex(r.source.id),c=this.getNodeIndex(r.target.id);return {source:n,target:c,relName:r.relationName,id:r.id,label:r.label,color:r.color,style:r.style,weight:r.weight,showLabel:r.showLabel,groupId:r.groupId,keyNodeId:r.keyNodeId}}collapseSymmetricEdges(r){let n=new Map,c=new Set;for(let s of r){if(c.has(s.id))continue;let e=Math.min(s.source,s.target),i=Math.max(s.source,s.target),o=`${e}-${i}-${s.label}`,p=r.find(E=>E.source===s.target&&E.target===s.source&&E.label===s.label&&!c.has(E.id));if(p){let E=s.source<s.target?s:p;n.set(o,{...E,bidirectional:true}),c.add(s.id),c.add(p.id);}else n.set(s.id,s),c.add(s.id);}return Array.from(n.values())}toColaConstraint(r){if(Kh(r)){let n=this.colaNodes[this.getNodeIndex(r.left.id)],c=this.colaNodes[this.getNodeIndex(r.right.id)];n.fixed=0,c.fixed=0;let s=this.computeHorizontalSeparation(n,c,r.minDistance);return this.leftConstraint(this.getNodeIndex(r.left.id),this.getNodeIndex(r.right.id),s)}if(Uh(r)){let n=this.colaNodes[this.getNodeIndex(r.top.id)],c=this.colaNodes[this.getNodeIndex(r.bottom.id)];n.fixed=0,c.fixed=0;let s=this.computeVerticalSeparation(n,c,r.minDistance);return this.topConstraint(this.getNodeIndex(r.top.id),this.getNodeIndex(r.bottom.id),s)}if(W0(r)){let n={type:"separation",axis:r.axis,left:this.getNodeIndex(r.node1.id),right:this.getNodeIndex(r.node2.id),gap:0,equality:true},c=this.colaNodes[this.getNodeIndex(r.node1.id)],s=this.colaNodes[this.getNodeIndex(r.node2.id)];return c.fixed=0,s.fixed=0,n}if(mh(r))return console.log("BoundingBoxConstraint detected."),{type:"noop"};if(w1(r))return console.log("GroupBoundaryConstraint detected."),{type:"noop"};throw new Error("Constraint type not recognized")}collapseIdenticalGroups(r){if(r.length===0)return r;let n=new Map;for(let e of r){let i=[...e.nodeIds].sort().join(",");n.has(i)||n.set(i,[]),n.get(i).push(e);}let c=[],s=0;for(let[e,i]of n)if(i.length===1)c.push(i[0]);else {s+=i.length-1;let o={...i[0],name:i.map(p=>p.name).join(" / "),showLabel:i.some(p=>p.showLabel)};c.push(o);}return c}determineGroups(r){let n={};r.forEach(s=>{n[s.name]=s.nodeIds;});let c=this.determineGroupsAndSubgroups(n);return c.forEach(s=>{let e=r.find(p=>p.name===s.name),i=e.keyNodeId,o=this.getNodeIndex(i);s.keyNode=o,s.id=e.name,s.showLabel=e.showLabel;}),c}isSubGroup(r,n){return r.every(c=>n.includes(c))}determineGroupsAndSubgroups(r){let n={};Object.entries(r).forEach(([e,i])=>{Object.entries(r).forEach(([o,p])=>{e!==o&&(!n[o]||!n[o].includes(e))&&this.isSubGroup(p,i)&&(n[e]?n[e].push(o):n[e]=[o]);});});let c=Object.entries(r).map(([e,i])=>({leaves:i.map(b=>this.getNodeIndex(b)),padding:10,name:e}));return Object.entries(c).map(([e,i])=>{let o=i.leaves,p=i.padding,E=i.name;if(!n[E])return {leaves:o,padding:p,name:E,groups:[]};let b=n[E].map(y=>c.findIndex(a=>a.name===y));return b.forEach(y=>{let m=c[y];o=o.filter(a=>!m.leaves.includes(a));}),{leaves:o,padding:p,name:E,groups:b}})}get nodes(){return this.colaNodes}get links(){return this.colaEdges}get constraints(){return this.colaConstraints}get groups(){return this.groupDefinitions}get conflictingNodes(){let r=[];return this.conflictingConstraints.forEach(n=>{Kh(n)?(r.push(n.left),r.push(n.right)):Uh(n)?(r.push(n.top),r.push(n.bottom)):W0(n)&&(r.push(n.node1),r.push(n.node2));}),r}get overlappingNodes(){return this.overlappingNodesData}get overlappingGroups(){if(this.overlappingNodesData.length===0)return [];let r=new Set;return this.groupDefinitions.forEach(n=>{n.leaves.some(s=>this.overlappingNodesData.some(e=>e.id===s.id))&&r.add(n);}),Array.from(r)}dispose(){this.dagre_graph&&(this.dagre_graph=null);}getMemoryStats(){return {nodeCount:this.colaNodes?.length||0,edgeCount:this.colaEdges?.length||0,groupCount:this.groupDefinitions?.length||0,constraintCount:this.colaConstraints?.length||0,hasDagreGraph:!!this.dagre_graph}}},exports.WebColaTranslator=class{async translate(r,n=800,c=800,s){return new i6(r,c,n,s)}};});var VF={};Qx(VF,{WebColaCnDGraph:()=>fx});function _ft(t,r){function n(e){return e&&typeof e=="object"&&"getBBox"in e}let c=n(t)?t.getBBox():{x:0,y:0,width:0,height:0},s=n(r)?r.getBBox():{x:0,y:0,width:0,height:0};return !(s.x>c.x+c.width||s.x+s.width<c.x||s.y>c.y+c.height||s.y+s.height<c.y)}var Co,Md,zF,qi,fx,K4=Cn(()=>{s6();Wm();Co=window.d3v4||window.d3,Md=window.cola;zF=5,qi=class qi extends HTMLElement{constructor(n=false){super();this.edgeRouteIdx=0;this.edgeRoutingCache={edgesBetweenNodes:new Map,alignmentEdges:new Set};this.isGridifyingInProgress=false;this.userHasManuallyZoomed=false;this.isInitialRender=true;this.dragStartPositions=new Map;this.isInputModeActive=false;this.inputModeEnabled=true;this.inputModeListenersAttached=false;this.handleInputModeKeydown=n=>{(n.metaKey||n.ctrlKey)&&!this.isInputModeActive&&this.activateInputMode();};this.handleInputModeKeyup=n=>{!n.metaKey&&!n.ctrlKey&&this.isInputModeActive&&this.deactivateInputMode();};this.handleInputModeBlur=()=>{this.isInputModeActive&&this.deactivateInputMode();};this.edgeCreationState={isCreating:false,sourceNode:null,temporaryEdge:null};this.edgeDragState={isDragging:false,edge:null,endpoint:null,dragMarker:null};this.textMeasurementCanvas=null;this.attachShadow({mode:"open"}),this.initializeDOM(),this.initializeD3(),this.lineFunction=Co.line().x(c=>c.x).y(c=>c.y).curve(Co.curveBasis),this.gridLineFunction=Co.line().x(c=>c.x).y(c=>c.y).curve(Co.curveLinear),this.inputModeEnabled=n,this.initializeInputModeHandlers();}get layoutFormat(){return this.getAttribute("layoutFormat")}get isUnsatCore(){return this.hasAttribute("unsat")}isAlignmentEdge(n){return this.edgeRoutingCache.alignmentEdges.size>0?this.edgeRoutingCache.alignmentEdges.has(n.id):n.id.startsWith("_alignment_")}isHiddenNode(n){let c=n.name||n.id;return c?c.startsWith("_"):false}isErrorNode(n){let c=this.currentLayout.conflictingNodes,s=this.currentLayout.overlappingNodes;if(c.length>0&&s.length>0){let i=c.map(p=>p.id),o=s.map(p=>p.id);throw new Error(`Layout cannot have both conflictingConstraints (${i}) and overlappingNodes ${o}`)}return [...c,...s].some(i=>i.id===n.id)}isSmallNode(n){let s=1;if(this.svg&&this.svg.node())try{s=Co.zoomTransform(this.svg.node()).k;}catch{s=1;}let e=(n.visualWidth??n.width??0)*s,i=(n.visualHeight??n.height??0)*s;return e<30||i<30}updateSmallNodeClasses(){this.container&&this.container.selectAll(".error-node").each((n,c,s)=>{let e=Co.select(s[c]);this.isSmallNode(n)?e.classed("small-error-node")||e.classed("small-error-node",true):e.classed("small-error-node")&&e.classed("small-error-node",false);});}getCurrentZoomScale(){if(this.svg&&this.svg.node())try{return Co.zoomTransform(this.svg.node()).k}catch{return 1}return 1}isErrorGroup(n){let c=this.currentLayout.overlappingGroups;if(!c)throw console.error("Overlapping groups data not available in current layout"),new Error("Overlapping groups data not available in current layout");return c.some(s=>s.name===n.name)}isInferredEdge(n){return n.id?n.id.includes("_inferred_"):false}isDisconnectedGroup(n){return n.name.startsWith(qi.DISCONNECTED_NODE_PREFIX)}computeAdaptiveLinkLength(n,c,s){if(!n||n.length===0)return 150;let e=0,i=0,o=0;if(n.forEach(_=>{_&&!this.isHiddenNode(_)&&(e+=_.visualWidth??_.width??100,i+=_.visualHeight??_.height??60,o++);}),o===0)return 150;let p=e/o,E=i/o,b=Math.max(p,E),y=0;s&&s.length>0&&s.forEach(S=>{if(S&&S.label){let v=this.measureTextWidth(S.label,12,"system-ui");y=Math.max(y,v);}});let m=15,a=50,l=y+m+20,u=Math.max(b+a+l,120),h=Math.max(.7,1-Math.log10(o)*.1);u*=h;let d=c/5,g=u/d;return Math.max(60,Math.min(g,350))}getScaledDetails(n,c=zF,s,e,i){let o=c/5,p=this.calculateAdaptiveGroupCompactness(e||[],s?.length||0,o),E;s&&s.length>0?E=this.computeAdaptiveLinkLength(s,c,i):E=250/o;function b(y){return y.map(m=>{if(m.type==="separation"&&typeof m.gap=="number"){let l=m.gap/o;return {...m,gap:l}}return m})}return {scaledConstraints:b(n),linkLength:E,groupCompactness:p}}calculateAdaptiveGroupCompactness(n,c,s){let e=qi.DEFAULT_GROUP_COMPACTNESS*s;if(!n||n.length===0)return e;let i=this.calculateMaxGroupDepth(n),o=n.length/Math.max(c,1),p=e;return i>2?p*=10:i>1&&(p*=5),o>.3&&(p*=2),p}getViewportBoundsInLayoutSpace(n){let c=this.shadowRoot?.querySelector("#svg-container"),s=c?.clientWidth||qi.DEFAULT_SVG_WIDTH,e=c?.clientHeight||qi.DEFAULT_SVG_HEIGHT;if(s<=0||e<=0)return;let i=n.k;if(!Number.isFinite(i)||i===0)return;let o=Number.isFinite(n.x)?n.x:0,p=Number.isFinite(n.y)?n.y:0;return {minX:(0-o)/i,maxX:(s-o)/i,minY:(0-p)/i,maxY:(e-p)/i}}calculateMaxGroupDepth(n){if(!n||n.length===0)return 0;let c=1;for(let s of n)if(s.groups&&Array.isArray(s.groups)&&s.groups.length>0){let e=s.groups.filter(i=>typeof i=="number"&&i>=0&&i<n.length).map(i=>n[i]).filter(i=>i!=null);if(e.length>0){let i=1+this.calculateMaxGroupDepth(e);c=Math.max(c,i);}}return c}initializeDOM(){let n=this.getBoundingClientRect(),c=n.width||800,s=n.height||600;this.shadowRoot.innerHTML=`
|
|
812
812
|
<style>
|
|
813
813
|
${this.getCSS()}
|
|
814
814
|
</style>
|